Skip to content

Commit

Permalink
fix: read-only state for editor
Browse files Browse the repository at this point in the history
  • Loading branch information
devcatalin committed Apr 27, 2023
1 parent 10dd39d commit 205e1cb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/editor/listeners/editorSelection.listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ export const editorSelectionListener: AppListenerFn = listen => {
recreateEditorModel(editor, resourceContent.text);
enableResourceSchemaValidation(resourceMeta, getState());

if (resourceMeta.storage === 'preview') {
editor.updateOptions({
readOnly: true,
});
} else {
editor.updateOptions({
readOnly: false,
});
}

const promises = editorEnhancers.map(enhancer =>
Promise.resolve(enhancer({state: getState(), editor, resourceIdentifier, dispatch}))
);
Expand Down

0 comments on commit 205e1cb

Please sign in to comment.