".concat(yr(e),"");this.$editor.chain().setContent(n,o).command(({tr:h})=>(h.setMeta("addToHistory",o),!0)).run()},setInitialYjsState(e,{isRichEditor:a}){const o=a?cs.render(e)+"":"
".concat(yr(e),""),n=F4({enableRichEditing:a}),h=m6(o,n.options.extensions),m=h6.fromJSON(n.schema,h),c=Cs((D=>{const p=new pa;p.clientID=0;const g=p.get("default",c6);return g.doc&&D6(D,g),p})(m));Wo(this.$ydoc,c)}}},JD={name:"CollisionResolveDialog",components:{NcButton:fa},mixins:[zo,w6,v4,$o],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 GD=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)},qD=[],KD=Du(JD,GD,qD,!1,null,"8ab72257");const ZD=KD.exports,QD={name:"DocumentStatus",components:{CollisionResolveDialog:ZD,Lock:zc,NcNoteCard:kc},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:Fa}},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 XD=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)},u2=[],e2=Du(QD,XD,u2,!1,null,"64a8995a");const t2=e2.exports,s2=()=>document.documentElement.clientWidth,Sr=()=>s2()<768,n2={data(){return{isMobile:Sr()}},beforeMount(){this.$onResize=Go(()=>{this.isMobile=Sr()},100),window.addEventListener("resize",this.$onResize)},beforeDestroy(){window.removeEventListener("resize",this.$onResize)}};var k4={exports:{}};(function(e,a){(function(o,n){e.exports=n()})(S0,function(){var o;function n(){return o.apply(null,arguments)}function h(u){o=u}function m(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 A(u){return typeof u=="number"||Object.prototype.toString.call(u)==="[object Number]"}function b(u){return u instanceof Date||Object.prototype.toString.call(u)==="[object Date]"}function x(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.options.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(yr(e),"");this.$editor.chain().setContent(n,o).command(({tr:h})=>(h.setMeta("addToHistory",o),!0)).run()},setInitialYjsState(e,{isRichEditor:a}){const o=a?hs.render(e)+"":"
".concat(yr(e),""),n=F4({enableRichEditing:a}),h=m6(o,n.options.extensions),m=h6.fromJSON(n.schema,h),c=ys((D=>{const p=new pa;p.clientID=0;const g=p.get("default",c6);return g.doc&&D6(D,g),p})(m));Wo(this.$ydoc,c)}}},JD={name:"CollisionResolveDialog",components:{NcButton:fa},mixins:[zo,w6,v4,$o],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 GD=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)},qD=[],KD=Du(JD,GD,qD,!1,null,"8ab72257");const ZD=KD.exports,XD={name:"DocumentStatus",components:{CollisionResolveDialog:ZD,Lock:zc,NcNoteCard:kc},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:Fa}},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 QD=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)},u2=[],e2=Du(XD,QD,u2,!1,null,"64a8995a");const t2=e2.exports,s2=()=>document.documentElement.clientWidth,Sr=()=>s2()<768,n2={data(){return{isMobile:Sr()}},beforeMount(){this.$onResize=Go(()=>{this.isMobile=Sr()},100),window.addEventListener("resize",this.$onResize)},beforeDestroy(){window.removeEventListener("resize",this.$onResize)}};var k4={exports:{}};(function(e,a){(function(o,n){e.exports=n()})(H0,function(){var o;function n(){return o.apply(null,arguments)}function h(u){o=u}function m(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 A(u){return typeof u=="number"||Object.prototype.toString.call(u)==="[object Number]"}function b(u){return u instanceof Date||Object.prototype.toString.call(u)==="[object Date]"}function w(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.options.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{X as r,aw as n}from"./RichText-BtWjh1Wr.chunk.mjs";import{n as o,e as s}from"./_plugin-vue2_normalizer-XF5BqDH-.chunk.mjs";import{B as a}from"./BaseReader-BAXIeIGu.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-DEY5W1h4.chunk.mjs.map b/js/PlainTextReader-BCkWtBJI.chunk.mjs.map similarity index 94% rename from js/PlainTextReader-DEY5W1h4.chunk.mjs.map rename to js/PlainTextReader-BCkWtBJI.chunk.mjs.map index 1244ee5f4fd..af6376d3d13 100644 --- a/js/PlainTextReader-DEY5W1h4.chunk.mjs.map +++ b/js/PlainTextReader-BCkWtBJI.chunk.mjs.map @@ -1 +1 @@ -{"version":3,"file":"PlainTextReader-DEY5W1h4.chunk.mjs","sources":["../src/components/PlainTextReader.vue"],"sourcesContent":["\n\n\n\t