diff --git a/core/Piranha.Manager/assets/dist/js/piranha.contentedit.js b/core/Piranha.Manager/assets/dist/js/piranha.contentedit.js index 4e1c418d3..6f907320a 100644 --- a/core/Piranha.Manager/assets/dist/js/piranha.contentedit.js +++ b/core/Piranha.Manager/assets/dist/js/piranha.contentedit.js @@ -374,7 +374,14 @@ Vue.component("audio-block", { update: function (media) { if (media.type === "Audio") { this.model.body.id = media.id; - this.model.body.media = media; // Tell parent that title has been updated + this.model.body.media = { + id: media.id, + folderId: media.folderId, + type: media.type, + filename: media.filename, + contentType: media.contentType, + publicUrl: media.publicUrl + }; // Tell parent that title has been updated this.$emit('update-title', { uid: this.uid, @@ -817,7 +824,14 @@ Vue.component("video-block", { update: function (media) { if (media.type === "Video") { this.model.body.id = media.id; - this.model.body.media = media; // Tell parent that title has been updated + this.model.body.media = { + id: media.id, + folderId: media.folderId, + type: media.type, + filename: media.filename, + contentType: media.contentType, + publicUrl: media.publicUrl + }; // Tell parent that title has been updated this.$emit('update-title', { uid: this.uid, diff --git a/core/Piranha.Manager/assets/dist/js/piranha.contentedit.min.js b/core/Piranha.Manager/assets/dist/js/piranha.contentedit.min.js index 116f44062..273767511 100644 --- a/core/Piranha.Manager/assets/dist/js/piranha.contentedit.min.js +++ b/core/Piranha.Manager/assets/dist/js/piranha.contentedit.min.js @@ -1 +1 @@ -Vue.component("region",{props:["model","content","type"],data:function(){return{itemAdded:!1}},methods:{moveItem:function(e,t){this.model.items.splice(t,0,this.model.items.splice(e,1)[0])},addItem:function(){var e=this;fetch(piranha.baseUrl+"manager/api/content/region/"+this.content+"/"+this.type+"/"+this.model.meta.id).then(function(e){return e.json()}).then(function(t){e.model.items.push(t),e.itemAdded=!0}).catch(function(e){console.log("error:",e)})},removeItem:function(e){this.model.items.splice(this.model.items.indexOf(e),1)},updateTitle:function(e){if(this.model.meta.isCollection)for(var t=0;t\n
\n
\n
\n
\n \n
\n
\n
\n \n
\n
\n\n
\n
\n
\n
\n
\n
\n \n
\n
\n
\n
\n \n
\n
\n
\n \n
\n
\n
\n
\n
\n
\n
\n \n
\n \n
\n
\n

{{ piranha.resources.texts.emptyAddAbove }}

\n
\n
\n'}),Vue.component("post-archive",{props:["uid","id"],data:function(){return{items:[],categories:[],postTypes:[],totalPosts:0,totalPages:0,index:0,status:"all",category:piranha.resources.texts.allCategories}},methods:{load:function(e){var t=this;e||(e=0),fetch(piranha.baseUrl+"manager/api/post/list/"+t.id+"/"+e).then(function(e){return e.json()}).then(function(e){t.items=e.posts,t.categories=e.categories,t.postTypes=e.postTypes,t.totalPosts=e.totalPosts,t.totalPages=e.totalPages,t.index=e.index}).catch(function(e){console.log("error:",e)})},remove:function(e){var t=this;piranha.alert.open({title:piranha.resources.texts.delete,body:piranha.resources.texts.deletePostConfirm,confirmCss:"btn-danger",confirmIcon:"fas fa-trash",confirmText:piranha.resources.texts.delete,onConfirm:function(){fetch(piranha.baseUrl+"manager/api/post/delete/"+e).then(function(e){return e.json()}).then(function(e){piranha.notifications.push(e),t.load()}).catch(function(e){console.log("error:",e)})}})},first:function(){this.hasPrev()&&this.load(0)},prev:function(){this.hasPrev()&&this.load(this.index-1)},next:function(){this.hasNext()&&this.load(this.index+1)},last:function(){this.hasNext()&&this.load(this.totalPages-1)},hasPrev:function(){return this.index>0},hasNext:function(){return this.index\n
\n
\n \n \n \n
\n
\n \n \n
\n \n
\n \n \n
\n {{ piranha.resources.texts.add }}\n
\n \n \n \n \n \n \n \n \n \n
\n {{ post.title }}\n | {{ post.published }}\n | Unpublished\n {{ piranha.resources.texts.draft }}\n {{ piranha.resources.texts.scheduled }}\n \n {{ post.typeName }}\n \n {{ post.category }}\n \n \n
\n
\n

Looks like there\'s no posts here. Click on the Add button above to get started!

\n
\n \n\n'}),Vue.component("block-group",{props:["uid","toolbar","model"],methods:{selectItem:function(e){for(var t=0;t\n
\n \n
\n
\n
\n
\n \n
\n \n
\n
\n
\n
\n
\n \n \n
\n
\n
\n

{{ piranha.resources.texts.emptyAddLeft }}

\n
\n \n
\n
\n\n'}),Vue.component("block-group-horizontal",{props:["uid","toolbar","model"],methods:{removeItem:function(e){var t=this.model.items.indexOf(e);this.model.items.splice(t,1)},addGroupBlock:function(e,t){var i=this;fetch(piranha.baseUrl+"manager/api/content/block/"+e).then(function(e){return e.json()}).then(function(e){sortable("#"+i.uid+" .block-group-items","destroy"),i.model.items.push(e.body),Vue.nextTick(function(){sortable("#"+i.uid+" .block-group-items",{handle:".handle",items:":not(.unsortable)",placeholderClass:"col sortable-placeholder"})[0].addEventListener("sortupdate",function(e){i.moveItem(e.detail.origin.index,e.detail.destination.index)})})}).catch(function(e){console.log("error:",e)})},toggleHeader:function(){this.model.meta.showHeader=!this.model.meta.showHeader},moveItem:function(e,t){this.model.items.splice(t,0,this.model.items.splice(e,1)[0])}},mounted:function(){var e=this;sortable("#"+this.uid+" .block-group-items",{handle:".handle",items:":not(.unsortable)",placeholderClass:"col sortable-placeholder"})[0].addEventListener("sortupdate",function(t){e.moveItem(t.detail.origin.index,t.detail.destination.index)})},template:'\n
\n
\n \n \n
\n
\n
\n
\n \n
\n \n
\n
\n
\n
\n
\n
\n

{{ piranha.resources.texts.emptyAddAbove }}

\n
\n
\n
\n
\n
\n
\n {{ child.meta.name }}\n
\n
\n \n \n \n \n
\n
\n \n
\n
\n
\n
\n'}),Vue.component("block-group-vertical",{props:["uid","toolbar","model"],methods:{collapseItem:function(e){e.meta.isCollapsed=!e.meta.isCollapsed},removeItem:function(e){var t=this.model.items.indexOf(e);this.model.items.splice(t,1)},addGroupBlock:function(e,t){var i=this;fetch(piranha.baseUrl+"manager/api/content/block/"+e).then(function(e){return e.json()}).then(function(e){sortable("#"+i.uid+" .block-group-items","destroy"),i.model.items.splice(t,0,e.body),Vue.nextTick(function(){sortable("#"+i.uid+" .block-group-items",{handle:".handle",items:":not(.unsortable)",placeholderClass:"sortable-placeholder"})[0].addEventListener("sortupdate",function(e){i.moveItem(e.detail.origin.index,e.detail.destination.index)})})}).catch(function(e){console.log("error:",e)})},toggleHeader:function(){this.model.meta.showHeader=!this.model.meta.showHeader},moveItem:function(e,t){this.model.items.splice(t,0,this.model.items.splice(e,1)[0])}},mounted:function(){var e=this;sortable("#"+this.uid+" .block-group-items",{handle:".handle",items:":not(.unsortable)",placeholderClass:"sortable-placeholder"})[0].addEventListener("sortupdate",function(t){e.moveItem(t.detail.origin.index,t.detail.destination.index)})},template:'\n
\n
\n \n
\n
\n
\n
\n \n
\n \n
\n
\n
\n
\n \n
\n \n
\n
\n
\n

{{ piranha.resources.texts.emptyAddAbove }}

\n
\n
\n
\n
\n
\n
\n {{ child.meta.name }}\n
\n
\n \n \n \n \n \n \n \n \n
\n
\n \n
\n \n
\n \n
\n
\n
\n
\n'}),Vue.component("generic-block",{props:["uid","toolbar","model"],methods:{updateTitle:function(e){this.$emit("update-title",{uid:this.uid,title:e.title})}},template:'\n
\n
\n
\n \n
\n \n
\n
\n
\n'}),Vue.component("audio-block",{props:["uid","model"],methods:{clear:function(){},select:function(){null!=this.model.body.media?piranha.mediapicker.open(this.update,"Audio",this.model.body.media.folderId):piranha.mediapicker.openCurrentFolder(this.update,"Audio")},remove:function(){this.model.body.id=null,this.model.body.media=null},update:function(e){"Audio"===e.type?(this.model.body.id=e.id,this.model.body.media=e,this.$emit("update-title",{uid:this.uid,title:this.model.body.media.filename})):console.log("No video was selected")}},computed:{isEmpty:function(){return null==this.model.body.media},mediaUrl:function(){if(null!=this.model.body.media)return piranha.utils.formatUrl(this.model.body.media.publicUrl)}},mounted:function(){this.model.getTitle=function(){return null!=this.model.media?this.model.media.filename:"No audio selected"}},template:'\n
\n \n
\n
\n \n \n
\n
\n
\n  \n
\n
\n {{ model.body.media.filename }}\n
\n
\n
\n
\n'}),Vue.component("html-block",{props:["uid","toolbar","model"],data:function(){return{body:this.model.body.value}},methods:{onBlur:function(e){this.model.body.value=e.target.innerHTML},onChange:function(e){this.model.body.value=e}},computed:{isEmpty:function(){return piranha.utils.isEmptyHtml(this.model.body.value)}},mounted:function(){piranha.editor.addInline(this.uid,this.toolbar,this.onChange)},beforeDestroy:function(){piranha.editor.remove(this.uid)},template:'\n
\n
\n
\n'}),Vue.component("html-column-block",{props:["uid","toolbar","model"],data:function(){return{column1:this.model.column1.value,column2:this.model.column2.value}},methods:{onBlurCol1:function(e){this.model.column1.value=e.target.innerHTML},onBlurCol2:function(e){this.model.column2.value=e.target.innerHTML},onChangeCol1:function(e){this.model.column1.value=e},onChangeCol2:function(e){this.model.column2.value=e}},computed:{isEmpty1:function(){return piranha.utils.isEmptyHtml(this.model.column1.value)},isEmpty2:function(){return piranha.utils.isEmptyHtml(this.model.column2.value)}},mounted:function(){piranha.editor.addInline(this.uid+1,this.toolbar,this.onChangeCol1),piranha.editor.addInline(this.uid+2,this.toolbar,this.onChangeCol2)},beforeDestroy:function(){piranha.editor.remove(this.uid+1),piranha.editor.remove(this.uid+2)},template:'\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n'}),Vue.component("image-block",{props:["uid","model"],methods:{clear:function(){},select:function(){null!=this.model.body.media?piranha.mediapicker.open(this.update,"Image",this.model.body.media.folderId):piranha.mediapicker.openCurrentFolder(this.update,"Image")},remove:function(){this.model.body.id=null,this.model.body.media=null},update:function(e){"Image"===e.type?(this.model.body.id=e.id,this.model.body.media={id:e.id,folderId:e.folderId,type:e.type,filename:e.filename,contentType:e.contentType,publicUrl:e.publicUrl},this.$emit("update-title",{uid:this.uid,title:this.model.body.media.filename})):console.log("No image was selected")},selectAspect:function(e){this.model.aspect.value=e},isAspectSelected(e){return this.model.aspect.value===e}},computed:{isEmpty:function(){return null==this.model.body.media},mediaUrl:function(){return null!=this.model.body.media?piranha.utils.formatUrl(this.model.body.media.publicUrl):piranha.utils.formatUrl("~/manager/assets/img/empty-image.png")},iconUrl:function(){if(this.model.aspect.value>0){if(1===this.model.aspect.value||3===this.model.aspect.value)return piranha.utils.formatUrl("~/manager/assets/img/icons/img-landscape.svg");if(2==this.model.aspect.value)return piranha.utils.formatUrl("~/manager/assets/img/icons/img-portrait.svg");if(4==this.model.aspect.value)return piranha.utils.formatUrl("~/manager/assets/img/icons/img-square.svg")}return null}},mounted:function(){this.model.getTitle=function(){return null!=this.model.media?this.model.media.filename:"No image selected"}},template:'\n
\n \n \n
\n'}),Vue.component("missing-block",{props:["model"],template:'\n\n'}),Vue.component("page-block",{props:["uid","model"],methods:{select:function(){piranha.pagepicker.open(this.update)},remove:function(){this.model.body.id=null,this.model.body.page=null},update:function(e){if(null!==e){var t=this;fetch(piranha.baseUrl+"manager/api/page/info/"+e.id).then(function(e){return e.json()}).then(function(e){t.model.body.id=e.id,t.model.body.page=e,t.$emit("update-title",{uid:t.uid,title:t.model.body.page.title})}).catch(function(e){console.log("error:",e)})}else console.log("No page was selected")}},computed:{isEmpty:function(){return null==this.model.body.page},pageImage:function(){return this.hasPageImage?piranha.baseUrl+"manager/api/media/url/"+this.model.body.page.primaryImage.id+"/446/220":piranha.utils.formatUrl("~/manager/assets/img/empty-image.png")},hasPageImage:function(){return null!==this.model.body.page&&null!==this.model.body.page.primaryImage.media},pageTitle:function(){return this.hasPageTitle?this.model.body.page.title:"Lorem Ipsum"},hasPageTitle:function(){return null!==this.model.body.page},pageExcerpt:function(){return this.hasPageExcerpt?this.model.body.page.excerpt:"Donec id elit non mi porta gravida at eget metus. Cras mattis consectetur purus sit amet fermentum. Integer posuere erat a ante venenatis dapibus posuere velit aliquet."},hasPageExcerpt:function(){return null!==this.model.body.page&&null!==this.model.body.page.excerpt}},mounted:function(){this.model.getTitle=function(){return null!==this.model.body.page?this.model.body.page.title:"No page selected"}},template:'\n
\n
\n
\n \n
\n

{{ pageTitle }}

\n

\n
\n
\n
\n \n \n
\n
\n
\n  \n
\n \n
\n
\n
\n'}),Vue.component("post-block",{props:["uid","model"],methods:{select:function(){piranha.postpicker.open(this.update)},remove:function(){this.model.body.id=null,this.model.body.post=null},update:function(e){if(null!==e){var t=this;fetch(piranha.baseUrl+"manager/api/post/info/"+e.id).then(function(e){return e.json()}).then(function(e){t.model.body.id=e.id,t.model.body.post=e,t.$emit("update-title",{uid:t.uid,title:t.model.body.post.title})}).catch(function(e){console.log("error:",e)})}else console.log("No post was selected")}},computed:{isEmpty:function(){return null==this.model.body.post},postImage:function(){return this.hasPostImage?piranha.baseUrl+"manager/api/media/url/"+this.model.body.post.primaryImage.id+"/446/220":piranha.utils.formatUrl("~/manager/assets/img/empty-image.png")},hasPostImage:function(){return null!==this.model.body.post&&null!==this.model.body.post.primaryImage.media},postTitle:function(){return this.hasPostTitle?this.model.body.post.title:"Lorem Ipsum"},hasPostTitle:function(){return null!==this.model.body.post},postExcerpt:function(){return this.hasPostExcerpt?this.model.body.post.excerpt:"Donec id elit non mi porta gravida at eget metus. Cras mattis consectetur purus sit amet fermentum. Integer posuere erat a ante venenatis dapibus posuere velit aliquet."},hasPostExcerpt:function(){return null!==this.model.body.post&&null!==this.model.body.post.excerpt}},mounted:function(){this.model.getTitle=function(){return null!==this.model.body.post?this.model.body.post.title:"No post selected"}},template:'\n
\n
\n
\n \n
\n

{{ postTitle }}

\n

\n
\n
\n
\n \n \n
\n
\n
\n  \n
\n \n
\n
\n
\n'}),Vue.component("quote-block",{props:["uid","model"],data:function(){return{placeholder:{body:"",author:""}}},methods:{onAuthorBlur:function(e){this.model.author.value=e.target.innerText},onBodyBlur:function(e){this.model.body.value=e.target.innerText;var t=this.model.body.value.replace(/(<([^>]+)>)/gi,"");t.length>40&&(t=t.substring(0,40)+"..."),this.$emit("update-title",{uid:this.uid,title:t})}},created:function(){var e=[{author:"Nelson Mandela",body:"The greatest glory in living lies not in never falling, but in rising every time we fall."},{author:"Walt Disney",body:"The way to get started is to quit talking and begin doing."},{author:"Eleanor Roosevelt",body:"The future belongs to those who believe in the beauty of their dreams."},{author:"John Lennon",body:"Life is what happens when you're busy making other plans."},{author:"Audrey Hepburn",body:"Nothing is impossible, the word itself says, 'I'm possible!'"},{author:"Mark Twain",body:"Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do."},{author:"Maya Angelou",body:"You will face many defeats in life, but never let yourself be defeated."}];this.placeholder=e[Math.floor(Math.random()*e.length)]},template:'\n
\n
\n

\n
\n
\n
\n'}),Vue.component("separator-block",{props:["model"],template:"\n
\n
\n
\n"}),Vue.component("text-block",{props:["uid","model"],methods:{onBlur:function(e){this.model.body.value=e.target.innerHTML;var t=this.model.body.value.replace(/(<([^>]+)>)/gi,"");t.length>40&&(t=t.substring(0,40)+"..."),this.$emit("update-title",{uid:this.uid,title:t})}},computed:{isEmpty:function(){return piranha.utils.isEmptyText(this.model.body.value)}},template:'\n
\n
\n
\n'}),Vue.component("video-block",{props:["uid","model"],methods:{clear:function(){},select:function(){null!=this.model.body.media?piranha.mediapicker.open(this.update,"Video",this.model.body.media.folderId):piranha.mediapicker.openCurrentFolder(this.update,"Video")},remove:function(){this.model.body.id=null,this.model.body.media=null},update:function(e){"Video"===e.type?(this.model.body.id=e.id,this.model.body.media=e,this.$emit("update-title",{uid:this.uid,title:this.model.body.media.filename})):console.log("No video was selected")}},computed:{isEmpty:function(){return null==this.model.body.media},mediaUrl:function(){if(null!=this.model.body.media)return piranha.utils.formatUrl(this.model.body.media.publicUrl)}},mounted:function(){this.model.getTitle=function(){return null!=this.model.media?this.model.media.filename:"No video selected"}},template:'\n
\n \n
\n
\n \n \n
\n
\n
\n  \n
\n
\n {{ model.body.media.filename }}\n
\n
\n
\n
\n'}),Vue.component("audio-field",{props:["uid","model","meta"],methods:{select:function(){null!=this.model.media?piranha.mediapicker.open(this.update,"Audio",this.model.media.folderId):piranha.mediapicker.openCurrentFolder(this.update,"Audio")},remove:function(){this.model.id=null,this.model.media=null},update:function(e){"Audio"===e.type?(this.model.id=e.id,this.model.media={id:e.id,folderId:e.folderId,type:e.type,filename:e.filename,title:e.title,contentType:e.contentType,publicUrl:e.publicUrl},this.meta.notifyChange&&this.$emit("update-title",{uid:this.uid,title:null!=this.model.media.title?this.model.media.title+" ("+this.model.media.filename+")":this.model.media.filename})):console.log("No audio was selected")}},computed:{isEmpty:function(){return null==this.model.media}},mounted:function(){this.model.getTitle=function(){return null!=this.model.media?null!=this.model.media.title?this.model.media.title+" ("+this.model.media.filename+")":this.model.media.filename:"No audio selected"}},template:'\n
\n
\n
\n \n \n
\n
\n
\n {{ meta.placeholder }}\n  \n
\n \n \n
\n
\n
\n'}),Vue.component("checkbox-field",{props:["uid","model","meta"],template:'\n
\n \n \n
\n'}),Vue.component("data-select-field",{props:["uid","model","meta"],methods:{update:function(){this.meta.notifyChange&&this.$emit("update-title",{uid:this.uid,title:this.model.items.$values[this.model.id]})}},template:'\n\n'}),Vue.component("date-field",{props:["uid","model","meta"],components:{datepicker:vuejsDatepicker},methods:{onClosed:function(){var e=this.model.value,t=e.getFullYear()+"-"+(e.getMonth()<9?"0":"")+(e.getMonth()+1)+"-"+(e.getDate()<10?"0":"")+e.getDate();this.model.value=t,this.meta.notifyChange&&this.$emit("update-title",{uid:this.uid,title:this.model.value})}},created:function(){this._options={bootstrapStyling:!0,mondayFirst:!0,format:"yyyy-MM-dd",typeable:!0}},template:'\n\n'}),Vue.component("document-field",{props:["uid","model","meta"],methods:{select:function(){null!=this.model.media?piranha.mediapicker.open(this.update,"Document",this.model.media.folderId):piranha.mediapicker.openCurrentFolder(this.update,"Document")},remove:function(){this.model.id=null,this.model.media=null},update:function(e){"Document"===e.type?(this.model.id=e.id,this.model.media={id:e.id,folderId:e.folderId,type:e.type,filename:e.filename,title:e.title,contentType:e.contentType,publicUrl:e.publicUrl},this.meta.notifyChange&&this.$emit("update-title",{uid:this.uid,title:null!=this.model.media.title?this.model.media.title+" ("+this.model.media.filename+")":this.model.media.filename})):console.log("No document was selected")}},computed:{isEmpty:function(){return null==this.model.media}},mounted:function(){this.model.getTitle=function(){return null!=this.model.media?null!=this.model.media.title?this.model.media.title+" ("+this.model.media.filename+")":this.model.media.filename:"No document selected"}},template:'\n
\n
\n
\n \n \n
\n
\n
\n {{ meta.placeholder }}\n  \n
\n \n \n
\n
\n
\n'}),Vue.component("html-field",{props:["uid","toolbar","model","meta"],data:function(){return{body:this.model.value}},methods:{onBlur:function(e){if(this.model.value=tinyMCE.activeEditor.getContent(),this.meta.notifyChange){var t=this.model.value.replace(/(<([^>]+)>)/gi,"");t.length>40&&(t=t.substring(0,40)+"..."),this.$emit("update-title",{uid:this.uid,title:t})}},onChange:function(e){if(this.model.value=e,this.meta.notifyChange){var t=this.model.value.replace(/(<([^>]+)>)/gi,"");t.length>40&&(t=t.substring(0,40)+"..."),this.meta.notifyChange&&this.$emit("update-title",{uid:this.uid,title:t})}}},computed:{isEmpty:function(){return piranha.utils.isEmptyHtml(this.model.value)}},mounted:function(){piranha.editor.addInline(this.uid,this.toolbar,this.onChange)},beforeDestroy:function(){piranha.editor.remove(this.uid)},template:'\n
\n
\n
\n'}),Vue.component("image-field",{props:["uid","model","meta"],methods:{select:function(){null!=this.model.media?piranha.mediapicker.open(this.update,"Image",this.model.media.folderId):piranha.mediapicker.openCurrentFolder(this.update,"Image")},remove:function(){this.model.id=null,this.model.media=null},update:function(e){"Image"===e.type?(this.model.id=e.id,this.model.media={id:e.id,folderId:e.folderId,type:e.type,filename:e.filename,title:e.title,contentType:e.contentType,publicUrl:e.publicUrl},this.meta.notifyChange&&this.$emit("update-title",{uid:this.uid,title:null!=this.model.media.title?this.model.media.title+" ("+this.model.media.filename+")":this.model.media.filename})):console.log("No image was selected")}},computed:{isEmpty:function(){return null==this.model.media}},mounted:function(){this.model.getTitle=function(){return null!=this.model.media?null!=this.model.media.title?this.model.media.title+" ("+this.model.media.filename+")":this.model.media.filename:"No image selected"}},template:'\n
\n
\n
\n \n \n
\n
\n
\n {{ meta.placeholder }}\n  \n
\n \n \n
\n
\n
\n'}),Vue.component("markdown-field",{props:["uid","model","meta"],data:function(){return{body:this.model.value}},methods:{update:function(e){if(this.model.value=e,this.meta.notifyChange){var t=this.model.value;t.length>40&&(t=t.substring(0,40)+"..."),this.$emit("update-title",{uid:this.uid,title:t})}}},computed:{isEmpty:function(){return null==this.model.value||""===this.model.value}},mounted:function(){piranha.editor.addInlineMarkdown(this.uid,this.model.value,this.update)},beforeDestroy:function(){piranha.editor.remove(this.uid)},template:'\n
\n \n
\n
\n'}),Vue.component("media-field",{props:["uid","model","meta"],methods:{select:function(){null!=this.model.media?piranha.mediapicker.open(this.update,null,this.model.media.folderId):piranha.mediapicker.openCurrentFolder(this.update,null)},remove:function(){this.model.id=null,this.model.media=null},update:function(e){this.model.id=e.id,this.model.media={id:e.id,folderId:e.folderId,type:e.type,filename:e.filename,title:e.title,contentType:e.contentType,publicUrl:e.publicUrl},this.meta.notifyChange&&this.$emit("update-title",{uid:this.uid,title:null!=this.model.media.title?this.model.media.title+" ("+this.model.media.filename+")":this.model.media.filename})}},computed:{isEmpty:function(){return null==this.model.media}},mounted:function(){this.model.getTitle=function(){return null!=this.model.media?null!=this.model.media.title?this.model.media.title+" ("+this.model.media.filename+")":this.model.media.filename:"No media selected"}},template:'\n
\n
\n
\n \n \n
\n
\n
\n {{ meta.placeholder }}\n  \n
\n \n \n
\n
\n
\n'}),Vue.component("missing-field",{props:["meta","model"],template:'\n\n'}),Vue.component("number-field",{props:["uid","model","meta"],template:'\n\n'}),Vue.component("page-field",{props:["uid","model","meta"],methods:{select:function(){var e=null;this.model.page?e=this.model.page.siteId:piranha.pageedit&&(e=piranha.pageedit.siteId),piranha.pagepicker.open(this.update,e)},remove:function(){this.model.id=null,this.model.page=null},update:function(e){this.model.id=e.id,this.model.page=e,this.meta.notifyChange&&this.$emit("update-title",{uid:this.uid,title:this.model.page.title})}},computed:{isEmpty:function(){return null==this.model.page}},mounted:function(){this.model.getTitle=function(){return null!=this.model.page?this.model.page.title:"No page selected"}},template:'\n
\n
\n
\n \n \n
\n
\n
\n {{ meta.placeholder }}\n  \n
\n \n
\n
\n
\n'}),Vue.component("post-field",{props:["uid","model","meta"],methods:{select:function(){piranha.postpicker.open(this.update)},remove:function(){this.model.id=null,this.model.post=null},update:function(e){this.model.id=e.id,this.model.post=e,this.meta.notifyChange&&this.$emit("update-title",{uid:this.uid,title:this.model.post.title})}},computed:{isEmpty:function(){return null==this.model.post}},mounted:function(){this.model.getTitle=function(){return null!=this.model.post?this.model.post.title:"No post selected"}},template:'\n
\n
\n
\n \n \n
\n
\n
\n {{ meta.placeholder }}\n  \n
\n \n
\n
\n
\n'}),Vue.component("readonly-field",{props:["uid","model","meta"],template:'\n
\n
{{ model.value }}
\n
\n'}),Vue.component("select-field",{props:["uid","model","meta"],methods:{update:function(){this.meta.notifyChange&&this.$emit("update-title",{uid:this.uid,title:this.meta.options[this.model.value]})}},template:'\n\n'}),Vue.component("string-field",{props:["uid","model","meta"],methods:{update:function(){this.meta.notifyChange&&this.$emit("update-title",{uid:this.uid,title:this.model.value})}},template:'\n\n'}),Vue.component("text-field",{props:["uid","model","meta"],methods:{update:function(){if(this.meta.notifyChange){var e=this.model.value;e.length>40&&(e=e.substring(0,40)+"..."),this.$emit("update-title",{uid:this.uid,title:e})}}},template:'\n\n'}),Vue.component("video-field",{props:["uid","model","meta"],methods:{clear:function(){},select:function(){null!=this.model.media?piranha.mediapicker.open(this.update,"Video",this.model.media.folderId):piranha.mediapicker.openCurrentFolder(this.update,"Video")},remove:function(){this.model.id=null,this.model.media=null},update:function(e){"Video"===e.type?(this.model.id=e.id,this.model.media={id:e.id,folderId:e.folderId,type:e.type,filename:e.filename,title:e.title,contentType:e.contentType,publicUrl:e.publicUrl},this.meta.notifyChange&&this.$emit("update-title",{uid:this.uid,title:null!=this.model.media.title?this.model.media.title+" ("+this.model.media.filename+")":this.model.media.filename})):console.log("No video was selected")}},computed:{isEmpty:function(){return null==this.model.media}},mounted:function(){this.model.getTitle=function(){return null!=this.model.media?null!=this.model.media.title?this.model.media.title+" ("+this.model.media.filename+")":this.model.media.filename:"No video selected"}},template:'\n
\n
\n
\n \n \n
\n
\n
\n {{ meta.placeholder }}\n  \n
\n \n \n
\n
\n
\n'}); \ No newline at end of file +Vue.component("region",{props:["model","content","type"],data:function(){return{itemAdded:!1}},methods:{moveItem:function(e,t){this.model.items.splice(t,0,this.model.items.splice(e,1)[0])},addItem:function(){var e=this;fetch(piranha.baseUrl+"manager/api/content/region/"+this.content+"/"+this.type+"/"+this.model.meta.id).then(function(e){return e.json()}).then(function(t){e.model.items.push(t),e.itemAdded=!0}).catch(function(e){console.log("error:",e)})},removeItem:function(e){this.model.items.splice(this.model.items.indexOf(e),1)},updateTitle:function(e){if(this.model.meta.isCollection)for(var t=0;t\n
\n
\n
\n
\n \n
\n
\n
\n \n
\n
\n\n
\n
\n
\n
\n
\n
\n \n
\n
\n
\n
\n \n
\n
\n
\n \n
\n
\n
\n
\n
\n
\n
\n \n
\n \n
\n
\n

{{ piranha.resources.texts.emptyAddAbove }}

\n
\n
\n'}),Vue.component("post-archive",{props:["uid","id"],data:function(){return{items:[],categories:[],postTypes:[],totalPosts:0,totalPages:0,index:0,status:"all",category:piranha.resources.texts.allCategories}},methods:{load:function(e){var t=this;e||(e=0),fetch(piranha.baseUrl+"manager/api/post/list/"+t.id+"/"+e).then(function(e){return e.json()}).then(function(e){t.items=e.posts,t.categories=e.categories,t.postTypes=e.postTypes,t.totalPosts=e.totalPosts,t.totalPages=e.totalPages,t.index=e.index}).catch(function(e){console.log("error:",e)})},remove:function(e){var t=this;piranha.alert.open({title:piranha.resources.texts.delete,body:piranha.resources.texts.deletePostConfirm,confirmCss:"btn-danger",confirmIcon:"fas fa-trash",confirmText:piranha.resources.texts.delete,onConfirm:function(){fetch(piranha.baseUrl+"manager/api/post/delete/"+e).then(function(e){return e.json()}).then(function(e){piranha.notifications.push(e),t.load()}).catch(function(e){console.log("error:",e)})}})},first:function(){this.hasPrev()&&this.load(0)},prev:function(){this.hasPrev()&&this.load(this.index-1)},next:function(){this.hasNext()&&this.load(this.index+1)},last:function(){this.hasNext()&&this.load(this.totalPages-1)},hasPrev:function(){return this.index>0},hasNext:function(){return this.index\n
\n
\n \n \n \n
\n
\n \n \n
\n \n
\n \n \n
\n {{ piranha.resources.texts.add }}\n
\n \n \n \n \n \n \n \n \n \n
\n {{ post.title }}\n | {{ post.published }}\n | Unpublished\n {{ piranha.resources.texts.draft }}\n {{ piranha.resources.texts.scheduled }}\n \n {{ post.typeName }}\n \n {{ post.category }}\n \n \n
\n
\n

Looks like there\'s no posts here. Click on the Add button above to get started!

\n
\n \n\n'}),Vue.component("block-group",{props:["uid","toolbar","model"],methods:{selectItem:function(e){for(var t=0;t\n
\n \n
\n
\n
\n
\n \n
\n \n
\n
\n
\n
\n
\n \n \n
\n
\n
\n

{{ piranha.resources.texts.emptyAddLeft }}

\n
\n \n
\n
\n\n'}),Vue.component("block-group-horizontal",{props:["uid","toolbar","model"],methods:{removeItem:function(e){var t=this.model.items.indexOf(e);this.model.items.splice(t,1)},addGroupBlock:function(e,t){var i=this;fetch(piranha.baseUrl+"manager/api/content/block/"+e).then(function(e){return e.json()}).then(function(e){sortable("#"+i.uid+" .block-group-items","destroy"),i.model.items.push(e.body),Vue.nextTick(function(){sortable("#"+i.uid+" .block-group-items",{handle:".handle",items:":not(.unsortable)",placeholderClass:"col sortable-placeholder"})[0].addEventListener("sortupdate",function(e){i.moveItem(e.detail.origin.index,e.detail.destination.index)})})}).catch(function(e){console.log("error:",e)})},toggleHeader:function(){this.model.meta.showHeader=!this.model.meta.showHeader},moveItem:function(e,t){this.model.items.splice(t,0,this.model.items.splice(e,1)[0])}},mounted:function(){var e=this;sortable("#"+this.uid+" .block-group-items",{handle:".handle",items:":not(.unsortable)",placeholderClass:"col sortable-placeholder"})[0].addEventListener("sortupdate",function(t){e.moveItem(t.detail.origin.index,t.detail.destination.index)})},template:'\n
\n
\n \n \n
\n
\n
\n
\n \n
\n \n
\n
\n
\n
\n
\n
\n

{{ piranha.resources.texts.emptyAddAbove }}

\n
\n
\n
\n
\n
\n
\n {{ child.meta.name }}\n
\n
\n \n \n \n \n
\n
\n \n
\n
\n
\n
\n'}),Vue.component("block-group-vertical",{props:["uid","toolbar","model"],methods:{collapseItem:function(e){e.meta.isCollapsed=!e.meta.isCollapsed},removeItem:function(e){var t=this.model.items.indexOf(e);this.model.items.splice(t,1)},addGroupBlock:function(e,t){var i=this;fetch(piranha.baseUrl+"manager/api/content/block/"+e).then(function(e){return e.json()}).then(function(e){sortable("#"+i.uid+" .block-group-items","destroy"),i.model.items.splice(t,0,e.body),Vue.nextTick(function(){sortable("#"+i.uid+" .block-group-items",{handle:".handle",items:":not(.unsortable)",placeholderClass:"sortable-placeholder"})[0].addEventListener("sortupdate",function(e){i.moveItem(e.detail.origin.index,e.detail.destination.index)})})}).catch(function(e){console.log("error:",e)})},toggleHeader:function(){this.model.meta.showHeader=!this.model.meta.showHeader},moveItem:function(e,t){this.model.items.splice(t,0,this.model.items.splice(e,1)[0])}},mounted:function(){var e=this;sortable("#"+this.uid+" .block-group-items",{handle:".handle",items:":not(.unsortable)",placeholderClass:"sortable-placeholder"})[0].addEventListener("sortupdate",function(t){e.moveItem(t.detail.origin.index,t.detail.destination.index)})},template:'\n
\n
\n \n
\n
\n
\n
\n \n
\n \n
\n
\n
\n
\n \n
\n \n
\n
\n
\n

{{ piranha.resources.texts.emptyAddAbove }}

\n
\n
\n
\n
\n
\n
\n {{ child.meta.name }}\n
\n
\n \n \n \n \n \n \n \n \n
\n
\n \n
\n \n
\n \n
\n
\n
\n
\n'}),Vue.component("generic-block",{props:["uid","toolbar","model"],methods:{updateTitle:function(e){this.$emit("update-title",{uid:this.uid,title:e.title})}},template:'\n
\n
\n
\n \n
\n \n
\n
\n
\n'}),Vue.component("audio-block",{props:["uid","model"],methods:{clear:function(){},select:function(){null!=this.model.body.media?piranha.mediapicker.open(this.update,"Audio",this.model.body.media.folderId):piranha.mediapicker.openCurrentFolder(this.update,"Audio")},remove:function(){this.model.body.id=null,this.model.body.media=null},update:function(e){"Audio"===e.type?(this.model.body.id=e.id,this.model.body.media={id:e.id,folderId:e.folderId,type:e.type,filename:e.filename,contentType:e.contentType,publicUrl:e.publicUrl},this.$emit("update-title",{uid:this.uid,title:this.model.body.media.filename})):console.log("No video was selected")}},computed:{isEmpty:function(){return null==this.model.body.media},mediaUrl:function(){if(null!=this.model.body.media)return piranha.utils.formatUrl(this.model.body.media.publicUrl)}},mounted:function(){this.model.getTitle=function(){return null!=this.model.media?this.model.media.filename:"No audio selected"}},template:'\n
\n \n
\n
\n \n \n
\n
\n
\n  \n
\n
\n {{ model.body.media.filename }}\n
\n
\n
\n
\n'}),Vue.component("html-block",{props:["uid","toolbar","model"],data:function(){return{body:this.model.body.value}},methods:{onBlur:function(e){this.model.body.value=e.target.innerHTML},onChange:function(e){this.model.body.value=e}},computed:{isEmpty:function(){return piranha.utils.isEmptyHtml(this.model.body.value)}},mounted:function(){piranha.editor.addInline(this.uid,this.toolbar,this.onChange)},beforeDestroy:function(){piranha.editor.remove(this.uid)},template:'\n
\n
\n
\n'}),Vue.component("html-column-block",{props:["uid","toolbar","model"],data:function(){return{column1:this.model.column1.value,column2:this.model.column2.value}},methods:{onBlurCol1:function(e){this.model.column1.value=e.target.innerHTML},onBlurCol2:function(e){this.model.column2.value=e.target.innerHTML},onChangeCol1:function(e){this.model.column1.value=e},onChangeCol2:function(e){this.model.column2.value=e}},computed:{isEmpty1:function(){return piranha.utils.isEmptyHtml(this.model.column1.value)},isEmpty2:function(){return piranha.utils.isEmptyHtml(this.model.column2.value)}},mounted:function(){piranha.editor.addInline(this.uid+1,this.toolbar,this.onChangeCol1),piranha.editor.addInline(this.uid+2,this.toolbar,this.onChangeCol2)},beforeDestroy:function(){piranha.editor.remove(this.uid+1),piranha.editor.remove(this.uid+2)},template:'\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n'}),Vue.component("image-block",{props:["uid","model"],methods:{clear:function(){},select:function(){null!=this.model.body.media?piranha.mediapicker.open(this.update,"Image",this.model.body.media.folderId):piranha.mediapicker.openCurrentFolder(this.update,"Image")},remove:function(){this.model.body.id=null,this.model.body.media=null},update:function(e){"Image"===e.type?(this.model.body.id=e.id,this.model.body.media={id:e.id,folderId:e.folderId,type:e.type,filename:e.filename,contentType:e.contentType,publicUrl:e.publicUrl},this.$emit("update-title",{uid:this.uid,title:this.model.body.media.filename})):console.log("No image was selected")},selectAspect:function(e){this.model.aspect.value=e},isAspectSelected(e){return this.model.aspect.value===e}},computed:{isEmpty:function(){return null==this.model.body.media},mediaUrl:function(){return null!=this.model.body.media?piranha.utils.formatUrl(this.model.body.media.publicUrl):piranha.utils.formatUrl("~/manager/assets/img/empty-image.png")},iconUrl:function(){if(this.model.aspect.value>0){if(1===this.model.aspect.value||3===this.model.aspect.value)return piranha.utils.formatUrl("~/manager/assets/img/icons/img-landscape.svg");if(2==this.model.aspect.value)return piranha.utils.formatUrl("~/manager/assets/img/icons/img-portrait.svg");if(4==this.model.aspect.value)return piranha.utils.formatUrl("~/manager/assets/img/icons/img-square.svg")}return null}},mounted:function(){this.model.getTitle=function(){return null!=this.model.media?this.model.media.filename:"No image selected"}},template:'\n
\n \n \n
\n'}),Vue.component("missing-block",{props:["model"],template:'\n\n'}),Vue.component("page-block",{props:["uid","model"],methods:{select:function(){piranha.pagepicker.open(this.update)},remove:function(){this.model.body.id=null,this.model.body.page=null},update:function(e){if(null!==e){var t=this;fetch(piranha.baseUrl+"manager/api/page/info/"+e.id).then(function(e){return e.json()}).then(function(e){t.model.body.id=e.id,t.model.body.page=e,t.$emit("update-title",{uid:t.uid,title:t.model.body.page.title})}).catch(function(e){console.log("error:",e)})}else console.log("No page was selected")}},computed:{isEmpty:function(){return null==this.model.body.page},pageImage:function(){return this.hasPageImage?piranha.baseUrl+"manager/api/media/url/"+this.model.body.page.primaryImage.id+"/446/220":piranha.utils.formatUrl("~/manager/assets/img/empty-image.png")},hasPageImage:function(){return null!==this.model.body.page&&null!==this.model.body.page.primaryImage.media},pageTitle:function(){return this.hasPageTitle?this.model.body.page.title:"Lorem Ipsum"},hasPageTitle:function(){return null!==this.model.body.page},pageExcerpt:function(){return this.hasPageExcerpt?this.model.body.page.excerpt:"Donec id elit non mi porta gravida at eget metus. Cras mattis consectetur purus sit amet fermentum. Integer posuere erat a ante venenatis dapibus posuere velit aliquet."},hasPageExcerpt:function(){return null!==this.model.body.page&&null!==this.model.body.page.excerpt}},mounted:function(){this.model.getTitle=function(){return null!==this.model.body.page?this.model.body.page.title:"No page selected"}},template:'\n
\n
\n
\n \n
\n

{{ pageTitle }}

\n

\n
\n
\n
\n \n \n
\n
\n
\n  \n
\n \n
\n
\n
\n'}),Vue.component("post-block",{props:["uid","model"],methods:{select:function(){piranha.postpicker.open(this.update)},remove:function(){this.model.body.id=null,this.model.body.post=null},update:function(e){if(null!==e){var t=this;fetch(piranha.baseUrl+"manager/api/post/info/"+e.id).then(function(e){return e.json()}).then(function(e){t.model.body.id=e.id,t.model.body.post=e,t.$emit("update-title",{uid:t.uid,title:t.model.body.post.title})}).catch(function(e){console.log("error:",e)})}else console.log("No post was selected")}},computed:{isEmpty:function(){return null==this.model.body.post},postImage:function(){return this.hasPostImage?piranha.baseUrl+"manager/api/media/url/"+this.model.body.post.primaryImage.id+"/446/220":piranha.utils.formatUrl("~/manager/assets/img/empty-image.png")},hasPostImage:function(){return null!==this.model.body.post&&null!==this.model.body.post.primaryImage.media},postTitle:function(){return this.hasPostTitle?this.model.body.post.title:"Lorem Ipsum"},hasPostTitle:function(){return null!==this.model.body.post},postExcerpt:function(){return this.hasPostExcerpt?this.model.body.post.excerpt:"Donec id elit non mi porta gravida at eget metus. Cras mattis consectetur purus sit amet fermentum. Integer posuere erat a ante venenatis dapibus posuere velit aliquet."},hasPostExcerpt:function(){return null!==this.model.body.post&&null!==this.model.body.post.excerpt}},mounted:function(){this.model.getTitle=function(){return null!==this.model.body.post?this.model.body.post.title:"No post selected"}},template:'\n
\n
\n
\n \n
\n

{{ postTitle }}

\n

\n
\n
\n
\n \n \n
\n
\n
\n  \n
\n \n
\n
\n
\n'}),Vue.component("quote-block",{props:["uid","model"],data:function(){return{placeholder:{body:"",author:""}}},methods:{onAuthorBlur:function(e){this.model.author.value=e.target.innerText},onBodyBlur:function(e){this.model.body.value=e.target.innerText;var t=this.model.body.value.replace(/(<([^>]+)>)/gi,"");t.length>40&&(t=t.substring(0,40)+"..."),this.$emit("update-title",{uid:this.uid,title:t})}},created:function(){var e=[{author:"Nelson Mandela",body:"The greatest glory in living lies not in never falling, but in rising every time we fall."},{author:"Walt Disney",body:"The way to get started is to quit talking and begin doing."},{author:"Eleanor Roosevelt",body:"The future belongs to those who believe in the beauty of their dreams."},{author:"John Lennon",body:"Life is what happens when you're busy making other plans."},{author:"Audrey Hepburn",body:"Nothing is impossible, the word itself says, 'I'm possible!'"},{author:"Mark Twain",body:"Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do."},{author:"Maya Angelou",body:"You will face many defeats in life, but never let yourself be defeated."}];this.placeholder=e[Math.floor(Math.random()*e.length)]},template:'\n
\n
\n

\n
\n
\n
\n'}),Vue.component("separator-block",{props:["model"],template:"\n
\n
\n
\n"}),Vue.component("text-block",{props:["uid","model"],methods:{onBlur:function(e){this.model.body.value=e.target.innerHTML;var t=this.model.body.value.replace(/(<([^>]+)>)/gi,"");t.length>40&&(t=t.substring(0,40)+"..."),this.$emit("update-title",{uid:this.uid,title:t})}},computed:{isEmpty:function(){return piranha.utils.isEmptyText(this.model.body.value)}},template:'\n
\n
\n
\n'}),Vue.component("video-block",{props:["uid","model"],methods:{clear:function(){},select:function(){null!=this.model.body.media?piranha.mediapicker.open(this.update,"Video",this.model.body.media.folderId):piranha.mediapicker.openCurrentFolder(this.update,"Video")},remove:function(){this.model.body.id=null,this.model.body.media=null},update:function(e){"Video"===e.type?(this.model.body.id=e.id,this.model.body.media={id:e.id,folderId:e.folderId,type:e.type,filename:e.filename,contentType:e.contentType,publicUrl:e.publicUrl},this.$emit("update-title",{uid:this.uid,title:this.model.body.media.filename})):console.log("No video was selected")}},computed:{isEmpty:function(){return null==this.model.body.media},mediaUrl:function(){if(null!=this.model.body.media)return piranha.utils.formatUrl(this.model.body.media.publicUrl)}},mounted:function(){this.model.getTitle=function(){return null!=this.model.media?this.model.media.filename:"No video selected"}},template:'\n
\n \n
\n
\n \n \n
\n
\n
\n  \n
\n
\n {{ model.body.media.filename }}\n
\n
\n
\n
\n'}),Vue.component("audio-field",{props:["uid","model","meta"],methods:{select:function(){null!=this.model.media?piranha.mediapicker.open(this.update,"Audio",this.model.media.folderId):piranha.mediapicker.openCurrentFolder(this.update,"Audio")},remove:function(){this.model.id=null,this.model.media=null},update:function(e){"Audio"===e.type?(this.model.id=e.id,this.model.media={id:e.id,folderId:e.folderId,type:e.type,filename:e.filename,title:e.title,contentType:e.contentType,publicUrl:e.publicUrl},this.meta.notifyChange&&this.$emit("update-title",{uid:this.uid,title:null!=this.model.media.title?this.model.media.title+" ("+this.model.media.filename+")":this.model.media.filename})):console.log("No audio was selected")}},computed:{isEmpty:function(){return null==this.model.media}},mounted:function(){this.model.getTitle=function(){return null!=this.model.media?null!=this.model.media.title?this.model.media.title+" ("+this.model.media.filename+")":this.model.media.filename:"No audio selected"}},template:'\n
\n
\n
\n \n \n
\n
\n
\n {{ meta.placeholder }}\n  \n
\n \n \n
\n
\n
\n'}),Vue.component("checkbox-field",{props:["uid","model","meta"],template:'\n
\n \n \n
\n'}),Vue.component("data-select-field",{props:["uid","model","meta"],methods:{update:function(){this.meta.notifyChange&&this.$emit("update-title",{uid:this.uid,title:this.model.items.$values[this.model.id]})}},template:'\n\n'}),Vue.component("date-field",{props:["uid","model","meta"],components:{datepicker:vuejsDatepicker},methods:{onClosed:function(){var e=this.model.value,t=e.getFullYear()+"-"+(e.getMonth()<9?"0":"")+(e.getMonth()+1)+"-"+(e.getDate()<10?"0":"")+e.getDate();this.model.value=t,this.meta.notifyChange&&this.$emit("update-title",{uid:this.uid,title:this.model.value})}},created:function(){this._options={bootstrapStyling:!0,mondayFirst:!0,format:"yyyy-MM-dd",typeable:!0}},template:'\n\n'}),Vue.component("document-field",{props:["uid","model","meta"],methods:{select:function(){null!=this.model.media?piranha.mediapicker.open(this.update,"Document",this.model.media.folderId):piranha.mediapicker.openCurrentFolder(this.update,"Document")},remove:function(){this.model.id=null,this.model.media=null},update:function(e){"Document"===e.type?(this.model.id=e.id,this.model.media={id:e.id,folderId:e.folderId,type:e.type,filename:e.filename,title:e.title,contentType:e.contentType,publicUrl:e.publicUrl},this.meta.notifyChange&&this.$emit("update-title",{uid:this.uid,title:null!=this.model.media.title?this.model.media.title+" ("+this.model.media.filename+")":this.model.media.filename})):console.log("No document was selected")}},computed:{isEmpty:function(){return null==this.model.media}},mounted:function(){this.model.getTitle=function(){return null!=this.model.media?null!=this.model.media.title?this.model.media.title+" ("+this.model.media.filename+")":this.model.media.filename:"No document selected"}},template:'\n
\n
\n
\n \n \n
\n
\n
\n {{ meta.placeholder }}\n  \n
\n \n \n
\n
\n
\n'}),Vue.component("html-field",{props:["uid","toolbar","model","meta"],data:function(){return{body:this.model.value}},methods:{onBlur:function(e){if(this.model.value=tinyMCE.activeEditor.getContent(),this.meta.notifyChange){var t=this.model.value.replace(/(<([^>]+)>)/gi,"");t.length>40&&(t=t.substring(0,40)+"..."),this.$emit("update-title",{uid:this.uid,title:t})}},onChange:function(e){if(this.model.value=e,this.meta.notifyChange){var t=this.model.value.replace(/(<([^>]+)>)/gi,"");t.length>40&&(t=t.substring(0,40)+"..."),this.meta.notifyChange&&this.$emit("update-title",{uid:this.uid,title:t})}}},computed:{isEmpty:function(){return piranha.utils.isEmptyHtml(this.model.value)}},mounted:function(){piranha.editor.addInline(this.uid,this.toolbar,this.onChange)},beforeDestroy:function(){piranha.editor.remove(this.uid)},template:'\n
\n
\n
\n'}),Vue.component("image-field",{props:["uid","model","meta"],methods:{select:function(){null!=this.model.media?piranha.mediapicker.open(this.update,"Image",this.model.media.folderId):piranha.mediapicker.openCurrentFolder(this.update,"Image")},remove:function(){this.model.id=null,this.model.media=null},update:function(e){"Image"===e.type?(this.model.id=e.id,this.model.media={id:e.id,folderId:e.folderId,type:e.type,filename:e.filename,title:e.title,contentType:e.contentType,publicUrl:e.publicUrl},this.meta.notifyChange&&this.$emit("update-title",{uid:this.uid,title:null!=this.model.media.title?this.model.media.title+" ("+this.model.media.filename+")":this.model.media.filename})):console.log("No image was selected")}},computed:{isEmpty:function(){return null==this.model.media}},mounted:function(){this.model.getTitle=function(){return null!=this.model.media?null!=this.model.media.title?this.model.media.title+" ("+this.model.media.filename+")":this.model.media.filename:"No image selected"}},template:'\n
\n
\n
\n \n \n
\n
\n
\n {{ meta.placeholder }}\n  \n
\n \n \n
\n
\n
\n'}),Vue.component("markdown-field",{props:["uid","model","meta"],data:function(){return{body:this.model.value}},methods:{update:function(e){if(this.model.value=e,this.meta.notifyChange){var t=this.model.value;t.length>40&&(t=t.substring(0,40)+"..."),this.$emit("update-title",{uid:this.uid,title:t})}}},computed:{isEmpty:function(){return null==this.model.value||""===this.model.value}},mounted:function(){piranha.editor.addInlineMarkdown(this.uid,this.model.value,this.update)},beforeDestroy:function(){piranha.editor.remove(this.uid)},template:'\n
\n \n
\n
\n'}),Vue.component("media-field",{props:["uid","model","meta"],methods:{select:function(){null!=this.model.media?piranha.mediapicker.open(this.update,null,this.model.media.folderId):piranha.mediapicker.openCurrentFolder(this.update,null)},remove:function(){this.model.id=null,this.model.media=null},update:function(e){this.model.id=e.id,this.model.media={id:e.id,folderId:e.folderId,type:e.type,filename:e.filename,title:e.title,contentType:e.contentType,publicUrl:e.publicUrl},this.meta.notifyChange&&this.$emit("update-title",{uid:this.uid,title:null!=this.model.media.title?this.model.media.title+" ("+this.model.media.filename+")":this.model.media.filename})}},computed:{isEmpty:function(){return null==this.model.media}},mounted:function(){this.model.getTitle=function(){return null!=this.model.media?null!=this.model.media.title?this.model.media.title+" ("+this.model.media.filename+")":this.model.media.filename:"No media selected"}},template:'\n
\n
\n
\n \n \n
\n
\n
\n {{ meta.placeholder }}\n  \n
\n \n \n
\n
\n
\n'}),Vue.component("missing-field",{props:["meta","model"],template:'\n\n'}),Vue.component("number-field",{props:["uid","model","meta"],template:'\n\n'}),Vue.component("page-field",{props:["uid","model","meta"],methods:{select:function(){var e=null;this.model.page?e=this.model.page.siteId:piranha.pageedit&&(e=piranha.pageedit.siteId),piranha.pagepicker.open(this.update,e)},remove:function(){this.model.id=null,this.model.page=null},update:function(e){this.model.id=e.id,this.model.page=e,this.meta.notifyChange&&this.$emit("update-title",{uid:this.uid,title:this.model.page.title})}},computed:{isEmpty:function(){return null==this.model.page}},mounted:function(){this.model.getTitle=function(){return null!=this.model.page?this.model.page.title:"No page selected"}},template:'\n
\n
\n
\n \n \n
\n
\n
\n {{ meta.placeholder }}\n  \n
\n \n
\n
\n
\n'}),Vue.component("post-field",{props:["uid","model","meta"],methods:{select:function(){piranha.postpicker.open(this.update)},remove:function(){this.model.id=null,this.model.post=null},update:function(e){this.model.id=e.id,this.model.post=e,this.meta.notifyChange&&this.$emit("update-title",{uid:this.uid,title:this.model.post.title})}},computed:{isEmpty:function(){return null==this.model.post}},mounted:function(){this.model.getTitle=function(){return null!=this.model.post?this.model.post.title:"No post selected"}},template:'\n
\n
\n
\n \n \n
\n
\n
\n {{ meta.placeholder }}\n  \n
\n \n
\n
\n
\n'}),Vue.component("readonly-field",{props:["uid","model","meta"],template:'\n
\n
{{ model.value }}
\n
\n'}),Vue.component("select-field",{props:["uid","model","meta"],methods:{update:function(){this.meta.notifyChange&&this.$emit("update-title",{uid:this.uid,title:this.meta.options[this.model.value]})}},template:'\n\n'}),Vue.component("string-field",{props:["uid","model","meta"],methods:{update:function(){this.meta.notifyChange&&this.$emit("update-title",{uid:this.uid,title:this.model.value})}},template:'\n\n'}),Vue.component("text-field",{props:["uid","model","meta"],methods:{update:function(){if(this.meta.notifyChange){var e=this.model.value;e.length>40&&(e=e.substring(0,40)+"..."),this.$emit("update-title",{uid:this.uid,title:e})}}},template:'\n\n'}),Vue.component("video-field",{props:["uid","model","meta"],methods:{clear:function(){},select:function(){null!=this.model.media?piranha.mediapicker.open(this.update,"Video",this.model.media.folderId):piranha.mediapicker.openCurrentFolder(this.update,"Video")},remove:function(){this.model.id=null,this.model.media=null},update:function(e){"Video"===e.type?(this.model.id=e.id,this.model.media={id:e.id,folderId:e.folderId,type:e.type,filename:e.filename,title:e.title,contentType:e.contentType,publicUrl:e.publicUrl},this.meta.notifyChange&&this.$emit("update-title",{uid:this.uid,title:null!=this.model.media.title?this.model.media.title+" ("+this.model.media.filename+")":this.model.media.filename})):console.log("No video was selected")}},computed:{isEmpty:function(){return null==this.model.media}},mounted:function(){this.model.getTitle=function(){return null!=this.model.media?null!=this.model.media.title?this.model.media.title+" ("+this.model.media.filename+")":this.model.media.filename:"No video selected"}},template:'\n
\n
\n
\n \n \n
\n
\n
\n {{ meta.placeholder }}\n  \n
\n \n \n
\n
\n
\n'}); \ No newline at end of file diff --git a/core/Piranha.Manager/assets/src/js/components/blocks/audio-block.vue b/core/Piranha.Manager/assets/src/js/components/blocks/audio-block.vue index 799337e49..b30b30b96 100644 --- a/core/Piranha.Manager/assets/src/js/components/blocks/audio-block.vue +++ b/core/Piranha.Manager/assets/src/js/components/blocks/audio-block.vue @@ -43,7 +43,14 @@ export default { update: function (media) { if (media.type === "Audio") { this.model.body.id = media.id; - this.model.body.media = media; + this.model.body.media = { + id: media.id, + folderId: media.folderId, + type: media.type, + filename: media.filename, + contentType: media.contentType, + publicUrl: media.publicUrl, + }; // Tell parent that title has been updated this.$emit('update-title', { diff --git a/core/Piranha.Manager/assets/src/js/components/blocks/video-block.vue b/core/Piranha.Manager/assets/src/js/components/blocks/video-block.vue index f9e70cd52..d21d55ca9 100644 --- a/core/Piranha.Manager/assets/src/js/components/blocks/video-block.vue +++ b/core/Piranha.Manager/assets/src/js/components/blocks/video-block.vue @@ -43,7 +43,14 @@ export default { update: function (media) { if (media.type === "Video") { this.model.body.id = media.id; - this.model.body.media = media; + this.model.body.media = { + id: media.id, + folderId: media.folderId, + type: media.type, + filename: media.filename, + contentType: media.contentType, + publicUrl: media.publicUrl, + }; // Tell parent that title has been updated this.$emit('update-title', {