menu_bootstrap_icon-1.x-dev/js/build/bootstrapIcons.js

js/build/bootstrapIcons.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.bootstrapIcons=t())}(self,()=>(()=>{var e={"ckeditor5/src/core.js":(e,t,s)=>{e.exports=s("dll-reference CKEditor5.dll")("./src/core.js")},"ckeditor5/src/ui.js":(e,t,s)=>{e.exports=s("dll-reference CKEditor5.dll")("./src/ui.js")},"ckeditor5/src/widget.js":(e,t,s)=>{e.exports=s("dll-reference CKEditor5.dll")("./src/widget.js")},"dll-reference CKEditor5.dll":e=>{"use strict";e.exports=CKEditor5.dll}},t={};function s(o){var i=t[o];if(void 0!==i)return i.exports;var n=t[o]={exports:{}};return e[o](n,n.exports,s),n.exports}s.d=(e,t)=>{for(var o in t)s.o(t,o)&&!s.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var o={};return(()=>{"use strict";s.d(o,{default:()=>d});var e=s("ckeditor5/src/core.js"),t=s("ckeditor5/src/ui.js");class i extends t.View{constructor(e){super(e.locale),this.searchInputView=this._createInput("Search icon (ie. chevron-down)");const s=e.config.get("bootstrapicons");let o=s.search_list,i=s.cdn;if(i.length){let e=document.createElement("link");e.rel="stylesheet",e.type="text/css",e.href=i,document.head.appendChild(e)}this.iconsBootstrap=new t.ListView,setTimeout(()=>this._createListIcons(o),0);const n=this.iconsBootstrap.items._items;this.searchInputView.fieldView.on("input",e=>{let t=e.source.element.value.toLowerCase().replace(/[_\-+]/g," ");sessionStorage.setItem("bootstrapIconSearch",t),n.forEach(e=>{const s=e.element.textContent.indexOf(t);e.element.style.display=-1!==s?"block":"none"})}),this.saveButtonView=this._createButton(e.t("Save"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.972 16.615a.997.997 0 0 1-.744-.292l-4.596-4.596a1 1 0 1 1 1.414-1.414l3.926 3.926 9.937-9.937a1 1 0 0 1 1.414 1.415L7.717 16.323a.997.997 0 0 1-.745.292z"/></svg>',"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(e.t("Cancel"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.591 10.177 4.243 4.242a1 1 0 0 1-1.415 1.415l-4.242-4.243-4.243 4.243a1 1 0 0 1-1.414-1.415l4.243-4.242L4.52 5.934A1 1 0 0 1 5.934 4.52l4.243 4.243 4.242-4.243a1 1 0 1 1 1.415 1.414l-4.243 4.243z"/></svg>',"ck-button-cancel"),this.cancelButtonView.delegate("execute").to(this,"cancel"),this.childViews=this.createCollection([this.searchInputView,this.iconsBootstrap,this.saveButtonView,this.cancelButtonView]),this.setTemplate({tag:"form",attributes:{class:["ck","ck-bootstrapicon-form","ck-responsive-form"],tabindex:"-1"},children:this.childViews})}render(){super.render(),(0,t.submitHandler)({view:this})}focus(){this.childViews.first.focus()}_createInput(e){const s=new t.LabeledFieldView(this.locale,t.createLabeledInputText);s.label=e;let o=sessionStorage.getItem("bootstrapIconSearch");return o&&s.fieldView.bind("value").to(this,e=>o),s}_createButton(e,s,o){const i=new t.ButtonView;return i.set({label:e,icon:s,tooltip:!0,class:o}),i}_createIconBtn(e,s){const o=new t.ButtonView;o.set({label:s,tooltip:s,class:"bootstrapicon bi bi-"+e}),o.on("execute",()=>{this.searchInputView.fieldView.element.value=e,this.searchInputView.fieldView.element.focus()});const i=new t.ListItemView;return i.children.add(o),i}_createListIcons(e){e.forEach(e=>{let t=Array.isArray(e.searchTerms)?e.searchTerms:Object.values(e.searchTerms),s=this._createIconBtn(e.title,t.join(" "));this.iconsBootstrap.items.add(s)})}}class n extends e.Plugin{init(){const e=this.editor;this._balloon=this.editor.plugins.get(t.ContextualBalloon),this.formView=this._createFormView(),e.ui.componentFactory.add("bootstrapIcons",s=>{const o=e.commands.get("InsertIconCommand"),i=new t.ButtonView(s);return i.set({label:e.t("Bootstrap icons"),icon:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-square" viewBox="0 0 16 16">\n  <path d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/>\n  <path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0"/>\n</svg>',tooltip:!0}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",()=>{this._showUI()}),i})}_createFormView(){const e=this.editor,s=new i(e);return this.listenTo(s,"bootstrapicon",()=>{let t={icon:s.searchInputView.fieldView.element.value};e.execute("InsertIconCommand",t),this._hideUI()}),this.listenTo(s,"submit",()=>{let t={icon:s.searchInputView.fieldView.element.value};e.execute("InsertIconCommand",t),this._hideUI()}),this.listenTo(s,"cancel",()=>{this._hideUI()}),(0,t.clickOutsideHandler)({emitter:s,activator:()=>this._balloon.visibleView===s,contextElements:[this._balloon.view.element],callback:()=>this._hideUI()}),s}_hideUI(){this.formView.searchInputView.fieldView.value="",this.formView.element.reset(),this._balloon.remove(this.formView),this.editor.editing.view.focus()}_showUI(){let e=sessionStorage.getItem("bootstrapIconSearch");this.formView.searchInputView.fieldView.value=e,this._balloon.add({view:this.formView,position:this._getBalloonPositionData(),icon:"testIcon"}),this.formView.focus()}_getBalloonPositionData(){const e=this.editor.editing.view,t=e.document;let s=null;return s=()=>e.domConverter.viewRangeToDom(t.selection.getFirstRange()),{target:s}}}var r=s("ckeditor5/src/widget.js");class c extends e.Command{execute(e){const{model:t}=this.editor;t.change(t=>{let s="bi";""!==e.icon&&(s+=" bi-"+e.icon);const o={class:s},i=t.createElement("bootstrapIcons",o),n=t.createDocumentFragment();t.append(i,n),t.insertText(drupalSettings.icon,i),this.editor.model.insertContent(n)})}refresh(){const{model:e}=this.editor,{selection:t}=e.document,s=e.schema.findAllowedParent(t.getFirstPosition(),"bootstrapIcons");this.isEnabled=null!==s}}class a extends e.Plugin{static get requires(){return[r.Widget]}init(){this._defineSchema(),this._defineConverters(),this._defineCommands()}_defineSchema(){this.editor.model.schema.register("bootstrapIcons",{isObject:!0,allowWhere:"$text",isInline:!0,allowAttributes:["class"]})}_defineConverters(){const{conversion:e}=this.editor;e.attributeToAttribute({model:"class",view:"class"}),e.for("downcast").elementToElement({model:"bootstrapIcons",view:"em"}),e.for("upcast").elementToElement({model:"bootstrapIcons",view:{name:"em",classes:"bootstrap-icon"}})}_defineCommands(){this.editor.commands.add("InsertIconCommand",new c(this.editor))}}class l extends e.Plugin{static get requires(){return[a,n]}static get pluginName(){return"BootstrapIcons"}}const d={BootstrapIcons:l}})(),o=o.default})());

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

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