Why is the ID not being found by getElementById() or querySelector() when making a classic editor via CKEditor 5

131 views Asked by At

I want to implement an classiceditor from ckeditor 5, but the id from my div can't be found. This is the code:

ClassicEditor
    // Note that you do not have to specify the plugin and toolbar configuration — using defaults from the build.
    .create( document.getElementById("editor") as HTMLElement )
    .catch( error => {
        console.error( error.stack );
    } );

And the SMUI component I'm using for the editor.

<div class="rowmargin">
    <Textfield
    style="width: 100%;"
    bind:value={$s_instruction.Text}
    label="Text"
    variant="outlined"
    id="editor">
    </Textfield>
</div>

Also tried just doing this, got the same problem:

<div class= "rowmargin" id="editor">  
</div>

Would have expected for the classiceditor to appear with in this div.

0

There are 0 answers