When Editor is on readonly' mode editor throw warning "EventDispatcher .off(): there is no subscribers for event"
If Editor.js has 'readonly' mode true, then console tab display warning
EventDispatcher .off(): there is no subscribers for event "editor mobile layout toggled". Probably, .off() called before .on()
Expected behavior: No warning will display for read only mode
Screenshots:
I tested this on vue3 project. Below is code snippet
import { onMounted, ref } from 'vue'
import EditorJS from '@editorjs/editorjs'
import Header from '@editorjs/header'
const editorInstance = ref()
onMounted(() => {
const editorEl = document.getElementById('editorJs')
if (!editorEl) return
editorInstance.value = new EditorJS({
holder: editorEl,
readOnly: true,
tools: {
header: {
class: Header,
inlineToolbar: ['link'],
config: {
levels: [1, 2, 3, 4, 5, 6],
defaultLevel: 1,
},
},
},
})
})
</script>
<template>
<div id="editorJs">
</div>
</template>
I have the same problem
I guess temporary fix. Try this :
{
// ... config
readOnly: false, // optional because default value is false
onReady: async () => {
await editor.readOnly.toggle(true); // toggle readonly mode only when editor is up !
}
}
Will this issue be addressed in the future? Still having the same problem in React dev mode:/
The issue was caused by incorrect toolbar initialization when the editor was instantiated with read-only mode enabled. Resolved since v2.31.1.