${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 = isRichEditor\n\t\t\t\t? createRichEditor()\n\t\t\t\t: createPlainEditor()\n\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(n,o).command(({tr:D})=>(D.setMeta("addToHistory",o),!0)).run()},setInitialYjsState(e,{isRichEditor:a}){const o=a?zn.render(e)+"":"
".concat(hr(e),""),n=a?A4():M4(),D=r6(o,n.extensionManager.extensions),_=o6.fromJSON(n.schema,D),h=Ds((c=>{const p=new wo;p.clientID=0;const g=p.get("default",d6);return g.doc&&l6(c,g),p})(_));da(this.$ydoc,h)}}},SD={name:"CollisionResolveDialog",components:{NcButton:la},mixins:[So,B6,f4,Oo],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 OD=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)},HD=[],PD=Du(SD,OD,HD,!1,null,"8ab72257");const ID=PD.exports,RD={name:"DocumentStatus",components:{CollisionResolveDialog:ID,Lock:jc,NcNoteCard:Ac},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===nu.SAVE_COLLISSION},isLoadingError(){return this.syncError&&this.syncError.type===nu.LOAD_ERROR},hasWarning(){return this.syncError||this.hasConnectionIssue}},methods:{reconnect(){this.$emit("reconnect")},reload(){window.location.reload()}}};var VD=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)},WD=[],ND=Du(RD,VD,WD,!1,null,"64a8995a");const zD=ND.exports,$D=()=>document.documentElement.clientWidth,Br=()=>$D()<768,UD={data(){return{isMobile:Br()}},beforeMount(){this.$onResize=Io(()=>{this.isMobile=Br()},100),window.addEventListener("resize",this.$onResize)},beforeDestroy(){window.removeEventListener("resize",this.$onResize)}};function JD(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 y4={exports:{}};(function(e,a){(function(o,n){e.exports=n()})(H0,function(){var o;function n(){return o.apply(null,arguments)}function D(u){o=u}function _(u){return u instanceof Array||Object.prototype.toString.call(u)==="[object Array]"}function h(u){return u!=null&&Object.prototype.toString.call(u)==="[object Object]"}function c(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(c(u,s))return!1;return!0}function g(u){return u===void 0}function M(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
".concat(hr(e),"");this.$editor.chain().setContent(n,o).command(({tr:D})=>(D.setMeta("addToHistory",o),!0)).run()},setInitialYjsState(e,{isRichEditor:a}){const o=a?zn.render(e)+"":"
".concat(hr(e),""),n=a?A4():f4(),D=r6(o,n.extensionManager.extensions),_=o6.fromJSON(n.schema,D),h=Ds((c=>{const p=new wo;p.clientID=0;const g=p.get("default",d6);return g.doc&&l6(c,g),p})(_));da(this.$ydoc,h)}}},SD={name:"CollisionResolveDialog",components:{NcButton:la},mixins:[So,B6,M4,Oo],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 OD=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)},HD=[],PD=Du(SD,OD,HD,!1,null,"8ab72257");const ID=PD.exports,RD={name:"DocumentStatus",components:{CollisionResolveDialog:ID,Lock:jc,NcNoteCard:Ac},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===nu.SAVE_COLLISSION},isLoadingError(){return this.syncError&&this.syncError.type===nu.LOAD_ERROR},hasWarning(){return this.syncError||this.hasConnectionIssue}},methods:{reconnect(){this.$emit("reconnect")},reload(){window.location.reload()}}};var VD=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)},WD=[],ND=Du(RD,VD,WD,!1,null,"64a8995a");const zD=ND.exports,$D=()=>document.documentElement.clientWidth,Br=()=>$D()<768,UD={data(){return{isMobile:Br()}},beforeMount(){this.$onResize=Io(()=>{this.isMobile=Br()},100),window.addEventListener("resize",this.$onResize)},beforeDestroy(){window.removeEventListener("resize",this.$onResize)}};function JD(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 y4={exports:{}};(function(e,a){(function(o,n){e.exports=n()})(H0,function(){var o;function n(){return o.apply(null,arguments)}function D(u){o=u}function _(u){return u instanceof Array||Object.prototype.toString.call(u)==="[object Array]"}function h(u){return u!=null&&Object.prototype.toString.call(u)==="[object Object]"}function c(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(c(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 = isRichEditor\n\t\t\t\t? createRichEditor()\n\t\t\t\t: createPlainEditor()\n\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