Welcome to mirror list, hosted at ThFree Co, Russian Federation.

editor-rich.js « js - github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 050803754b41718143245a064e609a589035cc74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
(window.textWebpackJsonp=window.textWebpackJsonp||[]).push([[193],{12:function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return i})),n.d(t,"c",(function(){return o}));
/*
 * @copyright Copyright (c) 2019 Julius Härtl <jus@bitgrid.net>
 *
 * @author Julius Härtl <jus@bitgrid.net>
 *
 * @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 <http://www.gnu.org/licenses/>.
 *
 */
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"],r=[].concat(i,o)},158:function(e,t,n){"use strict";var i=n(28);n.n(i).a},159:function(e,t,n){(t=n(48)(!1)).push([e.i,"#rich-workspace[data-v-7e1de019]{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-7e1de019]{min-height:90px}#rich-workspace[data-v-7e1de019]:only-child{margin-bottom:0}.empty-workspace[data-v-7e1de019]{padding-top:43px;color:var(--color-text-maxcontrast);height:0}#rich-workspace[data-v-7e1de019] div[contenteditable=false]{width:100%;padding:0px;background-color:var(--color-main-background);opacity:1;border:none}#rich-workspace[data-v-7e1de019] #editor-container{height:100%;position:unset !important;top:auto !important}#rich-workspace[data-v-7e1de019] #editor-wrapper{position:unset !important;overflow:visible}#rich-workspace[data-v-7e1de019] #editor{overflow:scroll !important;max-height:50vh}#rich-workspace[data-v-7e1de019] #editor-wrapper .ProseMirror{padding:0px;margin:0}#rich-workspace[data-v-7e1de019] .menubar{z-index:50;margin-bottom:-10px}#rich-workspace[data-v-7e1de019] .menubar .menubar-icons{margin-left:0}#rich-workspace[data-v-7e1de019] .editor__content{margin:0}#rich-workspace.focus[data-v-7e1de019]{max-height:50vh}#rich-workspace[data-v-7e1de019]:not(.focus){max-height:30vh;position:relative;overflow:hidden}#rich-workspace[data-v-7e1de019]: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-7e1de019]: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-7e1de019]:not(.focus){max-height:30vh}}html.ie #rich-workspace[data-v-7e1de019] #editor-container{position:initial}html.ie #rich-workspace[data-v-7e1de019] #editor-wrapper{position:relative !important;top:auto !important}html.ie #rich-workspace[data-v-7e1de019] #editor{display:flex;flex-direction:column;overflow:hidden !important}html.ie #rich-workspace[data-v-7e1de019] .menubar{position:relative;overflow:hidden;flex-shrink:0;height:44px;top:auto}html.ie #rich-workspace[data-v-7e1de019] #editor>div:nth-child(2){min-height:44px;overflow-x:hidden;overflow-y:auto;flex-shrink:1}\n",""]),e.exports=t},201:function(e,t,n){var i=n(505);"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n(49).default)("7f45cf78",i,!0,{})},202:function(e,t,n){var i=n(507);"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n(49).default)("77931eb0",i,!0,{})},28:function(e,t,n){var i=n(159);"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n(49).default)("482d15f0",i,!0,{})},29:function(e,n,i){"use strict";i.d(n,"b",(function(){return v})),i.d(n,"c",(function(){return g})),i.d(n,"d",(function(){return b})),i.d(n,"a",(function(){return k}));var o=i(14),r=i.n(o),a=i(13),c=i(12),s=i(15);function l(e,t,n,i,o,r,a){try{var c=e[r](a),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(i,o)}var u=!!document.getElementById("isPublic"),d=Object(a.generateOcsUrl)("apps/text"+(u?"/public":""),2)+"workspace",f={name:"RichWorkspace",components:{EditorWrapper:function(){return Promise.all([i.e(0),i.e(189),i.e(198),i.e(190)]).then(i.bind(null,169))}},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(e){e||document.querySelector("#editor").scrollTo(0,0)}},mounted:function(){var e,t=this;return(e=regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t.enabled&&t.getFileInfo(),Object(s.subscribe)("Text::showRichWorkspace",(function(){t.enabled=!0,t.getFileInfo()})),Object(s.subscribe)("Text::hideRichWorkspace",(function(){t.enabled=!1}));case 3:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(i,o){var r=e.apply(t,n);function a(e){l(r,i,o,a,c,"next",e)}function c(e){l(r,i,o,a,c,"throw",e)}a(void 0)}))})()},methods:{unfocus:function(){},reset:function(){var e=this;this.file=null,this.focus=!1,this.$nextTick((function(){e.creating=!1,e.getFileInfo()}))},getFileInfo:function(){var e=this;this.loaded=!1,this.autofocus=!1,this.ready=!1;var t={path:this.path};return u&&(t.shareToken=this.shareToken),r.a.get(d,{params:t}).then((function(t){var n=t.data.ocs.data;return e.folder=n.folder||null,e.file=n.file,e.editing=!0,e.loaded=!0,!0})).catch((function(t){var n=t.response.data.ocs.data;return e.folder=n.folder||null,e.file=null,e.loaded=!0,e.ready=!0,e.creating=!1,!1}))},createNew:function(){var e=this;this.creating||(this.creating=!0,this.getFileInfo().then((function(t){e.autofocus=!0,t||window.FileList.createFile("Readme.md",{scrollTo:!1,animate:!1}).then((function(t,n){e.getFileInfo()}))})))}}},p=(i(158),i(19)),h=Object(p.a)(f,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return e.enabled?n("div",{class:{"icon-loading":!e.loaded||!e.ready,focus:e.focus,dark:e.darkTheme,creatable:e.canCreate},attrs:{id:"rich-workspace"}},[e.showEmptyWorkspace?n("div",{staticClass:"empty-workspace",on:{click:e.createNew}},[n("p",{staticClass:"placeholder"},[e._v("\n\t\t\t"+e._s(e.t("text","Add notes, lists or links …"))+"\n\t\t")])]):e._e(),e._v(" "),e.file?n("EditorWrapper",{directives:[{name:"show",rawName:"v-show",value:e.ready,expression:"ready"}],key:e.file.id,attrs:{"file-id":e.file.id,"relative-path":e.file.path,"share-token":e.shareToken,active:!0,autohide:!0,mime:e.file.mimetype,autofocus:e.autofocus},on:{ready:function(t){e.ready=!0},focus:function(t){e.focus=!0},blur:e.unfocus,error:e.reset}}):e._e()],1):e._e()}),[],!1,null,"7e1de019",null).exports;function m(e,t,n,i,o,r,a){try{var c=e[r](a),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(i,o)}
/*
 * @copyright Copyright (c) 2019 Julius Härtl <jus@bitgrid.net>
 *
 * @author Julius Härtl <jus@bitgrid.net>
 *
 * @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 <http://www.gnu.org/licenses/>.
 *
 */
var v=function(){var e,t=(e=regeneratorRuntime.mark((function e(t,n){var i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r()({method:"PROPFIND",url:Object(a.generateRemoteUrl)("dav/files/".concat(t).concat(n)),headers:{requesttoken:OC.requestToken,"content-Type":"text/xml"},data:'<?xml version="1.0"?>\n<d:propfind  xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns" xmlns:ocs="http://open-collaboration-services.org/ns">\n  <d:prop>\n    <d:getlastmodified />\n    <d:getetag />\n    <d:getcontenttype />\n    <d:resourcetype />\n    <oc:fileid />\n    <oc:permissions />\n    <oc:size />\n    <d:getcontentlength />\n    <nc:has-preview />\n    <nc:mount-type />\n    <nc:is-encrypted />\n    <ocs:share-permissions />\n    <oc:tags />\n    <oc:favorite />\n    <oc:comments-unread />\n    <oc:owner-id />\n    <oc:owner-display-name />\n    <oc:share-types />\n  </d:prop>\n</d:propfind>'});case 2:return i=e.sent,o=OCA.Files.App.fileList.filesClient._client.parseMultiStatus(i.data),e.abrupt("return",o.map((function(e){var t=OCA.Files.App.fileList.filesClient._parseFileInfo(e);return t.href=e.href,t})));case 5:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(i,o){var r=e.apply(t,n);function a(e){m(r,i,o,a,c,"next",e)}function c(e){m(r,i,o,a,c,"throw",e)}a(void 0)}))});return function(e,n){return t.apply(this,arguments)}}(),b=function(){var e={attach:function(e){var n=e.fileList;"files"!==n.id&&"files.public"!==n.id||e.addMenuEntry({id:"file",displayName:t("text","New text document"),templateName:t("text","New text document")+".md",iconClass:"icon-filetype-text",fileType:"file",actionHandler:function(e){n.createFile(e).then((function(e,t){var i=new OCA.Files.FileInfoModel(t);void 0!==OCA.Viewer?OCA.Files.fileActions.triggerAction("view",i,n):void 0===OCA.Viewer&&OCA.Files.fileActions.triggerAction("Edit with text app",i,n)}))}})}};OC.Plugins.register("OCA.Files.NewFileMenu",e)},g=function(){var e=document.getElementById("sharingToken")?document.getElementById("sharingToken").value:null,n=document.getElementById("dir").value;if(!e||""!==n){var o=document.createElement("div");o.id="text-viewer-fallback",document.body.appendChild(o);for(var r=function(n){return OCA.Files.fileActions.register(n,"Edit with text app",OC.PERMISSION_UPDATE|OC.PERMISSION_READ,OC.imagePath("core","actions/rename"),(function(t){var n=window.FileList.findFile(t);Promise.all([i.e(0).then(i.bind(null,44)),Promise.all([i.e(1),i.e(0),i.e(189),i.e(188),i.e(195)]).then(i.bind(null,532))]).then((function(i){var r=window.FileList.getCurrentDirectory()+"/"+t,a=i[0].default;a.prototype.t=window.t,a.prototype.n=window.n,a.prototype.OCA=window.OCA;var c=i[1].default;new a({render:function(t){return t(c,{props:{fileId:n?n.id:null,active:!0,shareToken:e,relativePath:r,mimeType:n.mimetype}})}}).$mount(o)}))}),t("text","Edit"))},a=0;a<c.a.length;a++)r(c.a[a]),OCA.Files.fileActions.setDefault(c.a[a],"Edit with text app")}},k={el:null,attach:function(e){"files"!==e.id&&"files.public"!==e.id||(this.el=document.createElement("div"),e.registerHeader({id:"workspace",el:this.el,render:this.render.bind(this),priority:10}))},render:function(e){var t=this;"files"!==e.id&&"files.public"!==e.id||i.e(0).then(i.bind(null,44)).then((function(n){var i=n.default;t.el.id="files-workspace-wrapper",i.prototype.t=window.t,i.prototype.n=window.n,i.prototype.OCA=window.OCA;var o=new(i.extend(h))({propsData:{path:e.getCurrentDirectory()}}).$mount(t.el);e.$el.on("changeDirectory",(function(e){o.path=e.dir.toString()}))}))}}},504:function(e,t,n){"use strict";var i=n(201);n.n(i).a},505:function(e,t,n){(t=n(48)(!1)).push([e.i,".menubar[data-v-7c71a344]{position:fixed;position:-webkit-sticky;position:sticky;top:0;display:flex;z-index:10010;background-color:var(--color-main-background-translucent);height:44px}.menubar.autohide[data-v-7c71a344]{visibility:hidden;opacity:0;transition:visibility 0.2s 0.4s, opacity 0.2s 0.4s}.menubar.autohide.is-focused[data-v-7c71a344]{visibility:visible;opacity:1}.menubar .menubar-icons[data-v-7c71a344]{flex-grow:1;margin-left:calc((100% - 660px) / 2)}@media (max-width: 660px){.menubar .menubar-icons[data-v-7c71a344]{margin-left:0}}.menubar[data-v-7c71a344] .action-item__menu ul{max-height:calc(100vh - 88px);overflow:scroll}.menubar button[data-v-7c71a344]{width:44px;height:44px;margin:0;background-size:16px;border:0;background-color:transparent;opacity:.5;color:var(--color-main-text);background-position:center center;vertical-align:top}.menubar button[data-v-7c71a344]:hover,.menubar button[data-v-7c71a344]:focus,.menubar button[data-v-7c71a344]:active{background-color:var(--color-background-dark)}.menubar button.is-active[data-v-7c71a344],.menubar button[data-v-7c71a344]:hover,.menubar button[data-v-7c71a344]:focus{opacity:1}.menubar button.icon-undo[data-v-7c71a344],.menubar button.icon-redo[data-v-7c71a344]{opacity:.4}.menubar .submenu[data-v-7c71a344]{display:inline-block;width:44px;height:44px;position:relative;vertical-align:top}\n",""]),e.exports=t},506:function(e,t,n){"use strict";var i=n(202);n.n(i).a},507:function(e,t,n){(t=n(48)(!1)).push([e.i,".menububble[data-v-b3f47288]{position:absolute;display:flex;z-index:10020;background:var(--color-main-background-translucent);box-shadow:0 1px 5px var(--color-box-shadow);border-radius:var(--border-radius);padding:0;margin-bottom:0.4rem;visibility:hidden;opacity:0;transform:translateX(-50%);transition:opacity 0.2s, visibility 0.2s}.menububble.is-active[data-v-b3f47288]{opacity:1;visibility:visible}.menububble__button[data-v-b3f47288]{display:block;border:0;padding:0.3rem 0.7rem;margin:0;margin-right:0.2rem;border-radius:var(--border-radius);cursor:pointer}.menububble__button[data-v-b3f47288]:last-child{margin-right:0}.menububble__buttontext[data-v-b3f47288]{padding:0.4rem;padding-right:0}.menububble__form[data-v-b3f47288]{display:flex;align-items:center}.menububble__input[data-v-b3f47288]{font:inherit;border:none;background:transparent;min-width:150px}\n",""]),e.exports=t},531:function(e,n,i){"use strict";i.r(n);var o=i(177),r=i(179),a=i.n(r),c=[{label:t("text","Undo"),class:"icon-undo",isActive:function(e){},action:function(e){return e.undo()}},{label:t("text","Redo"),class:"icon-redo",isActive:function(e){},action:function(e){return e.redo()}},{label:t("text","Bold"),class:"icon-bold",isActive:function(e){return e.strong()},action:function(e){return e.strong()}},{label:t("text","Italic"),class:"icon-italic",isActive:function(e){return e.em()},action:function(e){return e.em()}},{label:t("text","Strikethrough"),class:"icon-strike",isActive:function(e){return e.strike()},action:function(e){return e.strike()}},{label:t("text","Paragraph"),class:"icon-paragraph",isActive:function(e){},action:function(e){return e.paragraph()}},{label:t("text","Headings"),visible:!1,children:[{label:t("text","Heading 1"),class:"icon-h1",isActive:function(e){return e.heading({level:1})},action:function(e){return e.heading({level:1})}},{label:t("text","Heading 2"),class:"icon-h2",isActive:function(e){return e.heading({level:2})},action:function(e){return e.heading({level:2})}},{label:t("text","Heading 3"),class:"icon-h3",isActive:function(e){return e.heading({level:3})},action:function(e){return e.heading({level:3})}},{label:t("text","Heading 4"),class:"icon-h4",isActive:function(e){return e.heading({level:4})},action:function(e){return e.heading({level:4})}},{label:t("text","Heading 5"),class:"icon-h5",isActive:function(e){return e.heading({level:5})},action:function(e){return e.heading({level:5})}},{label:t("text","Heading 6"),class:"icon-h6",isActive:function(e){return e.heading({level:6})},action:function(e){return e.heading({level:6})}}]},{label:t("text","Unordered list"),class:"icon-ul",isActive:function(e){return e.bullet_list()},action:function(e){return e.bullet_list_item()}},{label:t("text","Ordered list"),class:"icon-ol",isActive:function(e){return e.ordered_list()},action:function(e){return e.ordered_list()}},{label:t("text","ToDo list"),class:"icon-checkmark",isActive:function(e){return!1},action:function(e){return e.todo_item()}},{label:t("text","Blockquote"),class:"icon-quote",isActive:function(e){return e.blockquote()},action:function(e){return e.blockquote()}},{label:t("text","Code block"),class:"icon-code",isActive:function(e){return e.code_block()},action:function(e){return e.code_block()}}],s=i(29),l=i(501),u=i.n(l),d=i(502),f=i.n(d),p=i(200),h=i.n(p),m=i(503),v=i.n(m);function b(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],i=!0,o=!1,r=void 0;try{for(var a,c=e[Symbol.iterator]();!(i=(a=c.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){o=!0,r=e}finally{try{i||null==c.return||c.return()}finally{if(o)throw r}}return n}(e,t)||k(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e){return function(e){if(Array.isArray(e))return x(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||k(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(e,t){if(e){if("string"==typeof e)return x(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?x(e,t):void 0}}function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}var w={name:"MenuBar",components:{EditorMenuBar:o.c,ActionButton:f.a,PopoverMenu:h.a,Actions:u.a},directives:{Tooltip:a.a,ClickOutside:v.a},props:{editor:{type:Object,required:!1,default:null},isRichEditor:{type:Boolean,default:!0},autohide:{type:Boolean,default:!1},isPublic:{type:Boolean,default:!1}},data:function(){return{windowWidth:0,windowHeight:0,forceRecompute:0,submenuVisibility:{},icons:g(c)}},computed:{isHiddenInMenu:function(){var e=this;return function(t){return t-e.iconCount>=0}},getIconClasses:function(){return function(e,t){var n={"is-active":t.isActive(e)};return n[t.class]=!0,n}},isChildMenuVisible:function(){var e=this;return function(t){return!!Object.prototype.hasOwnProperty.call(e.submenuVisibility,t.label)&&e.submenuVisibility[t.label]}},allIcons:function(){var e=this;return this.isPublic?this.icons:[].concat(g(this.icons),[{label:t("text","Insert image"),class:"icon-image",isActive:function(){},action:function(t){e.showImagePrompt(t.image)}}])},childPopoverMenu:function(){var e=this;return function(t,n,i,o){var r=[],a=function(a){r.push({text:i[a].label,icon:i[a].class,action:function(){i[a].action(n),e.hideChildMenu(o)},active:i[a].isActive(t)})};for(var c in i)a(c);return r}},childIconClass:function(){return function(e,t){for(var n in t){var i=t[n];if(i.isActive(e))return i.class}return"icon-h1"}},iconCount:function(){this.forceRecompute,this.windowWidth;var e=this.$refs.menubar&&this.$refs.menubar.clientWidth>200?this.$refs.menubar.clientWidth:200,t=Math.max(Math.floor(e/44)-2,0);return t}},mounted:function(){var e=this;window.addEventListener("resize",this.getWindowWidth),this.checkInterval=setInterval((function(){var t=e.$refs.menubar&&e.$refs.menubar.clientWidth>0;e.isRichEditor&&t&&e.redrawMenuBar(),e.isRichEditor&&!t||clearInterval(e.checkInterval)}),100)},beforeDestroy:function(){window.removeEventListener("resize",this.getWindowWidth)},methods:{redrawMenuBar:function(){var e=this;this.$nextTick((function(){e.getWindowWidth(),e.forceRecompute++}))},clickIcon:function(e,t){return t.action(e)},getWindowWidth:function(e){this.windowWidth=document.documentElement.clientWidth},getWindowHeight:function(e){this.windowHeight=document.documentElement.clientHeight},hideChildMenu:function(e){this.$set(this.submenuVisibility,e.label,!1)},toggleChildMenu:function(e){var t=!!Object.prototype.hasOwnProperty.call(this.submenuVisibility,e.label)&&this.submenuVisibility[e.label];this.$set(this.submenuVisibility,e.label,!t)},showImagePrompt:function(e){var t=OC.getCurrentUser();if(t){var n=e;OC.dialogs.filepicker("Insert an image",(function(e){Object(s.b)(t.uid,e).then((function(e){var t=e[0];console.debug(t);var i=OC.generateUrl("/core/preview?")+"fileId=".concat(t.id,"&x=1024&y=1024&a=true"),o=OC.generateUrl("/f/"+t.id),r={mimetype:t.mimetype,hasPreview:t.hasPreview,fileId:t.id},a=(t.hasPreview?i:o)+"#"+Object.entries(r).map((function(e){var t=b(e,2),n=t[0],i=t[1];return"".concat(n,"=").concat(encodeURIComponent(i))})).join("&");n({src:a,alt:t.name})}))}),!1,[],!0)}}}},y=(i(504),i(19)),A=Object(y.a)(w,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("EditorMenuBar",{attrs:{editor:e.editor},scopedSlots:e._u([{key:"default",fn:function(t){var i=t.commands,o=t.isActive,r=t.focused;return[n("div",{staticClass:"menubar",class:{"is-focused":r,autohide:e.autohide}},[e.isRichEditor?n("div",{ref:"menubar",staticClass:"menubar-icons"},[e._l(e.allIcons,(function(t,r){return[t.class?n("button",{directives:[{name:"show",rawName:"v-show",value:r<e.iconCount,expression:"$index < iconCount"}],key:t.label,class:e.getIconClasses(o,t),attrs:{title:t.label},on:{click:function(n){return e.clickIcon(i,t)}}}):[n("div",{directives:[{name:"show",rawName:"v-show",value:r<e.iconCount||!t.class,expression:"$index < iconCount || !icon.class"},{name:"click-outside",rawName:"v-click-outside",value:function(){return e.hideChildMenu(t)},expression:"() => hideChildMenu(icon)"}],key:t.label,staticClass:"submenu"},[n("button",{class:e.childIconClass(o,t.children),attrs:{title:t.label},on:{click:function(n){return n.preventDefault(),e.toggleChildMenu(t)}}}),e._v(" "),n("div",{staticClass:"popovermenu menu-center",class:{open:e.isChildMenuVisible(t)}},[n("PopoverMenu",{attrs:{menu:e.childPopoverMenu(o,i,t.children,t)}})],1)])]]})),e._v(" "),n("Actions",[e._l(e.allIcons,(function(t,o){return[t.class&&e.isHiddenInMenu(o)?n("ActionButton",{key:t.class,attrs:{icon:t.class},on:{click:function(n){return e.clickIcon(i,t)}}},[e._v("\n\t\t\t\t\t\t"+e._s(t.label)+"\n\t\t\t\t\t")]):e._e()]}))],2)],2):e._e(),e._v(" "),e._t("default",[e._v("\n\t\t\tLeft side\n\t\t")])],2)]}}],null,!0)})}),[],!1,null,"7c71a344",null);n.default=A.exports},533:function(e,t,n){"use strict";n.r(t);var i=n(177),o=n(179),r=n.n(o),a={name:"MenuBubble",components:{EditorMenuBubble:i.d},directives:{tooltip:r.a},props:{editor:{type:Object,required:!1,default:null}},data:function(){return{linkUrl:null,linkMenuIsActive:!1}},methods:{showLinkMenu:function(e){var t=this;this.linkUrl=e.href,this.linkMenuIsActive=!0,this.$nextTick((function(){t.$refs.linkInput.focus()}))},hideLinkMenu:function(){this.linkUrl=null,this.linkMenuIsActive=!1},setLinkUrl:function(e,t){!t||t.match(/^[a-zA-Z]+:\/\//)||t.match(/^\//)||(t="https://"+t),e({href:t}),this.hideLinkMenu()}}},c=(n(506),n(19)),s=Object(c.a)(a,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("EditorMenuBubble",{staticClass:"menububble",attrs:{editor:e.editor},on:{hide:e.hideLinkMenu},scopedSlots:e._u([{key:"default",fn:function(t){var i=t.commands,o=t.isActive,r=t.getMarkAttrs,a=t.menu;return[n("div",{staticClass:"menububble",class:{"is-active":a.isActive},style:"left: "+a.left+"px; bottom: "+a.bottom+"px;"},[e.linkMenuIsActive?n("form",{staticClass:"menububble__form",on:{submit:function(t){return t.preventDefault(),e.setLinkUrl(i.link,e.linkUrl)}}},[n("input",{directives:[{name:"model",rawName:"v-model",value:e.linkUrl,expression:"linkUrl"}],ref:"linkInput",staticClass:"menububble__input",attrs:{type:"text",placeholder:"https://"},domProps:{value:e.linkUrl},on:{keydown:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:e.hideLinkMenu(t)},input:function(t){t.target.composing||(e.linkUrl=t.target.value)}}}),e._v(" "),n("button",{staticClass:"menububble__button icon-confirm",attrs:{type:"button"},on:{click:function(t){return e.setLinkUrl(i.link,e.linkUrl)}}})]):[n("button",{staticClass:"menububble__button",class:{"is-active":o.link()},on:{click:function(t){e.showLinkMenu(r("link"))}}},[n("span",{directives:[{name:"tooltip",rawName:"v-tooltip",value:o.link()?"Update Link":"Add Link",expression:"isActive.link() ? 'Update Link' : 'Add Link'"}],staticClass:"icon-link"}),e._v(" "),n("span",{staticClass:"menububble__buttontext"},[e._v(e._s(e.t("text","Add link")))])])]],2)]}}])})}),[],!1,null,"b3f47288",null);t.default=s.exports}}]);
//# sourceMappingURL=editor-rich.js.map?v=4c0dc6dd77bf6c026422