1414 <CollisionResolveDialog v-if =" isResolvingConflict" :sync-error =" syncError" />
1515 <Wrapper v-if =" displayed"
1616 :is-resolving-conflict =" isResolvingConflict"
17- :has-connection-issue =" hasConnectionIssue "
17+ :has-connection-issue =" requireReconnect "
1818 :content-loaded =" contentLoaded"
1919 :show-outline-outside =" showOutlineOutside"
2020 @read-only-toggled =" readOnlyToggled"
2828 :dirty =" dirty"
2929 :sessions =" filteredSessions"
3030 :sync-error =" syncError"
31- :has-connection-issue =" hasConnectionIssue " />
31+ :has-connection-issue =" requireReconnect " />
3232 </ReadonlyBar >
3333 </slot >
3434 </div >
4343 :dirty =" dirty"
4444 :sessions =" filteredSessions"
4545 :sync-error =" syncError"
46- :has-connection-issue =" hasConnectionIssue "
46+ :has-connection-issue =" requireReconnect "
4747 @editor-width-change =" handleEditorWidthChange" />
4848 <slot name =" header" />
4949 </MenuBar >
5959 <DocumentStatus :idle =" idle"
6060 :lock =" lock"
6161 :sync-error =" syncError"
62- :has-connection-issue =" hasConnectionIssue "
62+ :has-connection-issue =" requireReconnect "
6363 @reconnect =" reconnect" />
6464 </Wrapper >
6565 <Assistant v-if =" hasEditor" />
@@ -127,6 +127,7 @@ import CollisionResolveDialog from './CollisionResolveDialog.vue'
127127import { generateRemoteUrl } from ' @nextcloud/router'
128128import { fetchNode } from ' ../services/WebdavClient.ts'
129129import SuggestionsBar from ' ./SuggestionsBar.vue'
130+ import { useDelayedFlag } from ' ./Editor/useDelayedFlag.ts'
130131
131132export default {
132133 name: ' Editor' ,
@@ -244,7 +245,9 @@ export default {
244245 const maxWidth = Math .floor (value) - 36
245246 el .value .style .setProperty (' --widget-full-width' , ` ${ maxWidth} px` )
246247 })
247- return { el, width }
248+ const hasConnectionIssue = ref (false )
249+ const { delayed: requireReconnect } = useDelayedFlag (hasConnectionIssue)
250+ return { el, width, hasConnectionIssue, requireReconnect }
248251 },
249252
250253 data () {
@@ -262,7 +265,6 @@ export default {
262265 dirty: false ,
263266 contentLoaded: false ,
264267 syncError: null ,
265- hasConnectionIssue: false ,
266268 hasEditor: false ,
267269 readOnly: true ,
268270 openReadOnlyEnabled: OCA .Text .OpenReadOnlyEnabled ,
@@ -353,6 +355,14 @@ export default {
353355 window .removeEventListener (' beforeunload' , this .saveBeforeUnload )
354356 }
355357 },
358+ requireReconnect (val ) {
359+ if (val) {
360+ this .emit (' sync-service:error' )
361+ }
362+ if (this .$editor ? .isEditable === val) {
363+ this .$editor .setEditable (! val)
364+ }
365+ },
356366 },
357367 mounted () {
358368 if (this .active && (this .hasDocumentParameters )) {
@@ -595,7 +605,7 @@ export default {
595605 this .document = document
596606
597607 this .syncError = null
598- const editable = this .editMode && ! this .hasConnectionIssue
608+ const editable = this .editMode && ! this .requireReconnect
599609 if (this .$editor .isEditable !== editable) {
600610 this .$editor .setEditable (editable)
601611 }
@@ -618,7 +628,13 @@ export default {
618628 },
619629
620630 onSync ({ steps, document }) {
621- this .hasConnectionIssue = this .$syncService .backend .fetcher === 0 || ! this .$providers [0 ].wsconnected || this .$syncService .pushError > 0
631+ this .hasConnectionIssue = this .$syncService .backend .fetcher === 0
632+ || ! this .$providers [0 ].wsconnected
633+ || this .$syncService .pushError > 0
634+ if (this .$syncService .pushError > 0 ) {
635+ // successfully received steps - so let's try and also push
636+ this .$syncService .sendStepsNow ()
637+ }
622638 this .$nextTick (() => {
623639 this .emit (' sync-service:sync' )
624640 })
@@ -628,11 +644,6 @@ export default {
628644 },
629645
630646 onError ({ type, data }) {
631- this .$nextTick (() => {
632- this .$editor ? .setEditable (false )
633- this .emit (' sync-service:error' )
634- })
635-
636647 if (type === ERROR_TYPE .LOAD_ERROR ) {
637648 this .syncError = {
638649 type,
@@ -647,11 +658,8 @@ export default {
647658 data,
648659 }
649660 }
650- if (type === ERROR_TYPE .CONNECTION_FAILED && ! this .hasConnectionIssue ) {
651- this .hasConnectionIssue = true
652- OC .Notification .showTemporary (t (' text' , ' Connection failed.' ))
653- }
654- if (type === ERROR_TYPE .SOURCE_NOT_FOUND ) {
661+ if (type === ERROR_TYPE .CONNECTION_FAILED
662+ || type === ERROR_TYPE .SOURCE_NOT_FOUND ) {
655663 this .hasConnectionIssue = true
656664 }
657665
0 commit comments