ckeditor_mentions-8.x-2.x-dev/js/build/drupalMention.js

js/build/drupalMention.js
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.CKEditor5=e():(t.CKEditor5=t.CKEditor5||{},t.CKEditor5.drupalMention=e())}(self,(()=>(()=>{var t={"ckeditor5/src/core.js":(t,e,i)=>{t.exports=i("dll-reference CKEditor5.dll")("./src/core.js")},"dll-reference CKEditor5.dll":t=>{"use strict";t.exports=CKEditor5.dll}},e={};function i(n){var r=e[n];if(void 0!==r)return r.exports;var o=e[n]={exports:{}};return t[n](o,o.exports,i),o.exports}i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var n={};return(()=>{"use strict";i.d(n,{default:()=>o});var t=i("ckeditor5/src/core.js");class e extends t.Plugin{init(){const t=this.editor,e={},i={};t.config.get("mention").feeds.forEach((t=>{t.drupalMentionsType&&t.marker&&(e[t.drupalMentionsType]=t.marker,i[t.marker]=t.drupalMentionsType)})),t.conversion.for("upcast").elementToAttribute({view:{name:"a",key:"data-mention",classes:"mention",attributes:{href:!0,"data-plugin":!0,"data-entity-type":!0,"data-entity-uuid":!0,"data-mention-uuid":!0}},model:{key:"mention",value:i=>{let n=i.getAttribute("data-mention"),r=i.getAttribute("data-plugin"),o=e[r]??!1;return null!==r&&null!==n&&o&&n.charAt(0)!==o&&i._setAttribute("data-mention",o+n),t.plugins.get("Mention").toMentionAttribute(i,{link:i.getAttribute("href"),entity_type:i.getAttribute("data-entity-type"),entity_uuid:i.getAttribute("data-entity-uuid"),mention_uuid:i.getAttribute("data-mention-uuid"),plugin:i.getAttribute("data-plugin")})}},converterPriority:"high"}),t.conversion.for("downcast").attributeToElement({model:"mention",view:(t,{writer:e})=>{if(t)return e.createAttributeElement("a",{class:"mention","data-mention":t.id,"data-mention-uuid":t.mention_uuid??null,"data-entity-type":t.entity_type??null,"data-entity-uuid":t.entity_uuid??null,"data-plugin":t.plugin??null,href:t.link??null},{priority:20,id:t.uid})},converterPriority:"high"})}static get pluginName(){return"drupalMention"}}class r{constructor(t){this.options=t}static initialize(t){const e=new r(t);return t=>e.getFeedItems(t)}static itemRender(t){const e=document.createElement("span"),i=document.createElement("span"),n=document.createElement("img");return e.classList.add("ck-list__item--wrapper"),n.src=t.avatar,i.innerText=t.text,i.classList.add("ck-list__item--text"),e.appendChild(n),e.appendChild(i),e}getFeedItems(t){return new Promise((e=>{setTimeout((async()=>{let i=fetch(this.options.url.replace("--match--",t)).then((t=>t.json())).then((t=>this.prepareData(t)));e(i)}),100)}))}prepareData(t){return t.forEach((t=>(t.id=this.options.marker+t.entity_id,t.text=this.options.marker+t.label,t.link=t.url??"",t.plugin=this.options.type,t))),t}}const o={DrupalMention:e,MentionsAjax:r}})(),n=n.default})()));

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc