rich editor

This commit is contained in:
2026-05-14 23:10:07 +03:00
parent f99aadee83
commit d1c896acf4
5 changed files with 36 additions and 47 deletions
@@ -15,34 +15,14 @@
$: errorMessage = getErrorMessage(validationErrors, field.name);
let editor;
function insertMedia(e) {
editor.insertMedia(e.detail);
}
function onFilesInserted(e) {
console.log(e.detail);
const presetPath = e.detail.preset.path;
e.detail.files.map((aFile) => {
let html = htmlurl(channel, record, presetPath);
editor.insertMedia({
html: html,
url: presetUrl(channel, aFile, presetPath),
originalUrl: channel.filesUrl + "/" + aFile.path,
file: aFile,
});
});
editor.insertMedia(channel, e.detail.files, presetPath);
}
</script>
<div class="mb-3">
<RichEditorFiles
{record}
{field}
{validationErrors}
{onFilesInserted}
on:editor-insert={insertMedia}
<RichEditorFiles {record} {field} {validationErrors} {onFilesInserted}
></RichEditorFiles>
<Codemirror
bind:this={editor}