fix(documents): switch markdown editor to single-pane wysiwyg
This commit is contained in:
@@ -29,18 +29,20 @@ function looksLikeHtml(value: string) {
|
||||
onMounted(async () => {
|
||||
if (!mountEl.value) return;
|
||||
const [{ default: Editor }] = await Promise.all([
|
||||
import("@toast-ui/editor"),
|
||||
// @ts-ignore Package exports for ESM entry do not expose typings correctly.
|
||||
import("@toast-ui/editor/dist/esm/index.js"),
|
||||
import("@toast-ui/editor/dist/toastui-editor.css"),
|
||||
]);
|
||||
|
||||
const initialValue = String(props.modelValue ?? "");
|
||||
const instance = new Editor({
|
||||
el: mountEl.value,
|
||||
initialEditType: "markdown",
|
||||
previewStyle: "vertical",
|
||||
initialEditType: "wysiwyg",
|
||||
previewStyle: "tab",
|
||||
initialValue: looksLikeHtml(initialValue) ? "" : initialValue,
|
||||
placeholder: props.placeholder ?? "Write with Markdown...",
|
||||
height: "520px",
|
||||
hideModeSwitch: true,
|
||||
usageStatistics: false,
|
||||
events: {
|
||||
change: () => {
|
||||
@@ -99,10 +101,6 @@ onBeforeUnmount(() => {
|
||||
border: 1px solid color-mix(in oklab, var(--color-base-content) 14%, transparent);
|
||||
}
|
||||
|
||||
.markdown-rich-editor :deep(.toastui-editor-mode-switch) {
|
||||
border-top: 1px solid color-mix(in oklab, var(--color-base-content) 12%, transparent);
|
||||
}
|
||||
|
||||
.markdown-rich-editor :deep(.toastui-editor-main-container) {
|
||||
min-height: 360px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user