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