Skip to content

Commit 0182052

Browse files
committed
feat: Add experimental option to allow typing during connectivity issues or being offline
Signed-off-by: Julius Knorr <jus@bitgrid.net>
1 parent d9d209a commit 0182052

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

lib/Service/ConfigService.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ public function isRichWorkspaceEnabledForUser(?string $userId): bool {
4646

4747
public function isNotifyPushSyncEnabled(): bool {
4848
return $this->appConfig->getValueBool(Application::APP_NAME, 'notify_push');
49+
}
4950

51+
public function isExperimentalOfflineTypingEnabled(): bool {
52+
return $this->appConfig->getValueBool(Application::APP_NAME, 'experimental_offline_typing');
5053
}
5154

5255
public function isFullWidthEditor(?string $userId): bool {

lib/Service/InitialStateProvider.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ public function provideState(): void {
8383
$this->configService->isNotifyPushSyncEnabled(),
8484
);
8585

86+
$this->initialState->provideInitialState(
87+
'experimental_offline_typing',
88+
$this->configService->isExperimentalOfflineTypingEnabled(),
89+
);
90+
8691
$this->initialState->provideInitialState(
8792
'is_full_width_editor',
8893
$this->configService->isFullWidthEditor($this->userId),

src/components/Editor.vue

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ import { fetchNode } from '../services/WebdavClient.ts'
129129
import SuggestionsBar from './SuggestionsBar.vue'
130130
import { useDelayedFlag } from './Editor/useDelayedFlag.ts'
131131
132+
const experimentalOfflineTyping = loadState('text', 'experimental_offline_typing', false)
133+
132134
export default {
133135
name: 'Editor',
134136
components: {
@@ -605,7 +607,7 @@ export default {
605607
this.document = document
606608
607609
this.syncError = null
608-
const editable = this.editMode && !this.requireReconnect
610+
const editable = this.editMode && (!this.requireReconnect || experimentalOfflineTyping)
609611
if (this.$editor.isEditable !== editable) {
610612
this.$editor.setEditable(editable)
611613
}
@@ -698,7 +700,9 @@ export default {
698700
onIdle() {
699701
this.$syncService.close()
700702
this.idle = true
701-
this.readOnly = true
703+
if (!experimentalOfflineTyping) {
704+
this.readOnly = true
705+
}
702706
this.editMode = false
703707
this.$editor.setEditable(this.editMode)
704708
@@ -744,7 +748,9 @@ export default {
744748
this.$providers = []
745749
this.$syncService = null
746750
// disallow editing while still showing the content
747-
this.readOnly = true
751+
if (!experimentalOfflineTyping) {
752+
this.readOnly = true
753+
}
748754
},
749755
750756
async close() {

0 commit comments

Comments
 (0)