ui_icons-1.0.x-dev/modules/ui_icons_ckeditor5/js/build/icon.js

modules/ui_icons_ckeditor5/js/build/icon.js
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.CKEditor5=t():(e.CKEditor5=e.CKEditor5||{},e.CKEditor5.icon=t())}(self,(()=>(()=>{var e={"ckeditor5/src/core.js":(e,t,n)=>{e.exports=n("dll-reference CKEditor5.dll")("./src/core.js")},"ckeditor5/src/ui.js":(e,t,n)=>{e.exports=n("dll-reference CKEditor5.dll")("./src/ui.js")},"ckeditor5/src/widget.js":(e,t,n)=>{e.exports=n("dll-reference CKEditor5.dll")("./src/widget.js")},"dll-reference CKEditor5.dll":e=>{"use strict";e.exports=CKEditor5.dll}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var c=t[i]={exports:{}};return e[i](c,c.exports,n),c.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var i={};return(()=>{"use strict";n.d(i,{default:()=>a});var e=n("ckeditor5/src/core.js"),t=n("ckeditor5/src/ui.js");class o extends e.Plugin{init(){const e=this.editor,n=this.editor.config.get("icon");if(!n)return;this.dialogURL=n.dialogURL;const{openDialog:i,dialogSettings:o={}}=n;"function"==typeof i&&e.ui.componentFactory.add("icon",(n=>{const c=e.commands.get("insertIcon"),r=new t.ButtonView(n);return r.set({label:Drupal.t("Insert Icon"),icon:'<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n<svg\n   viewBox="0 0 20 20"\n   version="1.1"\n   id="svg1"\n   sodipodi:docname="icon.svg"\n   inkscape:version="1.3.2 (091e20ef0f, 2023-11-25)"\n   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"\n   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"\n   xmlns="http://www.w3.org/2000/svg"\n   xmlns:svg="http://www.w3.org/2000/svg">\n  <defs\n     id="defs1" />\n  <sodipodi:namedview\n     id="namedview1"\n     pagecolor="#ffffff"\n     bordercolor="#000000"\n     borderopacity="0.25"\n     inkscape:showpageshadow="2"\n     inkscape:pageopacity="0.0"\n     inkscape:pagecheckerboard="0"\n     inkscape:deskcolor="#d1d1d1"\n     inkscape:zoom="10.631582"\n     inkscape:cx="-17.589104"\n     inkscape:cy="13.356432"\n     inkscape:window-width="1920"\n     inkscape:window-height="1012"\n     inkscape:window-x="0"\n     inkscape:window-y="0"\n     inkscape:window-maximized="1"\n     inkscape:current-layer="svg1" />\n  <path\n     id="path1"\n     d="m 2.8007812,3.0292969 c -0.6099951,0 -1.1015624,0.4707854 -1.1015624,1.0507812 v 3.0509806 c 0.7594661,7.88e-5 0.6098625,-0.1875593 1.5,-0.1876963 V 4.5 h 4.5625 C 7.7694287,3.8270555 7.7108944,3.7132665 7.7089844,3.0292969 Z m 9.9199218,0 C 12.724803,3.5346514 12.510559,3.6774178 12.505859,4.5 h 4.263672 V 14.619141 L 14.25,11.650391 c -0.245295,-0.226882 -0.623846,-0.226882 -0.869141,0 L 11.150391,13.710938 7.7890625,10.570312 C 7.5490639,10.330319 7.1701548,10.309069 6.9101562,10.539062 l -3.7109374,4.080079 v -3.38086 c -0.7899957,0.01155 -0.6633571,0.542542 -1.5,0.551312 v 4.130329 c 0,0.589993 0.4898479,1.060547 1.0898437,1.060547 H 17.179688 c 0.599993,0 1.089843,-0.470554 1.089843,-1.060547 V 4.0800781 c 0,-0.5799958 -0.48985,-1.0507812 -1.089843,-1.0507812 z"\n     sodipodi:nodetypes="sscccccsccccccccccccssssssc" />\n  <path\n     d="M 10.008435,0.75694563 C 8.4005881,0.77794673 7.1120535,2.0758777 7.125044,3.6613611 L 7.1252566,3.864942 C 7.1243433,4.0317771 7.1915706,4.1919553 7.3117856,4.3093599 7.431237,4.427388 7.5928497,4.49454 7.761944,4.496398 8.1282485,4.474667 8.411255,4.17071 8.401981,3.8089827 8.393691,2.8547638 9.1963606,2.0875961 10.163365,2.1255013 c 0.977804,0.032954 1.753957,0.8227684 1.756556,1.7874828 0.0061,0.1683046 0.0826,0.3266226 0.211111,0.437569 0.127232,0.1105673 0.29438,0.1657463 0.463483,0.1530131 0.338454,-0.00394 0.608979,-0.2787775 0.60284,-0.6124758 l -1.3e-4,-0.047102 c -0.0048,-1.7256632 -1.439718,-3.11424657 -3.1896,-3.08651097 z"\n     id="path2-7-5-3"\n     sodipodi:nodetypes="cccccccccccscc"\n     style="stroke-width:0.966267" />\n  <path\n     d="M 5.5328819,9.3164894 C 5.5108434,7.7450394 4.1824182,6.4861097 2.5602287,6.4993497 L 2.3519341,6.4996273 C 2.1812357,6.4987919 2.0173718,6.5645523 1.89729,6.6820875 1.77657,6.7988761 1.7079186,6.9568545 1.7060755,7.1221228 1.7284345,7.4801302 2.0395271,7.756628 2.4096267,7.7474398 3.385937,7.7390098 4.171143,8.5232518 4.1326916,9.4683826 4.0993096,10.42407 3.291474,11.182929 2.3044233,11.185799 c -0.1721995,0.0061 -0.334157,0.08085 -0.4476282,0.206483 -0.1130838,0.124391 -0.1694832,0.287776 -0.1563971,0.453047 0.00415,0.330794 0.285441,0.595102 0.6268638,0.588988 l 0.048193,-1.43e-4 C 4.1410723,12.428874 5.561315,11.02597 5.5323374,9.315698 Z"\n     id="path2-7-5"\n     sodipodi:nodetypes="cccccccccccscc"\n     style="stroke-width:0.966267" />\n  <path\n     d="m 13.535164,5.0483665 c 0.06043,-0.1729268 0.306939,-0.1729268 0.367369,0 l 0.345918,1.0295533 c 0.154188,0.4602397 0.517536,0.8207164 0.981442,0.9736863 l 1.037753,0.3431841 c 0.174305,0.059951 0.174305,0.304514 0,0.3644671 l -1.037753,0.3431842 c -0.463077,0.1537128 -0.826504,0.5142678 -0.981442,0.9736861 l -0.345918,1.0295534 c -0.06043,0.172928 -0.306938,0.172928 -0.367369,0 L 13.189245,9.0761276 C 13.034308,8.6167093 12.670881,8.2561551 12.207804,8.1024415 L 11.171391,7.7592573 c -0.174303,-0.059951 -0.174303,-0.3045139 0,-0.3644671 l 1.037754,-0.3431841 c 0.463906,-0.1529699 0.827253,-0.5134466 0.981441,-0.9736863 z"\n     id="path1-6"\n     style="stroke-width:1.33546" />\n</svg>\n',tooltip:!0}),r.bind("isOn","isEnabled").to(c,"value","isEnabled"),this.listenTo(r,"execute",(()=>{i(this.dialogURL,(({settings:t})=>{e.execute("insertIcon",t)}),o)})),r}))}}var c=n("ckeditor5/src/widget.js");class r extends e.Command{execute(e){if(!e.icon)return;const t={drupalIconId:e.icon,drupalIconSettings:JSON.stringify(e.icon_settings)};this.editor.model.change((e=>{this.editor.model.insertObject(function(e,t){return e.createElement("drupalIcon",t)}(e,t))}))}refresh(){const e=this.editor.model,t=e.document.selection,n=e.schema.findAllowedParent(t.getFirstPosition(),"drupalIcon");this.isEnabled=null!==n}}class s extends e.Plugin{static get requires(){return[c.Widget]}constructor(e){super(e),this.attrs={drupalIconId:"data-icon-id",drupalIconSettings:"data-icon-settings",class:"class",role:"role",ariaLabel:"aria-label",ariaHidden:"aria-hidden"},this.converterAttributes=["drupalIconId","drupalIconSettings"]}init(){this._defineSchema(),this._defineConverters(),this.editor.commands.add("insertIcon",new r(this.editor))}_defineSchema(){const{schema:e}=this.editor.model;e.register("drupalIcon",{inheritAllFrom:"$inlineObject",allowAttributes:Object.keys(this.attrs)})}_defineConverters(){const{conversion:e}=this.editor;e.for("upcast").elementToElement({model:"drupalIcon",view:{name:"drupal-icon"}}),e.for("dataDowncast").elementToElement({model:"drupalIcon",view:{name:"drupal-icon"}}),e.for("editingDowncast").elementToElement({model:"drupalIcon",view:(e,{writer:t})=>{const n=t.createContainerElement("span",{class:"drupal-icon"});return t.setCustomProperty("drupalIcon",!0,n),(0,c.toWidget)(n,t,{label:Drupal.t("Icon widget")})}}).add((e=>{const t=async(e,t,n)=>{const i=n.writer,o=t.item,c=n.mapper.toViewElement(o),r=c.getChild(0);r&&i.remove(r);const d=i.createRawElement("span",{"data-drupal-icon-preview":"loading"});i.insert(i.createPositionAt(c,0),d);try{const{preview:e}=await s._fetchIcon(o);if(!d)return;this.editor.editing.view.change((t=>{const n=t.createRawElement("span",{"data-drupal-icon-preview":"ready"},(t=>{t.innerHTML=e}));t.insert(t.createPositionBefore(d),n),t.remove(d)}))}catch(e){console.error("Error fetching icon preview:",e)}};return this.converterAttributes.forEach((n=>{e.on(`attribute:${n}:drupalIcon`,t)})),e})),Object.keys(this.attrs).forEach((t=>{const n={model:{key:t,name:"drupalIcon"},view:{name:"drupal-icon",key:this.attrs[t]}};e.for("dataDowncast").attributeToAttribute(n),e.for("upcast").attributeToAttribute(n)}))}static async _fetchIcon(e){let t=e.getAttribute("drupalIconSettings");void 0===t&&(t="");const n={icon_id:e.getAttribute("drupalIconId"),settings:t},i=await fetch(`${Drupal.url("ui-icons/icon/preview")}?${new URLSearchParams(n)}`);if(i.ok){return{preview:await i.text()}}return{preview:`<span class="drupal-icon"><svg width="15" height="14" fill="none" xmlns="http://www.w3.org/2000/svg"><title>${`The referenced icon: "${e.getAttribute("drupalIconId")}" is missing and needs to be re-embedded.`}</title><path d="M7.002 0a7 7 0 100 14 7 7 0 000-14zm3 5c0 .551-.16 1.085-.477 1.586l-.158.22c-.07.093-.189.241-.361.393a9.67 9.67 0 01-.545.447l-.203.189-.141.129-.096.17L8 8.369v.63H5.999v-.704c.026-.396.078-.73.204-.999a2.83 2.83 0 01.439-.688l.225-.21-.01-.015.176-.14.137-.128c.186-.139.357-.277.516-.417l.148-.18A.948.948 0 008.002 5 1.001 1.001 0 006 5H4a3 3 0 016.002 0zm-1.75 6.619a.627.627 0 01-.625.625h-1.25a.627.627 0 01-.626-.625v-1.238c0-.344.281-.625.626-.625h1.25c.344 0 .625.281.625.625v1.238z" fill="#d72222"/></svg></span>`}}}class d extends e.Plugin{static get requires(){return[o,s]}static get pluginName(){return"Icon"}}const a={Icon:d}})(),i=i.default})()));

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

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