fix: Fixed issue where super note would be editable even when "Prevent editing" is enabled

This commit is contained in:
Aman Harwara
2023-09-29 19:06:02 +05:30
parent af43aa05c1
commit d2fad22418

View File

@@ -69,7 +69,7 @@ type State = {
isDesktop?: boolean isDesktop?: boolean
editorLineWidth: EditorLineWidth editorLineWidth: EditorLineWidth
noteLocked: boolean noteLocked: boolean
readonly: boolean readonly?: boolean
noteStatus?: NoteStatus noteStatus?: NoteStatus
saveError?: boolean saveError?: boolean
showProtectedWarning: boolean showProtectedWarning: boolean
@@ -129,7 +129,7 @@ class NoteView extends AbstractComponent<NoteViewProps, State> {
isDesktop: isDesktopApplication(), isDesktop: isDesktopApplication(),
noteStatus: undefined, noteStatus: undefined,
noteLocked: this.controller.item.locked, noteLocked: this.controller.item.locked,
readonly: itemVault ? this.application.vaultUsers.isCurrentUserReadonlyVaultMember(itemVault) : false, readonly: itemVault ? this.application.vaultUsers.isCurrentUserReadonlyVaultMember(itemVault) : undefined,
showProtectedWarning: false, showProtectedWarning: false,
spellcheck: true, spellcheck: true,
stackComponentViewers: [], stackComponentViewers: [],
@@ -223,7 +223,7 @@ class NoteView extends AbstractComponent<NoteViewProps, State> {
return return
} }
this.setState({ this.setState({
readonly: vault ? this.application.vaultUsers.isCurrentUserReadonlyVaultMember(vault) : false, readonly: vault ? this.application.vaultUsers.isCurrentUserReadonlyVaultMember(vault) : undefined,
}) })
} }
}) })
@@ -1008,7 +1008,7 @@ class NoteView extends AbstractComponent<NoteViewProps, State> {
spellcheck={this.state.spellcheck} spellcheck={this.state.spellcheck}
ref={this.setPlainEditorRef} ref={this.setPlainEditorRef}
controller={this.controller} controller={this.controller}
locked={this.state.noteLocked || this.state.readonly} locked={this.state.noteLocked || !!this.state.readonly}
onFocus={this.onPlainFocus} onFocus={this.onPlainFocus}
onBlur={this.onPlainBlur} onBlur={this.onPlainBlur}
/> />