rich editor
This commit is contained in:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user