(window.textWebpackJsonp=window.textWebpackJsonp||[]).push([[192],{13:function(t,e,n){"use strict";n.d(e,"a",(function(){return a})),n.d(e,"b",(function(){return i})),n.d(e,"c",(function(){return o})); /* * @copyright Copyright (c) 2019 Julius Härtl * * @author Julius Härtl * * @license GNU AGPL version 3 or any later version * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * */ var i=["text/markdown"],o=["text/plain","application/cmd","application/x-empty","application/x-msdos-program","application/epub+zip","application/javascript","application/json","application/x-perl","application/x-php","application/x-tex","application/xml","application/yaml","text/css","text/csv","text/html","text/x-c","text/x-c++src","text/x-h","text/x-java-source","text/x-ldif","text/x-python","text/x-shellscript"],a=[].concat(i,o)},164:function(t,e,n){"use strict";n(97)},165:function(t,e,n){(e=n(49)(!1)).push([t.i,"#rich-workspace[data-v-01f36cf5]{padding:0 60px;margin-bottom:-24px;text-align:left;max-height:0;transition:max-height 0.5s cubic-bezier(0, 1, 0, 1)}#rich-workspace.creatable[data-v-01f36cf5]{min-height:90px}#rich-workspace[data-v-01f36cf5]:only-child{margin-bottom:0}.empty-workspace[data-v-01f36cf5]{padding-top:43px;color:var(--color-text-maxcontrast);height:0}#rich-workspace[data-v-01f36cf5] div[contenteditable=false]{width:100%;padding:0px;background-color:var(--color-main-background);opacity:1;border:none}#rich-workspace[data-v-01f36cf5] #editor-container{height:100%;position:unset !important;top:auto !important}#rich-workspace[data-v-01f36cf5] #editor-wrapper{position:unset !important;overflow:visible}#rich-workspace[data-v-01f36cf5] #editor{overflow:scroll !important;max-height:50vh}#rich-workspace[data-v-01f36cf5] #editor-wrapper .ProseMirror{padding:0px;margin:0}#rich-workspace[data-v-01f36cf5] .menubar{z-index:50;margin-bottom:-10px}#rich-workspace[data-v-01f36cf5] .menubar .menubar-icons{margin-left:0}#rich-workspace[data-v-01f36cf5] .editor__content{margin:0}#rich-workspace.focus[data-v-01f36cf5]{max-height:50vh}#rich-workspace[data-v-01f36cf5]:not(.focus){max-height:30vh;position:relative;overflow:hidden}#rich-workspace[data-v-01f36cf5]:not(.focus):not(.icon-loading):after{content:'';position:absolute;z-index:1;bottom:0;left:0;pointer-events:none;background-image:linear-gradient(to bottom, rgba(255,255,255,0), var(--color-main-background));width:100%;height:4em}#rich-workspace.dark[data-v-01f36cf5]:not(.focus):not(.icon-loading):after{background-image:linear-gradient(to bottom, rgba(0,0,0,0), var(--color-main-background))}@media only screen and (max-width: 1024px){#rich-workspace[data-v-01f36cf5]:not(.focus){max-height:30vh}}html.ie #rich-workspace[data-v-01f36cf5] #editor-container{position:initial}html.ie #rich-workspace[data-v-01f36cf5] #editor-wrapper{position:relative !important;top:auto !important}html.ie #rich-workspace[data-v-01f36cf5] #editor{display:flex;flex-direction:column;overflow:hidden !important}html.ie #rich-workspace[data-v-01f36cf5] .menubar{position:relative;overflow:hidden;flex-shrink:0;height:44px;top:auto}html.ie #rich-workspace[data-v-01f36cf5] #editor>div:nth-child(2){min-height:44px;overflow-x:hidden;overflow-y:auto;flex-shrink:1}\n",""]),t.exports=e},27:function(e,n,i){"use strict";i.d(n,"b",(function(){return m})),i.d(n,"c",(function(){return b})),i.d(n,"d",(function(){return v})),i.d(n,"a",(function(){return g}));var o=i(13),a=i(28),r=i.n(a),c=i(11),l=i(14);function s(t,e,n,i,o,a,r){try{var c=t[a](r),l=c.value}catch(t){return void n(t)}c.done?e(l):Promise.resolve(l).then(i,o)}var u=!!document.getElementById("isPublic"),d=Object(c.generateOcsUrl)("apps/text"+(u?"/public":""),2)+"workspace",f={name:"RichWorkspace",components:{EditorWrapper:function(){return Promise.all([i.e(0),i.e(188),i.e(197),i.e(189)]).then(i.bind(null,176))}},props:{path:{type:String,required:!0}},data:function(){return{focus:!1,folder:null,file:null,loaded:!1,ready:!1,autofocus:!1,darkTheme:OCA.Accessibility&&"dark"===OCA.Accessibility.theme,enabled:OCA.Text.RichWorkspaceEnabled}},computed:{shareToken:function(){return document.getElementById("sharingToken")?document.getElementById("sharingToken").value:null},canCreate:function(){return!!(this.folder&&this.folder.permissions&OC.PERMISSION_CREATE)},showEmptyWorkspace:function(){return(!this.file||this.autofocus&&!this.ready)&&this.canCreate}},watch:{path:function(){this.getFileInfo()},focus:function(t){t||document.querySelector("#editor").scrollTo(0,0)}},mounted:function(){var t,e=this;return(t=regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.enabled&&e.getFileInfo(),Object(l.subscribe)("Text::showRichWorkspace",(function(){e.enabled=!0,e.getFileInfo()})),Object(l.subscribe)("Text::hideRichWorkspace",(function(){e.enabled=!1}));case 3:case"end":return t.stop()}}),t)})),function(){var e=this,n=arguments;return new Promise((function(i,o){var a=t.apply(e,n);function r(t){s(a,i,o,r,c,"next",t)}function c(t){s(a,i,o,r,c,"throw",t)}r(void 0)}))})()},methods:{unfocus:function(){},reset:function(){var t=this;this.file=null,this.focus=!1,this.$nextTick((function(){t.creating=!1,t.getFileInfo()}))},getFileInfo:function(){var t=this;this.loaded=!1,this.autofocus=!1,this.ready=!1;var e={path:this.path};return u&&(e.shareToken=this.shareToken),r.a.get(d,{params:e}).then((function(e){var n=e.data.ocs.data;return t.folder=n.folder||null,t.file=n.file,t.editing=!0,t.loaded=!0,!0})).catch((function(e){return e.response.data.ocs&&e.response.data.ocs.data.folder?t.folder=e.response.data.ocs.data.folder:t.folder=null,t.file=null,t.loaded=!0,t.ready=!0,t.creating=!1,!1}))},createNew:function(){var t=this;this.creating||(this.creating=!0,this.getFileInfo().then((function(e){t.autofocus=!0,e||window.FileList.createFile("Readme.md",{scrollTo:!1,animate:!1}).then((function(e,n){t.getFileInfo()}))})))}}},h=(i(164),i(18)),p=Object(h.a)(f,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.enabled?n("div",{class:{"icon-loading":!t.loaded||!t.ready,focus:t.focus,dark:t.darkTheme,creatable:t.canCreate},attrs:{id:"rich-workspace"}},[t.showEmptyWorkspace?n("div",{staticClass:"empty-workspace",on:{click:t.createNew}},[n("p",{staticClass:"placeholder"},[t._v("\n\t\t\t"+t._s(t.t("text","Add notes, lists or links …"))+"\n\t\t")])]):t._e(),t._v(" "),t.file?n("EditorWrapper",{directives:[{name:"show",rawName:"v-show",value:t.ready,expression:"ready"}],key:t.file.id,attrs:{"file-id":t.file.id,"relative-path":t.file.path,"share-token":t.shareToken,active:!0,autohide:!0,mime:t.file.mimetype,autofocus:t.autofocus},on:{ready:function(e){t.ready=!0},focus:function(e){t.focus=!0},blur:t.unfocus,error:t.reset}}):t._e()],1):t._e()}),[],!1,null,"01f36cf5",null).exports,m=function(t,e){var n=t.split("/"),i=e.split("/");for(n.pop();n[0]===i[0];)n.shift(),i.shift();var o=n.fill("..").concat(i),a=e.split("/");return o.lengtht.length)&&(e=t.length);for(var n=0,i=new Array(e);n=0}},getIconClasses:function(){return function(t,e){var n={"is-active":e.isActive(t)};return n[e.class]=!0,n}},isChildMenuVisible:function(){var t=this;return function(e){return!!Object.prototype.hasOwnProperty.call(t.submenuVisibility,e.label)&&t.submenuVisibility[e.label]}},allIcons:function(){var e=this;return this.isPublic?this.icons:[].concat(k(this.icons),[{label:t("text","Insert image"),class:"icon-image",isActive:function(){},action:function(t){e.showImagePrompt(t.image)}}])},childPopoverMenu:function(){var t=this;return function(e,n,i,o){var a=[],r=function(r){a.push({text:i[r].label,icon:i[r].class,action:function(){i[r].action(n),t.hideChildMenu(o)},active:i[r].isActive(e)})};for(var c in i)r(c);return a}},childIconClasses:function(){var t=this;return function(e,n){var i=t.childIcon(e,n);return t.getIconClasses(e,i)}},childIcon:function(){return function(t,e){for(var n in e){var i=e[n];if(i.isActive(t))return i}return e[0]}},iconCount:function(){this.forceRecompute,this.windowWidth;var t=this.$refs.menubar&&this.$refs.menubar.clientWidth>200?this.$refs.menubar.clientWidth:200,e=Math.max(Math.floor(t/44)-2,0);return e},imagePath:function(){return this.lastImagePath||this.filePath.split("/").slice(0,-1).join("/")}},mounted:function(){var t=this;window.addEventListener("resize",this.getWindowWidth),this.checkInterval=setInterval((function(){var e=t.$refs.menubar&&t.$refs.menubar.clientWidth>0;t.isRichEditor&&e&&t.redrawMenuBar(),t.isRichEditor&&!e||clearInterval(t.checkInterval)}),100)},beforeDestroy:function(){window.removeEventListener("resize",this.getWindowWidth)},methods:{redrawMenuBar:function(){var t=this;this.$nextTick((function(){t.getWindowWidth(),t.forceRecompute++}))},clickIcon:function(t,e){return e.action(t)},getWindowWidth:function(t){this.windowWidth=document.documentElement.clientWidth},getWindowHeight:function(t){this.windowHeight=document.documentElement.clientHeight},hideChildMenu:function(t){this.$set(this.submenuVisibility,t.label,!1)},toggleChildMenu:function(t){var e=!!Object.prototype.hasOwnProperty.call(this.submenuVisibility,t.label)&&this.submenuVisibility[t.label];this.$set(this.submenuVisibility,t.label,!e)},showImagePrompt:function(e){var n=this;if(Object(b.getCurrentUser)()){var i=e;OC.dialogs.filepicker(t("text","Insert an image"),(function(t){OC.Files.getClient().getFileInfo(t).then((function(t,e){n.lastImagePath=e.path;var o={mimetype:e.mimetype,hasPreview:e.hasPreview},a=Object(l.b)(n.filePath,"".concat(e.path,"/").concat(e.name)).split("/").map(encodeURIComponent).join("/"),r=Object.entries(o).map((function(t){var e=g(t,2),n=e[0],i=e[1];return"".concat(n,"=").concat(encodeURIComponent(i))})).join("&"),c="".concat(a,"?fileId=").concat(e.id,"#").concat(r);i({src:c,alt:e.name})}))}),!1,[],!0,void 0,this.imagePath)}},showLinkPrompt:function(t){var e=this;if(OC.getCurrentUser()){var n=t;OC.dialogs.filepicker("Insert a link",(function(t){OC.Files.getClient().getFileInfo(t).then((function(t,i){e.lastLinkPath=i.path;var o=e.optimalPathTo("".concat(i.path,"/").concat(i.name)).split("/").map(encodeURIComponent).join("/"),a="".concat(o,"?fileId=").concat(i.id);n({href:a})}))}),!1,[],!0,void 0,this.linkPath)}},optimalPathTo:function(t){var e=t.split("/"),n=this.relativePathTo(t).split("/");return n.length hideChildMenu(icon)"}],key:e.label,staticClass:"submenu"},[n("button",{class:t.childIconClasses(o,e.children),attrs:{title:e.label},on:{click:function(n){return n.preventDefault(),t.toggleChildMenu(e)}}}),t._v(" "),n("div",{staticClass:"popovermenu menu-center",class:{open:t.isChildMenuVisible(e)}},[n("PopoverMenu",{attrs:{menu:t.childPopoverMenu(o,i,e.children,e)}})],1)])]]})),t._v(" "),n("Actions",[t._l(t.allIcons,(function(e,o){return[e.class&&t.isHiddenInMenu(o)?n("ActionButton",{key:e.class,attrs:{icon:e.class},on:{click:function(n){return t.clickIcon(i,e)}}},[t._v("\n\t\t\t\t\t\t"+t._s(e.label)+"\n\t\t\t\t\t")]):t._e()]}))],2)],2):t._e(),t._v(" "),t._t("default",[t._v("\n\t\t\tLeft side\n\t\t")])],2)]}}],null,!0)})}),[],!1,null,"0d0204aa",null);n.default=A.exports},701:function(e,n,i){"use strict";i.r(n);var o=i(184),a=i(187),r=i.n(a),c=i(27),l={name:"MenuBubble",components:{EditorMenuBubble:o.d},directives:{tooltip:r.a},props:{editor:{type:Object,required:!1,default:null},filePath:{type:String,required:!1,default:""}},data:function(){return{linkUrl:null,linkMenuIsActive:!1}},methods:{showLinkMenu:function(t){var e=this;this.linkUrl=t.href,this.linkMenuIsActive=!0,this.$nextTick((function(){e.$refs.linkInput.focus()}))},hideLinkMenu:function(){this.linkUrl=null,this.linkMenuIsActive=!1},selectFile:function(e){var n=this;if(OC.getCurrentUser()){var i=this.filePath.split("/").slice(0,-1).join("/");OC.dialogs.filepicker(t("text","Select file to link to"),(function(t){OC.Files.getClient().getFileInfo(t).then((function(t,i){var o=Object(c.b)(n.filePath,"".concat(i.path,"/").concat(i.name)).split("/").map(encodeURIComponent).join("/");e({href:"".concat(o,"?fileId=").concat(i.id)}),n.hideLinkMenu()}))}),!1,[],!0,void 0,i)}},setLinkUrl:function(t,e){e&&![/^[a-zA-Z]+:/,/^\//,/\?fileId=/,/^\.\.?\//,/^[^.]*[/$]/,/^#/].find((function(t){return e.match(t)}))&&(e="https://"+e),t({href:e}),this.hideLinkMenu()}}},s=(i(660),i(18)),u=Object(s.a)(l,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("EditorMenuBubble",{staticClass:"menububble",attrs:{editor:t.editor},on:{hide:t.hideLinkMenu},scopedSlots:t._u([{key:"default",fn:function(e){var i=e.commands,o=e.isActive,a=e.getMarkAttrs,r=e.menu;return[n("div",{staticClass:"menububble",class:{"is-active":r.isActive},style:"left: "+r.left+"px; bottom: "+r.bottom+"px;"},[t.linkMenuIsActive?n("form",{staticClass:"menububble__form",on:{submit:function(e){return e.preventDefault(),t.setLinkUrl(i.link,t.linkUrl)}}},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.linkUrl,expression:"linkUrl"}],ref:"linkInput",staticClass:"menububble__input",attrs:{type:"text",placeholder:"https://"},domProps:{value:t.linkUrl},on:{keydown:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"esc",27,e.key,["Esc","Escape"])?null:t.hideLinkMenu(e)},input:function(e){e.target.composing||(t.linkUrl=e.target.value)}}}),t._v(" "),n("button",{staticClass:"menububble__button icon-confirm",attrs:{type:"button",tabindex:"0"},on:{click:function(e){return t.setLinkUrl(i.link,t.linkUrl)}}})]):[n("button",{staticClass:"menububble__button",class:{"is-active":o.link()},on:{click:function(e){t.showLinkMenu(a("link"))}}},[n("span",{directives:[{name:"tooltip",rawName:"v-tooltip",value:t.t("text",o.link()?"Update Link":"Add Link"),expression:"t('text', isActive.link() ? 'Update Link' : 'Add Link')"}],staticClass:"icon-link"}),t._v(" "),n("span",{staticClass:"menububble__buttontext"},[t._v("\n\t\t\t\t\t"+t._s(t.t("text",o.link()?"Update Link":"Add Link"))+"\n\t\t\t\t")])]),t._v(" "),n("button",{staticClass:"menububble__button",class:{"is-active":o.link()},on:{click:function(e){return t.selectFile(i.link)}}},[n("span",{directives:[{name:"tooltip",rawName:"v-tooltip",value:t.t("text","Link file"),expression:"t('text', 'Link file')"}],staticClass:"icon-file"}),t._v(" "),n("span",{staticClass:"menububble__buttontext"},[t._v(t._s(t.t("text","Link file")))])])]],2)]}}])})}),[],!1,null,"66ed9266",null);n.default=u.exports},97:function(t,e,n){var i=n(165);"string"==typeof i&&(i=[[t.i,i,""]]),i.locals&&(t.exports=i.locals);(0,n(50).default)("55d37b72",i,!0,{})}}]); //# sourceMappingURL=editor-rich.js.map?v=5523c8067fed42bbb6ee