".concat(hr(e),"");this.$editor.chain().setContent(n,o).command(({tr:m})=>(m.setMeta("addToHistory",o),!0)).run()},setInitialYjsState(e,{isRichEditor:a}){const o=a?zn.render(e)+"":"
".concat(hr(e),""),n=E4({enableRichEditing:a}),m=u6(o,n.extensionManager.extensions),_=e6.fromJSON(n.schema,m),c=Ds((D=>{const p=new To;p.clientID=0;const g=p.get("default",t6);return g.doc&&s6(D,g),p})(_));da(this.$ydoc,c)}}},bD={name:"CollisionResolveDialog",components:{NcButton:la},mixins:[wo,g6,g4,jo],props:{syncError:{type:Object,default:null}},data(){return{clicked:!1}},methods:{resolveThisVersion(){this.clicked=!0,this.$syncService.forceSave().then(()=>this.$syncService.syncUp()),this.$editor.setEditable(!this.readOnly)},resolveServerVersion(){const{outsideChange:e}=this.syncError.data;this.clicked=!0,this.$editor.setEditable(!this.readOnly),this.setContent(e,{isRichEditor:this.$isRichEditor}),this.$syncService.forceSave().then(()=>this.$syncService.syncUp())}}};var TD=function(){var e=this,a=e._self._c;return a("div",{staticClass:"collision-resolve-dialog",class:{"icon-loading":e.clicked},attrs:{id:"resolve-conflicts"}},[a("NcButton",{attrs:{disabled:e.clicked,"data-cy":"resolveThisVersion"},on:{click:e.resolveThisVersion}},[e._v(" "+e._s(e.t("text","Use current version"))+" ")]),a("NcButton",{attrs:{disabled:e.clicked,"data-cy":"resolveServerVersion"},on:{click:e.resolveServerVersion}},[e._v(" "+e._s(e.t("text","Use the saved version"))+" ")])],1)},xD=[],wD=Du(bD,TD,xD,!1,null,"8ab72257");const jD=wD.exports,SD={name:"DocumentStatus",components:{CollisionResolveDialog:jD,Lock:kc,NcNoteCard:cc},props:{idle:{type:Boolean,require:!0},lock:{type:Object,default:null},syncError:{type:Object,default:null},hasConnectionIssue:{type:Boolean,require:!0},isResolvingConflict:{type:Boolean,require:!0}},data(){return{IDLE_TIMEOUT:pa}},computed:{hasSyncCollission(){return this.syncError&&this.syncError.type===su.SAVE_COLLISSION},isLoadingError(){return this.syncError&&this.syncError.type===su.LOAD_ERROR},hasWarning(){return this.syncError||this.hasConnectionIssue}},methods:{reconnect(){this.$emit("reconnect")},reload(){window.location.reload()}}};var OD=function(){var e=this,a=e._self._c;return a("div",{staticClass:"document-status"},[e.hasWarning?a("NcNoteCard",{attrs:{type:"warning"}},[e.isLoadingError?a("p",[e._v(" "+e._s(e.syncError.data.data.error)+" "),e.syncError.data.status===412?a("a",{staticClass:"button primary",on:{click:e.reload}},[e._v(e._s(e.t("text","Reload")))]):e._e()]):e.hasSyncCollission?a("p",[e._v(" "+e._s(e.t("text","Document has been changed outside of the editor. The changes cannot be applied"))+" ")]):e.hasConnectionIssue?a("p",[e._v(" "+e._s(e.t("text","Document could not be loaded. Please check your internet connection."))+" "),a("a",{staticClass:"button primary",on:{click:e.reconnect}},[e._v(e._s(e.t("text","Reconnect")))])]):e._e()]):e.idle?a("NcNoteCard",{attrs:{type:"info"}},[a("p",[e._v(" "+e._s(e.t("text","Document idle for {timeout} minutes, click to continue editing",{timeout:e.IDLE_TIMEOUT}))+" "),a("a",{staticClass:"button primary",on:{click:e.reconnect}},[e._v(e._s(e.t("text","Reconnect")))])])]):e._e(),e.lock?a("NcNoteCard",{attrs:{type:"info"},scopedSlots:e._u([{key:"icon",fn:function(){return[a("Lock",{attrs:{size:20}})]},proxy:!0}],null,!1,326953187)},[a("p",[e._v(" "+e._s(e.t("text","This file is opened read-only as it is currently locked by {user}.",{user:e.lock.displayName}))+" ")])]):e._e(),e.isResolvingConflict?a("CollisionResolveDialog",{attrs:{"sync-error":e.syncError}}):e._e()],1)},HD=[],PD=Du(SD,OD,HD,!1,null,"64a8995a");const ID=PD.exports,RD=()=>document.documentElement.clientWidth,Br=()=>RD()<768,VD={data(){return{isMobile:Br()}},beforeMount(){this.$onResize=Ho(()=>{this.isMobile=Br()},100),window.addEventListener("resize",this.$onResize)},beforeDestroy(){window.removeEventListener("resize",this.$onResize)}};function WD(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var p4={exports:{}};(function(e,a){(function(o,n){e.exports=n()})(H0,function(){var o;function n(){return o.apply(null,arguments)}function m(u){o=u}function _(u){return u instanceof Array||Object.prototype.toString.call(u)==="[object Array]"}function c(u){return u!=null&&Object.prototype.toString.call(u)==="[object Object]"}function D(u,s){return Object.prototype.hasOwnProperty.call(u,s)}function p(u){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(u).length===0;var s;for(s in u)if(D(u,s))return!1;return!0}function g(u){return u===void 0}function f(u){return typeof u=="number"||Object.prototype.toString.call(u)==="[object Number]"}function w(u){return u instanceof Date||Object.prototype.toString.call(u)==="[object Date]"}function j(u,s){var i=[],r,d=u.length;for(r=0;r
${escapeHtml(content)}`\n\t\t\tthis.$editor.chain()\n\t\t\t\t.setContent(html, addToHistory)\n\t\t\t\t.command(({ tr }) => {\n\t\t\t\t\ttr.setMeta('addToHistory', addToHistory)\n\t\t\t\t\treturn true\n\t\t\t\t})\n\t\t\t\t.run()\n\t\t},\n\n\t\tsetInitialYjsState(content, { isRichEditor }) {\n\t\t\tconst html = isRichEditor\n\t\t\t\t? markdownit.render(content) + ''\n\t\t\t\t: `
${escapeHtml(content)}`\n\n\t\t\tconst editor = createEditor({\n\t\t\t\tenableRichEditing: isRichEditor,\n\t\t\t})\n\t\t\tconst json = generateJSON(html, editor.extensionManager.extensions)\n\n\t\t\tconst doc = Node.fromJSON(editor.schema, json)\n\t\t\tconst getBaseDoc = (doc) => {\n\t\t\t\tconst ydoc = new Doc()\n\t\t\t\t// In order to make the initial document state idempotent, we need to reset the clientID\n\t\t\t\t// While this is not recommended, we cannot avoid it here as we lack another mechanism\n\t\t\t\t// to generate the initial state on the server side\n\t\t\t\t// The only other option to avoid this could be to generate the initial state once and push\n\t\t\t\t// it to the server immediately, however this would require read only sessions to be able\n\t\t\t\t// to still push a state\n\t\t\t\tydoc.clientID = 0\n\t\t\t\tconst type = /** @type {XmlFragment} */ (ydoc.get('default', XmlFragment))\n\t\t\t\tif (!type.doc) {\n\t\t\t\t\t// This should not happen but is aligned with the upstream implementation\n\t\t\t\t\t// https://github.com/yjs/y-prosemirror/blob/8db24263770c2baaccb08e08ea9ef92dbcf8a9da/src/lib.js#L209\n\t\t\t\t\treturn ydoc\n\t\t\t\t}\n\n\t\t\t\tprosemirrorToYXmlFragment(doc, type)\n\t\t\t\treturn ydoc\n\t\t\t}\n\n\t\t\tconst baseUpdate = encodeStateAsUpdate(getBaseDoc(doc))\n\t\t\tapplyUpdate(this.$ydoc, baseUpdate)\n\t\t},\n\t},\n}\n","\n\n\n\t
\n\t\t\t\t{{ syncError.data.data.error }}\n\t\t\t\t\n\t\t\t\t{{ t('text', 'Reload') }}\n\t\t\t
\n\t\t\t\n\t\t\t\t{{ t('text', 'Document has been changed outside of the editor. The changes cannot be applied') }}\n\t\t\t
\n\t\t\t\n\t\t\t\t{{ t('text', 'Document could not be loaded. Please check your internet connection.') }}\n\t\t\t\t{{ t('text', 'Reconnect') }}\n\t\t\t
\n\t\t\n\t\t\t\t{{ t('text', 'Document idle for {timeout} minutes, click to continue editing', { timeout: IDLE_TIMEOUT }) }}\n\t\t\t\t{{ t('text', 'Reconnect') }}\n\t\t\t
\n\t\t\n\t\t\t\t{{ t('text', 'This file is opened read-only as it is currently locked by {user}.', { user: lock.displayName }) }}\n\t\t\t
\n\t\t\n\t\t\t\t{{ t('text', 'Last saved') }}: {{ lastSavedString }}\n\t\t\t
\n\t\t\t".concat(hr(e),"");this.$editor.chain().setContent(a,o).command(({tr:m})=>(m.setMeta("addToHistory",o),!0)).run()},setInitialYjsState(e,{isRichEditor:n}){const o=n?za.render(e)+"":"
".concat(hr(e),""),a=E4({enableRichEditing:n}),m=u6(o,a.extensionManager.extensions),_=e6.fromJSON(a.schema,m),c=Ds((D=>{const p=new To;p.clientID=0;const g=p.get("default",t6);return g.doc&&s6(D,g),p})(_));ln(this.$ydoc,c)}}},jD={name:"CollisionResolveDialog",components:{NcButton:_n},mixins:[wo,g6,g4,jo],props:{syncError:{type:Object,default:null}},data(){return{clicked:!1}},methods:{resolveThisVersion(){this.clicked=!0,this.$syncService.forceSave().then(()=>this.$syncService.syncUp()),this.$editor.setEditable(!this.readOnly)},resolveServerVersion(){const{outsideChange:e}=this.syncError.data;this.clicked=!0,this.$editor.setEditable(!this.readOnly),this.setContent(e,{isRichEditor:this.$isRichEditor}),this.$syncService.forceSave().then(()=>this.$syncService.syncUp())}}};var SD=function(){var e=this,n=e._self._c;return n("div",{staticClass:"collision-resolve-dialog",class:{"icon-loading":e.clicked},attrs:{id:"resolve-conflicts"}},[n("NcButton",{attrs:{disabled:e.clicked,"data-cy":"resolveThisVersion"},on:{click:e.resolveThisVersion}},[e._v(" "+e._s(e.t("text","Use current version"))+" ")]),n("NcButton",{attrs:{disabled:e.clicked,"data-cy":"resolveServerVersion"},on:{click:e.resolveServerVersion}},[e._v(" "+e._s(e.t("text","Use the saved version"))+" ")])],1)},OD=[],HD=hu(jD,SD,OD,!1,null,"8ab72257");const PD=HD.exports,ID={name:"DocumentStatus",components:{CollisionResolveDialog:PD,Lock:vc,NcNoteCard:hc},props:{idle:{type:Boolean,require:!0},lock:{type:Object,default:null},syncError:{type:Object,default:null},hasConnectionIssue:{type:Boolean,require:!0},isResolvingConflict:{type:Boolean,require:!0}},data(){return{IDLE_TIMEOUT:pn}},computed:{hasSyncCollission(){return this.syncError&&this.syncError.type===su.SAVE_COLLISSION},isLoadingError(){return this.syncError&&this.syncError.type===su.LOAD_ERROR},hasWarning(){return this.syncError||this.hasConnectionIssue}},methods:{reconnect(){this.$emit("reconnect")},reload(){window.location.reload()}}};var RD=function(){var e=this,n=e._self._c;return n("div",{staticClass:"document-status"},[e.hasWarning?n("NcNoteCard",{attrs:{type:"warning"}},[e.isLoadingError?n("p",[e._v(" "+e._s(e.syncError.data.data.error)+" "),e.syncError.data.status===412?n("a",{staticClass:"button primary",on:{click:e.reload}},[e._v(e._s(e.t("text","Reload")))]):e._e()]):e.hasSyncCollission?n("p",[e._v(" "+e._s(e.t("text","Document has been changed outside of the editor. The changes cannot be applied"))+" ")]):e.hasConnectionIssue?n("p",[e._v(" "+e._s(e.t("text","Document could not be loaded. Please check your internet connection."))+" "),n("a",{staticClass:"button primary",on:{click:e.reconnect}},[e._v(e._s(e.t("text","Reconnect")))])]):e._e()]):e.idle?n("NcNoteCard",{attrs:{type:"info"}},[n("p",[e._v(" "+e._s(e.t("text","Document idle for {timeout} minutes, click to continue editing",{timeout:e.IDLE_TIMEOUT}))+" "),n("a",{staticClass:"button primary",on:{click:e.reconnect}},[e._v(e._s(e.t("text","Reconnect")))])])]):e._e(),e.lock?n("NcNoteCard",{attrs:{type:"info"},scopedSlots:e._u([{key:"icon",fn:function(){return[n("Lock",{attrs:{size:20}})]},proxy:!0}],null,!1,326953187)},[n("p",[e._v(" "+e._s(e.t("text","This file is opened read-only as it is currently locked by {user}.",{user:e.lock.displayName}))+" ")])]):e._e(),e.isResolvingConflict?n("CollisionResolveDialog",{attrs:{"sync-error":e.syncError}}):e._e()],1)},VD=[],WD=hu(ID,RD,VD,!1,null,"64a8995a");const ND=WD.exports,zD=()=>document.documentElement.clientWidth,Br=()=>zD()<768,$D={data(){return{isMobile:Br()}},beforeMount(){this.$onResize=Ho(()=>{this.isMobile=Br()},100),window.addEventListener("resize",this.$onResize)},beforeDestroy(){window.removeEventListener("resize",this.$onResize)}};function UD(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var p4={exports:{}};(function(e,n){(function(o,a){e.exports=a()})(H0,function(){var o;function a(){return o.apply(null,arguments)}function m(u){o=u}function _(u){return u instanceof Array||Object.prototype.toString.call(u)==="[object Array]"}function c(u){return u!=null&&Object.prototype.toString.call(u)==="[object Object]"}function D(u,s){return Object.prototype.hasOwnProperty.call(u,s)}function p(u){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(u).length===0;var s;for(s in u)if(D(u,s))return!1;return!0}function g(u){return u===void 0}function f(u){return typeof u=="number"||Object.prototype.toString.call(u)==="[object Number]"}function w(u){return u instanceof Date||Object.prototype.toString.call(u)==="[object Date]"}function j(u,s){var i=[],r,d=u.length;for(r=0;r
${escapeHtml(content)}`\n\t\t\tthis.$editor.chain()\n\t\t\t\t.setContent(html, addToHistory)\n\t\t\t\t.command(({ tr }) => {\n\t\t\t\t\ttr.setMeta('addToHistory', addToHistory)\n\t\t\t\t\treturn true\n\t\t\t\t})\n\t\t\t\t.run()\n\t\t},\n\n\t\tsetInitialYjsState(content, { isRichEditor }) {\n\t\t\tconst html = isRichEditor\n\t\t\t\t? markdownit.render(content) + ''\n\t\t\t\t: `
${escapeHtml(content)}`\n\n\t\t\tconst editor = createEditor({\n\t\t\t\tenableRichEditing: isRichEditor,\n\t\t\t})\n\t\t\tconst json = generateJSON(html, editor.extensionManager.extensions)\n\n\t\t\tconst doc = Node.fromJSON(editor.schema, json)\n\t\t\tconst getBaseDoc = (doc) => {\n\t\t\t\tconst ydoc = new Doc()\n\t\t\t\t// In order to make the initial document state idempotent, we need to reset the clientID\n\t\t\t\t// While this is not recommended, we cannot avoid it here as we lack another mechanism\n\t\t\t\t// to generate the initial state on the server side\n\t\t\t\t// The only other option to avoid this could be to generate the initial state once and push\n\t\t\t\t// it to the server immediately, however this would require read only sessions to be able\n\t\t\t\t// to still push a state\n\t\t\t\tydoc.clientID = 0\n\t\t\t\tconst type = /** @type {XmlFragment} */ (ydoc.get('default', XmlFragment))\n\t\t\t\tif (!type.doc) {\n\t\t\t\t\t// This should not happen but is aligned with the upstream implementation\n\t\t\t\t\t// https://github.com/yjs/y-prosemirror/blob/8db24263770c2baaccb08e08ea9ef92dbcf8a9da/src/lib.js#L209\n\t\t\t\t\treturn ydoc\n\t\t\t\t}\n\n\t\t\t\tprosemirrorToYXmlFragment(doc, type)\n\t\t\t\treturn ydoc\n\t\t\t}\n\n\t\t\tconst baseUpdate = encodeStateAsUpdate(getBaseDoc(doc))\n\t\t\tapplyUpdate(this.$ydoc, baseUpdate)\n\t\t},\n\t},\n}\n","\n\n\n\t
\n\t\t\t\t{{ syncError.data.data.error }}\n\t\t\t\t\n\t\t\t\t{{ t('text', 'Reload') }}\n\t\t\t
\n\t\t\t\n\t\t\t\t{{ t('text', 'Document has been changed outside of the editor. The changes cannot be applied') }}\n\t\t\t
\n\t\t\t\n\t\t\t\t{{ t('text', 'Document could not be loaded. Please check your internet connection.') }}\n\t\t\t\t{{ t('text', 'Reconnect') }}\n\t\t\t
\n\t\t\n\t\t\t\t{{ t('text', 'Document idle for {timeout} minutes, click to continue editing', { timeout: IDLE_TIMEOUT }) }}\n\t\t\t\t{{ t('text', 'Reconnect') }}\n\t\t\t
\n\t\t\n\t\t\t\t{{ t('text', 'This file is opened read-only as it is currently locked by {user}.', { user: lock.displayName }) }}\n\t\t\t
\n\t\t\n\t\t\t\t{{ t('text', 'Last saved') }}: {{ lastSavedString }}\n\t\t\t
\n\t\t\t"+s(e)+""},extensions:()=>[r,n]},props:{content:{type:String,required:!0}}};var i=function(){var e=this,t=e._self._c;return t("BaseReader",{attrs:{content:e.content}})},c=[],m=o(p,i,c,!1,null,null);const u=m.exports;export{u as P}; +import{P as r,C as n}from"./RichText-CCvObw5l.chunk.mjs";import{n as o,e as s}from"./_plugin-vue2_normalizer-2oDy4QRL.chunk.mjs";import{B as a}from"./BaseReader-onZZv3hN.chunk.mjs";const p={name:"PlainTextReader",components:{BaseReader:a},provide:{renderHtml(e){return"
"+s(e)+""},extensions:()=>[r,n]},props:{content:{type:String,required:!0}}};var i=function(){var e=this,t=e._self._c;return t("BaseReader",{attrs:{content:e.content}})},c=[],m=o(p,i,c,!1,null,null);const u=m.exports;export{u as P}; diff --git a/js/PlainTextReader-KbdFHPYm.chunk.mjs.map b/js/PlainTextReader-DMy68Sk1.chunk.mjs.map similarity index 94% rename from js/PlainTextReader-KbdFHPYm.chunk.mjs.map rename to js/PlainTextReader-DMy68Sk1.chunk.mjs.map index b3d7a3cdaa5..b0b23072da3 100644 --- a/js/PlainTextReader-KbdFHPYm.chunk.mjs.map +++ b/js/PlainTextReader-DMy68Sk1.chunk.mjs.map @@ -1 +1 @@ -{"version":3,"file":"PlainTextReader-KbdFHPYm.chunk.mjs","sources":["../src/components/PlainTextReader.vue"],"sourcesContent":["\n\n\n\t