-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
1 lines (1 loc) · 3.62 KB
/
index.js
1
(function(){"use strict";function s(e,t,i,n,h,g,m,w){var l=typeof e=="function"?e.options:e;return t&&(l.render=t,l.staticRenderFns=i,l._compiled=!0),{exports:e,options:l}}const o={mixins:[{mixins:[{props:{cancelButton:{default:!0,type:[Boolean,String,Object]},disabled:{default:!1,type:Boolean},icon:{default:"check",type:String},submitButton:{type:[Boolean,String,Object],default:!0},theme:{default:"positive",type:String}}}],props:{size:{default:"default",type:String},visible:{default:!1,type:Boolean}},emits:["cancel","close","input","submit","success"],methods:{cancel(){this.$emit("cancel")},close(){this.$emit("close")},error(e){this.$panel.notification.error(e)},focus(e){this.$panel.dialog.focus(e)},input(e){this.$emit("input",e)},open(){this.$panel.dialog.open(this)},submit(){this.$emit("submit",this.value)},success(e){this.$emit("success",e)}}},{props:{empty:{default:()=>window.panel.$t("dialog.fields.empty"),type:String},fields:{default:()=>[],type:[Array,Object]},novalidate:{default:!0,type:Boolean},value:{default:()=>({}),type:Object}}}],props:{fields:{default:()=>({href:{label:window.panel.$t("link"),type:"link",placeholder:window.panel.$t("url.placeholder"),icon:"url"},title:{label:window.panel.$t("title"),type:"text",icon:"title"},target:{label:window.panel.$t("open.newWindow"),type:"toggle",text:[window.panel.$t("no"),window.panel.$t("yes")]},class:{label:'Hinzufügen der "button" Klasse',type:"toggle",text:[window.panel.$t("no"),window.panel.$t("yes")]}})},size:{default:"medium"},submitButton:{default:()=>window.panel.$t("insert")}},data(){return{values:{href:"",title:null,...this.value,target:!!(this.value.target??!1),class:!!(this.value.class??!1)}}},methods:{submit(){let e="/@/$1/";this.values.href.startsWith("page://")&&window.panel.language.code&&(e="/"+window.panel.language.code+e);const t=this.values.href.replace(/(file|page):\/\//,e);this.$emit("submit",{...this.values,href:t,target:this.values.target?"_blank":null,class:this.values.class?"button":null})}}};var r=function(){var t=this,i=t._self._c;return i("k-form-dialog",t._b({attrs:{value:t.values},on:{cancel:function(n){return t.$emit("cancel")},input:function(n){t.values=n},submit:t.submit}},"k-form-dialog",t.$props,!1))},u=[],p=s(o,r,u);const a=p.exports;window.panel.plugin("toto/writer-link-extended",{components:{"k-link-dialog":a,"k-writer":{components:{"k-link-dialog":a}}},writerMarks:{link:{get button(){return{icon:"url",label:window.panel.$t("toolbar.button.link")}},commands(){return{link:e=>{if(e.altKey||e.metaKey)return this.remove();this.editor.emit("link",this.editor)},insertLink:(e={})=>{const{selection:t}=this.editor.state;if(t.empty&&this.editor.activeMarks.includes("link")===!1&&this.editor.insertText(e.href,!0),e.href)return this.update(e)},removeLink:()=>this.remove(),toggleLink:(e={})=>{var t;((t=e.href)==null?void 0:t.length)>0?this.editor.command("insertLink",e):this.editor.command("removeLink")}}},get defaults(){return{target:null}},get name(){return"link"},pasteRules({type:e,utils:t}){return[t.pasteRule(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z]{2,}\b([-a-zA-Z0-9@:%_+.~#?&//=,]*)/gi,e,i=>({href:i}))]},plugins(){return[{props:{handleClick:(e,t,i)=>{const n=this.editor.getMarkAttrs("link");n.href&&i.altKey===!0&&i.target instanceof HTMLAnchorElement&&(i.stopPropagation(),window.open(n.href,n.target))}}}]},get schema(){return{attrs:{href:{default:null},target:{default:null},title:{default:null},class:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:e=>({href:e.getAttribute("href"),target:e.getAttribute("target"),title:e.getAttribute("title"),class:e.getAttribute("class")})}],toDOM:e=>["a",{...e.attrs},0]}}}}})})();