12345 |
- /*
- Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
- For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
- */
- !function(){function t(t,r){var a=r.feed;this.caseSensitive=r.caseSensitive,this.marker=r.hasOwnProperty("marker")?r.marker:"@",this.minChars=null!==r.minChars&&void 0!==r.minChars?r.minChars:2;var i;if(!(i=r.pattern)){i=this.minChars;var o="\\"+this.marker+"[_a-zA-Z0-9À-ž]",o=(i?o+("{"+i+",}"):o+"*")+"$";i=new RegExp(o)}this.pattern=i,this.cache=void 0!==r.cache?r.cache:!0,this.throttle=void 0!==r.throttle?r.throttle:200,this._autocomplete=new CKEDITOR.plugins.autocomplete(t,{textTestCallback:e(this.marker,this.minChars,this.pattern),dataCallback:n(a,this),itemTemplate:r.itemTemplate,outputTemplate:r.outputTemplate,throttle:this.throttle,itemsLimit:r.itemsLimit})}function e(t,e,n){function r(t,e){var r=t.slice(0,e).match(n);if(!r)return null;var a=t[r.index-1];return void 0===a||a.match(/\s+/)?{start:r.index,end:e}:null}return function(t){return t.collapsed?CKEDITOR.plugins.textMatch.match(t,r):null}}function n(t,e){return function(n,a){function i(){var n=o(t).filter(function(t){return t=t.name,e.caseSensitive||(t=t.toLowerCase(),c=c.toLowerCase()),0===t.indexOf(c)});u(n)}function o(t){var e=1;return CKEDITOR.tools.array.reduce(t,function(t,n){return t.push({name:n,id:e++}),t},[])}function s(){var n=new CKEDITOR.template(t).output({encodedQuery:encodeURIComponent(c)});return e.cache&&r[n]?u(r[n]):void CKEDITOR.ajax.load(n,function(t){t=JSON.parse(t),e.cache&&null!==t&&(r[n]=t),u(t)})}function u(t){t&&(t=CKEDITOR.tools.array.map(t,function(t){return CKEDITOR.tools.object.merge(t,{name:e.marker+t.name})}),a(t))}var c=n.query;e.marker&&(c=c.substring(e.marker.length)),CKEDITOR.tools.array.isArray(t)?i():"string"==typeof t?s():t({query:c,marker:e.marker},u)}}CKEDITOR._.mentions={cache:{}};var r=CKEDITOR._.mentions.cache;CKEDITOR.plugins.add("mentions",{requires:"autocomplete,textmatch,ajax",instances:[],init:function(e){var n=this;e.on("instanceReady",function(){CKEDITOR.tools.array.forEach(e.config.mentions||[],function(r){n.instances.push(new t(e,r))})})},isSupportedEnvironment:function(t){return t.plugins.autocomplete.isSupportedEnvironment(t)}}),t.prototype={destroy:function(){this._autocomplete.destroy()}},CKEDITOR.plugins.mentions=t}();
|