"TypeError: Failed to construct 'HTMLElement': Illegal constructor" while trying to bootstrap a project using EdgelessEditor in Preset with Vue #8927
-
Hi, I have an import { createEmptyDoc, EdgelessEditor } from "@blocksuite/presets";
export function initEditor() {
const doc = createEmptyDoc().init();
const editor = new EdgelessEditor();
editor.doc = doc;
return { editor };
} and then I will try to call it and init it in the Container like so: <template>
<div class="editor-container" ref="editorContainerRef"></div>
</template>
<script setup lang="ts">
import { inject, onMounted, ref } from "vue";
import { initEditor } from "../editor.ts";
const { editor } = initEditor();
const editorContainerRef = ref<HTMLDivElement>();
onMounted(() => {
editorContainerRef.value && editorContainerRef.value.appendChild(editor);
});
</script> It will throw the above error like this: I'm using the latest package from @BlockSuite: {
"dependencies": {
"@blocksuite/affine": "^0.18.5",
"@blocksuite/blocks": "^0.18.5",
"@blocksuite/presets": "^0.18.5",
"vue": "3.4.27"
},
} I was testing with the 0.15.0-canary version before, it works fine. But I can't bootstrap with 0.18.x Can someone help? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
import {effects as blocksEffects } from '@blocksuite/blocks/effects' blocksEffects() You should add this code before initializing editor |
Beta Was this translation helpful? Give feedback.
import {effects as blocksEffects } from '@blocksuite/blocks/effects'
import {effects as presetsEffects} from '@blocksuite/presets/effects'
blocksEffects()
presetsEffects()
You should add this code before initializing editor