Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

editor: disable selection persist in readonly mode

Abdullah Atta828cd6be35e3
diff --git a/packages/editor/src/extensions/selection-persist/selection-persist.ts b/packages/editor/src/extensions/selection-persist/selection-persist.ts
index 5bca4feb9..b44044941 100644
--- a/packages/editor/src/extensions/selection-persist/selection-persist.ts
+++ b/packages/editor/src/extensions/selection-persist/selection-persist.ts
@@ -45,7 +45,7 @@ export const SelectionPersist = Extension.create({
apply(tr, _value, oldState) {
const { isSearching } = (editor.storage.searchreplace ||
{}) as Partial<SearchStorage>;
- if (isSearching) return DecorationSet.empty;
+ if (isSearching || !editor.isEditable) return DecorationSet.empty;
// isBlurred should remain true until isFocused becomes true
// isFocused should remain true until isBlurred becomes true