Skip to content

feat: Add experimental option to allow typing during connectivity issues or being offline #6933

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/Service/ConfigService.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ public function isRichWorkspaceEnabledForUser(?string $userId): bool {

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

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

public function isFullWidthEditor(?string $userId): bool {
Expand Down
5 changes: 5 additions & 0 deletions lib/Service/InitialStateProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ public function provideState(): void {
$this->configService->isNotifyPushSyncEnabled(),
);

$this->initialState->provideInitialState(
'experimental_offline_typing',
$this->configService->isExperimentalOfflineTypingEnabled(),
);

$this->initialState->provideInitialState(
'is_full_width_editor',
$this->configService->isFullWidthEditor($this->userId),
Expand Down
14 changes: 10 additions & 4 deletions src/components/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ import { fetchNode } from '../services/WebdavClient.ts'
import SuggestionsBar from './SuggestionsBar.vue'
import { useDelayedFlag } from './Editor/useDelayedFlag.ts'

const experimentalOfflineTyping = loadState('text', 'experimental_offline_typing', false)

export default {
name: 'Editor',
components: {
Expand Down Expand Up @@ -375,7 +377,7 @@ export default {
if (val) {
this.emit('sync-service:error')
}
if (this.$editor?.isEditable === val) {
if (!experimentalOfflineTyping && this.$editor?.isEditable === val) {
this.$editor.setEditable(!val)
}
},
Expand Down Expand Up @@ -643,7 +645,7 @@ export default {
this.document = document

this.syncError = null
const editable = this.editMode && !this.requireReconnect
const editable = this.editMode && (!this.requireReconnect || experimentalOfflineTyping)
if (this.$editor.isEditable !== editable) {
this.$editor.setEditable(editable)
}
Expand Down Expand Up @@ -744,7 +746,9 @@ export default {
onIdle() {
this.$syncService.close()
this.idle = true
this.readOnly = true
if (!experimentalOfflineTyping) {
this.readOnly = true
}
this.editMode = false
this.$editor.setEditable(this.editMode)

Expand Down Expand Up @@ -790,7 +794,9 @@ export default {
this.$providers = []
this.$syncService = null
// disallow editing while still showing the content
this.readOnly = true
if (!experimentalOfflineTyping) {
this.readOnly = true
}
},

async close() {
Expand Down
Loading