summaryrefslogtreecommitdiffstats
path: root/apps/comments/js/vendor/At.js/src/textareaController.coffee
diff options
context:
space:
mode:
Diffstat (limited to 'apps/comments/js/vendor/At.js/src/textareaController.coffee')
-rw-r--r--apps/comments/js/vendor/At.js/src/textareaController.coffee51
1 files changed, 0 insertions, 51 deletions
diff --git a/apps/comments/js/vendor/At.js/src/textareaController.coffee b/apps/comments/js/vendor/At.js/src/textareaController.coffee
deleted file mode 100644
index 95f94bf8dcc..00000000000
--- a/apps/comments/js/vendor/At.js/src/textareaController.coffee
+++ /dev/null
@@ -1,51 +0,0 @@
-class TextareaController extends Controller
- # Catch query string behind the at char
- #
- # @return [Hash] Info of the query. Look likes this: {'text': "hello", 'headPos': 0, 'endPos': 0}
- catchQuery: ->
- content = @$inputor.val()
- caretPos = @$inputor.caret('pos', {iframe: @app.iframe})
- subtext = content.slice(0, caretPos)
- query = this.callbacks("matcher").call(this, @at, subtext, this.getOpt('startWithSpace'), @getOpt("acceptSpaceBar"))
- isString = typeof query is 'string'
-
- return if isString and query.length < this.getOpt('minLen', 0)
-
- if isString and query.length <= this.getOpt('maxLen', 20)
- start = caretPos - query.length
- end = start + query.length
- @pos = start
- query = {'text': query, 'headPos': start, 'endPos': end}
- this.trigger "matched", [@at, query.text]
- else
- query = null
- @view.hide()
-
- @query = query
-
- # Get offset of current at char(`flag`)
- #
- # @return [Hash] the offset which look likes this: {top: y, left: x, bottom: bottom}
- rect: ->
- return if not c = @$inputor.caret('offset', @pos - 1, {iframe: @app.iframe})
- if @app.iframe and not @app.iframeAsRoot
- iframeOffset = $(@app.iframe).offset()
- c.left += iframeOffset.left
- c.top += iframeOffset.top
- scaleBottom = if @app.document.selection then 0 else 2
- {left: c.left, top: c.top, bottom: c.top + c.height + scaleBottom}
-
- # Insert value of `data-value` attribute of chosen item into inputor
- #
- # @param content [String] string to insert
- insert: (content, $li) ->
- $inputor = @$inputor
- source = $inputor.val()
- startStr = source.slice 0, Math.max(@query.headPos - @at.length, 0)
- suffix = if (suffix = @getOpt 'suffix') == "" then suffix else suffix or " "
- content += suffix
- text = "#{startStr}#{content}#{source.slice @query['endPos'] || 0}"
- $inputor.val text
- $inputor.caret('pos', startStr.length + content.length, {iframe: @app.iframe})
- $inputor.focus() unless $inputor.is ':focus'
- $inputor.change()