diff --git a/app/coffee/modules/common.coffee b/app/coffee/modules/common.coffee index 594469a8..b9b31365 100644 --- a/app/coffee/modules/common.coffee +++ b/app/coffee/modules/common.coffee @@ -23,6 +23,21 @@ taiga = @.taiga module = angular.module("taigaCommon", []) +############################################################################# +## Get the selected text +############################################################################# +SelectedText = ($window, $document) -> + get = () -> + if $window.getSelection + return $window.getSelection().toString() + else if $document.selection + return $document.selection.createRange().text + return "" + + return {get: get} + +module.factory("$selectedText", ["$window", "$document", SelectedText]) + ############################################################################# ## Permission directive, hide elements when necessary ############################################################################# diff --git a/app/coffee/modules/common/components.coffee b/app/coffee/modules/common/components.coffee index 6a7057fe..f4a4b419 100644 --- a/app/coffee/modules/common/components.coffee +++ b/app/coffee/modules/common/components.coffee @@ -553,7 +553,7 @@ module.directive("tgEditableSubject", ["$rootScope", "$tgRepo", "$tgConfirm", "$ ## Editable subject directive ############################################################################# -EditableDescriptionDirective = ($window, $document, $rootscope, $repo, $confirm, $compile, $loading) -> +EditableDescriptionDirective = ($rootscope, $repo, $confirm, $compile, $loading, $selectedText) -> template = """