when canvas and mermaid are inserted using "include note", we insert them as images

This commit is contained in:
zadam 2023-11-27 10:22:54 +01:00
parent d07f02b95f
commit 686af0c6a1
2 changed files with 2 additions and 4 deletions

View File

@ -97,7 +97,7 @@ export default class IncludeNoteDialog extends BasicWidget {
const boxSize = $("input[name='include-note-box-size']:checked").val();
if (note.type === 'image') {
if (['image', 'canvas', 'mermaid'].includes(note.type)) {
// there's no benefit to use insert note functionlity for images,
// so we'll just add an IMG tag
this.textTypeWidget.addImage(noteId);

View File

@ -368,9 +368,7 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget {
const encodedTitle = encodeURIComponent(note.title);
const src = `api/images/${note.noteId}/${encodedTitle}`;
const imageElement = writer.createElement( 'image', { 'src': src } );
this.watchdog.editor.model.insertContent(imageElement, this.watchdog.editor.model.document.selection);
this.watchdog.editor.execute( 'insertImage', { source: src } );
} );
}