Skip to content

Commit

Permalink
fix(LexicalContentEditable): readonly state not firing
Browse files Browse the repository at this point in the history
  • Loading branch information
wobsoriano committed Jul 25, 2022
1 parent f5e6370 commit 6c48768
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions packages/lexical-vue/src/components/LexicalContentEditable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ withDefaults(defineProps<{
}>(), {
role: 'textbox',
spellcheck: true,
enableGrammarly: true,
})
const isReadOnly = ref(true)
let unregisterListener: () => void
onMounted(() => {
if (root.value)
if (root.value) {
editor.setRootElement(root.value)
isReadOnly.value = editor.isReadOnly()
}
})
unregisterListener = editor.registerReadOnlyListener((currentIsReadOnly) => {
isReadOnly.value = currentIsReadOnly
})
const unregisterListener = editor.registerReadOnlyListener((currentIsReadOnly) => {
isReadOnly.value = currentIsReadOnly
})
onUnmounted(() => {
Expand Down Expand Up @@ -68,6 +68,5 @@ onUnmounted(() => {
:role="isReadOnly ? undefined : role"
:spellcheck="spellcheck"
:tabindex="tabindex"
:data-enable-grammarly="enableGrammarly"
/>
</template>

0 comments on commit 6c48768

Please sign in to comment.