1
|
{"version":3,"sources":["tribute.min.js"],"names":["f","exports","module","define","amd","window","global","self","this","Tribute","r","e","n","t","o","i","c","require","u","a","Error","code","p","call","length","1","Object","defineProperty","value","_interopRequireDefault","_TributeEvents","_TributeMenuEvents","_TributeRange","_TributeSearch","obj","__esModule","default","_slicedToArray","arr","Array","isArray","_arrayWithHoles","_arr","_n","_d","_e","undefined","_s","_i","Symbol","iterator","next","done","push","err","_iterableToArrayLimit","TypeError","_nonIterableRest","_defineProperties","target","props","descriptor","enumerable","configurable","writable","key","_default","_ref","_this","_ref$values","values","_ref$iframe","iframe","_ref$selectClass","selectClass","_ref$trigger","trigger","_ref$autocompleteMode","autocompleteMode","_ref$selectTemplate","selectTemplate","_ref$menuItemTemplate","menuItemTemplate","_ref$lookup","lookup","_ref$fillAttr","fillAttr","_ref$collection","collection","_ref$menuContainer","menuContainer","_ref$noMatchTemplate","noMatchTemplate","_ref$requireLeadingSp","requireLeadingSpace","_ref$allowSpaces","allowSpaces","_ref$replaceTextSuffi","replaceTextSuffix","_ref$positionMenu","positionMenu","_ref$spaceSelectsMatc","spaceSelectsMatch","_ref$searchOpts","searchOpts","_ref$menuItemLimit","menuItemLimit","instance","Constructor","_classCallCheck","menuSelected","current","inputEvent","isActive","hasTrailingSpace","defaultSelectTemplate","bind","defaultMenuItemTemplate","console","warn","map","item","protoProps","staticProps","prototype","_createClass","config","el","jQuery","get","constructor","NodeList","HTMLCollection","_attach","hasAttribute","nodeName","ensureEditable","events","setAttribute","element","inputTypes","indexOf","contentEditable","wrapper","range","getDocument","createElement","ul","className","appendChild","body","scrollTo","_this2","mentionText","currentMentionTextSnapshot","menu","createMenu","tributeMenu","menuEvents","processValues","items","search","filter","pre","post","skip","extract","filteredItems","querySelector","positionMenuAtCaret","noMatchEvent","CustomEvent","detail","dispatchEvent","hideMenu","innerHTML","slice","fragment","createDocumentFragment","forEach","index","li","addEventListener","_this2$_findLiTarget2","_findLiTarget","movementY","setActiveLi","getAttribute","parentNode","collectionIndex","document","activeElement","placeCaretAtEnd","externalTrigger","isContentEditable","insertTextAtCursor","insertAtCaret","showMenuFor","focus","getSelection","createRange","selectNodeContents","collapse","sel","removeAllRanges","addRange","createTextRange","textRange","moveToElementText","select","text","getRangeAt","deleteContents","textNode","createTextNode","insertNode","textarea","scrollPos","scrollTop","caretPos","selectionStart","front","substring","back","selectionEnd","style","cssText","originalEvent","parseInt","isNaN","content","replaceText","replaceTriggerText","newValues","replace","concat","_append","_detach","_this3","unbind","setTimeout","removeAttribute","remove","original","matchItem","string","./TributeEvents","./TributeMenuEvents","./TributeRange","./TributeSearch","./utils","2","TributeEvents","tribute","boundKeydown","keydown","boundKeyup","keyup","boundInput","input","removeEventListener","event","shouldDeactivate","commandEvent","keys","keyCode","callbacks","toLowerCase","contains","preventDefault","stopPropagation","selectItemAtIndex","updateSelection","triggerChar","getKeyCode","triggers","find","charCodeAt","eventKeyPressed","info","getTriggerInfo","mentionTriggerChar","selectedPath","mentionSelectedPath","selectedOffset","mentionSelectedOffset","collectionItem","enter","escape","tab","space","up","count","selected","scrollHeight","down","delete","lis","querySelectorAll","classList","add","liClientRect","getBoundingClientRect","menuClientRect","bottom","scrollDistance","top","_scrollDistance","elem","includeMargin","height","currentStyle","getComputedStyle","parseFloat","marginTop","marginBottom","3","TributeMenuEvents","menuClickEvent","click","menuContainerScrollEvent","debounce","windowResizeEvent","func","wait","immediate","timeout","_arguments","arguments","context","args","callNow","clearTimeout","apply","4","TributeRange","contentWindow","coordinates","getContentEditableCaretPosition","mentionPosition","getTextAreaOrInputUnderlinePosition","left","right","scrollIntoView","menuDimensions","width","offsetWidth","offsetHeight","menuIsOffScreen","isMenuOffScreen","menuIsOffScreenHorizontally","innerWidth","menuIsOffScreenVertically","innerHeight","targetElement","path","offset","childNodes","nextSibling","previousSibling","getWindowSelection","setStart","setEnd","error","replaceEvent","pasteHtml","myField","textSuffix","startPos","endPos","html","anchorNode","node","lastNode","frag","firstChild","cloneRange","setStartAfter","ctx","ce","getNodePositionInParent","reverse","startOffset","selectedElem","workingNodeContent","textContent","selectStartOffset","textComponent","wordsArray","split","trim","menuAlreadyActive","isAutocomplete","selectionInfo","getContentEditableSelectedPath","effectiveRange","getTextPrecedingCurrentSelection","lastWordOfEffectiveRange","getLastWordInText","mentionSelectedElement","mostRecentTriggerCharPos","idx","lastIndexWithLeadingSpace","lastIndexOf","test","currentTriggerSnippet","firstSnippetChar","leadingSpace","regex","str","_char","reversedStr","join","cidx","len","firstChar","windowWidth","windowHeight","doc","documentElement","windowLeft","pageXOffset","scrollLeft","clientLeft","windowTop","pageYOffset","clientTop","menuTop","menuRight","menuBottom","menuLeft","Math","floor","ceil","dimensions","position","flipped","isFirefox","mozInnerScreenX","div","id","computed","whiteSpace","wordWrap","visibility","prop","overflowY","overflow","span","rect","offsetTop","borderTopWidth","fontSize","offsetLeft","borderLeftWidth","getMenuDimensions","parentHeight","scrollStillAvailable","removeChild","selectedNodePosition","markerEl","markerId","Date","getTime","random","toString","substr","prevRange","clientRect","elemTop","elemBottom","maxY","targetY","5","TributeSearch","pattern","array","match","opts","compareString","caseSensitive","rendered","score","patternCache","traverse","render","cache","stringIndex","patternIndex","calculateScore","best","temp","pop","indices","reduce","prev","sort","b","compare","6","./Tribute","7","predicate","list","thisArg","params","bubbles","cancelable","evt","createEvent","initCustomEvent","Event"],"mappings":"CAAA,SAAUA,GAAG,GAAoB,iBAAVC,SAAoC,oBAATC,OAAsBA,OAAOD,QAAQD,SAAS,GAAmB,mBAATG,QAAqBA,OAAOC,IAAKD,OAAO,GAAGH,OAAO,EAA0B,oBAATK,OAAwBA,OAA+B,oBAATC,OAAwBA,OAA6B,oBAAPC,KAAsBA,KAAYC,MAAOC,QAAUT,KAA5T,CAAmU,WAAqC,OAAmB,SAASU,EAAEC,EAAEC,EAAEC,GAAG,SAASC,EAAEC,EAAEf,GAAG,IAAIY,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,IAAIC,EAAE,mBAAmBC,SAASA,QAA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MAAMqF,UAAUwJ,OACnB7O,MAAMqF,UAAUwJ,KAAO,SAAUkO,GAC/B,GAAa,OAAT9e,KACF,MAAM,IAAIgD,UAAU,oDAGtB,GAAyB,mBAAd8b,EACT,MAAM,IAAI9b,UAAU,gCAQtB,IALA,IAGI5B,EAHA2d,EAAO7d,OAAOlB,MACdgB,EAAS+d,EAAK/d,SAAW,EACzBge,EAAUhL,UAAU,GAGfzT,EAAI,EAAGA,EAAIS,EAAQT,IAG1B,GAFAa,EAAQ2d,EAAKxe,GAETue,EAAU/d,KAAKie,EAAS5d,EAAOb,EAAGwe,GACpC,OAAO3d,IAQXvB,QAAwC,mBAAvBA,OAAOsK,YAA4B,CACtD,IAAIA,EAAc,SAAqB0F,EAAOoP,GAC5CA,EAASA,GAAU,CACjBC,SAAS,EACTC,YAAY,EACZ/U,YAAQ9H,GAEV,IAAI8c,EAAM9T,SAAS+T,YAAY,eAE/B,OADAD,EAAIE,gBAAgBzP,EAAOoP,EAAOC,QAASD,EAAOE,WAAYF,EAAO7U,QAC9DgV,QAGmB,IAAjBvf,OAAO0f,QAChBpV,EAAY/C,UAAYvH,OAAO0f,MAAMnY,WAGvCvH,OAAOsK,YAAcA,IAGrB,KAAK,GAAG,CAAC,GA9zDoW,CA8zDhW","file":"tribute.min.js","sourcesContent":["(function(f){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define([],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}g.Tribute = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n\nvar _utils = _interopRequireDefault(require(\"./utils\"));\n\nvar _TributeEvents = _interopRequireDefault(require(\"./TributeEvents\"));\n\nvar _TributeMenuEvents = _interopRequireDefault(require(\"./TributeMenuEvents\"));\n\nvar _TributeRange = _interopRequireDefault(require(\"./TributeRange\"));\n\nvar _TributeSearch = _interopRequireDefault(require(\"./TributeSearch\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nvar Tribute =\n/*#__PURE__*/\nfunction () {\n function Tribute(_ref) {\n var _this = this;\n\n var _ref$values = _ref.values,\n values = _ref$values === void 0 ? null : _ref$values,\n _ref$iframe = _ref.iframe,\n iframe = _ref$iframe === void 0 ? null : _ref$iframe,\n _ref$selectClass = _ref.selectClass,\n selectClass = _ref$selectClass === void 0 ? 'highlight' : _ref$selectClass,\n _ref$trigger = _ref.trigger,\n trigger = _ref$trigger === void 0 ? '@' : _ref$trigger,\n _ref$autocompleteMode = _ref.autocompleteMode,\n autocompleteMode = _ref$autocompleteMode === void 0 ? false : _ref$autocompleteMode,\n _ref$selectTemplate = _ref.selectTemplate,\n selectTemplate = _ref$selectTemplate === void 0 ? null : _ref$selectTemplate,\n _ref$menuItemTemplate = _ref.menuItemTemplate,\n menuItemTemplate = _ref$menuItemTemplate === void 0 ? null : _ref$menuItemTemplate,\n _ref$lookup = _ref.lookup,\n lookup = _ref$lookup === void 0 ? 'key' : _ref$lookup,\n _ref$fillAttr = _ref.fillAttr,\n fillAttr = _ref$fillAttr === void 0 ? 'value' : _ref$fillAttr,\n _ref$collection = _ref.collection,\n collection = _ref$collection === void 0 ? null : _ref$collection,\n _ref$menuContainer = _ref.menuContainer,\n menuContainer = _ref$menuContainer === void 0 ? null : _ref$menuContainer,\n _ref$noMatchTemplate = _ref.noMatchTemplate,\n noMatchTemplate = _ref$noMatchTemplate === void 0 ? null : _ref$noMatchTemplate,\n _ref$requireLeadingSp = _ref.requireLeadingSpace,\n requireLeadingSpace = _ref$requireLeadingSp === void 0 ? true : _ref$requireLeadingSp,\n _ref$allowSpaces = _ref.allowSpaces,\n allowSpaces = _ref$allowSpaces === void 0 ? false : _ref$allowSpaces,\n _ref$replaceTextSuffi = _ref.replaceTextSuffix,\n replaceTextSuffix = _ref$replaceTextSuffi === void 0 ? null : _ref$replaceTextSuffi,\n _ref$positionMenu = _ref.positionMenu,\n positionMenu = _ref$positionMenu === void 0 ? true : _ref$positionMenu,\n _ref$spaceSelectsMatc = _ref.spaceSelectsMatch,\n spaceSelectsMatch = _ref$spaceSelectsMatc === void 0 ? false : _ref$spaceSelectsMatc,\n _ref$searchOpts = _ref.searchOpts,\n searchOpts = _ref$searchOpts === void 0 ? {} : _ref$searchOpts,\n _ref$menuItemLimit = _ref.menuItemLimit,\n menuItemLimit = _ref$menuItemLimit === void 0 ? null : _ref$menuItemLimit;\n\n _classCallCheck(this, Tribute);\n\n this.autocompleteMode = autocompleteMode;\n this.menuSelected = 0;\n this.current = {};\n this.inputEvent = false;\n this.isActive = false;\n this.menuContainer = menuContainer;\n this.allowSpaces = allowSpaces;\n this.replaceTextSuffix = replaceTextSuffix;\n this.positionMenu = positionMenu;\n this.hasTrailingSpace = false;\n this.spaceSelectsMatch = spaceSelectsMatch;\n\n if (this.autocompleteMode) {\n trigger = '';\n allowSpaces = false;\n }\n\n if (values) {\n this.collection = [{\n // symbol that starts the lookup\n trigger: trigger,\n // is it wrapped in an iframe\n iframe: iframe,\n // class applied to selected item\n selectClass: selectClass,\n // function called on select that retuns the content to insert\n selectTemplate: (selectTemplate || Tribute.defaultSelectTemplate).bind(this),\n // function called that returns content for an item\n menuItemTemplate: (menuItemTemplate || Tribute.defaultMenuItemTemplate).bind(this),\n // function called when menu is empty, disables hiding of menu.\n noMatchTemplate: function (t) {\n if (typeof t === 'function') {\n return t.bind(_this);\n }\n\n return noMatchTemplate || function () {\n return '';\n }.bind(_this);\n }(noMatchTemplate),\n // column to search against in the object\n lookup: lookup,\n // column that contains the content to insert by default\n fillAttr: fillAttr,\n // array of objects or a function returning an array of objects\n values: values,\n requireLeadingSpace: requireLeadingSpace,\n searchOpts: searchOpts,\n menuItemLimit: menuItemLimit\n }];\n } else if (collection) {\n if (this.autocompleteMode) console.warn('Tribute in autocomplete mode does not work for collections');\n this.collection = collection.map(function (item) {\n return {\n trigger: item.trigger || trigger,\n iframe: item.iframe || iframe,\n selectClass: item.selectClass || selectClass,\n selectTemplate: (item.selectTemplate || Tribute.defaultSelectTemplate).bind(_this),\n menuItemTemplate: (item.menuItemTemplate || Tribute.defaultMenuItemTemplate).bind(_this),\n // function called when menu is empty, disables hiding of menu.\n noMatchTemplate: function (t) {\n if (typeof t === 'function') {\n return t.bind(_this);\n }\n\n return null;\n }(noMatchTemplate),\n lookup: item.lookup || lookup,\n fillAttr: item.fillAttr || fillAttr,\n values: item.values,\n requireLeadingSpace: item.requireLeadingSpace,\n searchOpts: item.searchOpts || searchOpts,\n menuItemLimit: item.menuItemLimit || menuItemLimit\n };\n });\n } else {\n throw new Error('[Tribute] No collection specified.');\n }\n\n new _TributeRange[\"default\"](this);\n new _TributeEvents[\"default\"](this);\n new _TributeMenuEvents[\"default\"](this);\n new _TributeSearch[\"default\"](this);\n }\n\n _createClass(Tribute, [{\n key: \"triggers\",\n value: function triggers() {\n return this.collection.map(function (config) {\n return config.trigger;\n });\n }\n }, {\n key: \"attach\",\n value: function attach(el) {\n if (!el) {\n throw new Error('[Tribute] Must pass in a DOM node or NodeList.');\n } // Check if it is a jQuery collection\n\n\n if (typeof jQuery !== 'undefined' && el instanceof jQuery) {\n el = el.get();\n } // Is el an Array/Array-like object?\n\n\n if (el.constructor === NodeList || el.constructor === HTMLCollection || el.constructor === Array) {\n var length = el.length;\n\n for (var i = 0; i < length; ++i) {\n this._attach(el[i]);\n }\n } else {\n this._attach(el);\n }\n }\n }, {\n key: \"_attach\",\n value: function _attach(el) {\n if (el.hasAttribute('data-tribute')) {\n console.warn('Tribute was already bound to ' + el.nodeName);\n }\n\n this.ensureEditable(el);\n this.events.bind(el);\n el.setAttribute('data-tribute', true);\n }\n }, {\n key: \"ensureEditable\",\n value: function ensureEditable(element) {\n if (Tribute.inputTypes().indexOf(element.nodeName) === -1) {\n if (element.contentEditable) {\n element.contentEditable = true;\n } else {\n throw new Error('[Tribute] Cannot bind to ' + element.nodeName);\n }\n }\n }\n }, {\n key: \"createMenu\",\n value: function createMenu() {\n var wrapper = this.range.getDocument().createElement('div'),\n ul = this.range.getDocument().createElement('ul');\n wrapper.className = 'tribute-container';\n wrapper.appendChild(ul);\n\n if (this.menuContainer) {\n return this.menuContainer.appendChild(wrapper);\n }\n\n return this.range.getDocument().body.appendChild(wrapper);\n }\n }, {\n key: \"showMenuFor\",\n value: function showMenuFor(element, scrollTo) {\n var _this2 = this;\n\n // Only proceed if menu isn't already shown for the current element & mentionText\n if (this.isActive && this.current.element === element && this.current.mentionText === this.currentMentionTextSnapshot) {\n return;\n }\n\n this.currentMentionTextSnapshot = this.current.mentionText; // create the menu if it doesn't exist.\n\n if (!this.menu) {\n this.menu = this.createMenu();\n element.tributeMenu = this.menu;\n this.menuEvents.bind(this.menu);\n }\n\n this.isActive = true;\n this.menuSelected = 0;\n\n if (!this.current.mentionText) {\n this.current.mentionText = '';\n }\n\n var processValues = function processValues(values) {\n // Tribute may not be active any more by the time the value callback returns\n if (!_this2.isActive) {\n return;\n }\n\n var items = _this2.search.filter(_this2.current.mentionText, values, {\n pre: _this2.current.collection.searchOpts.pre || '<span>',\n post: _this2.current.collection.searchOpts.post || '</span>',\n skip: _this2.current.collection.searchOpts.skip,\n extract: function extract(el) {\n if (typeof _this2.current.collection.lookup === 'string') {\n return el[_this2.current.collection.lookup];\n } else if (typeof _this2.current.collection.lookup === 'function') {\n return _this2.current.collection.lookup(el, _this2.current.mentionText);\n } else {\n throw new Error('Invalid lookup attribute, lookup must be string or function.');\n }\n }\n });\n\n _this2.current.filteredItems = items;\n\n var ul = _this2.menu.querySelector('ul');\n\n _this2.range.positionMenuAtCaret(scrollTo);\n\n if (!items.length) {\n var noMatchEvent = new CustomEvent('tribute-no-match', {\n detail: _this2.menu\n });\n\n _this2.current.element.dispatchEvent(noMatchEvent);\n\n if (typeof _this2.current.collection.noMatchTemplate === 'function' && !_this2.current.collection.noMatchTemplate() || !_this2.current.collection.noMatchTemplate) {\n _this2.hideMenu();\n } else {\n typeof _this2.current.collection.noMatchTemplate === 'function' ? ul.innerHTML = _this2.current.collection.noMatchTemplate() : ul.innerHTML = _this2.current.collection.noMatchTemplate;\n }\n\n return;\n }\n\n if (_this2.current.collection.menuItemLimit) {\n items = items.slice(0, _this2.current.collection.menuItemLimit);\n }\n\n ul.innerHTML = '';\n\n var fragment = _this2.range.getDocument().createDocumentFragment();\n\n items.forEach(function (item, index) {\n var li = _this2.range.getDocument().createElement('li');\n\n li.setAttribute('data-index', index);\n li.addEventListener('mousemove', function (e) {\n var _this2$_findLiTarget = _this2._findLiTarget(e.target),\n _this2$_findLiTarget2 = _slicedToArray(_this2$_findLiTarget, 2),\n li = _this2$_findLiTarget2[0],\n index = _this2$_findLiTarget2[1];\n\n if (e.movementY !== 0) {\n _this2.events.setActiveLi(index);\n }\n });\n\n if (_this2.menuSelected === index) {\n li.className = _this2.current.collection.selectClass;\n }\n\n li.innerHTML = _this2.current.collection.menuItemTemplate(item);\n fragment.appendChild(li);\n });\n ul.appendChild(fragment);\n };\n\n if (typeof this.current.collection.values === 'function') {\n this.current.collection.values(this.current.mentionText, processValues);\n } else {\n processValues(this.current.collection.values);\n }\n }\n }, {\n key: \"_findLiTarget\",\n value: function _findLiTarget(el) {\n if (!el) return [];\n var index = el.getAttribute('data-index');\n return !index ? this._findLiTarget(el.parentNode) : [el, index];\n }\n }, {\n key: \"showMenuForCollection\",\n value: function showMenuForCollection(element, collectionIndex) {\n if (element !== document.activeElement) {\n this.placeCaretAtEnd(element);\n }\n\n this.current.collection = this.collection[collectionIndex || 0];\n this.current.externalTrigger = true;\n this.current.element = element;\n if (element.isContentEditable) this.insertTextAtCursor(this.current.collection.trigger);else this.insertAtCaret(element, this.current.collection.trigger);\n this.showMenuFor(element);\n } // TODO: make sure this works for inputs/textareas\n\n }, {\n key: \"placeCaretAtEnd\",\n value: function placeCaretAtEnd(el) {\n el.focus();\n\n if (typeof window.getSelection != \"undefined\" && typeof document.createRange != \"undefined\") {\n var range = document.createRange();\n range.selectNodeContents(el);\n range.collapse(false);\n var sel = window.getSelection();\n sel.removeAllRanges();\n sel.addRange(range);\n } else if (typeof document.body.createTextRange != \"undefined\") {\n var textRange = document.body.createTextRange();\n textRange.moveToElementText(el);\n textRange.collapse(false);\n textRange.select();\n }\n } // for contenteditable\n\n }, {\n key: \"insertTextAtCursor\",\n value: function insertTextAtCursor(text) {\n var sel, range, html;\n sel = window.getSelection();\n range = sel.getRangeAt(0);\n range.deleteContents();\n var textNode = document.createTextNode(text);\n range.insertNode(textNode);\n range.selectNodeContents(textNode);\n range.collapse(false);\n sel.removeAllRanges();\n sel.addRange(range);\n } // for regular inputs\n\n }, {\n key: \"insertAtCaret\",\n value: function insertAtCaret(textarea, text) {\n var scrollPos = textarea.scrollTop;\n var caretPos = textarea.selectionStart;\n var front = textarea.value.substring(0, caretPos);\n var back = textarea.value.substring(textarea.selectionEnd, textarea.value.length);\n textarea.value = front + text + back;\n caretPos = caretPos + text.length;\n textarea.selectionStart = caretPos;\n textarea.selectionEnd = caretPos;\n textarea.focus();\n textarea.scrollTop = scrollPos;\n }\n }, {\n key: \"hideMenu\",\n value: function hideMenu() {\n if (this.menu) {\n this.menu.style.cssText = 'display: none;';\n this.isActive = false;\n this.menuSelected = 0;\n this.current = {};\n }\n }\n }, {\n key: \"selectItemAtIndex\",\n value: function selectItemAtIndex(index, originalEvent) {\n index = parseInt(index);\n if (typeof index !== 'number' || isNaN(index)) return;\n var item = this.current.filteredItems[index];\n var content = this.current.collection.selectTemplate(item);\n if (content !== null) this.replaceText(content, originalEvent, item);\n }\n }, {\n key: \"replaceText\",\n value: function replaceText(content, originalEvent, item) {\n this.range.replaceTriggerText(content, true, true, originalEvent, item);\n }\n }, {\n key: \"_append\",\n value: function _append(collection, newValues, replace) {\n if (typeof collection.values === 'function') {\n throw new Error('Unable to append to values, as it is a function.');\n } else if (!replace) {\n collection.values = collection.values.concat(newValues);\n } else {\n collection.values = newValues;\n }\n }\n }, {\n key: \"append\",\n value: function append(collectionIndex, newValues, replace) {\n var index = parseInt(collectionIndex);\n if (typeof index !== 'number') throw new Error('please provide an index for the collection to update.');\n var collection = this.collection[index];\n\n this._append(collection, newValues, replace);\n }\n }, {\n key: \"appendCurrent\",\n value: function appendCurrent(newValues, replace) {\n if (this.isActive) {\n this._append(this.current.collection, newValues, replace);\n } else {\n throw new Error('No active state. Please use append instead and pass an index.');\n }\n }\n }, {\n key: \"detach\",\n value: function detach(el) {\n if (!el) {\n throw new Error('[Tribute] Must pass in a DOM node or NodeList.');\n } // Check if it is a jQuery collection\n\n\n if (typeof jQuery !== 'undefined' && el instanceof jQuery) {\n el = el.get();\n } // Is el an Array/Array-like object?\n\n\n if (el.constructor === NodeList || el.constructor === HTMLCollection || el.constructor === Array) {\n var length = el.length;\n\n for (var i = 0; i < length; ++i) {\n this._detach(el[i]);\n }\n } else {\n this._detach(el);\n }\n }\n }, {\n key: \"_detach\",\n value: function _detach(el) {\n var _this3 = this;\n\n this.events.unbind(el);\n\n if (el.tributeMenu) {\n this.menuEvents.unbind(el.tributeMenu);\n }\n\n setTimeout(function () {\n el.removeAttribute('data-tribute');\n _this3.isActive = false;\n\n if (el.tributeMenu) {\n el.tributeMenu.remove();\n }\n });\n }\n }], [{\n key: \"defaultSelectTemplate\",\n value: function defaultSelectTemplate(item) {\n if (typeof item === 'undefined') return null;\n\n if (this.range.isContentEditable(this.current.element)) {\n return '<span class=\"tribute-mention\">' + (this.current.collection.trigger + item.original[this.current.collection.fillAttr]) + '</span>';\n }\n\n return this.current.collection.trigger + item.original[this.current.collection.fillAttr];\n }\n }, {\n key: \"defaultMenuItemTemplate\",\n value: function defaultMenuItemTemplate(matchItem) {\n return matchItem.string;\n }\n }, {\n key: \"inputTypes\",\n value: function inputTypes() {\n return ['TEXTAREA', 'INPUT'];\n }\n }]);\n\n return Tribute;\n}();\n\nvar _default = Tribute;\nexports[\"default\"] = _default;\nmodule.exports = exports.default;\n\n},{\"./TributeEvents\":2,\"./TributeMenuEvents\":3,\"./TributeRange\":4,\"./TributeSearch\":5,\"./utils\":7}],2:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nvar TributeEvents =\n/*#__PURE__*/\nfunction () {\n function TributeEvents(tribute) {\n _classCallCheck(this, TributeEvents);\n\n this.tribute = tribute;\n this.tribute.events = this;\n }\n\n _createClass(TributeEvents, [{\n key: \"bind\",\n value: function bind(element) {\n element.boundKeydown = this.keydown.bind(element, this);\n element.boundKeyup = this.keyup.bind(element, this);\n element.boundInput = this.input.bind(element, this);\n element.addEventListener('keydown', element.boundKeydown, false);\n element.addEventListener('keyup', element.boundKeyup, false);\n element.addEventListener('input', element.boundInput, false);\n }\n }, {\n key: \"unbind\",\n value: function unbind(element) {\n element.removeEventListener('keydown', element.boundKeydown, false);\n element.removeEventListener('keyup', element.boundKeyup, false);\n element.removeEventListener('input', element.boundInput, false);\n delete element.boundKeydown;\n delete element.boundKeyup;\n delete element.boundInput;\n }\n }, {\n key: \"keydown\",\n value: function keydown(instance, event) {\n if (instance.shouldDeactivate(event)) {\n instance.tribute.isActive = false;\n instance.tribute.hideMenu();\n }\n\n var element = this;\n instance.commandEvent = false;\n TributeEvents.keys().forEach(function (o) {\n if (o.key === event.keyCode) {\n instance.commandEvent = true;\n instance.callbacks()[o.value.toLowerCase()](event, element);\n }\n });\n }\n }, {\n key: \"input\",\n value: function input(instance, event) {\n instance.inputEvent = true;\n instance.keyup.call(this, instance, event);\n }\n }, {\n key: \"click\",\n value: function click(instance, event) {\n var tribute = instance.tribute;\n\n if (tribute.menu && tribute.menu.contains(event.target)) {\n var li = event.target;\n event.preventDefault();\n event.stopPropagation();\n\n while (li.nodeName.toLowerCase() !== 'li') {\n li = li.parentNode;\n\n if (!li || li === tribute.menu) {\n throw new Error('cannot find the <li> container for the click');\n }\n }\n\n tribute.selectItemAtIndex(li.getAttribute('data-index'), event);\n tribute.hideMenu(); // TODO: should fire with externalTrigger and target is outside of menu\n } else if (tribute.current.element && !tribute.current.externalTrigger) {\n tribute.current.externalTrigger = false;\n setTimeout(function () {\n return tribute.hideMenu();\n });\n }\n }\n }, {\n key: \"keyup\",\n value: function keyup(instance, event) {\n if (instance.inputEvent) {\n instance.inputEvent = false;\n }\n\n instance.updateSelection(this);\n if (event.keyCode === 27) return;\n\n if (!instance.tribute.allowSpaces && instance.tribute.hasTrailingSpace) {\n instance.tribute.hasTrailingSpace = false;\n instance.commandEvent = true;\n instance.callbacks()[\"space\"](event, this);\n return;\n }\n\n if (!instance.tribute.isActive) {\n if (instance.tribute.autocompleteMode) {\n instance.callbacks().triggerChar(event, this, '');\n } else {\n var keyCode = instance.getKeyCode(instance, this, event);\n if (isNaN(keyCode) || !keyCode) return;\n var trigger = instance.tribute.triggers().find(function (trigger) {\n return trigger.charCodeAt(0) === keyCode;\n });\n\n if (typeof trigger !== 'undefined') {\n instance.callbacks().triggerChar(event, this, trigger);\n }\n }\n }\n\n if ((instance.tribute.current.trigger || instance.tribute.autocompleteMode) && instance.commandEvent === false || instance.tribute.isActive && event.keyCode === 8) {\n instance.tribute.showMenuFor(this, true);\n }\n }\n }, {\n key: \"shouldDeactivate\",\n value: function shouldDeactivate(event) {\n if (!this.tribute.isActive) return false;\n\n if (this.tribute.current.mentionText.length === 0) {\n var eventKeyPressed = false;\n TributeEvents.keys().forEach(function (o) {\n if (event.keyCode === o.key) eventKeyPressed = true;\n });\n return !eventKeyPressed;\n }\n\n return false;\n }\n }, {\n key: \"getKeyCode\",\n value: function getKeyCode(instance, el, event) {\n var _char;\n\n var tribute = instance.tribute;\n var info = tribute.range.getTriggerInfo(false, tribute.hasTrailingSpace, true, tribute.allowSpaces, tribute.autocompleteMode);\n\n if (info) {\n return info.mentionTriggerChar.charCodeAt(0);\n } else {\n return false;\n }\n }\n }, {\n key: \"updateSelection\",\n value: function updateSelection(el) {\n this.tribute.current.element = el;\n var info = this.tribute.range.getTriggerInfo(false, this.tribute.hasTrailingSpace, true, this.tribute.allowSpaces, this.tribute.autocompleteMode);\n\n if (info) {\n this.tribute.current.selectedPath = info.mentionSelectedPath;\n this.tribute.current.mentionText = info.mentionText;\n this.tribute.current.selectedOffset = info.mentionSelectedOffset;\n }\n }\n }, {\n key: \"callbacks\",\n value: function callbacks() {\n var _this = this;\n\n return {\n triggerChar: function triggerChar(e, el, trigger) {\n var tribute = _this.tribute;\n tribute.current.trigger = trigger;\n var collectionItem = tribute.collection.find(function (item) {\n return item.trigger === trigger;\n });\n tribute.current.collection = collectionItem;\n if (tribute.inputEvent) tribute.showMenuFor(el, true);\n },\n enter: function enter(e, el) {\n // choose selection\n if (_this.tribute.isActive && _this.tribute.current.filteredItems) {\n e.preventDefault();\n e.stopPropagation();\n setTimeout(function () {\n _this.tribute.selectItemAtIndex(_this.tribute.menuSelected, e);\n\n _this.tribute.hideMenu();\n }, 0);\n }\n },\n escape: function escape(e, el) {\n if (_this.tribute.isActive) {\n e.preventDefault();\n e.stopPropagation();\n _this.tribute.isActive = false;\n\n _this.tribute.hideMenu();\n }\n },\n tab: function tab(e, el) {\n // choose first match\n _this.callbacks().enter(e, el);\n },\n space: function space(e, el) {\n if (_this.tribute.isActive) {\n if (_this.tribute.spaceSelectsMatch) {\n _this.callbacks().enter(e, el);\n } else if (!_this.tribute.allowSpaces) {\n e.stopPropagation();\n setTimeout(function () {\n _this.tribute.hideMenu();\n\n _this.tribute.isActive = false;\n }, 0);\n }\n }\n },\n up: function up(e, el) {\n // navigate up ul\n if (_this.tribute.isActive && _this.tribute.current.filteredItems) {\n e.preventDefault();\n e.stopPropagation();\n var count = _this.tribute.current.filteredItems.length,\n selected = _this.tribute.menuSelected;\n\n if (count > selected && selected > 0) {\n _this.tribute.menuSelected--;\n\n _this.setActiveLi();\n } else if (selected === 0) {\n _this.tribute.menuSelected = count - 1;\n\n _this.setActiveLi();\n\n _this.tribute.menu.scrollTop = _this.tribute.menu.scrollHeight;\n }\n }\n },\n down: function down(e, el) {\n // navigate down ul\n if (_this.tribute.isActive && _this.tribute.current.filteredItems) {\n e.preventDefault();\n e.stopPropagation();\n var count = _this.tribute.current.filteredItems.length - 1,\n selected = _this.tribute.menuSelected;\n\n if (count > selected) {\n _this.tribute.menuSelected++;\n\n _this.setActiveLi();\n } else if (count === selected) {\n _this.tribute.menuSelected = 0;\n\n _this.setActiveLi();\n\n _this.tribute.menu.scrollTop = 0;\n }\n }\n },\n \"delete\": function _delete(e, el) {\n if (_this.tribute.isActive && _this.tribute.current.mentionText.length < 1) {\n _this.tribute.hideMenu();\n } else if (_this.tribute.isActive) {\n _this.tribute.showMenuFor(el);\n }\n }\n };\n }\n }, {\n key: \"setActiveLi\",\n value: function setActiveLi(index) {\n var lis = this.tribute.menu.querySelectorAll('li'),\n length = lis.length >>> 0;\n if (index) this.tribute.menuSelected = parseInt(index);\n\n for (var i = 0; i < length; i++) {\n var li = lis[i];\n\n if (i === this.tribute.menuSelected) {\n li.classList.add(this.tribute.current.collection.selectClass);\n var liClientRect = li.getBoundingClientRect();\n var menuClientRect = this.tribute.menu.getBoundingClientRect();\n\n if (liClientRect.bottom > menuClientRect.bottom) {\n var scrollDistance = liClientRect.bottom - menuClientRect.bottom;\n this.tribute.menu.scrollTop += scrollDistance;\n } else if (liClientRect.top < menuClientRect.top) {\n var _scrollDistance = menuClientRect.top - liClientRect.top;\n\n this.tribute.menu.scrollTop -= _scrollDistance;\n }\n } else {\n li.classList.remove(this.tribute.current.collection.selectClass);\n }\n }\n }\n }, {\n key: \"getFullHeight\",\n value: function getFullHeight(elem, includeMargin) {\n var height = elem.getBoundingClientRect().height;\n\n if (includeMargin) {\n var style = elem.currentStyle || window.getComputedStyle(elem);\n return height + parseFloat(style.marginTop) + parseFloat(style.marginBottom);\n }\n\n return height;\n }\n }], [{\n key: \"keys\",\n value: function keys() {\n return [{\n key: 9,\n value: 'TAB'\n }, {\n key: 8,\n value: 'DELETE'\n }, {\n key: 13,\n value: 'ENTER'\n }, {\n key: 27,\n value: 'ESCAPE'\n }, {\n key: 32,\n value: 'SPACE'\n }, {\n key: 38,\n value: 'UP'\n }, {\n key: 40,\n value: 'DOWN'\n }];\n }\n }]);\n\n return TributeEvents;\n}();\n\nvar _default = TributeEvents;\nexports[\"default\"] = _default;\nmodule.exports = exports.default;\n\n},{}],3:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nvar TributeMenuEvents =\n/*#__PURE__*/\nfunction () {\n function TributeMenuEvents(tribute) {\n _classCallCheck(this, TributeMenuEvents);\n\n this.tribute = tribute;\n this.tribute.menuEvents = this;\n this.menu = this.tribute.menu;\n }\n\n _createClass(TributeMenuEvents, [{\n key: \"bind\",\n value: function bind(menu) {\n var _this = this;\n\n this.menuClickEvent = this.tribute.events.click.bind(null, this);\n this.menuContainerScrollEvent = this.debounce(function () {\n if (_this.tribute.isActive) {\n _this.tribute.showMenuFor(_this.tribute.current.element, false);\n }\n }, 300, false);\n this.windowResizeEvent = this.debounce(function () {\n if (_this.tribute.isActive) {\n _this.tribute.range.positionMenuAtCaret(true);\n }\n }, 300, false); // fixes IE11 issues with mousedown\n\n this.tribute.range.getDocument().addEventListener('MSPointerDown', this.menuClickEvent, false);\n this.tribute.range.getDocument().addEventListener('mousedown', this.menuClickEvent, false);\n window.addEventListener('resize', this.windowResizeEvent);\n\n if (this.menuContainer) {\n this.menuContainer.addEventListener('scroll', this.menuContainerScrollEvent, false);\n } else {\n window.addEventListener('scroll', this.menuContainerScrollEvent);\n }\n }\n }, {\n key: \"unbind\",\n value: function unbind(menu) {\n this.tribute.range.getDocument().removeEventListener('mousedown', this.menuClickEvent, false);\n this.tribute.range.getDocument().removeEventListener('MSPointerDown', this.menuClickEvent, false);\n window.removeEventListener('resize', this.windowResizeEvent);\n\n if (this.menuContainer) {\n this.menuContainer.removeEventListener('scroll', this.menuContainerScrollEvent, false);\n } else {\n window.removeEventListener('scroll', this.menuContainerScrollEvent);\n }\n }\n }, {\n key: \"debounce\",\n value: function debounce(func, wait, immediate) {\n var _this2 = this,\n _arguments = arguments;\n\n var timeout;\n return function () {\n var context = _this2,\n args = _arguments;\n\n var later = function later() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n }\n }]);\n\n return TributeMenuEvents;\n}();\n\nvar _default = TributeMenuEvents;\nexports[\"default\"] = _default;\nmodule.exports = exports.default;\n\n},{}],4:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n// Thanks to https://github.com/jeff-collins/ment.io\nvar TributeRange =\n/*#__PURE__*/\nfunction () {\n function TributeRange(tribute) {\n _classCallCheck(this, TributeRange);\n\n this.tribute = tribute;\n this.tribute.range = this;\n }\n\n _createClass(TributeRange, [{\n key: \"getDocument\",\n value: function getDocument() {\n var iframe;\n\n if (this.tribute.current.collection) {\n iframe = this.tribute.current.collection.iframe;\n }\n\n if (!iframe) {\n return document;\n }\n\n return iframe.contentWindow.document;\n }\n }, {\n key: \"positionMenuAtCaret\",\n value: function positionMenuAtCaret(scrollTo) {\n var _this = this;\n\n var context = this.tribute.current,\n coordinates;\n var info = this.getTriggerInfo(false, this.tribute.hasTrailingSpace, true, this.tribute.allowSpaces, this.tribute.autocompleteMode);\n\n if (typeof info !== 'undefined') {\n if (!this.tribute.positionMenu) {\n this.tribute.menu.style.cssText = \"display: block;\";\n return;\n }\n\n if (!this.isContentEditable(context.element)) {\n coordinates = this.getTextAreaOrInputUnderlinePosition(this.tribute.current.element, info.mentionPosition);\n } else {\n coordinates = this.getContentEditableCaretPosition(info.mentionPosition);\n }\n\n this.tribute.menu.style.cssText = \"top: \".concat(coordinates.top, \"px;\\n left: \").concat(coordinates.left, \"px;\\n right: \").concat(coordinates.right, \"px;\\n bottom: \").concat(coordinates.bottom, \"px;\\n position: absolute;\\n z-index: 10000;\\n display: block;\");\n\n if (coordinates.left === 'auto') {\n this.tribute.menu.style.left = 'auto';\n }\n\n if (coordinates.top === 'auto') {\n this.tribute.menu.style.top = 'auto';\n }\n\n if (scrollTo) this.scrollIntoView();\n window.setTimeout(function () {\n var menuDimensions = {\n width: _this.tribute.menu.offsetWidth,\n height: _this.tribute.menu.offsetHeight\n };\n\n var menuIsOffScreen = _this.isMenuOffScreen(coordinates, menuDimensions);\n\n var menuIsOffScreenHorizontally = window.innerWidth > menuDimensions.width && (menuIsOffScreen.left || menuIsOffScreen.right);\n var menuIsOffScreenVertically = window.innerHeight > menuDimensions.height && (menuIsOffScreen.top || menuIsOffScreen.bottom);\n\n if (menuIsOffScreenHorizontally || menuIsOffScreenVertically) {\n _this.tribute.menu.style.cssText = 'display: none';\n\n _this.positionMenuAtCaret(scrollTo);\n }\n }, 0);\n } else {\n this.tribute.menu.style.cssText = 'display: none';\n }\n }\n }, {\n key: \"selectElement\",\n value: function selectElement(targetElement, path, offset) {\n var range;\n var elem = targetElement;\n\n if (path) {\n for (var i = 0; i < path.length; i++) {\n elem = elem.childNodes[path[i]];\n\n if (elem === undefined) {\n return;\n }\n\n while (elem.length < offset) {\n offset -= elem.length;\n elem = elem.nextSibling;\n }\n\n if (elem.childNodes.length === 0 && !elem.length) {\n elem = elem.previousSibling;\n }\n }\n }\n\n var sel = this.getWindowSelection();\n range = this.getDocument().createRange();\n range.setStart(elem, offset);\n range.setEnd(elem, offset);\n range.collapse(true);\n\n try {\n sel.removeAllRanges();\n } catch (error) {}\n\n sel.addRange(range);\n targetElement.focus();\n }\n }, {\n key: \"replaceTriggerText\",\n value: function replaceTriggerText(text, requireLeadingSpace, hasTrailingSpace, originalEvent, item) {\n var info = this.getTriggerInfo(true, hasTrailingSpace, requireLeadingSpace, this.tribute.allowSpaces, this.tribute.autocompleteMode);\n\n if (info !== undefined) {\n var context = this.tribute.current;\n var replaceEvent = new CustomEvent('tribute-replaced', {\n detail: {\n item: item,\n instance: context,\n context: info,\n event: originalEvent\n }\n });\n\n if (!this.isContentEditable(context.element)) {\n var myField = this.tribute.current.element;\n var textSuffix = typeof this.tribute.replaceTextSuffix == 'string' ? this.tribute.replaceTextSuffix : ' ';\n text += textSuffix;\n var startPos = info.mentionPosition;\n var endPos = info.mentionPosition + info.mentionText.length + textSuffix.length;\n myField.value = myField.value.substring(0, startPos) + text + myField.value.substring(endPos, myField.value.length);\n myField.selectionStart = startPos + text.length;\n myField.selectionEnd = startPos + text.length;\n } else {\n // add a space to the end of the pasted text\n var _textSuffix = typeof this.tribute.replaceTextSuffix == 'string' ? this.tribute.replaceTextSuffix : '\\xA0';\n\n text += _textSuffix;\n this.pasteHtml(text, info.mentionPosition, info.mentionPosition + info.mentionText.length + !this.tribute.autocompleteMode);\n }\n\n context.element.dispatchEvent(replaceEvent);\n }\n }\n }, {\n key: \"pasteHtml\",\n value: function pasteHtml(html, startPos, endPos) {\n var range, sel;\n sel = this.getWindowSelection();\n range = this.getDocument().createRange();\n range.setStart(sel.anchorNode, startPos);\n range.setEnd(sel.anchorNode, endPos);\n range.deleteContents();\n var el = this.getDocument().createElement('div');\n el.innerHTML = html;\n var frag = this.getDocument().createDocumentFragment(),\n node,\n lastNode;\n\n while (node = el.firstChild) {\n lastNode = frag.appendChild(node);\n }\n\n range.insertNode(frag); // Preserve the selection\n\n if (lastNode) {\n range = range.cloneRange();\n range.setStartAfter(lastNode);\n range.collapse(true);\n sel.removeAllRanges();\n sel.addRange(range);\n }\n }\n }, {\n key: \"getWindowSelection\",\n value: function getWindowSelection() {\n if (this.tribute.collection.iframe) {\n return this.tribute.collection.iframe.contentWindow.getSelection();\n }\n\n return window.getSelection();\n }\n }, {\n key: \"getNodePositionInParent\",\n value: function getNodePositionInParent(element) {\n if (element.parentNode === null) {\n return 0;\n }\n\n for (var i = 0; i < element.parentNode.childNodes.length; i++) {\n var node = element.parentNode.childNodes[i];\n\n if (node === element) {\n return i;\n }\n }\n }\n }, {\n key: \"getContentEditableSelectedPath\",\n value: function getContentEditableSelectedPath(ctx) {\n var sel = this.getWindowSelection();\n var selected = sel.anchorNode;\n var path = [];\n var offset;\n\n if (selected != null) {\n var i;\n var ce = selected.contentEditable;\n\n while (selected !== null && ce !== 'true') {\n i = this.getNodePositionInParent(selected);\n path.push(i);\n selected = selected.parentNode;\n\n if (selected !== null) {\n ce = selected.contentEditable;\n }\n }\n\n path.reverse(); // getRangeAt may not exist, need alternative\n\n offset = sel.getRangeAt(0).startOffset;\n return {\n selected: selected,\n path: path,\n offset: offset\n };\n }\n }\n }, {\n key: \"getTextPrecedingCurrentSelection\",\n value: function getTextPrecedingCurrentSelection() {\n var context = this.tribute.current,\n text = '';\n\n if (!this.isContentEditable(context.element)) {\n var textComponent = this.tribute.current.element;\n\n if (textComponent) {\n var startPos = textComponent.selectionStart;\n\n if (textComponent.value && startPos >= 0) {\n text = textComponent.value.substring(0, startPos);\n }\n }\n } else {\n var selectedElem = this.getWindowSelection().anchorNode;\n\n if (selectedElem != null) {\n var workingNodeContent = selectedElem.textContent;\n var selectStartOffset = this.getWindowSelection().getRangeAt(0).startOffset;\n\n if (workingNodeContent && selectStartOffset >= 0) {\n text = workingNodeContent.substring(0, selectStartOffset);\n }\n }\n }\n\n return text;\n }\n }, {\n key: \"getLastWordInText\",\n value: function getLastWordInText(text) {\n text = text.replace(/\\u00A0/g, ' '); // https://stackoverflow.com/questions/29850407/how-do-i-replace-unicode-character-u00a0-with-a-space-in-javascript\n\n var wordsArray = text.split(' ');\n var worldsCount = wordsArray.length - 1;\n return wordsArray[worldsCount].trim();\n }\n }, {\n key: \"getTriggerInfo\",\n value: function getTriggerInfo(menuAlreadyActive, hasTrailingSpace, requireLeadingSpace, allowSpaces, isAutocomplete) {\n var _this2 = this;\n\n var ctx = this.tribute.current;\n var selected, path, offset;\n\n if (!this.isContentEditable(ctx.element)) {\n selected = this.tribute.current.element;\n } else {\n var selectionInfo = this.getContentEditableSelectedPath(ctx);\n\n if (selectionInfo) {\n selected = selectionInfo.selected;\n path = selectionInfo.path;\n offset = selectionInfo.offset;\n }\n }\n\n var effectiveRange = this.getTextPrecedingCurrentSelection();\n var lastWordOfEffectiveRange = this.getLastWordInText(effectiveRange);\n\n if (isAutocomplete) {\n return {\n mentionPosition: effectiveRange.length - lastWordOfEffectiveRange.length,\n mentionText: lastWordOfEffectiveRange,\n mentionSelectedElement: selected,\n mentionSelectedPath: path,\n mentionSelectedOffset: offset\n };\n }\n\n if (effectiveRange !== undefined && effectiveRange !== null) {\n var mostRecentTriggerCharPos = -1;\n var triggerChar;\n this.tribute.collection.forEach(function (config) {\n var c = config.trigger;\n var idx = config.requireLeadingSpace ? _this2.lastIndexWithLeadingSpace(effectiveRange, c) : effectiveRange.lastIndexOf(c);\n\n if (idx > mostRecentTriggerCharPos) {\n mostRecentTriggerCharPos = idx;\n triggerChar = c;\n requireLeadingSpace = config.requireLeadingSpace;\n }\n });\n\n if (mostRecentTriggerCharPos >= 0 && (mostRecentTriggerCharPos === 0 || !requireLeadingSpace || /[\\xA0\\s]/g.test(effectiveRange.substring(mostRecentTriggerCharPos - 1, mostRecentTriggerCharPos)))) {\n var currentTriggerSnippet = effectiveRange.substring(mostRecentTriggerCharPos + 1, effectiveRange.length);\n triggerChar = effectiveRange.substring(mostRecentTriggerCharPos, mostRecentTriggerCharPos + 1);\n var firstSnippetChar = currentTriggerSnippet.substring(0, 1);\n var leadingSpace = currentTriggerSnippet.length > 0 && (firstSnippetChar === ' ' || firstSnippetChar === '\\xA0');\n\n if (hasTrailingSpace) {\n currentTriggerSnippet = currentTriggerSnippet.trim();\n }\n\n var regex = allowSpaces ? /[^\\S ]/g : /[\\xA0\\s]/g;\n this.tribute.hasTrailingSpace = regex.test(currentTriggerSnippet);\n\n if (!leadingSpace && (menuAlreadyActive || !regex.test(currentTriggerSnippet))) {\n return {\n mentionPosition: mostRecentTriggerCharPos,\n mentionText: currentTriggerSnippet,\n mentionSelectedElement: selected,\n mentionSelectedPath: path,\n mentionSelectedOffset: offset,\n mentionTriggerChar: triggerChar\n };\n }\n }\n }\n }\n }, {\n key: \"lastIndexWithLeadingSpace\",\n value: function lastIndexWithLeadingSpace(str, _char) {\n var reversedStr = str.split('').reverse().join('');\n var index = -1;\n\n for (var cidx = 0, len = str.length; cidx < len; cidx++) {\n var firstChar = cidx === str.length - 1;\n var leadingSpace = /\\s/.test(reversedStr[cidx + 1]);\n var match = _char === reversedStr[cidx];\n\n if (match && (firstChar || leadingSpace)) {\n index = str.length - 1 - cidx;\n break;\n }\n }\n\n return index;\n }\n }, {\n key: \"isContentEditable\",\n value: function isContentEditable(element) {\n return element.nodeName !== 'INPUT' && element.nodeName !== 'TEXTAREA';\n }\n }, {\n key: \"isMenuOffScreen\",\n value: function isMenuOffScreen(coordinates, menuDimensions) {\n var windowWidth = window.innerWidth;\n var windowHeight = window.innerHeight;\n var doc = document.documentElement;\n var windowLeft = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0);\n var windowTop = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);\n var menuTop = typeof coordinates.top === 'number' ? coordinates.top : windowTop + windowHeight - coordinates.bottom - menuDimensions.height;\n var menuRight = typeof coordinates.right === 'number' ? coordinates.right : coordinates.left + menuDimensions.width;\n var menuBottom = typeof coordinates.bottom === 'number' ? coordinates.bottom : coordinates.top + menuDimensions.height;\n var menuLeft = typeof coordinates.left === 'number' ? coordinates.left : windowLeft + windowWidth - coordinates.right - menuDimensions.width;\n return {\n top: menuTop < Math.floor(windowTop),\n right: menuRight > Math.ceil(windowLeft + windowWidth),\n bottom: menuBottom > Math.ceil(windowTop + windowHeight),\n left: menuLeft < Math.floor(windowLeft)\n };\n }\n }, {\n key: \"getMenuDimensions\",\n value: function getMenuDimensions() {\n // Width of the menu depends of its contents and position\n // We must check what its width would be without any obstruction\n // This way, we can achieve good positioning for flipping the menu\n var dimensions = {\n width: null,\n height: null\n };\n this.tribute.menu.style.cssText = \"top: 0px;\\n left: 0px;\\n position: fixed;\\n zIndex: 10000;\\n display: block;\\n visibility; hidden;\";\n dimensions.width = this.tribute.menu.offsetWidth;\n dimensions.height = this.tribute.menu.offsetHeight;\n this.tribute.menu.style.cssText = \"display: none;\";\n return dimensions;\n }\n }, {\n key: \"getTextAreaOrInputUnderlinePosition\",\n value: function getTextAreaOrInputUnderlinePosition(element, position, flipped) {\n var properties = ['direction', 'boxSizing', 'width', 'height', 'overflowX', 'overflowY', 'borderTopWidth', 'borderRightWidth', 'borderBottomWidth', 'borderLeftWidth', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'fontStyle', 'fontVariant', 'fontWeight', 'fontStretch', 'fontSize', 'fontSizeAdjust', 'lineHeight', 'fontFamily', 'textAlign', 'textTransform', 'textIndent', 'textDecoration', 'letterSpacing', 'wordSpacing'];\n var isFirefox = window.mozInnerScreenX !== null;\n var div = this.getDocument().createElement('div');\n div.id = 'input-textarea-caret-position-mirror-div';\n this.getDocument().body.appendChild(div);\n var style = div.style;\n var computed = window.getComputedStyle ? getComputedStyle(element) : element.currentStyle;\n style.whiteSpace = 'pre-wrap';\n\n if (element.nodeName !== 'INPUT') {\n style.wordWrap = 'break-word';\n } // position off-screen\n\n\n style.position = 'absolute';\n style.visibility = 'hidden'; // transfer the element's properties to the div\n\n properties.forEach(function (prop) {\n style[prop] = computed[prop];\n });\n\n if (isFirefox) {\n style.width = \"\".concat(parseInt(computed.width) - 2, \"px\");\n if (element.scrollHeight > parseInt(computed.height)) style.overflowY = 'scroll';\n } else {\n style.overflow = 'hidden';\n }\n\n div.textContent = element.value.substring(0, position);\n\n if (element.nodeName === 'INPUT') {\n div.textContent = div.textContent.replace(/\\s/g, ' ');\n }\n\n var span = this.getDocument().createElement('span');\n span.textContent = element.value.substring(position) || '.';\n div.appendChild(span);\n var rect = element.getBoundingClientRect();\n var doc = document.documentElement;\n var windowLeft = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0);\n var windowTop = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);\n var coordinates = {\n top: rect.top + windowTop + span.offsetTop + parseInt(computed.borderTopWidth) + parseInt(computed.fontSize) - element.scrollTop,\n left: rect.left + windowLeft + span.offsetLeft + parseInt(computed.borderLeftWidth)\n };\n var windowWidth = window.innerWidth;\n var windowHeight = window.innerHeight;\n var menuDimensions = this.getMenuDimensions();\n var menuIsOffScreen = this.isMenuOffScreen(coordinates, menuDimensions);\n\n if (menuIsOffScreen.right) {\n coordinates.right = windowWidth - coordinates.left;\n coordinates.left = 'auto';\n }\n\n var parentHeight = this.tribute.menuContainer ? this.tribute.menuContainer.offsetHeight : this.getDocument().body.offsetHeight;\n\n if (menuIsOffScreen.bottom) {\n var parentRect = this.tribute.menuContainer ? this.tribute.menuContainer.getBoundingClientRect() : this.getDocument().body.getBoundingClientRect();\n var scrollStillAvailable = parentHeight - (windowHeight - parentRect.top);\n coordinates.bottom = scrollStillAvailable + (windowHeight - rect.top - span.offsetTop);\n coordinates.top = 'auto';\n }\n\n menuIsOffScreen = this.isMenuOffScreen(coordinates, menuDimensions);\n\n if (menuIsOffScreen.left) {\n coordinates.left = windowWidth > menuDimensions.width ? windowLeft + windowWidth - menuDimensions.width : windowLeft;\n delete coordinates.right;\n }\n\n if (menuIsOffScreen.top) {\n coordinates.top = windowHeight > menuDimensions.height ? windowTop + windowHeight - menuDimensions.height : windowTop;\n delete coordinates.bottom;\n }\n\n this.getDocument().body.removeChild(div);\n return coordinates;\n }\n }, {\n key: \"getContentEditableCaretPosition\",\n value: function getContentEditableCaretPosition(selectedNodePosition) {\n var markerTextChar = '';\n var markerEl,\n markerId = \"sel_\".concat(new Date().getTime(), \"_\").concat(Math.random().toString().substr(2));\n var range;\n var sel = this.getWindowSelection();\n var prevRange = sel.getRangeAt(0);\n range = this.getDocument().createRange();\n range.setStart(sel.anchorNode, selectedNodePosition);\n range.setEnd(sel.anchorNode, selectedNodePosition);\n range.collapse(false); // Create the marker element containing a single invisible character using DOM methods and insert it\n\n markerEl = this.getDocument().createElement('span');\n markerEl.id = markerId;\n markerEl.appendChild(this.getDocument().createTextNode(markerTextChar));\n range.insertNode(markerEl);\n sel.removeAllRanges();\n sel.addRange(prevRange);\n var rect = markerEl.getBoundingClientRect();\n var doc = document.documentElement;\n var windowLeft = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0);\n var windowTop = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);\n var coordinates = {\n left: rect.left + windowLeft,\n top: rect.top + markerEl.offsetHeight + windowTop\n };\n var windowWidth = window.innerWidth;\n var windowHeight = window.innerHeight;\n var menuDimensions = this.getMenuDimensions();\n var menuIsOffScreen = this.isMenuOffScreen(coordinates, menuDimensions);\n\n if (menuIsOffScreen.right) {\n coordinates.left = 'auto';\n coordinates.right = windowWidth - rect.left - windowLeft;\n }\n\n var parentHeight = this.tribute.menuContainer ? this.tribute.menuContainer.offsetHeight : this.getDocument().body.offsetHeight;\n\n if (menuIsOffScreen.bottom) {\n var parentRect = this.tribute.menuContainer ? this.tribute.menuContainer.getBoundingClientRect() : this.getDocument().body.getBoundingClientRect();\n var scrollStillAvailable = parentHeight - (windowHeight - parentRect.top);\n coordinates.top = 'auto';\n coordinates.bottom = scrollStillAvailable + (windowHeight - rect.top);\n }\n\n menuIsOffScreen = this.isMenuOffScreen(coordinates, menuDimensions);\n\n if (menuIsOffScreen.left) {\n coordinates.left = windowWidth > menuDimensions.width ? windowLeft + windowWidth - menuDimensions.width : windowLeft;\n delete coordinates.right;\n }\n\n if (menuIsOffScreen.top) {\n coordinates.top = windowHeight > menuDimensions.height ? windowTop + windowHeight - menuDimensions.height : windowTop;\n delete coordinates.bottom;\n }\n\n markerEl.parentNode.removeChild(markerEl);\n return coordinates;\n }\n }, {\n key: \"scrollIntoView\",\n value: function scrollIntoView(elem) {\n var reasonableBuffer = 20,\n clientRect;\n var maxScrollDisplacement = 100;\n var e = this.menu;\n if (typeof e === 'undefined') return;\n\n while (clientRect === undefined || clientRect.height === 0) {\n clientRect = e.getBoundingClientRect();\n\n if (clientRect.height === 0) {\n e = e.childNodes[0];\n\n if (e === undefined || !e.getBoundingClientRect) {\n return;\n }\n }\n }\n\n var elemTop = clientRect.top;\n var elemBottom = elemTop + clientRect.height;\n\n if (elemTop < 0) {\n window.scrollTo(0, window.pageYOffset + clientRect.top - reasonableBuffer);\n } else if (elemBottom > window.innerHeight) {\n var maxY = window.pageYOffset + clientRect.top - reasonableBuffer;\n\n if (maxY - window.pageYOffset > maxScrollDisplacement) {\n maxY = window.pageYOffset + maxScrollDisplacement;\n }\n\n var targetY = window.pageYOffset - (window.innerHeight - elemBottom);\n\n if (targetY > maxY) {\n targetY = maxY;\n }\n\n window.scrollTo(0, targetY);\n }\n }\n }]);\n\n return TributeRange;\n}();\n\nvar _default = TributeRange;\nexports[\"default\"] = _default;\nmodule.exports = exports.default;\n\n},{}],5:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n// Thanks to https://github.com/mattyork/fuzzy\nvar TributeSearch =\n/*#__PURE__*/\nfunction () {\n function TributeSearch(tribute) {\n _classCallCheck(this, TributeSearch);\n\n this.tribute = tribute;\n this.tribute.search = this;\n }\n\n _createClass(TributeSearch, [{\n key: \"simpleFilter\",\n value: function simpleFilter(pattern, array) {\n var _this = this;\n\n return array.filter(function (string) {\n return _this.test(pattern, string);\n });\n }\n }, {\n key: \"test\",\n value: function test(pattern, string) {\n return this.match(pattern, string) !== null;\n }\n }, {\n key: \"match\",\n value: function match(pattern, string, opts) {\n opts = opts || {};\n var patternIdx = 0,\n result = [],\n len = string.length,\n totalScore = 0,\n currScore = 0,\n pre = opts.pre || '',\n post = opts.post || '',\n compareString = opts.caseSensitive && string || string.toLowerCase(),\n ch,\n compareChar;\n\n if (opts.skip) {\n return {\n rendered: string,\n score: 0\n };\n }\n\n pattern = opts.caseSensitive && pattern || pattern.toLowerCase();\n var patternCache = this.traverse(compareString, pattern, 0, 0, []);\n\n if (!patternCache) {\n return null;\n }\n\n return {\n rendered: this.render(string, patternCache.cache, pre, post),\n score: patternCache.score\n };\n }\n }, {\n key: \"traverse\",\n value: function traverse(string, pattern, stringIndex, patternIndex, patternCache) {\n // if the pattern search at end\n if (pattern.length === patternIndex) {\n // calculate score and copy the cache containing the indices where it's found\n return {\n score: this.calculateScore(patternCache),\n cache: patternCache.slice()\n };\n } // if string at end or remaining pattern > remaining string\n\n\n if (string.length === stringIndex || pattern.length - patternIndex > string.length - stringIndex) {\n return undefined;\n }\n\n var c = pattern[patternIndex];\n var index = string.indexOf(c, stringIndex);\n var best, temp;\n\n while (index > -1) {\n patternCache.push(index);\n temp = this.traverse(string, pattern, index + 1, patternIndex + 1, patternCache);\n patternCache.pop(); // if downstream traversal failed, return best answer so far\n\n if (!temp) {\n return best;\n }\n\n if (!best || best.score < temp.score) {\n best = temp;\n }\n\n index = string.indexOf(c, index + 1);\n }\n\n return best;\n }\n }, {\n key: \"calculateScore\",\n value: function calculateScore(patternCache) {\n var score = 0;\n var temp = 1;\n patternCache.forEach(function (index, i) {\n if (i > 0) {\n if (patternCache[i - 1] + 1 === index) {\n temp += temp + 1;\n } else {\n temp = 1;\n }\n }\n\n score += temp;\n });\n return score;\n }\n }, {\n key: \"render\",\n value: function render(string, indices, pre, post) {\n var rendered = string.substring(0, indices[0]);\n indices.forEach(function (index, i) {\n rendered += pre + string[index] + post + string.substring(index + 1, indices[i + 1] ? indices[i + 1] : string.length);\n });\n return rendered;\n }\n }, {\n key: \"filter\",\n value: function filter(pattern, arr, opts) {\n var _this2 = this;\n\n opts = opts || {};\n return arr.reduce(function (prev, element, idx, arr) {\n var str = element;\n\n if (opts.extract) {\n str = opts.extract(element);\n\n if (!str) {\n // take care of undefineds / nulls / etc.\n str = '';\n }\n }\n\n var rendered = _this2.match(pattern, str, opts);\n\n if (rendered != null) {\n prev[prev.length] = {\n string: rendered.rendered,\n score: rendered.score,\n index: idx,\n original: element\n };\n }\n\n return prev;\n }, []).sort(function (a, b) {\n var compare = b.score - a.score;\n if (compare) return compare;\n return a.index - b.index;\n });\n }\n }]);\n\n return TributeSearch;\n}();\n\nvar _default = TributeSearch;\nexports[\"default\"] = _default;\nmodule.exports = exports.default;\n\n},{}],6:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n\nvar _Tribute = _interopRequireDefault(require(\"./Tribute\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\n/**\n* Tribute.js\n* Native ES6 JavaScript @mention Plugin\n**/\nvar _default = _Tribute[\"default\"];\nexports[\"default\"] = _default;\nmodule.exports = exports.default;\n\n},{\"./Tribute\":1}],7:[function(require,module,exports){\n\"use strict\";\n\nif (!Array.prototype.find) {\n Array.prototype.find = function (predicate) {\n if (this === null) {\n throw new TypeError('Array.prototype.find called on null or undefined');\n }\n\n if (typeof predicate !== 'function') {\n throw new TypeError('predicate must be a function');\n }\n\n var list = Object(this);\n var length = list.length >>> 0;\n var thisArg = arguments[1];\n var value;\n\n for (var i = 0; i < length; i++) {\n value = list[i];\n\n if (predicate.call(thisArg, value, i, list)) {\n return value;\n }\n }\n\n return undefined;\n };\n}\n\nif (window && typeof window.CustomEvent !== \"function\") {\n var CustomEvent = function CustomEvent(event, params) {\n params = params || {\n bubbles: false,\n cancelable: false,\n detail: undefined\n };\n var evt = document.createEvent('CustomEvent');\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n return evt;\n };\n\n if (typeof window.Event !== 'undefined') {\n CustomEvent.prototype = window.Event.prototype;\n }\n\n window.CustomEvent = CustomEvent;\n}\n\n},{}]},{},[6])(6)\n});\n//# sourceMappingURL=tribute.js.map\n"]}
|