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: fb6f25d3e6f456cb0498320bd8919202415397ca (plain)
1
2
(window.textWebpackJsonp=window.textWebpackJsonp||[]).push([[192],{215:function(t,n,e){var i=e(643);"string"==typeof i&&(i=[[t.i,i,""]]),i.locals&&(t.exports=i.locals);(0,e(50).default)("72b48125",i,!0,{})},216:function(t,n,e){var i=e(645);"string"==typeof i&&(i=[[t.i,i,""]]),i.locals&&(t.exports=i.locals);(0,e(50).default)("77931eb0",i,!0,{})},642:function(t,n,e){"use strict";var i=e(215);e.n(i).a},643:function(t,n,e){(n=e(49)(!1)).push([t.i,".menubar[data-v-1b42f055]{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-1b42f055]{visibility:hidden;opacity:0;transition:visibility 0.2s 0.4s, opacity 0.2s 0.4s}.menubar.autohide.is-focused[data-v-1b42f055]{visibility:visible;opacity:1}.menubar .menubar-icons[data-v-1b42f055]{flex-grow:1;margin-left:calc((100% - 660px) / 2)}@media (max-width: 660px){.menubar .menubar-icons[data-v-1b42f055]{margin-left:0}}.menubar[data-v-1b42f055] .action-item__menu ul{max-height:calc(100vh - 88px);overflow:scroll}.menubar button[data-v-1b42f055]{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-1b42f055]:hover,.menubar button[data-v-1b42f055]:focus,.menubar button[data-v-1b42f055]:active{background-color:var(--color-background-dark)}.menubar button.is-active[data-v-1b42f055],.menubar button[data-v-1b42f055]:hover,.menubar button[data-v-1b42f055]:focus{opacity:1}.menubar button.icon-undo[data-v-1b42f055],.menubar button.icon-redo[data-v-1b42f055]{opacity:.4}.menubar .submenu[data-v-1b42f055]{display:inline-block;width:44px;height:44px;position:relative;vertical-align:top}\n",""]),t.exports=n},644:function(t,n,e){"use strict";var i=e(216);e.n(i).a},645:function(t,n,e){(n=e(49)(!1)).push([t.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",""]),t.exports=n},668:function(n,e,i){"use strict";i.r(e);var o=i(184),r=i(186),a=i.n(r),c=[{label:t("text","Undo"),class:"icon-undo",isActive:function(t){},action:function(t){return t.undo()}},{label:t("text","Redo"),class:"icon-redo",isActive:function(t){},action:function(t){return t.redo()}},{label:t("text","Bold"),class:"icon-bold",isActive:function(t){return t.strong()},action:function(t){return t.strong()}},{label:t("text","Italic"),class:"icon-italic",isActive:function(t){return t.em()},action:function(t){return t.em()}},{label:t("text","Strikethrough"),class:"icon-strike",isActive:function(t){return t.strike()},action:function(t){return t.strike()}},{label:t("text","Paragraph"),class:"icon-paragraph",isActive:function(t){},action:function(t){return t.paragraph()}},{label:t("text","Headings"),visible:!1,children:[{label:t("text","Heading 1"),class:"icon-h1",isActive:function(t){return t.heading({level:1})},action:function(t){return t.heading({level:1})}},{label:t("text","Heading 2"),class:"icon-h2",isActive:function(t){return t.heading({level:2})},action:function(t){return t.heading({level:2})}},{label:t("text","Heading 3"),class:"icon-h3",isActive:function(t){return t.heading({level:3})},action:function(t){return t.heading({level:3})}},{label:t("text","Heading 4"),class:"icon-h4",isActive:function(t){return t.heading({level:4})},action:function(t){return t.heading({level:4})}},{label:t("text","Heading 5"),class:"icon-h5",isActive:function(t){return t.heading({level:5})},action:function(t){return t.heading({level:5})}},{label:t("text","Heading 6"),class:"icon-h6",isActive:function(t){return t.heading({level:6})},action:function(t){return t.heading({level:6})}}]},{label:t("text","Unordered list"),class:"icon-ul",isActive:function(t){return t.bullet_list()},action:function(t){return t.bullet_list_item()}},{label:t("text","Ordered list"),class:"icon-ol",isActive:function(t){return t.ordered_list()},action:function(t){return t.ordered_list()}},{label:t("text","ToDo list"),class:"icon-checkmark",isActive:function(t){return!1},action:function(t){return t.todo_item()}},{label:t("text","Blockquote"),class:"icon-quote",isActive:function(t){return t.blockquote()},action:function(t){return t.blockquote()}},{label:t("text","Code block"),class:"icon-code",isActive:function(t){return t.code_block()},action:function(t){return t.code_block()}}],l=i(639),u=i.n(l),s=i(640),d=i.n(s),b=i(214),f=i.n(b),h=i(641),v=i.n(h),m=i(109);function p(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var e=[],i=!0,o=!1,r=void 0;try{for(var a,c=t[Symbol.iterator]();!(i=(a=c.next()).done)&&(e.push(a.value),!n||e.length!==n);i=!0);}catch(t){o=!0,r=t}finally{try{i||null==c.return||c.return()}finally{if(o)throw r}}return e}(t,n)||k(t,n)||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(t){return function(t){if(Array.isArray(t))return y(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||k(t)||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(t,n){if(t){if("string"==typeof t)return y(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?y(t,n):void 0}}function y(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,i=new Array(n);e<n;e++)i[e]=t[e];return i}var x={name:"MenuBar",components:{EditorMenuBar:o.c,ActionButton:d.a,PopoverMenu:f.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},filePath:{type:String,required:!1,default:""}},data:function(){return{windowWidth:0,windowHeight:0,forceRecompute:0,submenuVisibility:{},lastImagePath:null,icons:g(c)}},computed:{isHiddenInMenu:function(){var t=this;return function(n){return n-t.iconCount>=0}},getIconClasses:function(){return function(t,n){var e={"is-active":n.isActive(t)};return e[n.class]=!0,e}},isChildMenuVisible:function(){var t=this;return function(n){return!!Object.prototype.hasOwnProperty.call(t.submenuVisibility,n.label)&&t.submenuVisibility[n.label]}},allIcons:function(){var n=this;return this.isPublic?this.icons:[].concat(g(this.icons),[{label:t("text","Insert image"),class:"icon-image",isActive:function(){},action:function(t){n.showImagePrompt(t.image)}}])},childPopoverMenu:function(){var t=this;return function(n,e,i,o){var r=[],a=function(a){r.push({text:i[a].label,icon:i[a].class,action:function(){i[a].action(e),t.hideChildMenu(o)},active:i[a].isActive(n)})};for(var c in i)a(c);return r}},childIconClass:function(){return function(t,n){for(var e in n){var i=n[e];if(i.isActive(t))return i.class}return"icon-h1"}},iconCount:function(){this.forceRecompute,this.windowWidth;var t=this.$refs.menubar&&this.$refs.menubar.clientWidth>200?this.$refs.menubar.clientWidth:200,n=Math.max(Math.floor(t/44)-2,0);return n},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 n=t.$refs.menubar&&t.$refs.menubar.clientWidth>0;t.isRichEditor&&n&&t.redrawMenuBar(),t.isRichEditor&&!n||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,n){return n.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 n=!!Object.prototype.hasOwnProperty.call(this.submenuVisibility,t.label)&&this.submenuVisibility[t.label];this.$set(this.submenuVisibility,t.label,!n)},showImagePrompt:function(t){var n=this;if(Object(m.getCurrentUser)()){var e=t;OC.dialogs.filepicker("Insert an image",(function(t){OC.Files.getClient().getFileInfo(t).then((function(t,i){n.lastImagePath=i.path;var o={mimetype:i.mimetype,hasPreview:i.hasPreview},r=n.optimalPathTo("".concat(i.path,"/").concat(i.name)).split("/").map(encodeURIComponent).join("/"),a=Object.entries(o).map((function(t){var n=p(t,2),e=n[0],i=n[1];return"".concat(e,"=").concat(encodeURIComponent(i))})).join("&"),c="".concat(r,"?fileId=").concat(i.id,"#").concat(a);e({src:c,alt:i.name})}))}),!1,[],!0,void 0,this.imagePath)}},optimalPathTo:function(t){var n=t.split("/"),e=this.relativePathTo(t).split("/");return e.length<n.length?e.join("/"):t},relativePathTo:function(t){var n=this.filePath.split("/"),e=t.split("/");for(n.pop();n[0]===e[0];)n.shift(),e.shift();return n.fill("..").concat(e).join("/")}}},w=(i(642),i(18)),_=Object(w.a)(x,(function(){var t=this,n=t.$createElement,e=t._self._c||n;return e("EditorMenuBar",{attrs:{editor:t.editor},scopedSlots:t._u([{key:"default",fn:function(n){var i=n.commands,o=n.isActive,r=n.focused;return[e("div",{staticClass:"menubar",class:{"is-focused":r,autohide:t.autohide}},[t.isRichEditor?e("div",{ref:"menubar",staticClass:"menubar-icons"},[t._l(t.allIcons,(function(n,r){return[n.class?e("button",{directives:[{name:"show",rawName:"v-show",value:r<t.iconCount,expression:"$index < iconCount"}],key:n.label,class:t.getIconClasses(o,n),attrs:{title:n.label},on:{click:function(e){return t.clickIcon(i,n)}}}):[e("div",{directives:[{name:"show",rawName:"v-show",value:r<t.iconCount||!n.class,expression:"$index < iconCount || !icon.class"},{name:"click-outside",rawName:"v-click-outside",value:function(){return t.hideChildMenu(n)},expression:"() => hideChildMenu(icon)"}],key:n.label,staticClass:"submenu"},[e("button",{class:t.childIconClass(o,n.children),attrs:{title:n.label},on:{click:function(e){return e.preventDefault(),t.toggleChildMenu(n)}}}),t._v(" "),e("div",{staticClass:"popovermenu menu-center",class:{open:t.isChildMenuVisible(n)}},[e("PopoverMenu",{attrs:{menu:t.childPopoverMenu(o,i,n.children,n)}})],1)])]]})),t._v(" "),e("Actions",[t._l(t.allIcons,(function(n,o){return[n.class&&t.isHiddenInMenu(o)?e("ActionButton",{key:n.class,attrs:{icon:n.class},on:{click:function(e){return t.clickIcon(i,n)}}},[t._v("\n\t\t\t\t\t\t"+t._s(n.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,"1b42f055",null);e.default=_.exports},670:function(t,n,e){"use strict";e.r(n);var i=e(184),o=e(186),r=e.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(t){var n=this;this.linkUrl=t.href,this.linkMenuIsActive=!0,this.$nextTick((function(){n.$refs.linkInput.focus()}))},hideLinkMenu:function(){this.linkUrl=null,this.linkMenuIsActive=!1},setLinkUrl:function(t,n){!n||n.match(/^[a-zA-Z]+:\/\//)||n.match(/^\//)||(n="https://"+n),t({href:n}),this.hideLinkMenu()}}},c=(e(644),e(18)),l=Object(c.a)(a,(function(){var t=this,n=t.$createElement,e=t._self._c||n;return e("EditorMenuBubble",{staticClass:"menububble",attrs:{editor:t.editor},on:{hide:t.hideLinkMenu},scopedSlots:t._u([{key:"default",fn:function(n){var i=n.commands,o=n.isActive,r=n.getMarkAttrs,a=n.menu;return[e("div",{staticClass:"menububble",class:{"is-active":a.isActive},style:"left: "+a.left+"px; bottom: "+a.bottom+"px;"},[t.linkMenuIsActive?e("form",{staticClass:"menububble__form",on:{submit:function(n){return n.preventDefault(),t.setLinkUrl(i.link,t.linkUrl)}}},[e("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(n){return!n.type.indexOf("key")&&t._k(n.keyCode,"esc",27,n.key,["Esc","Escape"])?null:t.hideLinkMenu(n)},input:function(n){n.target.composing||(t.linkUrl=n.target.value)}}}),t._v(" "),e("button",{staticClass:"menububble__button icon-confirm",attrs:{type:"button"},on:{click:function(n){return t.setLinkUrl(i.link,t.linkUrl)}}})]):[e("button",{staticClass:"menububble__button",class:{"is-active":o.link()},on:{click:function(n){t.showLinkMenu(r("link"))}}},[e("span",{directives:[{name:"tooltip",rawName:"v-tooltip",value:o.link()?"Update Link":"Add Link",expression:"isActive.link() ? 'Update Link' : 'Add Link'"}],staticClass:"icon-link"}),t._v(" "),e("span",{staticClass:"menububble__buttontext"},[t._v(t._s(t.t("text","Add link")))])])]],2)]}}])})}),[],!1,null,"b3f47288",null);n.default=l.exports}}]);
//# sourceMappingURL=editor-rich.js.map?v=f2dcd77a03fdef92c37a