diff --git a/README.md b/README.md index a93d1e4..2bed577 100755 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ return [ This will wrap the text in `###` => (`### In the jungle of Sumatra ###`) ## Available translations -`` + - German - English diff --git a/index.js b/index.js index 94c1628..e5de364 100644 --- a/index.js +++ b/index.js @@ -1 +1 @@ -(function () {var a={data:function(){return{tabs:[{name:"external",label:this.$t("gearsdigital.enhanced-toolbar-link-dialog.external")},{name:"internal",label:this.$t("gearsdigital.enhanced-toolbar-link-dialog.internal")}],search:null,currentPage:{},currentTab:{},pages:[],value:{url:null,text:null},pagination:{page:1,total:0},externalFields:{url:{label:this.$t("link"),type:"text",placeholder:this.$t("url.placeholder"),icon:"url"},text:{label:this.$t("link.text"),type:"text"}}}},watch:{search:b(function(){this.pagination.page=0,this.fetch()},200)},computed:{hasPages:function(){return this.pages.length},kirbytext:function(){return this.$store.state.system.info.kirbytext}},methods:{open:function(t,e){this.value.text=e,this.currentTab=this.tabs[0],this.$refs.dialog.open()},resetForm:function(){this.value={url:null,text:null},this.value.text=null,this.search=null,this.pagination.page=1},selectTab:function(t){this.currentTab=t},selectPage:function(t){this.value={url:t.slug,text:this.value.text||t.title},this.isCurrentPage(t)?(this.currentPage={},this.value={url:null,text:null}):this.currentPage=t},isCurrentPage:function(t){return this.currentPage===t},paginate:function(t){this.pagination.page=t.page,this.fetch()},createKirbytext:function(){return this.value.text.length>0?"(link: ".concat(this.value.url," text: ").concat(this.value.text,")"):"(link: ".concat(this.value.url,")")},createMarkdown:function(){return this.value.text.length>0?"[".concat(this.value.text,"](").concat(this.value.url,")"):"<".concat(this.value.url,">")},fetch:function(){var t=this,e={page:this.pagination.page,search:this.search};this.$api.get("enhanced-toolbar-link-dialog/pages",e).then(function(e){t.pages=e.data,t.pagination=e.pagination})},submit:function(){this.$emit("submit",this.kirbytext?this.createKirbytext():this.createMarkdown()),this.$refs.dialog.close()}}};function b(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200,a=null;return function(){var n=this,i=arguments;clearTimeout(a),a=setTimeout(function(){t.apply(n,i)},e)}}if(typeof a==="function"){a=a.options}Object.assign(a,function(){var render=function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c("k-dialog",{ref:"dialog",staticClass:"k-pages-dialog",attrs:{"size":"medium","button":_vm.$t("insert")},on:{"submit":_vm.submit,"open":_vm.fetch,"close":_vm.resetForm}},[_vm.tabs&&_vm.tabs.length>1?_c("div",{staticClass:"k-header-tabs"},[_c("nav",_vm._l(_vm.tabs,function(tab){return _c("k-button",{staticClass:"k-tab-button",attrs:{"link":"#"+tab.name,"current":_vm.currentTab&&_vm.currentTab.name===tab.name},on:{"click":function($event){return _vm.selectTab(tab)}}},[_vm._v(" "+_vm._s(tab.label)+" ")])}),1)]):_vm._e(),_vm._v(" "),_vm.currentTab.name==="external"?_c("div",{staticClass:"k-tab"},[_c("k-form",{ref:"form",attrs:{"fields":_vm.externalFields},on:{"submit":_vm.submit},model:{value:_vm.value,callback:function($$v){_vm.value=$$v},expression:"value"}})],1):_vm._e(),_vm._v(" "),_vm.currentTab.name==="internal"?_c("div",{staticClass:"k-tab"},[_c("k-input",{staticClass:"k-dialog-search",attrs:{"autofocus":"","placeholder":_vm.$t("search")+" \u2026","type":"text","icon":"search"},model:{value:_vm.search,callback:function($$v){_vm.search=$$v},expression:"search"}}),_vm._v(" "),_vm.hasPages?_c("k-list",_vm._l(_vm.pages,function(page){return _c("k-list-item",{key:page.id,attrs:{"text":page.title},on:{"click":function($event){return _vm.selectPage(page)}}},[_c("template",{slot:"options"},[_vm.isCurrentPage(page)?_c("k-button",{attrs:{"slot":"options","autofocus":"","icon":"check","theme":"positive","tooltip":_vm.$t("remove")},slot:"options"}):_c("k-button",{attrs:{"slot":"options","autofocus":"","icon":"circle-outline","tooltip":_vm.$t("select")},slot:"options"})],1)],2)}),1):_c("k-text",[_vm._v(" "+_vm._s(_vm.$t("gearsdigital.enhanced-toolbar-link-dialog.empty"))+" ")]),_vm._v(" "),_c("k-pagination",_vm._b({staticClass:"k-dialog-pagination",attrs:{"details":true,"dropdown":false,"align":"center"},on:{"paginate":_vm.paginate}},"k-pagination",_vm.pagination,false))],1):_vm._e()])};var staticRenderFns=[];return{render:render,staticRenderFns:staticRenderFns,_compiled:true,_scopeId:null,functional:undefined}}());panel.plugin("gearsdigital/enhanced-toolbar-link-dialog",{components:{"k-toolbar-link-dialog":{extends:a}}});})(); \ No newline at end of file +(function () {var b={data:function(){return{tabs:[{name:"external",label:this.$t("gearsdigital.enhanced-toolbar-link-dialog.external")},{name:"internal",label:this.$t("gearsdigital.enhanced-toolbar-link-dialog.internal")}],search:null,currentPage:{},currentTab:{},pages:[],value:{url:null,text:null},pagination:{page:1,total:0},externalFields:{url:{label:this.$t("link"),type:"text",placeholder:this.$t("url.placeholder"),icon:"url"},text:{label:this.$t("link.text"),type:"text"}},selectedLinkTarget:null,linkTargets:[{value:"_blank",text:"_blank"},{value:"_self",text:"_blank"},{value:"_parent",text:"_parent"},{value:"_top",text:"_top"}]}},watch:{search:c(function(){this.pagination.page=0,this.fetch()},200)},computed:{hasPages:function(){return this.pages.length},kirbytext:function(){return this.$store.state.system.info.kirbytext}},methods:{open:function(t,e){this.value.text=e,this.currentTab=this.tabs[0],this.$refs.dialog.open()},resetForm:function(){this.value={url:null,text:null},this.value.text=null,this.search=null,this.pagination.page=1,this.selectedLinkTarget=null},selectTab:function(t){this.currentTab=t},selectPage:function(t){this.value={url:t.slug,text:this.value.text||t.title},this.isCurrentPage(t)?(this.currentPage={},this.value={url:null,text:null}):this.currentPage=t},isCurrentPage:function(t){return this.currentPage===t},paginate:function(t){this.pagination.page=t.page,this.fetch()},createKirbytext:function(){if(!this.value.url&&this.value.text)return this.value.text;var t="".concat(this.selectedLinkTarget?"target: "+this.selectedLinkTarget:""),e="link: ".concat(this.value.url),a="text: ".concat(this.value.text);return this.value.text.length>0?"(".concat(e," ").concat(a," ").concat(t,")"):"(".concat(e," ").concat(t,")")},createMarkdown:function(){return this.value.text.length>0?"[".concat(this.value.text,"](").concat(this.value.url,")"):"<".concat(this.value.url,">")},fetch:function(){var t=this,e={page:this.pagination.page,search:this.search};this.$api.get("enhanced-toolbar-link-dialog/pages",e).then(function(e){t.pages=e.data,t.pagination=e.pagination})},submit:function(){this.$emit("submit",this.kirbytext?this.createKirbytext():this.createMarkdown()),this.$refs.dialog.close()}}};function c(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200,a=null;return function(){var n=this,i=arguments;clearTimeout(a),a=setTimeout(function(){t.apply(n,i)},e)}}if(typeof b==="function"){b=b.options}Object.assign(b,function(){var render=function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c("k-dialog",{ref:"dialog",staticClass:"k-pages-dialog",attrs:{"size":"medium","button":_vm.$t("insert")},on:{"submit":_vm.submit,"open":_vm.fetch,"close":_vm.resetForm}},[_vm.tabs&&_vm.tabs.length>1?_c("div",{staticClass:"k-header-tabs"},[_c("nav",_vm._l(_vm.tabs,function(tab){return _c("k-button",{staticClass:"k-tab-button",attrs:{"current":_vm.currentTab&&_vm.currentTab.name===tab.name},on:{"click":function($event){return _vm.selectTab(tab)}}},[_vm._v(" "+_vm._s(tab.label)+" ")])}),1)]):_vm._e(),_vm._v(" "),_vm.currentTab.name==="external"?_c("div",{staticClass:"k-tab"},[_c("k-form",{ref:"form",attrs:{"fields":_vm.externalFields},on:{"submit":_vm.submit},model:{value:_vm.value,callback:function($$v){_vm.value=$$v},expression:"value"}})],1):_vm._e(),_vm._v(" "),_vm.currentTab.name==="internal"?_c("div",{staticClass:"k-tab"},[_c("k-input",{staticClass:"k-dialog-search",attrs:{"autofocus":"","placeholder":_vm.$t("search")+" \u2026","type":"text","icon":"search"},model:{value:_vm.search,callback:function($$v){_vm.search=$$v},expression:"search"}}),_vm._v(" "),_vm.hasPages?_c("div",[_c("k-list",_vm._l(_vm.pages,function(page){return _c("k-list-item",{key:page.id,attrs:{"text":page.title},on:{"click":function($event){return _vm.selectPage(page)}}},[_c("template",{slot:"options"},[_vm.isCurrentPage(page)?_c("k-button",{attrs:{"slot":"options","autofocus":"","icon":"check","theme":"positive","tooltip":_vm.$t("remove")},slot:"options"}):_c("k-button",{attrs:{"slot":"options","autofocus":"","icon":"circle-outline","tooltip":_vm.$t("select")},slot:"options"})],1)],2)}),1),_vm._v(" "),_c("k-line-field"),_vm._v(" "),_c("k-select-field",{attrs:{"options":_vm.linkTargets,"type":"select","name":"target","label":_vm.$t("gearsdigital.enhanced-toolbar-link-dialog.target.title"),"help":_vm.$t("gearsdigital.enhanced-toolbar-link-dialog.target.help")},model:{value:_vm.selectedLinkTarget,callback:function($$v){_vm.selectedLinkTarget=$$v},expression:"selectedLinkTarget"}})],1):_c("k-text",[_vm._v(" "+_vm._s(_vm.$t("gearsdigital.enhanced-toolbar-link-dialog.empty"))+" ")]),_vm._v(" "),_c("k-pagination",_vm._b({staticClass:"k-dialog-pagination",attrs:{"details":true,"dropdown":false,"align":"center"},on:{"paginate":_vm.paginate}},"k-pagination",_vm.pagination,false))],1):_vm._e()])};var staticRenderFns=[];return{render:render,staticRenderFns:staticRenderFns,_compiled:true,_scopeId:null,functional:undefined}}());panel.plugin("gearsdigital/enhanced-toolbar-link-dialog",{components:{"k-toolbar-link-dialog":{extends:b}}});})(); \ No newline at end of file diff --git a/src/components/EnhancedToolbarLinkDialog.vue b/src/components/EnhancedToolbarLinkDialog.vue index 38c0a0f..469cbb3 100755 --- a/src/components/EnhancedToolbarLinkDialog.vue +++ b/src/components/EnhancedToolbarLinkDialog.vue @@ -13,7 +13,6 @@