Socket
Socket
Sign inDemoInstall

quill-mention

Package Overview
Dependencies
30
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.3.0 to 3.4.0

316

dist/quill.mention.csj.js

@@ -11,38 +11,21 @@ 'use strict';

var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) {
symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
}
keys.push.apply(keys, symbols);
enumerableOnly && (symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})), keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
var source = null != arguments[i] ? arguments[i] : {};
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
_defineProperty(target, key, source[key]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
return target;
}
function _classCallCheck(instance, Constructor) {

@@ -53,3 +36,2 @@ if (!(instance instanceof Constructor)) {

}
function _defineProperties(target, props) {

@@ -61,13 +43,15 @@ for (var i = 0; i < props.length; i++) {

if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {

@@ -83,11 +67,8 @@ Object.defineProperty(obj, key, {

}
return obj;
}
function _extends() {
_extends = Object.assign || function (target) {
_extends = Object.assign ? Object.assign.bind() : function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {

@@ -99,9 +80,6 @@ if (Object.prototype.hasOwnProperty.call(source, key)) {

}
return target;
};
return _extends.apply(this, arguments);
}
function _inherits(subClass, superClass) {

@@ -111,3 +89,2 @@ if (typeof superClass !== "function" && superClass !== null) {

}
subClass.prototype = Object.create(superClass && superClass.prototype, {

@@ -120,7 +97,9 @@ constructor: {

});
Object.defineProperty(subClass, "prototype", {
writable: false
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);

@@ -130,12 +109,9 @@ };

}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _isNativeReflectConstruct() {

@@ -145,3 +121,2 @@ if (typeof Reflect === "undefined" || !Reflect.construct) return false;

if (typeof Proxy === "function") return true;
try {

@@ -154,3 +129,2 @@ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));

}
function _assertThisInitialized(self) {

@@ -160,6 +134,4 @@ if (self === void 0) {

}
return self;
}
function _possibleConstructorReturn(self, call) {

@@ -171,16 +143,11 @@ if (call && (typeof call === "object" || typeof call === "function")) {

}
return _assertThisInitialized(self);
}
function _createSuper(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived),
result;
result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);

@@ -190,7 +157,5 @@ } else {

}
return _possibleConstructorReturn(this, result);
};
}
function _superPropBase(object, property) {

@@ -201,27 +166,20 @@ while (!Object.prototype.hasOwnProperty.call(object, property)) {

}
return object;
}
function _get() {
if (typeof Reflect !== "undefined" && Reflect.get) {
_get = Reflect.get;
_get = Reflect.get.bind();
} else {
_get = function _get(target, property, receiver) {
var base = _superPropBase(target, property);
if (!base) return;
var desc = Object.getOwnPropertyDescriptor(base, property);
if (desc.get) {
return desc.get.call(arguments.length < 3 ? target : receiver);
}
return desc.value;
};
}
return _get.apply(this, arguments);
}
function _unsupportedIterableToArray(o, minLen) {

@@ -235,14 +193,9 @@ if (!o) return;

}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _createForOfIteratorHelper(o, allowArrayLike) {
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (!it) {

@@ -252,5 +205,3 @@ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {

var i = 0;
var F = function () {};
return {

@@ -273,9 +224,7 @@ s: F,

}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
var normalCompletion = true,
didErr = false,
err;
didErr = false,
err;
return {

@@ -303,2 +252,16 @@ s: function () {

}
function _toPrimitive(input, hint) {
if (typeof input !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (typeof res !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return typeof key === "symbol" ? key : String(key);
}

@@ -324,7 +287,18 @@ var Keys = {

}
function getMentionCharIndex(text, mentionDenotationChars) {
function getMentionCharIndex(text, mentionDenotationChars, isolateChar, allowInlineMentionChar) {
return mentionDenotationChars.reduce(function (prev, mentionChar) {
var mentionCharIndex = text.lastIndexOf(mentionChar);
var mentionCharIndex;
if (isolateChar && allowInlineMentionChar) {
var regex = new RegExp("^".concat(mentionChar, "|\\s").concat(mentionChar), 'g');
var lastMatch = (text.match(regex) || []).pop();
if (!lastMatch) {
return {
mentionChar: prev.mentionChar,
mentionCharIndex: prev.mentionCharIndex
};
}
mentionCharIndex = lastMatch !== mentionChar ? text.lastIndexOf(lastMatch) + lastMatch.length - mentionChar.length : 0;
} else {
mentionCharIndex = text.lastIndexOf(mentionChar);
}
if (mentionCharIndex > prev.mentionCharIndex) {

@@ -336,3 +310,2 @@ return {

}
return {

@@ -347,37 +320,26 @@ mentionChar: prev.mentionChar,

}
function hasValidChars(text, allowedChars) {
return allowedChars.test(text);
}
function hasValidMentionCharIndex(mentionCharIndex, text, isolateChar) {
if (mentionCharIndex > -1) {
if (isolateChar && !(mentionCharIndex === 0 || !!text[mentionCharIndex - 1].match(/\s/g))) {
return false;
}
function hasValidMentionCharIndex(mentionCharIndex, text, isolateChar, textPrefix) {
if (mentionCharIndex === -1) {
return false;
}
if (!isolateChar) {
return true;
}
return false;
var mentionPrefix = mentionCharIndex ? text[mentionCharIndex - 1] : textPrefix;
return !mentionPrefix || !!mentionPrefix.match(/\s/);
}
var Embed = Quill__default["default"]["import"]("blots/embed");
var MentionBlot = /*#__PURE__*/function (_Embed) {
_inherits(MentionBlot, _Embed);
var _super = _createSuper(MentionBlot);
function MentionBlot(scroll, node) {
var _this;
_classCallCheck(this, MentionBlot);
_this = _super.call(this, scroll, node);
_defineProperty(_assertThisInitialized(_this), "hoverHandler", void 0);
_defineProperty(_assertThisInitialized(_this), "hoverHandler", void 0);
_this.clickHandler = null;

@@ -388,3 +350,2 @@ _this.hoverHandler = null;

}
_createClass(MentionBlot, [{

@@ -394,3 +355,2 @@ key: "attach",

_get(_getPrototypeOf(MentionBlot.prototype), "attach", this).call(this);
if (!this.mounted) {

@@ -408,5 +368,3 @@ this.mounted = true;

_get(_getPrototypeOf(MentionBlot.prototype), "detach", this).call(this);
this.mounted = false;
if (this.clickHandler) {

@@ -421,6 +379,4 @@ this.domNode.removeEventListener("click", this.clickHandler);

var _this2 = this;
return function (e) {
var event = _this2.buildEvent("mention-clicked", e);
window.dispatchEvent(event);

@@ -434,6 +390,4 @@ e.preventDefault();

var _this3 = this;
return function (e) {
var event = _this3.buildEvent('mention-hovered', e);
window.dispatchEvent(event);

@@ -458,3 +412,2 @@ e.preventDefault();

var node = _get(_getPrototypeOf(MentionBlot), "create", this).call(this);
var denotationChar = document.createElement("span");

@@ -482,6 +435,4 @@ denotationChar.className = "ql-mention-denotation-char";

}]);
return MentionBlot;
}(Embed);
MentionBlot.blotName = "mention";

@@ -495,5 +446,3 @@ MentionBlot.tagName = "span";

var _this = this;
_classCallCheck(this, Mention);
this.isOpen = false;

@@ -504,7 +453,7 @@ this.itemIndex = 0;

this.values = [];
this.suspendMouseEnter = false; //this token is an object that may contains one key "abandoned", set to
this.suspendMouseEnter = false;
//this token is an object that may contains one key "abandoned", set to
//true when the previous source call should be ignored in favor or a
//more recent execution. This token will be null unless a source call
//is in progress.
this.existingSourceExecutionToken = null;

@@ -531,2 +480,3 @@ this.quill = quill;

isolateCharacter: false,
allowInlineMentionChar: false,
fixMentionsToQuill: false,

@@ -554,8 +504,7 @@ positioningStrategy: "normal",

};
_extends(this.options, options, {
dataAttributes: Array.isArray(options.dataAttributes) ? this.options.dataAttributes.concat(options.dataAttributes) : this.options.dataAttributes
}); //Bind all option-functions so they have a reasonable context
});
//Bind all option-functions so they have a reasonable context
for (var o in this.options) {

@@ -565,5 +514,5 @@ if (typeof this.options[o] === 'function') {

}
} //create mention container
}
//create mention container
this.mentionContainer = document.createElement("div");

@@ -573,7 +522,5 @@ this.mentionContainer.className = this.options.mentionContainerClass ? this.options.mentionContainerClass : "";

this.mentionContainer.onmousemove = this.onContainerMouseMove.bind(this);
if (this.options.fixMentionsToQuill) {
this.mentionContainer.style.width = "auto";
}
this.mentionList = document.createElement("ul");

@@ -585,9 +532,9 @@ this.mentionList.id = 'quill-mention-list';

quill.on("text-change", this.onTextChange.bind(this));
quill.on("selection-change", this.onSelectionChange.bind(this)); //Pasting doesn't fire selection-change after the pasted text is
quill.on("selection-change", this.onSelectionChange.bind(this));
//Pasting doesn't fire selection-change after the pasted text is
//inserted, so here we manually trigger one
quill.container.addEventListener("paste", function () {
setTimeout(function () {
var range = quill.getSelection();
_this.onSelectionChange(range);

@@ -600,6 +547,4 @@ });

quill.keyboard.bindings[Keys.TAB].unshift(quill.keyboard.bindings[Keys.TAB].pop());
var _iterator = _createForOfIteratorHelper(this.options.selectKeys),
_step;
_step;
try {

@@ -617,3 +562,2 @@ for (_iterator.s(); !(_step = _iterator.n()).done;) {

}
quill.keyboard.bindings[Keys.ENTER].unshift(quill.keyboard.bindings[Keys.ENTER].pop());

@@ -630,3 +574,2 @@ quill.keyboard.addBinding({

}
_createClass(Mention, [{

@@ -639,3 +582,2 @@ key: "selectHandler",

}
return true;

@@ -650,7 +592,5 @@ }

}
this.hideMentionList();
return false;
}
return true;

@@ -665,3 +605,2 @@ }

}
return true;

@@ -676,3 +615,2 @@ }

}
return true;

@@ -688,3 +626,2 @@ }

}
this.mentionContainer.style.visibility = "hidden";

@@ -709,14 +646,10 @@ this.mentionContainer.style.display = "";

var scrollItemInView = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
for (var i = 0; i < this.mentionList.childNodes.length; i += 1) {
this.mentionList.childNodes[i].classList.remove("selected");
}
if (this.itemIndex === -1 || this.mentionList.childNodes[this.itemIndex].dataset.disabled === "true") {
return;
}
this.mentionList.childNodes[this.itemIndex].classList.add("selected");
this.quill.root.setAttribute('aria-activedescendant', this.mentionList.childNodes[this.itemIndex].id);
if (scrollItemInView) {

@@ -727,3 +660,2 @@ var itemHeight = this.mentionList.childNodes[this.itemIndex].offsetHeight;

var containerBottom = containerTop + this.mentionContainer.offsetHeight;
if (itemPos < containerTop) {

@@ -744,7 +676,5 @@ // Scroll up if the item is above the top of the container

var itemTarget = this.mentionList.childNodes[this.itemIndex].dataset.target;
if (hasLinkValue) {
this.mentionList.childNodes[this.itemIndex].dataset.value = "<a href=\"".concat(link, "\" target=").concat(itemTarget || this.options.linkTarget, ">").concat(this.mentionList.childNodes[this.itemIndex].dataset.value);
}
return this.mentionList.childNodes[this.itemIndex].dataset;

@@ -761,13 +691,9 @@ }

var _this2 = this;
if (this.itemIndex === -1) {
return;
}
var data = this.getItemData();
if (data.disabled) {
return;
}
this.options.onSelect(data, function (asyncData) {

@@ -785,15 +711,10 @@ var programmaticInsert = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

var render = data;
if (render === null) {
return;
}
var options = _objectSpread2(_objectSpread2({}, this.options), overriddenOptions);
if (!options.showDenotationChar) {
render.denotationChar = "";
}
var insertAtPos;
if (!programmaticInsert) {

@@ -805,8 +726,6 @@ insertAtPos = this.mentionCharPos;

}
var delta = this.quill.insertEmbed(insertAtPos, options.blotName, render, Quill__default["default"].sources.USER);
if (options.spaceAfterInsert) {
this.quill.insertText(insertAtPos + 1, " ", Quill__default["default"].sources.USER); // setSelection here sets cursor position
this.quill.insertText(insertAtPos + 1, " ", Quill__default["default"].sources.USER);
// setSelection here sets cursor position
this.quill.setSelection(insertAtPos + 2, Quill__default["default"].sources.USER);

@@ -816,3 +735,2 @@ } else {

}
this.hideMentionList();

@@ -827,5 +745,3 @@ return delta;

}
var index = Number(e.target.dataset.index);
if (!Number.isNaN(index) && index !== this.itemIndex) {

@@ -842,3 +758,2 @@ this.itemIndex = index;

}
this.itemIndex = -1;

@@ -853,3 +768,2 @@ this.highlightItem(false);

}
e.preventDefault();

@@ -871,7 +785,5 @@ e.stopImmediatePropagation();

var renderedLoading = this.options.renderLoading();
if (!renderedLoading) {
return;
}
if (this.mentionContainer.getElementsByClassName("ql-mention-loading").length > 0) {

@@ -881,3 +793,2 @@ this.showMentionList();

}
this.mentionList.innerHTML = "";

@@ -894,3 +805,2 @@ var loadingDiv = document.createElement("div");

var loadingDiv = this.mentionContainer.getElementsByClassName("ql-mention-loading");
if (loadingDiv.length > 0) {

@@ -908,3 +818,2 @@ loadingDiv[0].remove();

var initialSelection = -1;
for (var i = 0; i < data.length; i += 1) {

@@ -914,3 +823,2 @@ var li = document.createElement("li");

li.className = this.options.listItemClass ? this.options.listItemClass : "";
if (data[i].disabled) {

@@ -922,6 +830,4 @@ li.className += " disabled";

}
li.dataset.index = i;
li.innerHTML = this.options.renderItem(data[i], searchTerm);
if (!data[i].disabled) {

@@ -934,7 +840,5 @@ li.onmouseenter = this.onItemMouseEnter.bind(this);

}
li.dataset.denotationChar = mentionChar;
this.mentionList.appendChild(attachDataValues(li, data[i], this.options.dataAttributes));
}
this.itemIndex = initialSelection;

@@ -952,3 +856,2 @@ this.highlightItem();

var newIndex;
do {

@@ -958,3 +861,2 @@ increment++;

var disabled = this.mentionList.childNodes[newIndex].dataset.disabled === "true";
if (increment === this.values.length + 1) {

@@ -966,3 +868,2 @@ //we've wrapped around w/o finding an enabled item

} while (disabled);
this.itemIndex = newIndex;

@@ -977,3 +878,2 @@ this.suspendMouseEnter = true;

var newIndex;
do {

@@ -983,3 +883,2 @@ decrement++;

var disabled = this.mentionList.childNodes[newIndex].dataset.disabled === "true";
if (decrement === this.values.length + 1) {

@@ -991,3 +890,2 @@ //we've wrapped around w/o finding an enabled item

} while (disabled);
this.itemIndex = newIndex;

@@ -1009,3 +907,2 @@ this.suspendMouseEnter = true;

}
var rightPos = leftPos + this.mentionContainer.offsetWidth + containerPos.left;

@@ -1024,3 +921,2 @@ var browserWidth = window.pageXOffset + document.documentElement.clientWidth;

}
this.isOpen = isOpen;

@@ -1042,3 +938,2 @@ }

var _this3 = this;
var containerPos = this.quill.container.getBoundingClientRect();

@@ -1048,4 +943,5 @@ var mentionCharPos = this.quill.getBounds(this.mentionCharPos);

var topPos = this.options.offsetTop;
var leftPos = this.options.offsetLeft; // handle horizontal positioning
var leftPos = this.options.offsetLeft;
// handle horizontal positioning
if (this.options.fixMentionsToQuill) {

@@ -1057,3 +953,2 @@ var rightPos = 0;

}
if (this.containerRightIsNotVisible(leftPos, containerPos)) {

@@ -1063,5 +958,5 @@ var containerWidth = this.mentionContainer.offsetWidth + this.options.offsetLeft;

leftPos = quillWidth - containerWidth;
} // handle vertical positioning
}
// handle vertical positioning
if (this.options.defaultMenuOrientation === "top") {

@@ -1073,8 +968,7 @@ // Attempt to align the mention container with the top of the quill editor

topPos = mentionCharPos.top - (containerHeight + this.options.offsetTop);
} // default to bottom if the top is not visible
}
// default to bottom if the top is not visible
if (topPos + containerPos.top <= 0) {
var overMentionCharPos = this.options.offsetTop;
if (this.options.fixMentionsToQuill) {

@@ -1085,3 +979,2 @@ overMentionCharPos += containerPos.height;

}
topPos = overMentionCharPos;

@@ -1095,20 +988,16 @@ }

topPos += mentionCharPos.bottom;
} // default to the top if the bottom is not visible
}
// default to the top if the bottom is not visible
if (this.containerBottomIsNotVisible(topPos, containerPos)) {
var _overMentionCharPos = this.options.offsetTop * -1;
if (!this.options.fixMentionsToQuill) {
_overMentionCharPos += mentionCharPos.top;
}
topPos = _overMentionCharPos - containerHeight;
}
}
if (topPos >= 0) {
this.options.mentionContainerClass.split(' ').forEach(function (className) {
_this3.mentionContainer.classList.add("".concat(className, "-bottom"));
_this3.mentionContainer.classList.remove("".concat(className, "-top"));

@@ -1119,7 +1008,5 @@ });

_this3.mentionContainer.classList.add("".concat(className, "-top"));
_this3.mentionContainer.classList.remove("".concat(className, "-bottom"));
});
}
this.mentionContainer.style.top = "".concat(topPos, "px");

@@ -1133,3 +1020,2 @@ this.mentionContainer.style.left = "".concat(leftPos, "px");

var _this4 = this;
this.mentionContainer.style.position = "fixed";

@@ -1144,8 +1030,10 @@ this.mentionContainer.style.height = null;

height: mentionCharPos.height
}; //Which rectangle should it be relative to
};
//Which rectangle should it be relative to
var relativeToPos = this.options.fixMentionsToQuill ? containerPos : mentionCharPosAbsolute;
var topPos = this.options.offsetTop;
var leftPos = this.options.offsetLeft; // handle horizontal positioning
var leftPos = this.options.offsetLeft;
// handle horizontal positioning
if (this.options.fixMentionsToQuill) {

@@ -1155,4 +1043,5 @@ var rightPos = relativeToPos.right;

} else {
leftPos += relativeToPos.left; //if its off the righ edge, push it back
leftPos += relativeToPos.left;
//if its off the righ edge, push it back
if (leftPos + this.mentionContainer.offsetWidth > document.documentElement.clientWidth) {

@@ -1162,3 +1051,2 @@ leftPos -= leftPos + this.mentionContainer.offsetWidth - document.documentElement.clientWidth;

}
var availableSpaceTop = relativeToPos.top;

@@ -1169,3 +1057,2 @@ var availableSpaceBottom = document.documentElement.clientHeight - (relativeToPos.top + relativeToPos.height);

var placement;
if (this.options.defaultMenuOrientation === "top" && fitsTop) {

@@ -1179,6 +1066,4 @@ placement = "top";

}
if (placement === "bottom") {
topPos = relativeToPos.top + relativeToPos.height;
if (!fitsBottom) {

@@ -1189,6 +1074,4 @@ //shrink it to fit

}
this.options.mentionContainerClass.split(" ").forEach(function (className) {
_this4.mentionContainer.classList.add("".concat(className, "-bottom"));
_this4.mentionContainer.classList.remove("".concat(className, "-top"));

@@ -1198,3 +1081,2 @@ });

topPos = relativeToPos.top - this.mentionContainer.offsetHeight;
if (!fitsTop) {

@@ -1206,10 +1088,7 @@ //shrink it to fit

}
this.options.mentionContainerClass.split(" ").forEach(function (className) {
_this4.mentionContainer.classList.add("".concat(className, "-top"));
_this4.mentionContainer.classList.remove("".concat(className, "-bottom"));
});
}
this.mentionContainer.style.top = "".concat(topPos, "px");

@@ -1230,3 +1109,2 @@ this.mentionContainer.style.left = "".concat(leftPos, "px");

var _this5 = this;
var range = this.quill.getSelection();

@@ -1236,12 +1114,11 @@ if (range == null) return;

var textBeforeCursor = this.getTextBeforeCursor();
var _getMentionCharIndex = getMentionCharIndex(textBeforeCursor, this.options.mentionDenotationChars),
mentionChar = _getMentionCharIndex.mentionChar,
mentionCharIndex = _getMentionCharIndex.mentionCharIndex;
if (hasValidMentionCharIndex(mentionCharIndex, textBeforeCursor, this.options.isolateCharacter)) {
var textOffset = Math.max(0, this.cursorPos - this.options.maxChars);
var textPrefix = textOffset ? this.quill.getText(textOffset - 1, textOffset) : '';
var _getMentionCharIndex = getMentionCharIndex(textBeforeCursor, this.options.mentionDenotationChars, this.options.isolateCharacter, this.options.allowInlineMentionChar),
mentionChar = _getMentionCharIndex.mentionChar,
mentionCharIndex = _getMentionCharIndex.mentionCharIndex;
if (hasValidMentionCharIndex(mentionCharIndex, textBeforeCursor, this.options.isolateCharacter, textPrefix)) {
var mentionCharPos = this.cursorPos - (textBeforeCursor.length - mentionCharIndex);
this.mentionCharPos = mentionCharPos;
var textAfter = textBeforeCursor.substring(mentionCharIndex + mentionChar.length);
if (textAfter.length >= this.options.minChars && hasValidChars(textAfter, this.getAllowedCharsRegex(mentionChar))) {

@@ -1251,3 +1128,2 @@ if (this.existingSourceExecutionToken) {

}
this.renderLoading();

@@ -1262,5 +1138,3 @@ var sourceRequestToken = {

}
_this5.existingSourceExecutionToken = null;
_this5.renderList(mentionChar, data, searchTerm);

@@ -1272,3 +1146,2 @@ }, mentionChar);

}
this.hideMentionList();

@@ -1280,3 +1153,2 @@ }

}
this.hideMentionList();

@@ -1319,8 +1191,6 @@ }

}]);
return Mention;
}();
Quill__default["default"].register("modules/mention", Mention);
module.exports = Mention;

@@ -5,38 +5,21 @@ import Quill from 'quill';

var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) {
symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
}
keys.push.apply(keys, symbols);
enumerableOnly && (symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})), keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
var source = null != arguments[i] ? arguments[i] : {};
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
_defineProperty(target, key, source[key]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
return target;
}
function _classCallCheck(instance, Constructor) {

@@ -47,3 +30,2 @@ if (!(instance instanceof Constructor)) {

}
function _defineProperties(target, props) {

@@ -55,13 +37,15 @@ for (var i = 0; i < props.length; i++) {

if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {

@@ -77,11 +61,8 @@ Object.defineProperty(obj, key, {

}
return obj;
}
function _extends() {
_extends = Object.assign || function (target) {
_extends = Object.assign ? Object.assign.bind() : function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {

@@ -93,9 +74,6 @@ if (Object.prototype.hasOwnProperty.call(source, key)) {

}
return target;
};
return _extends.apply(this, arguments);
}
function _inherits(subClass, superClass) {

@@ -105,3 +83,2 @@ if (typeof superClass !== "function" && superClass !== null) {

}
subClass.prototype = Object.create(superClass && superClass.prototype, {

@@ -114,7 +91,9 @@ constructor: {

});
Object.defineProperty(subClass, "prototype", {
writable: false
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);

@@ -124,12 +103,9 @@ };

}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _isNativeReflectConstruct() {

@@ -139,3 +115,2 @@ if (typeof Reflect === "undefined" || !Reflect.construct) return false;

if (typeof Proxy === "function") return true;
try {

@@ -148,3 +123,2 @@ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));

}
function _assertThisInitialized(self) {

@@ -154,6 +128,4 @@ if (self === void 0) {

}
return self;
}
function _possibleConstructorReturn(self, call) {

@@ -165,16 +137,11 @@ if (call && (typeof call === "object" || typeof call === "function")) {

}
return _assertThisInitialized(self);
}
function _createSuper(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived),
result;
result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);

@@ -184,7 +151,5 @@ } else {

}
return _possibleConstructorReturn(this, result);
};
}
function _superPropBase(object, property) {

@@ -195,27 +160,20 @@ while (!Object.prototype.hasOwnProperty.call(object, property)) {

}
return object;
}
function _get() {
if (typeof Reflect !== "undefined" && Reflect.get) {
_get = Reflect.get;
_get = Reflect.get.bind();
} else {
_get = function _get(target, property, receiver) {
var base = _superPropBase(target, property);
if (!base) return;
var desc = Object.getOwnPropertyDescriptor(base, property);
if (desc.get) {
return desc.get.call(arguments.length < 3 ? target : receiver);
}
return desc.value;
};
}
return _get.apply(this, arguments);
}
function _unsupportedIterableToArray(o, minLen) {

@@ -229,14 +187,9 @@ if (!o) return;

}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _createForOfIteratorHelper(o, allowArrayLike) {
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (!it) {

@@ -246,5 +199,3 @@ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {

var i = 0;
var F = function () {};
return {

@@ -267,9 +218,7 @@ s: F,

}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
var normalCompletion = true,
didErr = false,
err;
didErr = false,
err;
return {

@@ -297,2 +246,16 @@ s: function () {

}
function _toPrimitive(input, hint) {
if (typeof input !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (typeof res !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return typeof key === "symbol" ? key : String(key);
}

@@ -318,7 +281,18 @@ var Keys = {

}
function getMentionCharIndex(text, mentionDenotationChars) {
function getMentionCharIndex(text, mentionDenotationChars, isolateChar, allowInlineMentionChar) {
return mentionDenotationChars.reduce(function (prev, mentionChar) {
var mentionCharIndex = text.lastIndexOf(mentionChar);
var mentionCharIndex;
if (isolateChar && allowInlineMentionChar) {
var regex = new RegExp("^".concat(mentionChar, "|\\s").concat(mentionChar), 'g');
var lastMatch = (text.match(regex) || []).pop();
if (!lastMatch) {
return {
mentionChar: prev.mentionChar,
mentionCharIndex: prev.mentionCharIndex
};
}
mentionCharIndex = lastMatch !== mentionChar ? text.lastIndexOf(lastMatch) + lastMatch.length - mentionChar.length : 0;
} else {
mentionCharIndex = text.lastIndexOf(mentionChar);
}
if (mentionCharIndex > prev.mentionCharIndex) {

@@ -330,3 +304,2 @@ return {

}
return {

@@ -341,37 +314,26 @@ mentionChar: prev.mentionChar,

}
function hasValidChars(text, allowedChars) {
return allowedChars.test(text);
}
function hasValidMentionCharIndex(mentionCharIndex, text, isolateChar) {
if (mentionCharIndex > -1) {
if (isolateChar && !(mentionCharIndex === 0 || !!text[mentionCharIndex - 1].match(/\s/g))) {
return false;
}
function hasValidMentionCharIndex(mentionCharIndex, text, isolateChar, textPrefix) {
if (mentionCharIndex === -1) {
return false;
}
if (!isolateChar) {
return true;
}
return false;
var mentionPrefix = mentionCharIndex ? text[mentionCharIndex - 1] : textPrefix;
return !mentionPrefix || !!mentionPrefix.match(/\s/);
}
var Embed = Quill["import"]("blots/embed");
var MentionBlot = /*#__PURE__*/function (_Embed) {
_inherits(MentionBlot, _Embed);
var _super = _createSuper(MentionBlot);
function MentionBlot(scroll, node) {
var _this;
_classCallCheck(this, MentionBlot);
_this = _super.call(this, scroll, node);
_defineProperty(_assertThisInitialized(_this), "hoverHandler", void 0);
_defineProperty(_assertThisInitialized(_this), "hoverHandler", void 0);
_this.clickHandler = null;

@@ -382,3 +344,2 @@ _this.hoverHandler = null;

}
_createClass(MentionBlot, [{

@@ -388,3 +349,2 @@ key: "attach",

_get(_getPrototypeOf(MentionBlot.prototype), "attach", this).call(this);
if (!this.mounted) {

@@ -402,5 +362,3 @@ this.mounted = true;

_get(_getPrototypeOf(MentionBlot.prototype), "detach", this).call(this);
this.mounted = false;
if (this.clickHandler) {

@@ -415,6 +373,4 @@ this.domNode.removeEventListener("click", this.clickHandler);

var _this2 = this;
return function (e) {
var event = _this2.buildEvent("mention-clicked", e);
window.dispatchEvent(event);

@@ -428,6 +384,4 @@ e.preventDefault();

var _this3 = this;
return function (e) {
var event = _this3.buildEvent('mention-hovered', e);
window.dispatchEvent(event);

@@ -452,3 +406,2 @@ e.preventDefault();

var node = _get(_getPrototypeOf(MentionBlot), "create", this).call(this);
var denotationChar = document.createElement("span");

@@ -476,6 +429,4 @@ denotationChar.className = "ql-mention-denotation-char";

}]);
return MentionBlot;
}(Embed);
MentionBlot.blotName = "mention";

@@ -489,5 +440,3 @@ MentionBlot.tagName = "span";

var _this = this;
_classCallCheck(this, Mention);
this.isOpen = false;

@@ -498,7 +447,7 @@ this.itemIndex = 0;

this.values = [];
this.suspendMouseEnter = false; //this token is an object that may contains one key "abandoned", set to
this.suspendMouseEnter = false;
//this token is an object that may contains one key "abandoned", set to
//true when the previous source call should be ignored in favor or a
//more recent execution. This token will be null unless a source call
//is in progress.
this.existingSourceExecutionToken = null;

@@ -525,2 +474,3 @@ this.quill = quill;

isolateCharacter: false,
allowInlineMentionChar: false,
fixMentionsToQuill: false,

@@ -548,8 +498,7 @@ positioningStrategy: "normal",

};
_extends(this.options, options, {
dataAttributes: Array.isArray(options.dataAttributes) ? this.options.dataAttributes.concat(options.dataAttributes) : this.options.dataAttributes
}); //Bind all option-functions so they have a reasonable context
});
//Bind all option-functions so they have a reasonable context
for (var o in this.options) {

@@ -559,5 +508,5 @@ if (typeof this.options[o] === 'function') {

}
} //create mention container
}
//create mention container
this.mentionContainer = document.createElement("div");

@@ -567,7 +516,5 @@ this.mentionContainer.className = this.options.mentionContainerClass ? this.options.mentionContainerClass : "";

this.mentionContainer.onmousemove = this.onContainerMouseMove.bind(this);
if (this.options.fixMentionsToQuill) {
this.mentionContainer.style.width = "auto";
}
this.mentionList = document.createElement("ul");

@@ -579,9 +526,9 @@ this.mentionList.id = 'quill-mention-list';

quill.on("text-change", this.onTextChange.bind(this));
quill.on("selection-change", this.onSelectionChange.bind(this)); //Pasting doesn't fire selection-change after the pasted text is
quill.on("selection-change", this.onSelectionChange.bind(this));
//Pasting doesn't fire selection-change after the pasted text is
//inserted, so here we manually trigger one
quill.container.addEventListener("paste", function () {
setTimeout(function () {
var range = quill.getSelection();
_this.onSelectionChange(range);

@@ -594,6 +541,4 @@ });

quill.keyboard.bindings[Keys.TAB].unshift(quill.keyboard.bindings[Keys.TAB].pop());
var _iterator = _createForOfIteratorHelper(this.options.selectKeys),
_step;
_step;
try {

@@ -611,3 +556,2 @@ for (_iterator.s(); !(_step = _iterator.n()).done;) {

}
quill.keyboard.bindings[Keys.ENTER].unshift(quill.keyboard.bindings[Keys.ENTER].pop());

@@ -624,3 +568,2 @@ quill.keyboard.addBinding({

}
_createClass(Mention, [{

@@ -633,3 +576,2 @@ key: "selectHandler",

}
return true;

@@ -644,7 +586,5 @@ }

}
this.hideMentionList();
return false;
}
return true;

@@ -659,3 +599,2 @@ }

}
return true;

@@ -670,3 +609,2 @@ }

}
return true;

@@ -682,3 +620,2 @@ }

}
this.mentionContainer.style.visibility = "hidden";

@@ -703,14 +640,10 @@ this.mentionContainer.style.display = "";

var scrollItemInView = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
for (var i = 0; i < this.mentionList.childNodes.length; i += 1) {
this.mentionList.childNodes[i].classList.remove("selected");
}
if (this.itemIndex === -1 || this.mentionList.childNodes[this.itemIndex].dataset.disabled === "true") {
return;
}
this.mentionList.childNodes[this.itemIndex].classList.add("selected");
this.quill.root.setAttribute('aria-activedescendant', this.mentionList.childNodes[this.itemIndex].id);
if (scrollItemInView) {

@@ -721,3 +654,2 @@ var itemHeight = this.mentionList.childNodes[this.itemIndex].offsetHeight;

var containerBottom = containerTop + this.mentionContainer.offsetHeight;
if (itemPos < containerTop) {

@@ -738,7 +670,5 @@ // Scroll up if the item is above the top of the container

var itemTarget = this.mentionList.childNodes[this.itemIndex].dataset.target;
if (hasLinkValue) {
this.mentionList.childNodes[this.itemIndex].dataset.value = "<a href=\"".concat(link, "\" target=").concat(itemTarget || this.options.linkTarget, ">").concat(this.mentionList.childNodes[this.itemIndex].dataset.value);
}
return this.mentionList.childNodes[this.itemIndex].dataset;

@@ -755,13 +685,9 @@ }

var _this2 = this;
if (this.itemIndex === -1) {
return;
}
var data = this.getItemData();
if (data.disabled) {
return;
}
this.options.onSelect(data, function (asyncData) {

@@ -779,15 +705,10 @@ var programmaticInsert = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

var render = data;
if (render === null) {
return;
}
var options = _objectSpread2(_objectSpread2({}, this.options), overriddenOptions);
if (!options.showDenotationChar) {
render.denotationChar = "";
}
var insertAtPos;
if (!programmaticInsert) {

@@ -799,8 +720,6 @@ insertAtPos = this.mentionCharPos;

}
var delta = this.quill.insertEmbed(insertAtPos, options.blotName, render, Quill.sources.USER);
if (options.spaceAfterInsert) {
this.quill.insertText(insertAtPos + 1, " ", Quill.sources.USER); // setSelection here sets cursor position
this.quill.insertText(insertAtPos + 1, " ", Quill.sources.USER);
// setSelection here sets cursor position
this.quill.setSelection(insertAtPos + 2, Quill.sources.USER);

@@ -810,3 +729,2 @@ } else {

}
this.hideMentionList();

@@ -821,5 +739,3 @@ return delta;

}
var index = Number(e.target.dataset.index);
if (!Number.isNaN(index) && index !== this.itemIndex) {

@@ -836,3 +752,2 @@ this.itemIndex = index;

}
this.itemIndex = -1;

@@ -847,3 +762,2 @@ this.highlightItem(false);

}
e.preventDefault();

@@ -865,7 +779,5 @@ e.stopImmediatePropagation();

var renderedLoading = this.options.renderLoading();
if (!renderedLoading) {
return;
}
if (this.mentionContainer.getElementsByClassName("ql-mention-loading").length > 0) {

@@ -875,3 +787,2 @@ this.showMentionList();

}
this.mentionList.innerHTML = "";

@@ -888,3 +799,2 @@ var loadingDiv = document.createElement("div");

var loadingDiv = this.mentionContainer.getElementsByClassName("ql-mention-loading");
if (loadingDiv.length > 0) {

@@ -902,3 +812,2 @@ loadingDiv[0].remove();

var initialSelection = -1;
for (var i = 0; i < data.length; i += 1) {

@@ -908,3 +817,2 @@ var li = document.createElement("li");

li.className = this.options.listItemClass ? this.options.listItemClass : "";
if (data[i].disabled) {

@@ -916,6 +824,4 @@ li.className += " disabled";

}
li.dataset.index = i;
li.innerHTML = this.options.renderItem(data[i], searchTerm);
if (!data[i].disabled) {

@@ -928,7 +834,5 @@ li.onmouseenter = this.onItemMouseEnter.bind(this);

}
li.dataset.denotationChar = mentionChar;
this.mentionList.appendChild(attachDataValues(li, data[i], this.options.dataAttributes));
}
this.itemIndex = initialSelection;

@@ -946,3 +850,2 @@ this.highlightItem();

var newIndex;
do {

@@ -952,3 +855,2 @@ increment++;

var disabled = this.mentionList.childNodes[newIndex].dataset.disabled === "true";
if (increment === this.values.length + 1) {

@@ -960,3 +862,2 @@ //we've wrapped around w/o finding an enabled item

} while (disabled);
this.itemIndex = newIndex;

@@ -971,3 +872,2 @@ this.suspendMouseEnter = true;

var newIndex;
do {

@@ -977,3 +877,2 @@ decrement++;

var disabled = this.mentionList.childNodes[newIndex].dataset.disabled === "true";
if (decrement === this.values.length + 1) {

@@ -985,3 +884,2 @@ //we've wrapped around w/o finding an enabled item

} while (disabled);
this.itemIndex = newIndex;

@@ -1003,3 +901,2 @@ this.suspendMouseEnter = true;

}
var rightPos = leftPos + this.mentionContainer.offsetWidth + containerPos.left;

@@ -1018,3 +915,2 @@ var browserWidth = window.pageXOffset + document.documentElement.clientWidth;

}
this.isOpen = isOpen;

@@ -1036,3 +932,2 @@ }

var _this3 = this;
var containerPos = this.quill.container.getBoundingClientRect();

@@ -1042,4 +937,5 @@ var mentionCharPos = this.quill.getBounds(this.mentionCharPos);

var topPos = this.options.offsetTop;
var leftPos = this.options.offsetLeft; // handle horizontal positioning
var leftPos = this.options.offsetLeft;
// handle horizontal positioning
if (this.options.fixMentionsToQuill) {

@@ -1051,3 +947,2 @@ var rightPos = 0;

}
if (this.containerRightIsNotVisible(leftPos, containerPos)) {

@@ -1057,5 +952,5 @@ var containerWidth = this.mentionContainer.offsetWidth + this.options.offsetLeft;

leftPos = quillWidth - containerWidth;
} // handle vertical positioning
}
// handle vertical positioning
if (this.options.defaultMenuOrientation === "top") {

@@ -1067,8 +962,7 @@ // Attempt to align the mention container with the top of the quill editor

topPos = mentionCharPos.top - (containerHeight + this.options.offsetTop);
} // default to bottom if the top is not visible
}
// default to bottom if the top is not visible
if (topPos + containerPos.top <= 0) {
var overMentionCharPos = this.options.offsetTop;
if (this.options.fixMentionsToQuill) {

@@ -1079,3 +973,2 @@ overMentionCharPos += containerPos.height;

}
topPos = overMentionCharPos;

@@ -1089,20 +982,16 @@ }

topPos += mentionCharPos.bottom;
} // default to the top if the bottom is not visible
}
// default to the top if the bottom is not visible
if (this.containerBottomIsNotVisible(topPos, containerPos)) {
var _overMentionCharPos = this.options.offsetTop * -1;
if (!this.options.fixMentionsToQuill) {
_overMentionCharPos += mentionCharPos.top;
}
topPos = _overMentionCharPos - containerHeight;
}
}
if (topPos >= 0) {
this.options.mentionContainerClass.split(' ').forEach(function (className) {
_this3.mentionContainer.classList.add("".concat(className, "-bottom"));
_this3.mentionContainer.classList.remove("".concat(className, "-top"));

@@ -1113,7 +1002,5 @@ });

_this3.mentionContainer.classList.add("".concat(className, "-top"));
_this3.mentionContainer.classList.remove("".concat(className, "-bottom"));
});
}
this.mentionContainer.style.top = "".concat(topPos, "px");

@@ -1127,3 +1014,2 @@ this.mentionContainer.style.left = "".concat(leftPos, "px");

var _this4 = this;
this.mentionContainer.style.position = "fixed";

@@ -1138,8 +1024,10 @@ this.mentionContainer.style.height = null;

height: mentionCharPos.height
}; //Which rectangle should it be relative to
};
//Which rectangle should it be relative to
var relativeToPos = this.options.fixMentionsToQuill ? containerPos : mentionCharPosAbsolute;
var topPos = this.options.offsetTop;
var leftPos = this.options.offsetLeft; // handle horizontal positioning
var leftPos = this.options.offsetLeft;
// handle horizontal positioning
if (this.options.fixMentionsToQuill) {

@@ -1149,4 +1037,5 @@ var rightPos = relativeToPos.right;

} else {
leftPos += relativeToPos.left; //if its off the righ edge, push it back
leftPos += relativeToPos.left;
//if its off the righ edge, push it back
if (leftPos + this.mentionContainer.offsetWidth > document.documentElement.clientWidth) {

@@ -1156,3 +1045,2 @@ leftPos -= leftPos + this.mentionContainer.offsetWidth - document.documentElement.clientWidth;

}
var availableSpaceTop = relativeToPos.top;

@@ -1163,3 +1051,2 @@ var availableSpaceBottom = document.documentElement.clientHeight - (relativeToPos.top + relativeToPos.height);

var placement;
if (this.options.defaultMenuOrientation === "top" && fitsTop) {

@@ -1173,6 +1060,4 @@ placement = "top";

}
if (placement === "bottom") {
topPos = relativeToPos.top + relativeToPos.height;
if (!fitsBottom) {

@@ -1183,6 +1068,4 @@ //shrink it to fit

}
this.options.mentionContainerClass.split(" ").forEach(function (className) {
_this4.mentionContainer.classList.add("".concat(className, "-bottom"));
_this4.mentionContainer.classList.remove("".concat(className, "-top"));

@@ -1192,3 +1075,2 @@ });

topPos = relativeToPos.top - this.mentionContainer.offsetHeight;
if (!fitsTop) {

@@ -1200,10 +1082,7 @@ //shrink it to fit

}
this.options.mentionContainerClass.split(" ").forEach(function (className) {
_this4.mentionContainer.classList.add("".concat(className, "-top"));
_this4.mentionContainer.classList.remove("".concat(className, "-bottom"));
});
}
this.mentionContainer.style.top = "".concat(topPos, "px");

@@ -1224,3 +1103,2 @@ this.mentionContainer.style.left = "".concat(leftPos, "px");

var _this5 = this;
var range = this.quill.getSelection();

@@ -1230,12 +1108,11 @@ if (range == null) return;

var textBeforeCursor = this.getTextBeforeCursor();
var _getMentionCharIndex = getMentionCharIndex(textBeforeCursor, this.options.mentionDenotationChars),
mentionChar = _getMentionCharIndex.mentionChar,
mentionCharIndex = _getMentionCharIndex.mentionCharIndex;
if (hasValidMentionCharIndex(mentionCharIndex, textBeforeCursor, this.options.isolateCharacter)) {
var textOffset = Math.max(0, this.cursorPos - this.options.maxChars);
var textPrefix = textOffset ? this.quill.getText(textOffset - 1, textOffset) : '';
var _getMentionCharIndex = getMentionCharIndex(textBeforeCursor, this.options.mentionDenotationChars, this.options.isolateCharacter, this.options.allowInlineMentionChar),
mentionChar = _getMentionCharIndex.mentionChar,
mentionCharIndex = _getMentionCharIndex.mentionCharIndex;
if (hasValidMentionCharIndex(mentionCharIndex, textBeforeCursor, this.options.isolateCharacter, textPrefix)) {
var mentionCharPos = this.cursorPos - (textBeforeCursor.length - mentionCharIndex);
this.mentionCharPos = mentionCharPos;
var textAfter = textBeforeCursor.substring(mentionCharIndex + mentionChar.length);
if (textAfter.length >= this.options.minChars && hasValidChars(textAfter, this.getAllowedCharsRegex(mentionChar))) {

@@ -1245,3 +1122,2 @@ if (this.existingSourceExecutionToken) {

}
this.renderLoading();

@@ -1256,5 +1132,3 @@ var sourceRequestToken = {

}
_this5.existingSourceExecutionToken = null;
_this5.renderList(mentionChar, data, searchTerm);

@@ -1266,3 +1140,2 @@ }, mentionChar);

}
this.hideMentionList();

@@ -1274,3 +1147,2 @@ }

}
this.hideMentionList();

@@ -1313,8 +1185,6 @@ }

}]);
return Mention;
}();
Quill.register("modules/mention", Mention);
export { Mention as default };

@@ -1,1 +0,1 @@

var quillMention=function(t){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=e(t);function i(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function o(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?i(Object(n),!0).forEach((function(e){l(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function a(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}function l(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function h(){return h=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},h.apply(this,arguments)}function u(t){return u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},u(t)}function c(t,e){return c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},c(t,e)}function d(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function f(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return d(t)}function m(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=u(t);if(e){var o=u(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return f(this,n)}}function p(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=u(t)););return t}function v(){return v="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var i=p(t,e);if(i){var o=Object.getOwnPropertyDescriptor(i,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},v.apply(this,arguments)}function g(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function y(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return g(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,o=function(){};return{s:o,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,r=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return r=t.done,t},e:function(t){a=!0,s=t},f:function(){try{r||null==n.return||n.return()}finally{if(a)throw s}}}}var b=9,C=13,x=27,k=38,I=40;function L(t,e,n){var i=t;return Object.keys(e).forEach((function(t){n.indexOf(t)>-1?i.dataset[t]=e[t]:delete i.dataset[t]})),i}var E=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&c(t,e)}(n,t);var e=m(n);function n(t,i){var o;return s(this,n),l(d(o=e.call(this,t,i)),"hoverHandler",void 0),l(d(o),"hoverHandler",void 0),o.clickHandler=null,o.hoverHandler=null,o.mounted=!1,o}return a(n,[{key:"attach",value:function(){v(u(n.prototype),"attach",this).call(this),this.mounted||(this.mounted=!0,this.clickHandler=this.getClickHandler(),this.hoverHandler=this.getHoverHandler(),this.domNode.addEventListener("click",this.clickHandler,!1),this.domNode.addEventListener("mouseenter",this.hoverHandler,!1))}},{key:"detach",value:function(){v(u(n.prototype),"detach",this).call(this),this.mounted=!1,this.clickHandler&&(this.domNode.removeEventListener("click",this.clickHandler),this.clickHandler=null)}},{key:"getClickHandler",value:function(){var t=this;return function(e){var n=t.buildEvent("mention-clicked",e);window.dispatchEvent(n),e.preventDefault()}}},{key:"getHoverHandler",value:function(){var t=this;return function(e){var n=t.buildEvent("mention-hovered",e);window.dispatchEvent(n),e.preventDefault()}}},{key:"buildEvent",value:function(t,e){var n=new Event(t,{bubbles:!0,cancelable:!0});return n.value=h({},this.domNode.dataset),n.event=e,n}}],[{key:"create",value:function(t){var e=v(u(n),"create",this).call(this),i=document.createElement("span");return i.className="ql-mention-denotation-char",i.innerHTML=t.denotationChar,e.appendChild(i),e.innerHTML+=t.value,n.setDataValues(e,t)}},{key:"setDataValues",value:function(t,e){var n=t;return Object.keys(e).forEach((function(t){n.dataset[t]=e[t]})),n}},{key:"value",value:function(t){return t.dataset}}]),n}(n.default.import("blots/embed"));E.blotName="mention",E.tagName="span",E.className="mention",n.default.register(E);var O=function(){function t(e,n){var i=this;for(var o in s(this,t),this.isOpen=!1,this.itemIndex=0,this.mentionCharPos=null,this.cursorPos=null,this.values=[],this.suspendMouseEnter=!1,this.existingSourceExecutionToken=null,this.quill=e,this.options={source:null,renderItem:function(t){return"".concat(t.value)},renderLoading:function(){return null},onSelect:function(t,e){e(t)},mentionDenotationChars:["@"],showDenotationChar:!0,allowedChars:/^[a-zA-Z0-9_]*$/,minChars:0,maxChars:31,offsetTop:2,offsetLeft:0,isolateCharacter:!1,fixMentionsToQuill:!1,positioningStrategy:"normal",defaultMenuOrientation:"bottom",blotName:"mention",dataAttributes:["id","value","denotationChar","link","target","disabled"],linkTarget:"_blank",onOpen:function(){return!0},onBeforeClose:function(){return!0},onClose:function(){return!0},listItemClass:"ql-mention-list-item",mentionContainerClass:"ql-mention-list-container",mentionListClass:"ql-mention-list",spaceAfterInsert:!0,selectKeys:[C]},h(this.options,n,{dataAttributes:Array.isArray(n.dataAttributes)?this.options.dataAttributes.concat(n.dataAttributes):this.options.dataAttributes}),this.options)"function"==typeof this.options[o]&&(this.options[o]=this.options[o].bind(this));this.mentionContainer=document.createElement("div"),this.mentionContainer.className=this.options.mentionContainerClass?this.options.mentionContainerClass:"",this.mentionContainer.style.cssText="display: none; position: absolute;",this.mentionContainer.onmousemove=this.onContainerMouseMove.bind(this),this.options.fixMentionsToQuill&&(this.mentionContainer.style.width="auto"),this.mentionList=document.createElement("ul"),this.mentionList.id="quill-mention-list",e.root.setAttribute("aria-owns","quill-mention-list"),this.mentionList.className=this.options.mentionListClass?this.options.mentionListClass:"",this.mentionContainer.appendChild(this.mentionList),e.on("text-change",this.onTextChange.bind(this)),e.on("selection-change",this.onSelectionChange.bind(this)),e.container.addEventListener("paste",(function(){setTimeout((function(){var t=e.getSelection();i.onSelectionChange(t)}))})),e.keyboard.addBinding({key:b},this.selectHandler.bind(this)),e.keyboard.bindings[b].unshift(e.keyboard.bindings[b].pop());var r,a=y(this.options.selectKeys);try{for(a.s();!(r=a.n()).done;){var l=r.value;e.keyboard.addBinding({key:l},this.selectHandler.bind(this))}}catch(t){a.e(t)}finally{a.f()}e.keyboard.bindings[C].unshift(e.keyboard.bindings[C].pop()),e.keyboard.addBinding({key:x},this.escapeHandler.bind(this)),e.keyboard.addBinding({key:k},this.upHandler.bind(this)),e.keyboard.addBinding({key:I},this.downHandler.bind(this))}return a(t,[{key:"selectHandler",value:function(){return!(this.isOpen&&!this.existingSourceExecutionToken)||(this.selectItem(),!1)}},{key:"escapeHandler",value:function(){return!this.isOpen||(this.existingSourceExecutionToken&&(this.existingSourceExecutionToken.abandoned=!0),this.hideMentionList(),!1)}},{key:"upHandler",value:function(){return!(this.isOpen&&!this.existingSourceExecutionToken)||(this.prevItem(),!1)}},{key:"downHandler",value:function(){return!(this.isOpen&&!this.existingSourceExecutionToken)||(this.nextItem(),!1)}},{key:"showMentionList",value:function(){"fixed"===this.options.positioningStrategy?document.body.appendChild(this.mentionContainer):this.quill.container.appendChild(this.mentionContainer),this.mentionContainer.style.visibility="hidden",this.mentionContainer.style.display="",this.mentionContainer.scrollTop=0,this.setMentionContainerPosition(),this.setIsOpen(!0)}},{key:"hideMentionList",value:function(){this.options.onBeforeClose(),this.mentionContainer.style.display="none",this.mentionContainer.remove(),this.setIsOpen(!1),this.quill.root.removeAttribute("aria-activedescendant")}},{key:"highlightItem",value:function(){for(var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=0;e<this.mentionList.childNodes.length;e+=1)this.mentionList.childNodes[e].classList.remove("selected");if(-1!==this.itemIndex&&"true"!==this.mentionList.childNodes[this.itemIndex].dataset.disabled&&(this.mentionList.childNodes[this.itemIndex].classList.add("selected"),this.quill.root.setAttribute("aria-activedescendant",this.mentionList.childNodes[this.itemIndex].id),t)){var n=this.mentionList.childNodes[this.itemIndex].offsetHeight,i=this.mentionList.childNodes[this.itemIndex].offsetTop,o=this.mentionContainer.scrollTop,s=o+this.mentionContainer.offsetHeight;i<o?this.mentionContainer.scrollTop=i:i>s-n&&(this.mentionContainer.scrollTop+=i-s+n)}}},{key:"getItemData",value:function(){var t=this.mentionList.childNodes[this.itemIndex].dataset.link,e=void 0!==t,n=this.mentionList.childNodes[this.itemIndex].dataset.target;return e&&(this.mentionList.childNodes[this.itemIndex].dataset.value='<a href="'.concat(t,'" target=').concat(n||this.options.linkTarget,">").concat(this.mentionList.childNodes[this.itemIndex].dataset.value)),this.mentionList.childNodes[this.itemIndex].dataset}},{key:"onContainerMouseMove",value:function(){this.suspendMouseEnter=!1}},{key:"selectItem",value:function(){var t=this;if(-1!==this.itemIndex){var e=this.getItemData();e.disabled||(this.options.onSelect(e,(function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.insertItem(e,n,i)})),this.hideMentionList())}}},{key:"insertItem",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=t;if(null!==s){var r,a=o(o({},this.options),i);a.showDenotationChar||(s.denotationChar=""),e?r=this.cursorPos:(r=this.mentionCharPos,this.quill.deleteText(this.mentionCharPos,this.cursorPos-this.mentionCharPos,n.default.sources.USER));var l=this.quill.insertEmbed(r,a.blotName,s,n.default.sources.USER);return a.spaceAfterInsert?(this.quill.insertText(r+1," ",n.default.sources.USER),this.quill.setSelection(r+2,n.default.sources.USER)):this.quill.setSelection(r+1,n.default.sources.USER),this.hideMentionList(),l}}},{key:"onItemMouseEnter",value:function(t){if(!this.suspendMouseEnter){var e=Number(t.target.dataset.index);Number.isNaN(e)||e===this.itemIndex||(this.itemIndex=e,this.highlightItem(!1))}}},{key:"onDisabledItemMouseEnter",value:function(t){this.suspendMouseEnter||(this.itemIndex=-1,this.highlightItem(!1))}},{key:"onItemClick",value:function(t){0===t.button&&(t.preventDefault(),t.stopImmediatePropagation(),this.itemIndex=t.currentTarget.dataset.index,this.highlightItem(),this.selectItem())}},{key:"onItemMouseDown",value:function(t){t.preventDefault(),t.stopImmediatePropagation()}},{key:"renderLoading",value:function(){if(this.options.renderLoading())if(this.mentionContainer.getElementsByClassName("ql-mention-loading").length>0)this.showMentionList();else{this.mentionList.innerHTML="";var t=document.createElement("div");t.className="ql-mention-loading",t.innerHTML=this.options.renderLoading(),this.mentionContainer.append(t),this.showMentionList()}}},{key:"removeLoading",value:function(){var t=this.mentionContainer.getElementsByClassName("ql-mention-loading");t.length>0&&t[0].remove()}},{key:"renderList",value:function(t,e,n){if(e&&e.length>0){this.removeLoading(),this.values=e,this.mentionList.innerHTML="";for(var i=-1,o=0;o<e.length;o+=1){var s=document.createElement("li");s.id="quill-mention-item-"+o,s.className=this.options.listItemClass?this.options.listItemClass:"",e[o].disabled?(s.className+=" disabled",s.setAttribute("aria-hidden","true")):-1===i&&(i=o),s.dataset.index=o,s.innerHTML=this.options.renderItem(e[o],n),e[o].disabled?s.onmouseenter=this.onDisabledItemMouseEnter.bind(this):(s.onmouseenter=this.onItemMouseEnter.bind(this),s.onmouseup=this.onItemClick.bind(this),s.onmousedown=this.onItemMouseDown.bind(this)),s.dataset.denotationChar=t,this.mentionList.appendChild(L(s,e[o],this.options.dataAttributes))}this.itemIndex=i,this.highlightItem(),this.showMentionList()}else this.hideMentionList()}},{key:"nextItem",value:function(){var t,e=0;do{e++,t=(this.itemIndex+e)%this.values.length;var n="true"===this.mentionList.childNodes[t].dataset.disabled;if(e===this.values.length+1){t=-1;break}}while(n);this.itemIndex=t,this.suspendMouseEnter=!0,this.highlightItem()}},{key:"prevItem",value:function(){var t,e=0;do{e++,t=(this.itemIndex+this.values.length-e)%this.values.length;var n="true"===this.mentionList.childNodes[t].dataset.disabled;if(e===this.values.length+1){t=-1;break}}while(n);this.itemIndex=t,this.suspendMouseEnter=!0,this.highlightItem()}},{key:"containerBottomIsNotVisible",value:function(t,e){return t+this.mentionContainer.offsetHeight+e.top>window.pageYOffset+window.innerHeight}},{key:"containerRightIsNotVisible",value:function(t,e){return!this.options.fixMentionsToQuill&&t+this.mentionContainer.offsetWidth+e.left>window.pageXOffset+document.documentElement.clientWidth}},{key:"setIsOpen",value:function(t){this.isOpen!==t&&(t?this.options.onOpen():this.options.onClose(),this.isOpen=t)}},{key:"setMentionContainerPosition",value:function(){"fixed"===this.options.positioningStrategy?this.setMentionContainerPosition_Fixed():this.setMentionContainerPosition_Normal()}},{key:"setMentionContainerPosition_Normal",value:function(){var t=this,e=this.quill.container.getBoundingClientRect(),n=this.quill.getBounds(this.mentionCharPos),i=this.mentionContainer.offsetHeight,o=this.options.offsetTop,s=this.options.offsetLeft;if(this.options.fixMentionsToQuill){this.mentionContainer.style.right="".concat(0,"px")}else s+=n.left;if(this.containerRightIsNotVisible(s,e)){var r=this.mentionContainer.offsetWidth+this.options.offsetLeft;s=e.width-r}if("top"===this.options.defaultMenuOrientation){if((o=this.options.fixMentionsToQuill?-1*(i+this.options.offsetTop):n.top-(i+this.options.offsetTop))+e.top<=0){var a=this.options.offsetTop;this.options.fixMentionsToQuill?a+=e.height:a+=n.bottom,o=a}}else if(this.options.fixMentionsToQuill?o+=e.height:o+=n.bottom,this.containerBottomIsNotVisible(o,e)){var l=-1*this.options.offsetTop;this.options.fixMentionsToQuill||(l+=n.top),o=l-i}o>=0?this.options.mentionContainerClass.split(" ").forEach((function(e){t.mentionContainer.classList.add("".concat(e,"-bottom")),t.mentionContainer.classList.remove("".concat(e,"-top"))})):this.options.mentionContainerClass.split(" ").forEach((function(e){t.mentionContainer.classList.add("".concat(e,"-top")),t.mentionContainer.classList.remove("".concat(e,"-bottom"))})),this.mentionContainer.style.top="".concat(o,"px"),this.mentionContainer.style.left="".concat(s,"px"),this.mentionContainer.style.visibility="visible"}},{key:"setMentionContainerPosition_Fixed",value:function(){var t=this;this.mentionContainer.style.position="fixed",this.mentionContainer.style.height=null;var e=this.quill.container.getBoundingClientRect(),n=this.quill.getBounds(this.mentionCharPos),i={left:e.left+n.left,top:e.top+n.top,width:0,height:n.height},o=this.options.fixMentionsToQuill?e:i,s=this.options.offsetTop,r=this.options.offsetLeft;if(this.options.fixMentionsToQuill){var a=o.right;this.mentionContainer.style.right="".concat(a,"px")}else(r+=o.left)+this.mentionContainer.offsetWidth>document.documentElement.clientWidth&&(r-=r+this.mentionContainer.offsetWidth-document.documentElement.clientWidth);var l=o.top,h=document.documentElement.clientHeight-(o.top+o.height),u=this.mentionContainer.offsetHeight<=h,c=this.mentionContainer.offsetHeight<=l;"bottom"===("top"===this.options.defaultMenuOrientation&&c?"top":"bottom"===this.options.defaultMenuOrientation&&u||h>l?"bottom":"top")?(s=o.top+o.height,u||(this.mentionContainer.style.height=h-3+"px"),this.options.mentionContainerClass.split(" ").forEach((function(e){t.mentionContainer.classList.add("".concat(e,"-bottom")),t.mentionContainer.classList.remove("".concat(e,"-top"))}))):(s=o.top-this.mentionContainer.offsetHeight,c||(this.mentionContainer.style.height=l-3+"px",s=3),this.options.mentionContainerClass.split(" ").forEach((function(e){t.mentionContainer.classList.add("".concat(e,"-top")),t.mentionContainer.classList.remove("".concat(e,"-bottom"))}))),this.mentionContainer.style.top="".concat(s,"px"),this.mentionContainer.style.left="".concat(r,"px"),this.mentionContainer.style.visibility="visible"}},{key:"getTextBeforeCursor",value:function(){var t=Math.max(0,this.cursorPos-this.options.maxChars);return this.quill.getText(t,this.cursorPos-t)}},{key:"onSomethingChange",value:function(){var t=this,e=this.quill.getSelection();if(null!=e){this.cursorPos=e.index;var n,i=this.getTextBeforeCursor(),o=(n=i,this.options.mentionDenotationChars.reduce((function(t,e){var i=n.lastIndexOf(e);return i>t.mentionCharIndex?{mentionChar:e,mentionCharIndex:i}:{mentionChar:t.mentionChar,mentionCharIndex:t.mentionCharIndex}}),{mentionChar:null,mentionCharIndex:-1})),s=o.mentionChar,r=o.mentionCharIndex;if(function(t,e,n){return t>-1&&!(n&&0!==t&&!e[t-1].match(/\s/g))}(r,i,this.options.isolateCharacter)){var a=this.cursorPos-(i.length-r);this.mentionCharPos=a;var l=i.substring(r+s.length);if(l.length>=this.options.minChars&&function(t,e){return e.test(t)}(l,this.getAllowedCharsRegex(s))){this.existingSourceExecutionToken&&(this.existingSourceExecutionToken.abandoned=!0),this.renderLoading();var h={abandoned:!1};this.existingSourceExecutionToken=h,this.options.source(l,(function(e,n){h.abandoned||(t.existingSourceExecutionToken=null,t.renderList(s,e,n))}),s)}else this.existingSourceExecutionToken&&(this.existingSourceExecutionToken.abandoned=!0),this.hideMentionList()}else this.existingSourceExecutionToken&&(this.existingSourceExecutionToken.abandoned=!0),this.hideMentionList()}}},{key:"getAllowedCharsRegex",value:function(t){return this.options.allowedChars instanceof RegExp?this.options.allowedChars:this.options.allowedChars(t)}},{key:"onTextChange",value:function(t,e,n){"user"===n&&this.onSomethingChange()}},{key:"onSelectionChange",value:function(t){t&&0===t.length?this.onSomethingChange():this.hideMentionList()}},{key:"openMenu",value:function(t){var e=this.quill.getSelection(!0);this.quill.insertText(e.index,t),this.quill.blur(),this.quill.focus()}}]),t}();return n.default.register("modules/mention",O),O}(Quill);
var quillMention=function(t){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=e(t);function i(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function o(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?i(Object(n),!0).forEach((function(e){l(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,g(i.key),i)}}function a(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function l(t,e,n){return(e=g(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function h(){return h=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},h.apply(this,arguments)}function u(t){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},u(t)}function c(t,e){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},c(t,e)}function d(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function f(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=u(t);if(e){var o=u(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return d(t)}(this,n)}}function m(){return m="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var i=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=u(t)););return t}(t,e);if(i){var o=Object.getOwnPropertyDescriptor(i,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},m.apply(this,arguments)}function p(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function v(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return p(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,o=function(){};return{s:o,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,r=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return r=t.done,t},e:function(t){a=!0,s=t},f:function(){try{r||null==n.return||n.return()}finally{if(a)throw s}}}}function g(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}var y=9,b=13,C=27,x=38,k=40;function I(t,e,n){var i=t;return Object.keys(e).forEach((function(t){n.indexOf(t)>-1?i.dataset[t]=e[t]:delete i.dataset[t]})),i}var L=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&c(t,e)}(n,t);var e=f(n);function n(t,i){var o;return s(this,n),l(d(o=e.call(this,t,i)),"hoverHandler",void 0),l(d(o),"hoverHandler",void 0),o.clickHandler=null,o.hoverHandler=null,o.mounted=!1,o}return a(n,[{key:"attach",value:function(){m(u(n.prototype),"attach",this).call(this),this.mounted||(this.mounted=!0,this.clickHandler=this.getClickHandler(),this.hoverHandler=this.getHoverHandler(),this.domNode.addEventListener("click",this.clickHandler,!1),this.domNode.addEventListener("mouseenter",this.hoverHandler,!1))}},{key:"detach",value:function(){m(u(n.prototype),"detach",this).call(this),this.mounted=!1,this.clickHandler&&(this.domNode.removeEventListener("click",this.clickHandler),this.clickHandler=null)}},{key:"getClickHandler",value:function(){var t=this;return function(e){var n=t.buildEvent("mention-clicked",e);window.dispatchEvent(n),e.preventDefault()}}},{key:"getHoverHandler",value:function(){var t=this;return function(e){var n=t.buildEvent("mention-hovered",e);window.dispatchEvent(n),e.preventDefault()}}},{key:"buildEvent",value:function(t,e){var n=new Event(t,{bubbles:!0,cancelable:!0});return n.value=h({},this.domNode.dataset),n.event=e,n}}],[{key:"create",value:function(t){var e=m(u(n),"create",this).call(this),i=document.createElement("span");return i.className="ql-mention-denotation-char",i.innerHTML=t.denotationChar,e.appendChild(i),e.innerHTML+=t.value,n.setDataValues(e,t)}},{key:"setDataValues",value:function(t,e){var n=t;return Object.keys(e).forEach((function(t){n.dataset[t]=e[t]})),n}},{key:"value",value:function(t){return t.dataset}}]),n}(n.default.import("blots/embed"));L.blotName="mention",L.tagName="span",L.className="mention",n.default.register(L);var E=function(){function t(e,n){var i=this;for(var o in s(this,t),this.isOpen=!1,this.itemIndex=0,this.mentionCharPos=null,this.cursorPos=null,this.values=[],this.suspendMouseEnter=!1,this.existingSourceExecutionToken=null,this.quill=e,this.options={source:null,renderItem:function(t){return"".concat(t.value)},renderLoading:function(){return null},onSelect:function(t,e){e(t)},mentionDenotationChars:["@"],showDenotationChar:!0,allowedChars:/^[a-zA-Z0-9_]*$/,minChars:0,maxChars:31,offsetTop:2,offsetLeft:0,isolateCharacter:!1,allowInlineMentionChar:!1,fixMentionsToQuill:!1,positioningStrategy:"normal",defaultMenuOrientation:"bottom",blotName:"mention",dataAttributes:["id","value","denotationChar","link","target","disabled"],linkTarget:"_blank",onOpen:function(){return!0},onBeforeClose:function(){return!0},onClose:function(){return!0},listItemClass:"ql-mention-list-item",mentionContainerClass:"ql-mention-list-container",mentionListClass:"ql-mention-list",spaceAfterInsert:!0,selectKeys:[b]},h(this.options,n,{dataAttributes:Array.isArray(n.dataAttributes)?this.options.dataAttributes.concat(n.dataAttributes):this.options.dataAttributes}),this.options)"function"==typeof this.options[o]&&(this.options[o]=this.options[o].bind(this));this.mentionContainer=document.createElement("div"),this.mentionContainer.className=this.options.mentionContainerClass?this.options.mentionContainerClass:"",this.mentionContainer.style.cssText="display: none; position: absolute;",this.mentionContainer.onmousemove=this.onContainerMouseMove.bind(this),this.options.fixMentionsToQuill&&(this.mentionContainer.style.width="auto"),this.mentionList=document.createElement("ul"),this.mentionList.id="quill-mention-list",e.root.setAttribute("aria-owns","quill-mention-list"),this.mentionList.className=this.options.mentionListClass?this.options.mentionListClass:"",this.mentionContainer.appendChild(this.mentionList),e.on("text-change",this.onTextChange.bind(this)),e.on("selection-change",this.onSelectionChange.bind(this)),e.container.addEventListener("paste",(function(){setTimeout((function(){var t=e.getSelection();i.onSelectionChange(t)}))})),e.keyboard.addBinding({key:y},this.selectHandler.bind(this)),e.keyboard.bindings[y].unshift(e.keyboard.bindings[y].pop());var r,a=v(this.options.selectKeys);try{for(a.s();!(r=a.n()).done;){var l=r.value;e.keyboard.addBinding({key:l},this.selectHandler.bind(this))}}catch(t){a.e(t)}finally{a.f()}e.keyboard.bindings[b].unshift(e.keyboard.bindings[b].pop()),e.keyboard.addBinding({key:C},this.escapeHandler.bind(this)),e.keyboard.addBinding({key:x},this.upHandler.bind(this)),e.keyboard.addBinding({key:k},this.downHandler.bind(this))}return a(t,[{key:"selectHandler",value:function(){return!(this.isOpen&&!this.existingSourceExecutionToken)||(this.selectItem(),!1)}},{key:"escapeHandler",value:function(){return!this.isOpen||(this.existingSourceExecutionToken&&(this.existingSourceExecutionToken.abandoned=!0),this.hideMentionList(),!1)}},{key:"upHandler",value:function(){return!(this.isOpen&&!this.existingSourceExecutionToken)||(this.prevItem(),!1)}},{key:"downHandler",value:function(){return!(this.isOpen&&!this.existingSourceExecutionToken)||(this.nextItem(),!1)}},{key:"showMentionList",value:function(){"fixed"===this.options.positioningStrategy?document.body.appendChild(this.mentionContainer):this.quill.container.appendChild(this.mentionContainer),this.mentionContainer.style.visibility="hidden",this.mentionContainer.style.display="",this.mentionContainer.scrollTop=0,this.setMentionContainerPosition(),this.setIsOpen(!0)}},{key:"hideMentionList",value:function(){this.options.onBeforeClose(),this.mentionContainer.style.display="none",this.mentionContainer.remove(),this.setIsOpen(!1),this.quill.root.removeAttribute("aria-activedescendant")}},{key:"highlightItem",value:function(){for(var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=0;e<this.mentionList.childNodes.length;e+=1)this.mentionList.childNodes[e].classList.remove("selected");if(-1!==this.itemIndex&&"true"!==this.mentionList.childNodes[this.itemIndex].dataset.disabled&&(this.mentionList.childNodes[this.itemIndex].classList.add("selected"),this.quill.root.setAttribute("aria-activedescendant",this.mentionList.childNodes[this.itemIndex].id),t)){var n=this.mentionList.childNodes[this.itemIndex].offsetHeight,i=this.mentionList.childNodes[this.itemIndex].offsetTop,o=this.mentionContainer.scrollTop,s=o+this.mentionContainer.offsetHeight;i<o?this.mentionContainer.scrollTop=i:i>s-n&&(this.mentionContainer.scrollTop+=i-s+n)}}},{key:"getItemData",value:function(){var t=this.mentionList.childNodes[this.itemIndex].dataset.link,e=void 0!==t,n=this.mentionList.childNodes[this.itemIndex].dataset.target;return e&&(this.mentionList.childNodes[this.itemIndex].dataset.value='<a href="'.concat(t,'" target=').concat(n||this.options.linkTarget,">").concat(this.mentionList.childNodes[this.itemIndex].dataset.value)),this.mentionList.childNodes[this.itemIndex].dataset}},{key:"onContainerMouseMove",value:function(){this.suspendMouseEnter=!1}},{key:"selectItem",value:function(){var t=this;if(-1!==this.itemIndex){var e=this.getItemData();e.disabled||(this.options.onSelect(e,(function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.insertItem(e,n,i)})),this.hideMentionList())}}},{key:"insertItem",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=t;if(null!==s){var r,a=o(o({},this.options),i);a.showDenotationChar||(s.denotationChar=""),e?r=this.cursorPos:(r=this.mentionCharPos,this.quill.deleteText(this.mentionCharPos,this.cursorPos-this.mentionCharPos,n.default.sources.USER));var l=this.quill.insertEmbed(r,a.blotName,s,n.default.sources.USER);return a.spaceAfterInsert?(this.quill.insertText(r+1," ",n.default.sources.USER),this.quill.setSelection(r+2,n.default.sources.USER)):this.quill.setSelection(r+1,n.default.sources.USER),this.hideMentionList(),l}}},{key:"onItemMouseEnter",value:function(t){if(!this.suspendMouseEnter){var e=Number(t.target.dataset.index);Number.isNaN(e)||e===this.itemIndex||(this.itemIndex=e,this.highlightItem(!1))}}},{key:"onDisabledItemMouseEnter",value:function(t){this.suspendMouseEnter||(this.itemIndex=-1,this.highlightItem(!1))}},{key:"onItemClick",value:function(t){0===t.button&&(t.preventDefault(),t.stopImmediatePropagation(),this.itemIndex=t.currentTarget.dataset.index,this.highlightItem(),this.selectItem())}},{key:"onItemMouseDown",value:function(t){t.preventDefault(),t.stopImmediatePropagation()}},{key:"renderLoading",value:function(){if(this.options.renderLoading())if(this.mentionContainer.getElementsByClassName("ql-mention-loading").length>0)this.showMentionList();else{this.mentionList.innerHTML="";var t=document.createElement("div");t.className="ql-mention-loading",t.innerHTML=this.options.renderLoading(),this.mentionContainer.append(t),this.showMentionList()}}},{key:"removeLoading",value:function(){var t=this.mentionContainer.getElementsByClassName("ql-mention-loading");t.length>0&&t[0].remove()}},{key:"renderList",value:function(t,e,n){if(e&&e.length>0){this.removeLoading(),this.values=e,this.mentionList.innerHTML="";for(var i=-1,o=0;o<e.length;o+=1){var s=document.createElement("li");s.id="quill-mention-item-"+o,s.className=this.options.listItemClass?this.options.listItemClass:"",e[o].disabled?(s.className+=" disabled",s.setAttribute("aria-hidden","true")):-1===i&&(i=o),s.dataset.index=o,s.innerHTML=this.options.renderItem(e[o],n),e[o].disabled?s.onmouseenter=this.onDisabledItemMouseEnter.bind(this):(s.onmouseenter=this.onItemMouseEnter.bind(this),s.onmouseup=this.onItemClick.bind(this),s.onmousedown=this.onItemMouseDown.bind(this)),s.dataset.denotationChar=t,this.mentionList.appendChild(I(s,e[o],this.options.dataAttributes))}this.itemIndex=i,this.highlightItem(),this.showMentionList()}else this.hideMentionList()}},{key:"nextItem",value:function(){var t,e=0;do{e++,t=(this.itemIndex+e)%this.values.length;var n="true"===this.mentionList.childNodes[t].dataset.disabled;if(e===this.values.length+1){t=-1;break}}while(n);this.itemIndex=t,this.suspendMouseEnter=!0,this.highlightItem()}},{key:"prevItem",value:function(){var t,e=0;do{e++,t=(this.itemIndex+this.values.length-e)%this.values.length;var n="true"===this.mentionList.childNodes[t].dataset.disabled;if(e===this.values.length+1){t=-1;break}}while(n);this.itemIndex=t,this.suspendMouseEnter=!0,this.highlightItem()}},{key:"containerBottomIsNotVisible",value:function(t,e){return t+this.mentionContainer.offsetHeight+e.top>window.pageYOffset+window.innerHeight}},{key:"containerRightIsNotVisible",value:function(t,e){return!this.options.fixMentionsToQuill&&t+this.mentionContainer.offsetWidth+e.left>window.pageXOffset+document.documentElement.clientWidth}},{key:"setIsOpen",value:function(t){this.isOpen!==t&&(t?this.options.onOpen():this.options.onClose(),this.isOpen=t)}},{key:"setMentionContainerPosition",value:function(){"fixed"===this.options.positioningStrategy?this.setMentionContainerPosition_Fixed():this.setMentionContainerPosition_Normal()}},{key:"setMentionContainerPosition_Normal",value:function(){var t=this,e=this.quill.container.getBoundingClientRect(),n=this.quill.getBounds(this.mentionCharPos),i=this.mentionContainer.offsetHeight,o=this.options.offsetTop,s=this.options.offsetLeft;if(this.options.fixMentionsToQuill){this.mentionContainer.style.right="".concat(0,"px")}else s+=n.left;if(this.containerRightIsNotVisible(s,e)){var r=this.mentionContainer.offsetWidth+this.options.offsetLeft;s=e.width-r}if("top"===this.options.defaultMenuOrientation){if((o=this.options.fixMentionsToQuill?-1*(i+this.options.offsetTop):n.top-(i+this.options.offsetTop))+e.top<=0){var a=this.options.offsetTop;this.options.fixMentionsToQuill?a+=e.height:a+=n.bottom,o=a}}else if(this.options.fixMentionsToQuill?o+=e.height:o+=n.bottom,this.containerBottomIsNotVisible(o,e)){var l=-1*this.options.offsetTop;this.options.fixMentionsToQuill||(l+=n.top),o=l-i}o>=0?this.options.mentionContainerClass.split(" ").forEach((function(e){t.mentionContainer.classList.add("".concat(e,"-bottom")),t.mentionContainer.classList.remove("".concat(e,"-top"))})):this.options.mentionContainerClass.split(" ").forEach((function(e){t.mentionContainer.classList.add("".concat(e,"-top")),t.mentionContainer.classList.remove("".concat(e,"-bottom"))})),this.mentionContainer.style.top="".concat(o,"px"),this.mentionContainer.style.left="".concat(s,"px"),this.mentionContainer.style.visibility="visible"}},{key:"setMentionContainerPosition_Fixed",value:function(){var t=this;this.mentionContainer.style.position="fixed",this.mentionContainer.style.height=null;var e=this.quill.container.getBoundingClientRect(),n=this.quill.getBounds(this.mentionCharPos),i={left:e.left+n.left,top:e.top+n.top,width:0,height:n.height},o=this.options.fixMentionsToQuill?e:i,s=this.options.offsetTop,r=this.options.offsetLeft;if(this.options.fixMentionsToQuill){var a=o.right;this.mentionContainer.style.right="".concat(a,"px")}else(r+=o.left)+this.mentionContainer.offsetWidth>document.documentElement.clientWidth&&(r-=r+this.mentionContainer.offsetWidth-document.documentElement.clientWidth);var l=o.top,h=document.documentElement.clientHeight-(o.top+o.height),u=this.mentionContainer.offsetHeight<=h,c=this.mentionContainer.offsetHeight<=l;"bottom"===("top"===this.options.defaultMenuOrientation&&c?"top":"bottom"===this.options.defaultMenuOrientation&&u||h>l?"bottom":"top")?(s=o.top+o.height,u||(this.mentionContainer.style.height=h-3+"px"),this.options.mentionContainerClass.split(" ").forEach((function(e){t.mentionContainer.classList.add("".concat(e,"-bottom")),t.mentionContainer.classList.remove("".concat(e,"-top"))}))):(s=o.top-this.mentionContainer.offsetHeight,c||(this.mentionContainer.style.height=l-3+"px",s=3),this.options.mentionContainerClass.split(" ").forEach((function(e){t.mentionContainer.classList.add("".concat(e,"-top")),t.mentionContainer.classList.remove("".concat(e,"-bottom"))}))),this.mentionContainer.style.top="".concat(s,"px"),this.mentionContainer.style.left="".concat(r,"px"),this.mentionContainer.style.visibility="visible"}},{key:"getTextBeforeCursor",value:function(){var t=Math.max(0,this.cursorPos-this.options.maxChars);return this.quill.getText(t,this.cursorPos-t)}},{key:"onSomethingChange",value:function(){var t=this,e=this.quill.getSelection();if(null!=e){this.cursorPos=e.index;var n,i,o,s,r=this.getTextBeforeCursor(),a=Math.max(0,this.cursorPos-this.options.maxChars),l=a?this.quill.getText(a-1,a):"",h=(n=r,i=this.options.mentionDenotationChars,o=this.options.isolateCharacter,s=this.options.allowInlineMentionChar,i.reduce((function(t,e){var i;if(o&&s){var r=new RegExp("^".concat(e,"|\\s").concat(e),"g"),a=(n.match(r)||[]).pop();if(!a)return{mentionChar:t.mentionChar,mentionCharIndex:t.mentionCharIndex};i=a!==e?n.lastIndexOf(a)+a.length-e.length:0}else i=n.lastIndexOf(e);return i>t.mentionCharIndex?{mentionChar:e,mentionCharIndex:i}:{mentionChar:t.mentionChar,mentionCharIndex:t.mentionCharIndex}}),{mentionChar:null,mentionCharIndex:-1})),u=h.mentionChar,c=h.mentionCharIndex;if(function(t,e,n,i){if(-1===t)return!1;if(!n)return!0;var o=t?e[t-1]:i;return!o||!!o.match(/\s/)}(c,r,this.options.isolateCharacter,l)){var d=this.cursorPos-(r.length-c);this.mentionCharPos=d;var f=r.substring(c+u.length);if(f.length>=this.options.minChars&&function(t,e){return e.test(t)}(f,this.getAllowedCharsRegex(u))){this.existingSourceExecutionToken&&(this.existingSourceExecutionToken.abandoned=!0),this.renderLoading();var m={abandoned:!1};this.existingSourceExecutionToken=m,this.options.source(f,(function(e,n){m.abandoned||(t.existingSourceExecutionToken=null,t.renderList(u,e,n))}),u)}else this.existingSourceExecutionToken&&(this.existingSourceExecutionToken.abandoned=!0),this.hideMentionList()}else this.existingSourceExecutionToken&&(this.existingSourceExecutionToken.abandoned=!0),this.hideMentionList()}}},{key:"getAllowedCharsRegex",value:function(t){return this.options.allowedChars instanceof RegExp?this.options.allowedChars:this.options.allowedChars(t)}},{key:"onTextChange",value:function(t,e,n){"user"===n&&this.onSomethingChange()}},{key:"onSelectionChange",value:function(t){t&&0===t.length?this.onSomethingChange():this.hideMentionList()}},{key:"openMenu",value:function(t){var e=this.quill.getSelection(!0);this.quill.insertText(e.index,t),this.quill.blur(),this.quill.focus()}}]),t}();return n.default.register("modules/mention",E),E}(Quill);
{
"name": "quill-mention",
"version": "3.3.0",
"version": "3.4.0",
"description": "@mentions for the Quill rich text editor",

@@ -26,3 +26,3 @@ "homepage": "https://quill-mention.com/",

"@rollup/plugin-babel": "^5.3.0",
"ava": "^3.15.0",
"ava": "^5.3.1",
"concurrently": "^6.3.0",

@@ -29,0 +29,0 @@ "eslint": "^8.1.0",

@@ -158,2 +158,3 @@ ![Quill Mention](docs/static/quill-mention.png "Quill Mention")

| `isolateCharacter` | `false` | Whether or not the denotation character(s) should be isolated. For example, to avoid mentioning in an email. |
| `allowInlineMentionChar` | `false` | Only works if `isolateCharacter` is set to `true`. Whether or not the denotation character(s) can appear inline of the mention text. For example, to allow mentioning an email with the @ symbol as the denotation character. |
| `fixMentionsToQuill` | `false` | When set to true, the mentions menu will be rendered above or below the quill container. Otherwise, the mentions menu will track the denotation character(s); |

@@ -160,0 +161,0 @@ | `showDenotationChar` | `true` | Whether to show the used denotation character in the mention item or not |

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc