rich editor
This commit is contained in:
@@ -8,19 +8,25 @@
|
||||
import { indentWithTab } from "@codemirror/commands";
|
||||
import { markdown } from "@codemirror/lang-markdown";
|
||||
import { lintKeymap } from "@codemirror/lint";
|
||||
import { fileurl, presetUrl } from "../files/imageserver";
|
||||
|
||||
let parentElement;
|
||||
let codeMirrorView;
|
||||
export let value;
|
||||
export let editable = true;
|
||||
|
||||
export function insertMedia(info) {
|
||||
let insertText = "";
|
||||
if (info.file.width > 0) {
|
||||
insertText = ``;
|
||||
} else {
|
||||
insertText = `[${info.file.filename}](${info.originalUrl})`;
|
||||
}
|
||||
export function insertMedia(channel, files, presetPath) {
|
||||
const insertText = files.reduce((text, aFile) => {
|
||||
const url =
|
||||
aFile.width > 0
|
||||
? presetUrl(channel, aFile, presetPath)
|
||||
: fileurl(channel, aFile);
|
||||
|
||||
let addTest = ``;
|
||||
|
||||
return text + "\n" + addTest;
|
||||
}, "");
|
||||
|
||||
const cursor = codeMirrorView.state.selection.main.head;
|
||||
const transaction = codeMirrorView.state.update({
|
||||
changes: {
|
||||
|
||||
Reference in New Issue
Block a user