fix(editor): Disable expression editor modal opening on readonly field (#8457)

This commit is contained in:
Csaba Tuncsik
2024-01-29 16:34:10 +01:00
committed by GitHub
parent 9e93980957
commit eb27ed068b
6 changed files with 118 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
<template>
<div ref="root" @keydown.stop></div>
<div ref="root" :class="$style.editor" @keydown.stop></div>
</template>
<script lang="ts">
@@ -67,6 +67,7 @@ export default defineComponent({
history(),
expressionInputHandler(),
EditorView.lineWrapping,
EditorView.editable.of(!this.isReadOnly),
EditorState.readOnly.of(this.isReadOnly),
EditorView.contentAttributes.of({ 'data-gramm': 'false' }), // disable grammarly
EditorView.domEventHandlers({ scroll: forceParse }),
@@ -146,4 +147,14 @@ export default defineComponent({
});
</script>
<style lang="scss"></style>
<style lang="scss" module>
.editor div[contenteditable='false'] {
background-color: var(--disabled-fill, var(--color-background-light));
cursor: not-allowed;
}
</style>
<style lang="scss" scoped>
:deep(.cm-content) {
border-radius: var(--border-radius-base);
}
</style>