From 80885385894c42aae91ee69807344185c6c4d01e Mon Sep 17 00:00:00 2001 From: AceDataCloud Date: Sat, 4 Sep 2021 03:28:07 +0800 Subject: [PATCH] rm src --- .../{src => }/assets/scss/_content.scss | 0 .../vditor/{src => }/assets/scss/_hint.scss | 0 .../vditor/{src => }/assets/scss/_ir.scss | 0 .../vditor/{src => }/assets/scss/_panel.scss | 0 .../vditor/{src => }/assets/scss/_reset.scss | 0 .../vditor/{src => }/assets/scss/_sv.scss | 0 .../{src => }/assets/scss/_toolbar.scss | 0 .../{src => }/assets/scss/_tooltipped.scss | 0 .../{src => }/assets/scss/_wysiwyg.scss | 0 .../vditor/{src => }/assets/scss/index.scss | 0 src/libs/vditor/index.ts | 471 ++++++++++++++++ src/libs/vditor/{src => }/method.ts | 0 src/libs/vditor/src/index.ts | 502 ------------------ src/libs/vditor/{src => }/ts/constants.ts | 0 .../vditor/{src => }/ts/devtools/index.ts | 0 src/libs/vditor/{src => }/ts/export/index.ts | 0 src/libs/vditor/{src => }/ts/hint/index.ts | 0 .../vditor/{src => }/ts/ir/expandMarker.ts | 0 .../{src => }/ts/ir/highlightToolbarIR.ts | 0 src/libs/vditor/{src => }/ts/ir/index.ts | 0 src/libs/vditor/{src => }/ts/ir/input.ts | 0 src/libs/vditor/{src => }/ts/ir/process.ts | 0 .../vditor/{src => }/ts/ir/processKeydown.ts | 0 .../vditor/{src => }/ts/markdown/abcRender.ts | 0 .../{src => }/ts/markdown/adapterRender.ts | 0 .../{src => }/ts/markdown/anchorRender.ts | 0 .../{src => }/ts/markdown/chartRender.ts | 0 .../{src => }/ts/markdown/codeRender.ts | 0 .../{src => }/ts/markdown/flowchartRender.ts | 0 .../vditor/{src => }/ts/markdown/getHTML.ts | 0 .../{src => }/ts/markdown/getMarkdown.ts | 0 .../{src => }/ts/markdown/graphvizRender.ts | 0 .../{src => }/ts/markdown/highlightRender.ts | 0 .../ts/markdown/lazyLoadImageRender.ts | 0 .../{src => }/ts/markdown/mathRender.ts | 0 .../{src => }/ts/markdown/mediaRender.ts | 0 .../{src => }/ts/markdown/mermaidRender.ts | 0 .../{src => }/ts/markdown/mindmapRender.ts | 0 .../{src => }/ts/markdown/outlineRender.ts | 0 .../{src => }/ts/markdown/plantumlRender.ts | 0 .../{src => }/ts/markdown/previewRender.ts | 0 .../vditor/{src => }/ts/markdown/setLute.ts | 0 .../{src => }/ts/markdown/speechRender.ts | 0 src/libs/vditor/{src => }/ts/outline/index.ts | 0 src/libs/vditor/{src => }/ts/preview/image.ts | 0 src/libs/vditor/{src => }/ts/preview/index.ts | 0 src/libs/vditor/{src => }/ts/resize/index.ts | 0 src/libs/vditor/{src => }/ts/sv/index.ts | 0 src/libs/vditor/{src => }/ts/sv/inputEvent.ts | 0 src/libs/vditor/{src => }/ts/sv/process.ts | 0 .../vditor/{src => }/ts/sv/processKeydown.ts | 0 src/libs/vditor/{src => }/ts/tip/index.ts | 0 src/libs/vditor/{src => }/ts/toolbar/Both.ts | 0 src/libs/vditor/{src => }/ts/toolbar/Br.ts | 0 .../vditor/{src => }/ts/toolbar/CodeTheme.ts | 0 .../{src => }/ts/toolbar/ContentTheme.ts | 0 .../vditor/{src => }/ts/toolbar/Counter.ts | 0 .../vditor/{src => }/ts/toolbar/Custom.ts | 0 .../vditor/{src => }/ts/toolbar/Devtools.ts | 0 .../vditor/{src => }/ts/toolbar/Divider.ts | 0 .../vditor/{src => }/ts/toolbar/EditMode.ts | 0 src/libs/vditor/{src => }/ts/toolbar/Emoji.ts | 0 .../vditor/{src => }/ts/toolbar/Export.ts | 0 .../vditor/{src => }/ts/toolbar/Fullscreen.ts | 0 .../vditor/{src => }/ts/toolbar/Headings.ts | 0 src/libs/vditor/{src => }/ts/toolbar/Help.ts | 0 .../vditor/{src => }/ts/toolbar/Indent.ts | 0 src/libs/vditor/{src => }/ts/toolbar/Info.ts | 0 .../{src => }/ts/toolbar/InsertAfter.ts | 0 .../{src => }/ts/toolbar/InsertBefore.ts | 0 .../vditor/{src => }/ts/toolbar/MenuItem.ts | 0 .../vditor/{src => }/ts/toolbar/Outdent.ts | 0 .../vditor/{src => }/ts/toolbar/Outline.ts | 0 .../vditor/{src => }/ts/toolbar/Preview.ts | 0 .../vditor/{src => }/ts/toolbar/Record.ts | 0 src/libs/vditor/{src => }/ts/toolbar/Redo.ts | 0 src/libs/vditor/{src => }/ts/toolbar/Undo.ts | 0 .../vditor/{src => }/ts/toolbar/Upload.ts | 0 src/libs/vditor/{src => }/ts/toolbar/index.ts | 0 .../vditor/{src => }/ts/toolbar/setToolbar.ts | 0 src/libs/vditor/{src => }/ts/ui/initUI.ts | 0 .../vditor/{src => }/ts/ui/setCodeTheme.ts | 0 .../vditor/{src => }/ts/ui/setContentTheme.ts | 0 .../vditor/{src => }/ts/ui/setPreviewMode.ts | 0 src/libs/vditor/{src => }/ts/ui/setTheme.ts | 0 src/libs/vditor/{src => }/ts/undo/index.ts | 0 .../vditor/{src => }/ts/upload/getElement.ts | 0 src/libs/vditor/{src => }/ts/upload/index.ts | 0 .../vditor/{src => }/ts/upload/setHeaders.ts | 0 src/libs/vditor/{src => }/ts/util/Options.ts | 0 .../vditor/{src => }/ts/util/RecordMedia.ts | 0 .../vditor/{src => }/ts/util/addScript.ts | 0 src/libs/vditor/{src => }/ts/util/addStyle.ts | 0 .../vditor/{src => }/ts/util/code160to32.ts | 0 .../vditor/{src => }/ts/util/compatibility.ts | 0 .../{src => }/ts/util/editorCommonEvent.ts | 0 .../{src => }/ts/util/fixBrowserBehavior.ts | 0 .../vditor/{src => }/ts/util/getSelectText.ts | 0 .../vditor/{src => }/ts/util/hasClosest.ts | 0 .../{src => }/ts/util/hasClosestByHeadings.ts | 0 .../{src => }/ts/util/highlightToolbar.ts | 0 src/libs/vditor/{src => }/ts/util/hotKey.ts | 0 src/libs/vditor/{src => }/ts/util/log.ts | 0 src/libs/vditor/{src => }/ts/util/merge.ts | 0 .../vditor/{src => }/ts/util/processCode.ts | 0 .../vditor/{src => }/ts/util/selection.ts | 0 src/libs/vditor/{src => }/ts/util/toc.ts | 0 .../{src => }/ts/wysiwyg/afterRenderEvent.ts | 0 .../ts/wysiwyg/highlightToolbarWYSIWYG.ts | 0 src/libs/vditor/{src => }/ts/wysiwyg/index.ts | 0 .../vditor/{src => }/ts/wysiwyg/inlineTag.ts | 0 src/libs/vditor/{src => }/ts/wysiwyg/input.ts | 0 .../{src => }/ts/wysiwyg/processKeydown.ts | 0 .../{src => }/ts/wysiwyg/renderDomByMd.ts | 0 .../vditor/{src => }/ts/wysiwyg/setHeading.ts | 0 .../vditor/{src => }/ts/wysiwyg/showCode.ts | 0 .../{src => }/ts/wysiwyg/toolbarEvent.ts | 0 src/pages/editor/article/Detail.vue | 4 +- src/settings/editor.ts | 2 +- 119 files changed, 474 insertions(+), 505 deletions(-) rename src/libs/vditor/{src => }/assets/scss/_content.scss (100%) rename src/libs/vditor/{src => }/assets/scss/_hint.scss (100%) rename src/libs/vditor/{src => }/assets/scss/_ir.scss (100%) rename src/libs/vditor/{src => }/assets/scss/_panel.scss (100%) rename src/libs/vditor/{src => }/assets/scss/_reset.scss (100%) rename src/libs/vditor/{src => }/assets/scss/_sv.scss (100%) rename src/libs/vditor/{src => }/assets/scss/_toolbar.scss (100%) rename src/libs/vditor/{src => }/assets/scss/_tooltipped.scss (100%) rename src/libs/vditor/{src => }/assets/scss/_wysiwyg.scss (100%) rename src/libs/vditor/{src => }/assets/scss/index.scss (100%) create mode 100644 src/libs/vditor/index.ts rename src/libs/vditor/{src => }/method.ts (100%) delete mode 100644 src/libs/vditor/src/index.ts rename src/libs/vditor/{src => }/ts/constants.ts (100%) rename src/libs/vditor/{src => }/ts/devtools/index.ts (100%) rename src/libs/vditor/{src => }/ts/export/index.ts (100%) rename src/libs/vditor/{src => }/ts/hint/index.ts (100%) rename src/libs/vditor/{src => }/ts/ir/expandMarker.ts (100%) rename src/libs/vditor/{src => }/ts/ir/highlightToolbarIR.ts (100%) rename src/libs/vditor/{src => }/ts/ir/index.ts (100%) rename src/libs/vditor/{src => }/ts/ir/input.ts (100%) rename src/libs/vditor/{src => }/ts/ir/process.ts (100%) rename src/libs/vditor/{src => }/ts/ir/processKeydown.ts (100%) rename src/libs/vditor/{src => }/ts/markdown/abcRender.ts (100%) rename src/libs/vditor/{src => }/ts/markdown/adapterRender.ts (100%) rename src/libs/vditor/{src => }/ts/markdown/anchorRender.ts (100%) rename src/libs/vditor/{src => }/ts/markdown/chartRender.ts (100%) rename src/libs/vditor/{src => }/ts/markdown/codeRender.ts (100%) rename src/libs/vditor/{src => }/ts/markdown/flowchartRender.ts (100%) rename src/libs/vditor/{src => }/ts/markdown/getHTML.ts (100%) rename src/libs/vditor/{src => }/ts/markdown/getMarkdown.ts (100%) rename src/libs/vditor/{src => }/ts/markdown/graphvizRender.ts (100%) rename src/libs/vditor/{src => }/ts/markdown/highlightRender.ts (100%) rename src/libs/vditor/{src => }/ts/markdown/lazyLoadImageRender.ts (100%) rename src/libs/vditor/{src => }/ts/markdown/mathRender.ts (100%) rename src/libs/vditor/{src => }/ts/markdown/mediaRender.ts (100%) rename src/libs/vditor/{src => }/ts/markdown/mermaidRender.ts (100%) rename src/libs/vditor/{src => }/ts/markdown/mindmapRender.ts (100%) rename src/libs/vditor/{src => }/ts/markdown/outlineRender.ts (100%) rename src/libs/vditor/{src => }/ts/markdown/plantumlRender.ts (100%) rename src/libs/vditor/{src => }/ts/markdown/previewRender.ts (100%) rename src/libs/vditor/{src => }/ts/markdown/setLute.ts (100%) rename src/libs/vditor/{src => }/ts/markdown/speechRender.ts (100%) rename src/libs/vditor/{src => }/ts/outline/index.ts (100%) rename src/libs/vditor/{src => }/ts/preview/image.ts (100%) rename src/libs/vditor/{src => }/ts/preview/index.ts (100%) rename src/libs/vditor/{src => }/ts/resize/index.ts (100%) rename src/libs/vditor/{src => }/ts/sv/index.ts (100%) rename src/libs/vditor/{src => }/ts/sv/inputEvent.ts (100%) rename src/libs/vditor/{src => }/ts/sv/process.ts (100%) rename src/libs/vditor/{src => }/ts/sv/processKeydown.ts (100%) rename src/libs/vditor/{src => }/ts/tip/index.ts (100%) rename src/libs/vditor/{src => }/ts/toolbar/Both.ts (100%) rename src/libs/vditor/{src => }/ts/toolbar/Br.ts (100%) rename src/libs/vditor/{src => }/ts/toolbar/CodeTheme.ts (100%) rename src/libs/vditor/{src => }/ts/toolbar/ContentTheme.ts (100%) rename src/libs/vditor/{src => }/ts/toolbar/Counter.ts (100%) rename src/libs/vditor/{src => }/ts/toolbar/Custom.ts (100%) rename src/libs/vditor/{src => }/ts/toolbar/Devtools.ts (100%) rename src/libs/vditor/{src => }/ts/toolbar/Divider.ts (100%) rename src/libs/vditor/{src => }/ts/toolbar/EditMode.ts (100%) rename src/libs/vditor/{src => }/ts/toolbar/Emoji.ts (100%) rename src/libs/vditor/{src => }/ts/toolbar/Export.ts (100%) rename src/libs/vditor/{src => }/ts/toolbar/Fullscreen.ts (100%) rename src/libs/vditor/{src => }/ts/toolbar/Headings.ts (100%) rename src/libs/vditor/{src => }/ts/toolbar/Help.ts (100%) rename src/libs/vditor/{src => }/ts/toolbar/Indent.ts (100%) rename src/libs/vditor/{src => }/ts/toolbar/Info.ts (100%) rename src/libs/vditor/{src => }/ts/toolbar/InsertAfter.ts (100%) rename src/libs/vditor/{src => }/ts/toolbar/InsertBefore.ts (100%) rename src/libs/vditor/{src => }/ts/toolbar/MenuItem.ts (100%) rename src/libs/vditor/{src => }/ts/toolbar/Outdent.ts (100%) rename src/libs/vditor/{src => }/ts/toolbar/Outline.ts (100%) rename src/libs/vditor/{src => }/ts/toolbar/Preview.ts (100%) rename src/libs/vditor/{src => }/ts/toolbar/Record.ts (100%) rename src/libs/vditor/{src => }/ts/toolbar/Redo.ts (100%) rename src/libs/vditor/{src => }/ts/toolbar/Undo.ts (100%) rename src/libs/vditor/{src => }/ts/toolbar/Upload.ts (100%) rename src/libs/vditor/{src => }/ts/toolbar/index.ts (100%) rename src/libs/vditor/{src => }/ts/toolbar/setToolbar.ts (100%) rename src/libs/vditor/{src => }/ts/ui/initUI.ts (100%) rename src/libs/vditor/{src => }/ts/ui/setCodeTheme.ts (100%) rename src/libs/vditor/{src => }/ts/ui/setContentTheme.ts (100%) rename src/libs/vditor/{src => }/ts/ui/setPreviewMode.ts (100%) rename src/libs/vditor/{src => }/ts/ui/setTheme.ts (100%) rename src/libs/vditor/{src => }/ts/undo/index.ts (100%) rename src/libs/vditor/{src => }/ts/upload/getElement.ts (100%) rename src/libs/vditor/{src => }/ts/upload/index.ts (100%) rename src/libs/vditor/{src => }/ts/upload/setHeaders.ts (100%) rename src/libs/vditor/{src => }/ts/util/Options.ts (100%) rename src/libs/vditor/{src => }/ts/util/RecordMedia.ts (100%) rename src/libs/vditor/{src => }/ts/util/addScript.ts (100%) rename src/libs/vditor/{src => }/ts/util/addStyle.ts (100%) rename src/libs/vditor/{src => }/ts/util/code160to32.ts (100%) rename src/libs/vditor/{src => }/ts/util/compatibility.ts (100%) rename src/libs/vditor/{src => }/ts/util/editorCommonEvent.ts (100%) rename src/libs/vditor/{src => }/ts/util/fixBrowserBehavior.ts (100%) rename src/libs/vditor/{src => }/ts/util/getSelectText.ts (100%) rename src/libs/vditor/{src => }/ts/util/hasClosest.ts (100%) rename src/libs/vditor/{src => }/ts/util/hasClosestByHeadings.ts (100%) rename src/libs/vditor/{src => }/ts/util/highlightToolbar.ts (100%) rename src/libs/vditor/{src => }/ts/util/hotKey.ts (100%) rename src/libs/vditor/{src => }/ts/util/log.ts (100%) rename src/libs/vditor/{src => }/ts/util/merge.ts (100%) rename src/libs/vditor/{src => }/ts/util/processCode.ts (100%) rename src/libs/vditor/{src => }/ts/util/selection.ts (100%) rename src/libs/vditor/{src => }/ts/util/toc.ts (100%) rename src/libs/vditor/{src => }/ts/wysiwyg/afterRenderEvent.ts (100%) rename src/libs/vditor/{src => }/ts/wysiwyg/highlightToolbarWYSIWYG.ts (100%) rename src/libs/vditor/{src => }/ts/wysiwyg/index.ts (100%) rename src/libs/vditor/{src => }/ts/wysiwyg/inlineTag.ts (100%) rename src/libs/vditor/{src => }/ts/wysiwyg/input.ts (100%) rename src/libs/vditor/{src => }/ts/wysiwyg/processKeydown.ts (100%) rename src/libs/vditor/{src => }/ts/wysiwyg/renderDomByMd.ts (100%) rename src/libs/vditor/{src => }/ts/wysiwyg/setHeading.ts (100%) rename src/libs/vditor/{src => }/ts/wysiwyg/showCode.ts (100%) rename src/libs/vditor/{src => }/ts/wysiwyg/toolbarEvent.ts (100%) diff --git a/src/libs/vditor/src/assets/scss/_content.scss b/src/libs/vditor/assets/scss/_content.scss similarity index 100% rename from src/libs/vditor/src/assets/scss/_content.scss rename to src/libs/vditor/assets/scss/_content.scss diff --git a/src/libs/vditor/src/assets/scss/_hint.scss b/src/libs/vditor/assets/scss/_hint.scss similarity index 100% rename from src/libs/vditor/src/assets/scss/_hint.scss rename to src/libs/vditor/assets/scss/_hint.scss diff --git a/src/libs/vditor/src/assets/scss/_ir.scss b/src/libs/vditor/assets/scss/_ir.scss similarity index 100% rename from src/libs/vditor/src/assets/scss/_ir.scss rename to src/libs/vditor/assets/scss/_ir.scss diff --git a/src/libs/vditor/src/assets/scss/_panel.scss b/src/libs/vditor/assets/scss/_panel.scss similarity index 100% rename from src/libs/vditor/src/assets/scss/_panel.scss rename to src/libs/vditor/assets/scss/_panel.scss diff --git a/src/libs/vditor/src/assets/scss/_reset.scss b/src/libs/vditor/assets/scss/_reset.scss similarity index 100% rename from src/libs/vditor/src/assets/scss/_reset.scss rename to src/libs/vditor/assets/scss/_reset.scss diff --git a/src/libs/vditor/src/assets/scss/_sv.scss b/src/libs/vditor/assets/scss/_sv.scss similarity index 100% rename from src/libs/vditor/src/assets/scss/_sv.scss rename to src/libs/vditor/assets/scss/_sv.scss diff --git a/src/libs/vditor/src/assets/scss/_toolbar.scss b/src/libs/vditor/assets/scss/_toolbar.scss similarity index 100% rename from src/libs/vditor/src/assets/scss/_toolbar.scss rename to src/libs/vditor/assets/scss/_toolbar.scss diff --git a/src/libs/vditor/src/assets/scss/_tooltipped.scss b/src/libs/vditor/assets/scss/_tooltipped.scss similarity index 100% rename from src/libs/vditor/src/assets/scss/_tooltipped.scss rename to src/libs/vditor/assets/scss/_tooltipped.scss diff --git a/src/libs/vditor/src/assets/scss/_wysiwyg.scss b/src/libs/vditor/assets/scss/_wysiwyg.scss similarity index 100% rename from src/libs/vditor/src/assets/scss/_wysiwyg.scss rename to src/libs/vditor/assets/scss/_wysiwyg.scss diff --git a/src/libs/vditor/src/assets/scss/index.scss b/src/libs/vditor/assets/scss/index.scss similarity index 100% rename from src/libs/vditor/src/assets/scss/index.scss rename to src/libs/vditor/assets/scss/index.scss diff --git a/src/libs/vditor/index.ts b/src/libs/vditor/index.ts new file mode 100644 index 00000000..bdc0698b --- /dev/null +++ b/src/libs/vditor/index.ts @@ -0,0 +1,471 @@ +import './assets/scss/index.scss'; +import VditorMethod from './method'; +import { Constants, VDITOR_VERSION } from './ts/constants'; +import { DevTools } from './ts/devtools/index'; +import { Hint } from './ts/hint/index'; +import { IR } from './ts/ir/index'; +import { input as irInput } from './ts/ir/input'; +import { processAfterRender } from './ts/ir/process'; +import { getHTML } from './ts/markdown/getHTML'; +import { getMarkdown } from './ts/markdown/getMarkdown'; +import { setLute } from './ts/markdown/setLute'; +import { Outline } from './ts/outline/index'; +import { Preview } from './ts/preview/index'; +import { Resize } from './ts/resize/index'; +import { Editor } from './ts/sv/index'; +import { inputEvent } from './ts/sv/inputEvent'; +import { processAfterRender as processSVAfterRender } from './ts/sv/process'; +import { Tip } from './ts/tip/index'; +import { Toolbar } from './ts/toolbar/index'; +import { disableToolbar, hidePanel } from './ts/toolbar/setToolbar'; +import { enableToolbar } from './ts/toolbar/setToolbar'; +import { initUI } from './ts/ui/initUI'; +import { setCodeTheme } from './ts/ui/setCodeTheme'; +import { setContentTheme } from './ts/ui/setContentTheme'; +import { setPreviewMode } from './ts/ui/setPreviewMode'; +import { setTheme } from './ts/ui/setTheme'; +import { Undo } from './ts/undo/index'; +import { Upload } from './ts/upload/index'; +import { addScript, addScriptSync } from './ts/util/addScript'; +import { getSelectText } from './ts/util/getSelectText'; +import { Options } from './ts/util/Options'; +import { processCodeRender } from './ts/util/processCode'; +import { getCursorPosition, getEditorRange } from './ts/util/selection'; +import { afterRenderEvent } from './ts/wysiwyg/afterRenderEvent'; +import { WYSIWYG } from './ts/wysiwyg/index'; +import { input } from './ts/wysiwyg/input'; +import { renderDomByMd } from './ts/wysiwyg/renderDomByMd'; + +class Vditor extends VditorMethod { + public readonly version: string; + public vditor: IVditor; + + /** + * @param id 要挂载 Vditor 的元素或者元素 ID。 + * @param options Vditor 参数 + */ + constructor(id: string | HTMLElement, options?: IOptions) { + super(); + this.version = VDITOR_VERSION; + + if (typeof id === 'string') { + if (!options) { + options = { + cache: { + id: `vditor${id}` + } + }; + } else if (!options.cache) { + options.cache = { id: `vditor${id}` }; + } else if (!options.cache.id) { + options.cache.id = `vditor${id}`; + } + id = document.getElementById(id); + } + + const getOptions = new Options(options); + const mergedOptions = getOptions.merge(); + + // 支持自定义国际化 + if (!mergedOptions.i18n) { + if (!['en_US', 'ja_JP', 'ko_KR', 'ru_RU', 'zh_CN', 'zh_TW'].includes(mergedOptions.lang)) { + throw new Error('options.lang error, see https://ld246.com/article/1549638745630#options'); + } else { + addScript(`${mergedOptions.cdn}/dist/js/i18n/${mergedOptions.lang}.js`, 'vditorI18nScript').then(() => { + this.init(id as HTMLElement, mergedOptions); + }); + } + } else { + window.VditorI18n = mergedOptions.i18n; + this.init(id, mergedOptions); + } + } + + /** 设置主题 */ + public setTheme(theme: 'dark' | 'classic', contentTheme?: string, codeTheme?: string, contentThemePath?: string) { + this.vditor.options.theme = theme; + setTheme(this.vditor); + if (contentTheme) { + this.vditor.options.preview.theme.current = contentTheme; + setContentTheme(contentTheme, contentThemePath || this.vditor.options.preview.theme.path); + } + if (codeTheme) { + this.vditor.options.preview.hljs.style = codeTheme; + setCodeTheme(codeTheme, this.vditor.options.cdn); + } + } + + /** 获取 Markdown 内容 */ + public getValue() { + return getMarkdown(this.vditor); + } + + /** 获取编辑器当前编辑模式 */ + public getCurrentMode() { + return this.vditor.currentMode; + } + + /** 聚焦到编辑器 */ + public focus() { + if (this.vditor.currentMode === 'sv') { + this.vditor.sv.element.focus(); + } else if (this.vditor.currentMode === 'wysiwyg') { + this.vditor.wysiwyg.element.focus(); + } else if (this.vditor.currentMode === 'ir') { + this.vditor.ir.element.focus(); + } + } + + /** 让编辑器失焦 */ + public blur() { + if (this.vditor.currentMode === 'sv') { + this.vditor.sv.element.blur(); + } else if (this.vditor.currentMode === 'wysiwyg') { + this.vditor.wysiwyg.element.blur(); + } else if (this.vditor.currentMode === 'ir') { + this.vditor.ir.element.blur(); + } + } + + /** 禁用编辑器 */ + public disabled() { + hidePanel(this.vditor, ['subToolbar', 'hint', 'popover']); + disableToolbar( + this.vditor.toolbar.elements, + Constants.EDIT_TOOLBARS.concat(['undo', 'redo', 'fullscreen', 'edit-mode']) + ); + this.vditor[this.vditor.currentMode].element.setAttribute('contenteditable', 'false'); + } + + /** 解除编辑器禁用 */ + public enable() { + enableToolbar( + this.vditor.toolbar.elements, + Constants.EDIT_TOOLBARS.concat(['undo', 'redo', 'fullscreen', 'edit-mode']) + ); + this.vditor.undo.resetIcon(this.vditor); + this.vditor[this.vditor.currentMode].element.setAttribute('contenteditable', 'true'); + } + + /** 返回选中的字符串 */ + public getSelection() { + if (this.vditor.currentMode === 'wysiwyg') { + return getSelectText(this.vditor.wysiwyg.element); + } else if (this.vditor.currentMode === 'sv') { + return getSelectText(this.vditor.sv.element); + } else if (this.vditor.currentMode === 'ir') { + return getSelectText(this.vditor.ir.element); + } + } + + /** 设置预览区域内容 */ + public renderPreview(value?: string) { + this.vditor.preview.render(this.vditor, value); + } + + /** 获取焦点位置 */ + public getCursorPosition() { + return getCursorPosition(this.vditor[this.vditor.currentMode].element); + } + + /** 上传是否还在进行中 */ + public isUploading() { + return this.vditor.upload.isUploading; + } + + /** 清除缓存 */ + public clearCache() { + localStorage.removeItem(this.vditor.options.cache.id); + } + + /** 禁用缓存 */ + public disabledCache() { + this.vditor.options.cache.enable = false; + } + + /** 启用缓存 */ + public enableCache() { + if (!this.vditor.options.cache.id) { + throw new Error('need options.cache.id, see https://ld246.com/article/1549638745630#options'); + } + this.vditor.options.cache.enable = true; + } + + /** HTML 转 md */ + public html2md(value: string) { + return this.vditor.lute.HTML2Md(value); + } + + /** markdown 转 JSON 输出 */ + public exportJSON(value: string) { + return this.vditor.lute.RenderJSON(value); + } + + /** 获取 HTML */ + public getHTML() { + return getHTML(this.vditor); + } + + /** 消息提示。time 为 0 将一直显示 */ + public tip(text: string, time?: number) { + this.vditor.tip.show(text, time); + } + + /** 设置预览模式 */ + public setPreviewMode(mode: 'both' | 'editor') { + setPreviewMode(mode, this.vditor); + } + + /** 删除选中内容 */ + public deleteValue() { + if (window.getSelection().isCollapsed) { + return; + } + document.execCommand('delete', false); + } + + /** 更新选中内容 */ + public updateValue(value: string) { + document.execCommand('insertHTML', false, value); + } + + /** 在焦点处插入内容,并默认进行 Markdown 渲染 */ + public insertValue(value: string, render = true) { + const range = getEditorRange(this.vditor); + range.collapse(true); + const tmpElement = document.createElement('template'); + tmpElement.innerHTML = value; + range.insertNode(tmpElement.content.cloneNode(true)); + if (this.vditor.currentMode === 'sv') { + this.vditor.sv.preventInput = true; + if (render) { + inputEvent(this.vditor); + } + } else if (this.vditor.currentMode === 'wysiwyg') { + this.vditor.wysiwyg.preventInput = true; + if (render) { + input(this.vditor, getSelection().getRangeAt(0)); + } + } else if (this.vditor.currentMode === 'ir') { + this.vditor.ir.preventInput = true; + if (render) { + irInput(this.vditor, getSelection().getRangeAt(0), true); + } + } + } + + /** 设置编辑器内容 */ + public setValue(markdown: string, clearStack = false) { + if (this.vditor.currentMode === 'sv') { + this.vditor.sv.element.innerHTML = this.vditor.lute.SpinVditorSVDOM(markdown); + processSVAfterRender(this.vditor, { + enableAddUndoStack: true, + enableHint: false, + enableInput: false + }); + } else if (this.vditor.currentMode === 'wysiwyg') { + renderDomByMd(this.vditor, markdown, { + enableAddUndoStack: true, + enableHint: false, + enableInput: false + }); + } else { + this.vditor.ir.element.innerHTML = this.vditor.lute.Md2VditorIRDOM(markdown); + this.vditor.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach((item: HTMLElement) => { + processCodeRender(item, this.vditor); + }); + processAfterRender(this.vditor, { + enableAddUndoStack: true, + enableHint: false, + enableInput: false + }); + } + + this.vditor.outline.render(this.vditor); + + if (!markdown) { + hidePanel(this.vditor, ['emoji', 'headings', 'submenu', 'hint']); + if (this.vditor.wysiwyg.popover) { + this.vditor.wysiwyg.popover.style.display = 'none'; + } + this.clearCache(); + } + if (clearStack) { + this.clearStack(); + } + } + + /** 清空 undo & redo 栈 */ + public clearStack() { + this.vditor.undo.clearStack(this.vditor); + this.vditor.undo.addToUndoStack(this.vditor); + } + + /** 销毁编辑器 */ + public destroy() { + this.vditor.element.innerHTML = this.vditor.originalInnerHTML; + this.vditor.element.classList.remove('vditor'); + this.vditor.element.removeAttribute('style'); + document.getElementById('vditorIconScript').remove(); + this.clearCache(); + } + + /** 获取评论 ID */ + public getCommentIds() { + if (this.vditor.currentMode !== 'wysiwyg') { + return []; + } + return this.vditor.wysiwyg.getComments(this.vditor, true); + } + + /** 高亮评论 */ + public hlCommentIds(ids: string[]) { + if (this.vditor.currentMode !== 'wysiwyg') { + return; + } + const hlItem = (item: Element) => { + item.classList.remove('vditor-comment--hover'); + ids.forEach((id) => { + if (item.getAttribute('data-cmtids').indexOf(id) > -1) { + item.classList.add('vditor-comment--hover'); + } + }); + }; + this.vditor.wysiwyg.element.querySelectorAll('.vditor-comment').forEach((item) => { + hlItem(item); + }); + if (this.vditor.preview.element.style.display !== 'none') { + this.vditor.preview.element.querySelectorAll('.vditor-comment').forEach((item) => { + hlItem(item); + }); + } + } + + /** 取消评论高亮 */ + public unHlCommentIds(ids: string[]) { + if (this.vditor.currentMode !== 'wysiwyg') { + return; + } + const unHlItem = (item: Element) => { + ids.forEach((id) => { + if (item.getAttribute('data-cmtids').indexOf(id) > -1) { + item.classList.remove('vditor-comment--hover'); + } + }); + }; + this.vditor.wysiwyg.element.querySelectorAll('.vditor-comment').forEach((item) => { + unHlItem(item); + }); + if (this.vditor.preview.element.style.display !== 'none') { + this.vditor.preview.element.querySelectorAll('.vditor-comment').forEach((item) => { + unHlItem(item); + }); + } + } + + /** 删除评论 */ + public removeCommentIds(removeIds: string[]) { + if (this.vditor.currentMode !== 'wysiwyg') { + return; + } + + const removeItem = (item: Element, removeId: string) => { + const ids = item.getAttribute('data-cmtids').split(' '); + ids.find((id, index) => { + if (id === removeId) { + ids.splice(index, 1); + return true; + } + }); + if (ids.length === 0) { + item.outerHTML = item.innerHTML; + getEditorRange(this.vditor).collapse(true); + } else { + item.setAttribute('data-cmtids', ids.join(' ')); + } + }; + removeIds.forEach((removeId) => { + this.vditor.wysiwyg.element.querySelectorAll('.vditor-comment').forEach((item) => { + removeItem(item, removeId); + }); + if (this.vditor.preview.element.style.display !== 'none') { + this.vditor.preview.element.querySelectorAll('.vditor-comment').forEach((item) => { + removeItem(item, removeId); + }); + } + }); + afterRenderEvent(this.vditor, { + enableAddUndoStack: true, + enableHint: false, + enableInput: false + }); + } + + private init(id: HTMLElement, mergedOptions: IOptions) { + this.vditor = { + currentMode: mergedOptions.mode, + element: id, + hint: new Hint(mergedOptions.hint.extend), + lute: undefined, + options: mergedOptions, + originalInnerHTML: id.innerHTML, + outline: new Outline(window.VditorI18n.outline), + tip: new Tip() + }; + + this.vditor.sv = new Editor(this.vditor); + this.vditor.undo = new Undo(); + this.vditor.wysiwyg = new WYSIWYG(this.vditor); + this.vditor.ir = new IR(this.vditor); + this.vditor.toolbar = new Toolbar(this.vditor); + + if (mergedOptions.resize.enable) { + this.vditor.resize = new Resize(this.vditor); + } + + if (this.vditor.toolbar.elements.devtools) { + this.vditor.devtools = new DevTools(); + } + + if (mergedOptions.upload.url || mergedOptions.upload.handler) { + this.vditor.upload = new Upload(); + } + + addScript(mergedOptions._lutePath || `${mergedOptions.cdn}/dist/js/lute/lute.min.js`, 'vditorLuteScript').then( + () => { + this.vditor.lute = setLute({ + autoSpace: this.vditor.options.preview.markdown.autoSpace, + codeBlockPreview: this.vditor.options.preview.markdown.codeBlockPreview, + emojiSite: this.vditor.options.hint.emojiPath, + emojis: this.vditor.options.hint.emoji, + fixTermTypo: this.vditor.options.preview.markdown.fixTermTypo, + footnotes: this.vditor.options.preview.markdown.footnotes, + headingAnchor: false, + inlineMathDigit: this.vditor.options.preview.math.inlineDigit, + linkBase: this.vditor.options.preview.markdown.linkBase, + linkPrefix: this.vditor.options.preview.markdown.linkPrefix, + listStyle: this.vditor.options.preview.markdown.listStyle, + mark: this.vditor.options.preview.markdown.mark, + mathBlockPreview: this.vditor.options.preview.markdown.mathBlockPreview, + paragraphBeginningSpace: this.vditor.options.preview.markdown.paragraphBeginningSpace, + sanitize: this.vditor.options.preview.markdown.sanitize, + toc: this.vditor.options.preview.markdown.toc + }); + + this.vditor.preview = new Preview(this.vditor); + + initUI(this.vditor); + + if (mergedOptions.after) { + mergedOptions.after(); + } + if (mergedOptions.icon) { + // 防止初始化 2 个编辑器时加载 2 次 + addScriptSync(`${mergedOptions.cdn}/dist/js/icons/${mergedOptions.icon}.js`, 'vditorIconScript'); + } + } + ); + } +} + +export default Vditor; diff --git a/src/libs/vditor/src/method.ts b/src/libs/vditor/method.ts similarity index 100% rename from src/libs/vditor/src/method.ts rename to src/libs/vditor/method.ts diff --git a/src/libs/vditor/src/index.ts b/src/libs/vditor/src/index.ts deleted file mode 100644 index b34dadc5..00000000 --- a/src/libs/vditor/src/index.ts +++ /dev/null @@ -1,502 +0,0 @@ -import "./assets/scss/index.scss"; -import VditorMethod from "./method"; -import {Constants, VDITOR_VERSION} from "./ts/constants"; -import {DevTools} from "./ts/devtools/index"; -import {Hint} from "./ts/hint/index"; -import {IR} from "./ts/ir/index"; -import {input as irInput} from "./ts/ir/input"; -import {processAfterRender} from "./ts/ir/process"; -import {getHTML} from "./ts/markdown/getHTML"; -import {getMarkdown} from "./ts/markdown/getMarkdown"; -import {setLute} from "./ts/markdown/setLute"; -import {Outline} from "./ts/outline/index"; -import {Preview} from "./ts/preview/index"; -import {Resize} from "./ts/resize/index"; -import {Editor} from "./ts/sv/index"; -import {inputEvent} from "./ts/sv/inputEvent"; -import {processAfterRender as processSVAfterRender} from "./ts/sv/process"; -import {Tip} from "./ts/tip/index"; -import {Toolbar} from "./ts/toolbar/index"; -import {disableToolbar, hidePanel} from "./ts/toolbar/setToolbar"; -import {enableToolbar} from "./ts/toolbar/setToolbar"; -import {initUI} from "./ts/ui/initUI"; -import {setCodeTheme} from "./ts/ui/setCodeTheme"; -import {setContentTheme} from "./ts/ui/setContentTheme"; -import {setPreviewMode} from "./ts/ui/setPreviewMode"; -import {setTheme} from "./ts/ui/setTheme"; -import {Undo} from "./ts/undo/index"; -import {Upload} from "./ts/upload/index"; -import {addScript, addScriptSync} from "./ts/util/addScript"; -import {getSelectText} from "./ts/util/getSelectText"; -import {Options} from "./ts/util/Options"; -import {processCodeRender} from "./ts/util/processCode"; -import {getCursorPosition, getEditorRange} from "./ts/util/selection"; -import {afterRenderEvent} from "./ts/wysiwyg/afterRenderEvent"; -import {WYSIWYG} from "./ts/wysiwyg/index"; -import {input} from "./ts/wysiwyg/input"; -import {renderDomByMd} from "./ts/wysiwyg/renderDomByMd"; - -class Vditor extends VditorMethod { - public readonly version: string; - public vditor: IVditor; - - /** - * @param id 要挂载 Vditor 的元素或者元素 ID。 - * @param options Vditor 参数 - */ - constructor(id: string | HTMLElement, options?: IOptions) { - super(); - this.version = VDITOR_VERSION; - - if (typeof id === "string") { - if (!options) { - options = { - cache: { - id: `vditor${id}`, - }, - }; - } else if (!options.cache) { - options.cache = {id: `vditor${id}`}; - } else if (!options.cache.id) { - options.cache.id = `vditor${id}`; - } - id = document.getElementById(id); - } - - const getOptions = new Options(options); - const mergedOptions = getOptions.merge(); - - // 支持自定义国际化 - if (!mergedOptions.i18n) { - if (!["en_US", "ja_JP", "ko_KR", "ru_RU", "zh_CN", "zh_TW"].includes(mergedOptions.lang)) { - throw new Error( - "options.lang error, see https://ld246.com/article/1549638745630#options", - ); - } else { - addScript(`${mergedOptions.cdn}/dist/js/i18n/${mergedOptions.lang}.js`, "vditorI18nScript").then(() => { - this.init(id as HTMLElement, mergedOptions); - }); - } - } else { - window.VditorI18n = mergedOptions.i18n; - this.init(id, mergedOptions); - } - } - - /** 设置主题 */ - public setTheme( - theme: "dark" | "classic", - contentTheme?: string, - codeTheme?: string, - contentThemePath?: string, - ) { - this.vditor.options.theme = theme; - setTheme(this.vditor); - if (contentTheme) { - this.vditor.options.preview.theme.current = contentTheme; - setContentTheme(contentTheme, contentThemePath || this.vditor.options.preview.theme.path); - } - if (codeTheme) { - this.vditor.options.preview.hljs.style = codeTheme; - setCodeTheme(codeTheme, this.vditor.options.cdn); - } - } - - /** 获取 Markdown 内容 */ - public getValue() { - return getMarkdown(this.vditor); - } - - /** 获取编辑器当前编辑模式 */ - public getCurrentMode() { - return this.vditor.currentMode; - } - - /** 聚焦到编辑器 */ - public focus() { - if (this.vditor.currentMode === "sv") { - this.vditor.sv.element.focus(); - } else if (this.vditor.currentMode === "wysiwyg") { - this.vditor.wysiwyg.element.focus(); - } else if (this.vditor.currentMode === "ir") { - this.vditor.ir.element.focus(); - } - } - - /** 让编辑器失焦 */ - public blur() { - if (this.vditor.currentMode === "sv") { - this.vditor.sv.element.blur(); - } else if (this.vditor.currentMode === "wysiwyg") { - this.vditor.wysiwyg.element.blur(); - } else if (this.vditor.currentMode === "ir") { - this.vditor.ir.element.blur(); - } - } - - /** 禁用编辑器 */ - public disabled() { - hidePanel(this.vditor, ["subToolbar", "hint", "popover"]); - disableToolbar( - this.vditor.toolbar.elements, - Constants.EDIT_TOOLBARS.concat(["undo", "redo", "fullscreen", "edit-mode"]), - ); - this.vditor[this.vditor.currentMode].element.setAttribute( - "contenteditable", - "false", - ); - } - - /** 解除编辑器禁用 */ - public enable() { - enableToolbar( - this.vditor.toolbar.elements, - Constants.EDIT_TOOLBARS.concat(["undo", "redo", "fullscreen", "edit-mode"]), - ); - this.vditor.undo.resetIcon(this.vditor); - this.vditor[this.vditor.currentMode].element.setAttribute("contenteditable", "true"); - } - - /** 返回选中的字符串 */ - public getSelection() { - if (this.vditor.currentMode === "wysiwyg") { - return getSelectText(this.vditor.wysiwyg.element); - } else if (this.vditor.currentMode === "sv") { - return getSelectText(this.vditor.sv.element); - } else if (this.vditor.currentMode === "ir") { - return getSelectText(this.vditor.ir.element); - } - } - - /** 设置预览区域内容 */ - public renderPreview(value?: string) { - this.vditor.preview.render(this.vditor, value); - } - - /** 获取焦点位置 */ - public getCursorPosition() { - return getCursorPosition(this.vditor[this.vditor.currentMode].element); - } - - /** 上传是否还在进行中 */ - public isUploading() { - return this.vditor.upload.isUploading; - } - - /** 清除缓存 */ - public clearCache() { - localStorage.removeItem(this.vditor.options.cache.id); - } - - /** 禁用缓存 */ - public disabledCache() { - this.vditor.options.cache.enable = false; - } - - /** 启用缓存 */ - public enableCache() { - if (!this.vditor.options.cache.id) { - throw new Error( - "need options.cache.id, see https://ld246.com/article/1549638745630#options", - ); - } - this.vditor.options.cache.enable = true; - } - - /** HTML 转 md */ - public html2md(value: string) { - return this.vditor.lute.HTML2Md(value); - } - - /** markdown 转 JSON 输出 */ - public exportJSON(value: string) { - return this.vditor.lute.RenderJSON(value); - } - - /** 获取 HTML */ - public getHTML() { - return getHTML(this.vditor); - } - - /** 消息提示。time 为 0 将一直显示 */ - public tip(text: string, time?: number) { - this.vditor.tip.show(text, time); - } - - /** 设置预览模式 */ - public setPreviewMode(mode: "both" | "editor") { - setPreviewMode(mode, this.vditor); - } - - /** 删除选中内容 */ - public deleteValue() { - if (window.getSelection().isCollapsed) { - return; - } - document.execCommand("delete", false); - } - - /** 更新选中内容 */ - public updateValue(value: string) { - document.execCommand("insertHTML", false, value); - } - - /** 在焦点处插入内容,并默认进行 Markdown 渲染 */ - public insertValue(value: string, render = true) { - const range = getEditorRange(this.vditor); - range.collapse(true); - const tmpElement = document.createElement("template"); - tmpElement.innerHTML = value; - range.insertNode(tmpElement.content.cloneNode(true)); - if (this.vditor.currentMode === "sv") { - this.vditor.sv.preventInput = true; - if (render) { - inputEvent(this.vditor); - } - } else if (this.vditor.currentMode === "wysiwyg") { - this.vditor.wysiwyg.preventInput = true; - if (render) { - input(this.vditor, getSelection().getRangeAt(0)); - } - } else if (this.vditor.currentMode === "ir") { - this.vditor.ir.preventInput = true; - if (render) { - irInput(this.vditor, getSelection().getRangeAt(0), true); - } - } - } - - /** 设置编辑器内容 */ - public setValue(markdown: string, clearStack = false) { - if (this.vditor.currentMode === "sv") { - this.vditor.sv.element.innerHTML = this.vditor.lute.SpinVditorSVDOM(markdown); - processSVAfterRender(this.vditor, { - enableAddUndoStack: true, - enableHint: false, - enableInput: false, - }); - } else if (this.vditor.currentMode === "wysiwyg") { - renderDomByMd(this.vditor, markdown, { - enableAddUndoStack: true, - enableHint: false, - enableInput: false, - }); - } else { - this.vditor.ir.element.innerHTML = this.vditor.lute.Md2VditorIRDOM(markdown); - this.vditor.ir.element - .querySelectorAll(".vditor-ir__preview[data-render='2']") - .forEach((item: HTMLElement) => { - processCodeRender(item, this.vditor); - }); - processAfterRender(this.vditor, { - enableAddUndoStack: true, - enableHint: false, - enableInput: false, - }); - } - - this.vditor.outline.render(this.vditor); - - if (!markdown) { - hidePanel(this.vditor, ["emoji", "headings", "submenu", "hint"]); - if (this.vditor.wysiwyg.popover) { - this.vditor.wysiwyg.popover.style.display = "none"; - } - this.clearCache(); - } - if (clearStack) { - this.clearStack(); - } - } - - /** 清空 undo & redo 栈 */ - public clearStack() { - this.vditor.undo.clearStack(this.vditor); - this.vditor.undo.addToUndoStack(this.vditor); - } - - /** 销毁编辑器 */ - public destroy() { - this.vditor.element.innerHTML = this.vditor.originalInnerHTML; - this.vditor.element.classList.remove("vditor"); - this.vditor.element.removeAttribute("style"); - document.getElementById("vditorIconScript").remove(); - this.clearCache(); - } - - /** 获取评论 ID */ - public getCommentIds() { - if (this.vditor.currentMode !== "wysiwyg") { - return []; - } - return this.vditor.wysiwyg.getComments(this.vditor, true); - } - - /** 高亮评论 */ - public hlCommentIds(ids: string[]) { - if (this.vditor.currentMode !== "wysiwyg") { - return; - } - const hlItem = (item: Element) => { - item.classList.remove("vditor-comment--hover"); - ids.forEach((id) => { - if (item.getAttribute("data-cmtids").indexOf(id) > -1) { - item.classList.add("vditor-comment--hover"); - } - }); - }; - this.vditor.wysiwyg.element - .querySelectorAll(".vditor-comment") - .forEach((item) => { - hlItem(item); - }); - if (this.vditor.preview.element.style.display !== "none") { - this.vditor.preview.element - .querySelectorAll(".vditor-comment") - .forEach((item) => { - hlItem(item); - }); - } - } - - /** 取消评论高亮 */ - public unHlCommentIds(ids: string[]) { - if (this.vditor.currentMode !== "wysiwyg") { - return; - } - const unHlItem = (item: Element) => { - ids.forEach((id) => { - if (item.getAttribute("data-cmtids").indexOf(id) > -1) { - item.classList.remove("vditor-comment--hover"); - } - }); - }; - this.vditor.wysiwyg.element - .querySelectorAll(".vditor-comment") - .forEach((item) => { - unHlItem(item); - }); - if (this.vditor.preview.element.style.display !== "none") { - this.vditor.preview.element - .querySelectorAll(".vditor-comment") - .forEach((item) => { - unHlItem(item); - }); - } - } - - /** 删除评论 */ - public removeCommentIds(removeIds: string[]) { - if (this.vditor.currentMode !== "wysiwyg") { - return; - } - - const removeItem = (item: Element, removeId: string) => { - const ids = item.getAttribute("data-cmtids").split(" "); - ids.find((id, index) => { - if (id === removeId) { - ids.splice(index, 1); - return true; - } - }); - if (ids.length === 0) { - item.outerHTML = item.innerHTML; - getEditorRange(this.vditor).collapse(true); - } else { - item.setAttribute("data-cmtids", ids.join(" ")); - } - }; - removeIds.forEach((removeId) => { - this.vditor.wysiwyg.element - .querySelectorAll(".vditor-comment") - .forEach((item) => { - removeItem(item, removeId); - }); - if (this.vditor.preview.element.style.display !== "none") { - this.vditor.preview.element - .querySelectorAll(".vditor-comment") - .forEach((item) => { - removeItem(item, removeId); - }); - } - }); - afterRenderEvent(this.vditor, { - enableAddUndoStack: true, - enableHint: false, - enableInput: false, - }); - } - - private init(id: HTMLElement, mergedOptions: IOptions) { - this.vditor = { - currentMode: mergedOptions.mode, - element: id, - hint: new Hint(mergedOptions.hint.extend), - lute: undefined, - options: mergedOptions, - originalInnerHTML: id.innerHTML, - outline: new Outline(window.VditorI18n.outline), - tip: new Tip(), - }; - - this.vditor.sv = new Editor(this.vditor); - this.vditor.undo = new Undo(); - this.vditor.wysiwyg = new WYSIWYG(this.vditor); - this.vditor.ir = new IR(this.vditor); - this.vditor.toolbar = new Toolbar(this.vditor); - - if (mergedOptions.resize.enable) { - this.vditor.resize = new Resize(this.vditor); - } - - if (this.vditor.toolbar.elements.devtools) { - this.vditor.devtools = new DevTools(); - } - - if (mergedOptions.upload.url || mergedOptions.upload.handler) { - this.vditor.upload = new Upload(); - } - - addScript( - mergedOptions._lutePath || - `${mergedOptions.cdn}/dist/js/lute/lute.min.js`, - "vditorLuteScript", - ).then(() => { - this.vditor.lute = setLute({ - autoSpace: this.vditor.options.preview.markdown.autoSpace, - codeBlockPreview: this.vditor.options.preview.markdown - .codeBlockPreview, - emojiSite: this.vditor.options.hint.emojiPath, - emojis: this.vditor.options.hint.emoji, - fixTermTypo: this.vditor.options.preview.markdown.fixTermTypo, - footnotes: this.vditor.options.preview.markdown.footnotes, - headingAnchor: false, - inlineMathDigit: this.vditor.options.preview.math.inlineDigit, - linkBase: this.vditor.options.preview.markdown.linkBase, - linkPrefix: this.vditor.options.preview.markdown.linkPrefix, - listStyle: this.vditor.options.preview.markdown.listStyle, - mark: this.vditor.options.preview.markdown.mark, - mathBlockPreview: this.vditor.options.preview.markdown - .mathBlockPreview, - paragraphBeginningSpace: this.vditor.options.preview.markdown - .paragraphBeginningSpace, - sanitize: this.vditor.options.preview.markdown.sanitize, - toc: this.vditor.options.preview.markdown.toc, - }); - - this.vditor.preview = new Preview(this.vditor); - - initUI(this.vditor); - - if (mergedOptions.after) { - mergedOptions.after(); - } - if (mergedOptions.icon) { - // 防止初始化 2 个编辑器时加载 2 次 - addScriptSync(`${mergedOptions.cdn}/dist/js/icons/${mergedOptions.icon}.js`, "vditorIconScript"); - } - }); - } -} - -export default Vditor; diff --git a/src/libs/vditor/src/ts/constants.ts b/src/libs/vditor/ts/constants.ts similarity index 100% rename from src/libs/vditor/src/ts/constants.ts rename to src/libs/vditor/ts/constants.ts diff --git a/src/libs/vditor/src/ts/devtools/index.ts b/src/libs/vditor/ts/devtools/index.ts similarity index 100% rename from src/libs/vditor/src/ts/devtools/index.ts rename to src/libs/vditor/ts/devtools/index.ts diff --git a/src/libs/vditor/src/ts/export/index.ts b/src/libs/vditor/ts/export/index.ts similarity index 100% rename from src/libs/vditor/src/ts/export/index.ts rename to src/libs/vditor/ts/export/index.ts diff --git a/src/libs/vditor/src/ts/hint/index.ts b/src/libs/vditor/ts/hint/index.ts similarity index 100% rename from src/libs/vditor/src/ts/hint/index.ts rename to src/libs/vditor/ts/hint/index.ts diff --git a/src/libs/vditor/src/ts/ir/expandMarker.ts b/src/libs/vditor/ts/ir/expandMarker.ts similarity index 100% rename from src/libs/vditor/src/ts/ir/expandMarker.ts rename to src/libs/vditor/ts/ir/expandMarker.ts diff --git a/src/libs/vditor/src/ts/ir/highlightToolbarIR.ts b/src/libs/vditor/ts/ir/highlightToolbarIR.ts similarity index 100% rename from src/libs/vditor/src/ts/ir/highlightToolbarIR.ts rename to src/libs/vditor/ts/ir/highlightToolbarIR.ts diff --git a/src/libs/vditor/src/ts/ir/index.ts b/src/libs/vditor/ts/ir/index.ts similarity index 100% rename from src/libs/vditor/src/ts/ir/index.ts rename to src/libs/vditor/ts/ir/index.ts diff --git a/src/libs/vditor/src/ts/ir/input.ts b/src/libs/vditor/ts/ir/input.ts similarity index 100% rename from src/libs/vditor/src/ts/ir/input.ts rename to src/libs/vditor/ts/ir/input.ts diff --git a/src/libs/vditor/src/ts/ir/process.ts b/src/libs/vditor/ts/ir/process.ts similarity index 100% rename from src/libs/vditor/src/ts/ir/process.ts rename to src/libs/vditor/ts/ir/process.ts diff --git a/src/libs/vditor/src/ts/ir/processKeydown.ts b/src/libs/vditor/ts/ir/processKeydown.ts similarity index 100% rename from src/libs/vditor/src/ts/ir/processKeydown.ts rename to src/libs/vditor/ts/ir/processKeydown.ts diff --git a/src/libs/vditor/src/ts/markdown/abcRender.ts b/src/libs/vditor/ts/markdown/abcRender.ts similarity index 100% rename from src/libs/vditor/src/ts/markdown/abcRender.ts rename to src/libs/vditor/ts/markdown/abcRender.ts diff --git a/src/libs/vditor/src/ts/markdown/adapterRender.ts b/src/libs/vditor/ts/markdown/adapterRender.ts similarity index 100% rename from src/libs/vditor/src/ts/markdown/adapterRender.ts rename to src/libs/vditor/ts/markdown/adapterRender.ts diff --git a/src/libs/vditor/src/ts/markdown/anchorRender.ts b/src/libs/vditor/ts/markdown/anchorRender.ts similarity index 100% rename from src/libs/vditor/src/ts/markdown/anchorRender.ts rename to src/libs/vditor/ts/markdown/anchorRender.ts diff --git a/src/libs/vditor/src/ts/markdown/chartRender.ts b/src/libs/vditor/ts/markdown/chartRender.ts similarity index 100% rename from src/libs/vditor/src/ts/markdown/chartRender.ts rename to src/libs/vditor/ts/markdown/chartRender.ts diff --git a/src/libs/vditor/src/ts/markdown/codeRender.ts b/src/libs/vditor/ts/markdown/codeRender.ts similarity index 100% rename from src/libs/vditor/src/ts/markdown/codeRender.ts rename to src/libs/vditor/ts/markdown/codeRender.ts diff --git a/src/libs/vditor/src/ts/markdown/flowchartRender.ts b/src/libs/vditor/ts/markdown/flowchartRender.ts similarity index 100% rename from src/libs/vditor/src/ts/markdown/flowchartRender.ts rename to src/libs/vditor/ts/markdown/flowchartRender.ts diff --git a/src/libs/vditor/src/ts/markdown/getHTML.ts b/src/libs/vditor/ts/markdown/getHTML.ts similarity index 100% rename from src/libs/vditor/src/ts/markdown/getHTML.ts rename to src/libs/vditor/ts/markdown/getHTML.ts diff --git a/src/libs/vditor/src/ts/markdown/getMarkdown.ts b/src/libs/vditor/ts/markdown/getMarkdown.ts similarity index 100% rename from src/libs/vditor/src/ts/markdown/getMarkdown.ts rename to src/libs/vditor/ts/markdown/getMarkdown.ts diff --git a/src/libs/vditor/src/ts/markdown/graphvizRender.ts b/src/libs/vditor/ts/markdown/graphvizRender.ts similarity index 100% rename from src/libs/vditor/src/ts/markdown/graphvizRender.ts rename to src/libs/vditor/ts/markdown/graphvizRender.ts diff --git a/src/libs/vditor/src/ts/markdown/highlightRender.ts b/src/libs/vditor/ts/markdown/highlightRender.ts similarity index 100% rename from src/libs/vditor/src/ts/markdown/highlightRender.ts rename to src/libs/vditor/ts/markdown/highlightRender.ts diff --git a/src/libs/vditor/src/ts/markdown/lazyLoadImageRender.ts b/src/libs/vditor/ts/markdown/lazyLoadImageRender.ts similarity index 100% rename from src/libs/vditor/src/ts/markdown/lazyLoadImageRender.ts rename to src/libs/vditor/ts/markdown/lazyLoadImageRender.ts diff --git a/src/libs/vditor/src/ts/markdown/mathRender.ts b/src/libs/vditor/ts/markdown/mathRender.ts similarity index 100% rename from src/libs/vditor/src/ts/markdown/mathRender.ts rename to src/libs/vditor/ts/markdown/mathRender.ts diff --git a/src/libs/vditor/src/ts/markdown/mediaRender.ts b/src/libs/vditor/ts/markdown/mediaRender.ts similarity index 100% rename from src/libs/vditor/src/ts/markdown/mediaRender.ts rename to src/libs/vditor/ts/markdown/mediaRender.ts diff --git a/src/libs/vditor/src/ts/markdown/mermaidRender.ts b/src/libs/vditor/ts/markdown/mermaidRender.ts similarity index 100% rename from src/libs/vditor/src/ts/markdown/mermaidRender.ts rename to src/libs/vditor/ts/markdown/mermaidRender.ts diff --git a/src/libs/vditor/src/ts/markdown/mindmapRender.ts b/src/libs/vditor/ts/markdown/mindmapRender.ts similarity index 100% rename from src/libs/vditor/src/ts/markdown/mindmapRender.ts rename to src/libs/vditor/ts/markdown/mindmapRender.ts diff --git a/src/libs/vditor/src/ts/markdown/outlineRender.ts b/src/libs/vditor/ts/markdown/outlineRender.ts similarity index 100% rename from src/libs/vditor/src/ts/markdown/outlineRender.ts rename to src/libs/vditor/ts/markdown/outlineRender.ts diff --git a/src/libs/vditor/src/ts/markdown/plantumlRender.ts b/src/libs/vditor/ts/markdown/plantumlRender.ts similarity index 100% rename from src/libs/vditor/src/ts/markdown/plantumlRender.ts rename to src/libs/vditor/ts/markdown/plantumlRender.ts diff --git a/src/libs/vditor/src/ts/markdown/previewRender.ts b/src/libs/vditor/ts/markdown/previewRender.ts similarity index 100% rename from src/libs/vditor/src/ts/markdown/previewRender.ts rename to src/libs/vditor/ts/markdown/previewRender.ts diff --git a/src/libs/vditor/src/ts/markdown/setLute.ts b/src/libs/vditor/ts/markdown/setLute.ts similarity index 100% rename from src/libs/vditor/src/ts/markdown/setLute.ts rename to src/libs/vditor/ts/markdown/setLute.ts diff --git a/src/libs/vditor/src/ts/markdown/speechRender.ts b/src/libs/vditor/ts/markdown/speechRender.ts similarity index 100% rename from src/libs/vditor/src/ts/markdown/speechRender.ts rename to src/libs/vditor/ts/markdown/speechRender.ts diff --git a/src/libs/vditor/src/ts/outline/index.ts b/src/libs/vditor/ts/outline/index.ts similarity index 100% rename from src/libs/vditor/src/ts/outline/index.ts rename to src/libs/vditor/ts/outline/index.ts diff --git a/src/libs/vditor/src/ts/preview/image.ts b/src/libs/vditor/ts/preview/image.ts similarity index 100% rename from src/libs/vditor/src/ts/preview/image.ts rename to src/libs/vditor/ts/preview/image.ts diff --git a/src/libs/vditor/src/ts/preview/index.ts b/src/libs/vditor/ts/preview/index.ts similarity index 100% rename from src/libs/vditor/src/ts/preview/index.ts rename to src/libs/vditor/ts/preview/index.ts diff --git a/src/libs/vditor/src/ts/resize/index.ts b/src/libs/vditor/ts/resize/index.ts similarity index 100% rename from src/libs/vditor/src/ts/resize/index.ts rename to src/libs/vditor/ts/resize/index.ts diff --git a/src/libs/vditor/src/ts/sv/index.ts b/src/libs/vditor/ts/sv/index.ts similarity index 100% rename from src/libs/vditor/src/ts/sv/index.ts rename to src/libs/vditor/ts/sv/index.ts diff --git a/src/libs/vditor/src/ts/sv/inputEvent.ts b/src/libs/vditor/ts/sv/inputEvent.ts similarity index 100% rename from src/libs/vditor/src/ts/sv/inputEvent.ts rename to src/libs/vditor/ts/sv/inputEvent.ts diff --git a/src/libs/vditor/src/ts/sv/process.ts b/src/libs/vditor/ts/sv/process.ts similarity index 100% rename from src/libs/vditor/src/ts/sv/process.ts rename to src/libs/vditor/ts/sv/process.ts diff --git a/src/libs/vditor/src/ts/sv/processKeydown.ts b/src/libs/vditor/ts/sv/processKeydown.ts similarity index 100% rename from src/libs/vditor/src/ts/sv/processKeydown.ts rename to src/libs/vditor/ts/sv/processKeydown.ts diff --git a/src/libs/vditor/src/ts/tip/index.ts b/src/libs/vditor/ts/tip/index.ts similarity index 100% rename from src/libs/vditor/src/ts/tip/index.ts rename to src/libs/vditor/ts/tip/index.ts diff --git a/src/libs/vditor/src/ts/toolbar/Both.ts b/src/libs/vditor/ts/toolbar/Both.ts similarity index 100% rename from src/libs/vditor/src/ts/toolbar/Both.ts rename to src/libs/vditor/ts/toolbar/Both.ts diff --git a/src/libs/vditor/src/ts/toolbar/Br.ts b/src/libs/vditor/ts/toolbar/Br.ts similarity index 100% rename from src/libs/vditor/src/ts/toolbar/Br.ts rename to src/libs/vditor/ts/toolbar/Br.ts diff --git a/src/libs/vditor/src/ts/toolbar/CodeTheme.ts b/src/libs/vditor/ts/toolbar/CodeTheme.ts similarity index 100% rename from src/libs/vditor/src/ts/toolbar/CodeTheme.ts rename to src/libs/vditor/ts/toolbar/CodeTheme.ts diff --git a/src/libs/vditor/src/ts/toolbar/ContentTheme.ts b/src/libs/vditor/ts/toolbar/ContentTheme.ts similarity index 100% rename from src/libs/vditor/src/ts/toolbar/ContentTheme.ts rename to src/libs/vditor/ts/toolbar/ContentTheme.ts diff --git a/src/libs/vditor/src/ts/toolbar/Counter.ts b/src/libs/vditor/ts/toolbar/Counter.ts similarity index 100% rename from src/libs/vditor/src/ts/toolbar/Counter.ts rename to src/libs/vditor/ts/toolbar/Counter.ts diff --git a/src/libs/vditor/src/ts/toolbar/Custom.ts b/src/libs/vditor/ts/toolbar/Custom.ts similarity index 100% rename from src/libs/vditor/src/ts/toolbar/Custom.ts rename to src/libs/vditor/ts/toolbar/Custom.ts diff --git a/src/libs/vditor/src/ts/toolbar/Devtools.ts b/src/libs/vditor/ts/toolbar/Devtools.ts similarity index 100% rename from src/libs/vditor/src/ts/toolbar/Devtools.ts rename to src/libs/vditor/ts/toolbar/Devtools.ts diff --git a/src/libs/vditor/src/ts/toolbar/Divider.ts b/src/libs/vditor/ts/toolbar/Divider.ts similarity index 100% rename from src/libs/vditor/src/ts/toolbar/Divider.ts rename to src/libs/vditor/ts/toolbar/Divider.ts diff --git a/src/libs/vditor/src/ts/toolbar/EditMode.ts b/src/libs/vditor/ts/toolbar/EditMode.ts similarity index 100% rename from src/libs/vditor/src/ts/toolbar/EditMode.ts rename to src/libs/vditor/ts/toolbar/EditMode.ts diff --git a/src/libs/vditor/src/ts/toolbar/Emoji.ts b/src/libs/vditor/ts/toolbar/Emoji.ts similarity index 100% rename from src/libs/vditor/src/ts/toolbar/Emoji.ts rename to src/libs/vditor/ts/toolbar/Emoji.ts diff --git a/src/libs/vditor/src/ts/toolbar/Export.ts b/src/libs/vditor/ts/toolbar/Export.ts similarity index 100% rename from src/libs/vditor/src/ts/toolbar/Export.ts rename to src/libs/vditor/ts/toolbar/Export.ts diff --git a/src/libs/vditor/src/ts/toolbar/Fullscreen.ts b/src/libs/vditor/ts/toolbar/Fullscreen.ts similarity index 100% rename from src/libs/vditor/src/ts/toolbar/Fullscreen.ts rename to src/libs/vditor/ts/toolbar/Fullscreen.ts diff --git a/src/libs/vditor/src/ts/toolbar/Headings.ts b/src/libs/vditor/ts/toolbar/Headings.ts similarity index 100% rename from src/libs/vditor/src/ts/toolbar/Headings.ts rename to src/libs/vditor/ts/toolbar/Headings.ts diff --git a/src/libs/vditor/src/ts/toolbar/Help.ts b/src/libs/vditor/ts/toolbar/Help.ts similarity index 100% rename from src/libs/vditor/src/ts/toolbar/Help.ts rename to src/libs/vditor/ts/toolbar/Help.ts diff --git a/src/libs/vditor/src/ts/toolbar/Indent.ts b/src/libs/vditor/ts/toolbar/Indent.ts similarity index 100% rename from src/libs/vditor/src/ts/toolbar/Indent.ts rename to src/libs/vditor/ts/toolbar/Indent.ts diff --git a/src/libs/vditor/src/ts/toolbar/Info.ts b/src/libs/vditor/ts/toolbar/Info.ts similarity index 100% rename from src/libs/vditor/src/ts/toolbar/Info.ts rename to src/libs/vditor/ts/toolbar/Info.ts diff --git a/src/libs/vditor/src/ts/toolbar/InsertAfter.ts b/src/libs/vditor/ts/toolbar/InsertAfter.ts similarity index 100% rename from src/libs/vditor/src/ts/toolbar/InsertAfter.ts rename to src/libs/vditor/ts/toolbar/InsertAfter.ts diff --git a/src/libs/vditor/src/ts/toolbar/InsertBefore.ts b/src/libs/vditor/ts/toolbar/InsertBefore.ts similarity index 100% rename from src/libs/vditor/src/ts/toolbar/InsertBefore.ts rename to src/libs/vditor/ts/toolbar/InsertBefore.ts diff --git a/src/libs/vditor/src/ts/toolbar/MenuItem.ts b/src/libs/vditor/ts/toolbar/MenuItem.ts similarity index 100% rename from src/libs/vditor/src/ts/toolbar/MenuItem.ts rename to src/libs/vditor/ts/toolbar/MenuItem.ts diff --git a/src/libs/vditor/src/ts/toolbar/Outdent.ts b/src/libs/vditor/ts/toolbar/Outdent.ts similarity index 100% rename from src/libs/vditor/src/ts/toolbar/Outdent.ts rename to src/libs/vditor/ts/toolbar/Outdent.ts diff --git a/src/libs/vditor/src/ts/toolbar/Outline.ts b/src/libs/vditor/ts/toolbar/Outline.ts similarity index 100% rename from src/libs/vditor/src/ts/toolbar/Outline.ts rename to src/libs/vditor/ts/toolbar/Outline.ts diff --git a/src/libs/vditor/src/ts/toolbar/Preview.ts b/src/libs/vditor/ts/toolbar/Preview.ts similarity index 100% rename from src/libs/vditor/src/ts/toolbar/Preview.ts rename to src/libs/vditor/ts/toolbar/Preview.ts diff --git a/src/libs/vditor/src/ts/toolbar/Record.ts b/src/libs/vditor/ts/toolbar/Record.ts similarity index 100% rename from src/libs/vditor/src/ts/toolbar/Record.ts rename to src/libs/vditor/ts/toolbar/Record.ts diff --git a/src/libs/vditor/src/ts/toolbar/Redo.ts b/src/libs/vditor/ts/toolbar/Redo.ts similarity index 100% rename from src/libs/vditor/src/ts/toolbar/Redo.ts rename to src/libs/vditor/ts/toolbar/Redo.ts diff --git a/src/libs/vditor/src/ts/toolbar/Undo.ts b/src/libs/vditor/ts/toolbar/Undo.ts similarity index 100% rename from src/libs/vditor/src/ts/toolbar/Undo.ts rename to src/libs/vditor/ts/toolbar/Undo.ts diff --git a/src/libs/vditor/src/ts/toolbar/Upload.ts b/src/libs/vditor/ts/toolbar/Upload.ts similarity index 100% rename from src/libs/vditor/src/ts/toolbar/Upload.ts rename to src/libs/vditor/ts/toolbar/Upload.ts diff --git a/src/libs/vditor/src/ts/toolbar/index.ts b/src/libs/vditor/ts/toolbar/index.ts similarity index 100% rename from src/libs/vditor/src/ts/toolbar/index.ts rename to src/libs/vditor/ts/toolbar/index.ts diff --git a/src/libs/vditor/src/ts/toolbar/setToolbar.ts b/src/libs/vditor/ts/toolbar/setToolbar.ts similarity index 100% rename from src/libs/vditor/src/ts/toolbar/setToolbar.ts rename to src/libs/vditor/ts/toolbar/setToolbar.ts diff --git a/src/libs/vditor/src/ts/ui/initUI.ts b/src/libs/vditor/ts/ui/initUI.ts similarity index 100% rename from src/libs/vditor/src/ts/ui/initUI.ts rename to src/libs/vditor/ts/ui/initUI.ts diff --git a/src/libs/vditor/src/ts/ui/setCodeTheme.ts b/src/libs/vditor/ts/ui/setCodeTheme.ts similarity index 100% rename from src/libs/vditor/src/ts/ui/setCodeTheme.ts rename to src/libs/vditor/ts/ui/setCodeTheme.ts diff --git a/src/libs/vditor/src/ts/ui/setContentTheme.ts b/src/libs/vditor/ts/ui/setContentTheme.ts similarity index 100% rename from src/libs/vditor/src/ts/ui/setContentTheme.ts rename to src/libs/vditor/ts/ui/setContentTheme.ts diff --git a/src/libs/vditor/src/ts/ui/setPreviewMode.ts b/src/libs/vditor/ts/ui/setPreviewMode.ts similarity index 100% rename from src/libs/vditor/src/ts/ui/setPreviewMode.ts rename to src/libs/vditor/ts/ui/setPreviewMode.ts diff --git a/src/libs/vditor/src/ts/ui/setTheme.ts b/src/libs/vditor/ts/ui/setTheme.ts similarity index 100% rename from src/libs/vditor/src/ts/ui/setTheme.ts rename to src/libs/vditor/ts/ui/setTheme.ts diff --git a/src/libs/vditor/src/ts/undo/index.ts b/src/libs/vditor/ts/undo/index.ts similarity index 100% rename from src/libs/vditor/src/ts/undo/index.ts rename to src/libs/vditor/ts/undo/index.ts diff --git a/src/libs/vditor/src/ts/upload/getElement.ts b/src/libs/vditor/ts/upload/getElement.ts similarity index 100% rename from src/libs/vditor/src/ts/upload/getElement.ts rename to src/libs/vditor/ts/upload/getElement.ts diff --git a/src/libs/vditor/src/ts/upload/index.ts b/src/libs/vditor/ts/upload/index.ts similarity index 100% rename from src/libs/vditor/src/ts/upload/index.ts rename to src/libs/vditor/ts/upload/index.ts diff --git a/src/libs/vditor/src/ts/upload/setHeaders.ts b/src/libs/vditor/ts/upload/setHeaders.ts similarity index 100% rename from src/libs/vditor/src/ts/upload/setHeaders.ts rename to src/libs/vditor/ts/upload/setHeaders.ts diff --git a/src/libs/vditor/src/ts/util/Options.ts b/src/libs/vditor/ts/util/Options.ts similarity index 100% rename from src/libs/vditor/src/ts/util/Options.ts rename to src/libs/vditor/ts/util/Options.ts diff --git a/src/libs/vditor/src/ts/util/RecordMedia.ts b/src/libs/vditor/ts/util/RecordMedia.ts similarity index 100% rename from src/libs/vditor/src/ts/util/RecordMedia.ts rename to src/libs/vditor/ts/util/RecordMedia.ts diff --git a/src/libs/vditor/src/ts/util/addScript.ts b/src/libs/vditor/ts/util/addScript.ts similarity index 100% rename from src/libs/vditor/src/ts/util/addScript.ts rename to src/libs/vditor/ts/util/addScript.ts diff --git a/src/libs/vditor/src/ts/util/addStyle.ts b/src/libs/vditor/ts/util/addStyle.ts similarity index 100% rename from src/libs/vditor/src/ts/util/addStyle.ts rename to src/libs/vditor/ts/util/addStyle.ts diff --git a/src/libs/vditor/src/ts/util/code160to32.ts b/src/libs/vditor/ts/util/code160to32.ts similarity index 100% rename from src/libs/vditor/src/ts/util/code160to32.ts rename to src/libs/vditor/ts/util/code160to32.ts diff --git a/src/libs/vditor/src/ts/util/compatibility.ts b/src/libs/vditor/ts/util/compatibility.ts similarity index 100% rename from src/libs/vditor/src/ts/util/compatibility.ts rename to src/libs/vditor/ts/util/compatibility.ts diff --git a/src/libs/vditor/src/ts/util/editorCommonEvent.ts b/src/libs/vditor/ts/util/editorCommonEvent.ts similarity index 100% rename from src/libs/vditor/src/ts/util/editorCommonEvent.ts rename to src/libs/vditor/ts/util/editorCommonEvent.ts diff --git a/src/libs/vditor/src/ts/util/fixBrowserBehavior.ts b/src/libs/vditor/ts/util/fixBrowserBehavior.ts similarity index 100% rename from src/libs/vditor/src/ts/util/fixBrowserBehavior.ts rename to src/libs/vditor/ts/util/fixBrowserBehavior.ts diff --git a/src/libs/vditor/src/ts/util/getSelectText.ts b/src/libs/vditor/ts/util/getSelectText.ts similarity index 100% rename from src/libs/vditor/src/ts/util/getSelectText.ts rename to src/libs/vditor/ts/util/getSelectText.ts diff --git a/src/libs/vditor/src/ts/util/hasClosest.ts b/src/libs/vditor/ts/util/hasClosest.ts similarity index 100% rename from src/libs/vditor/src/ts/util/hasClosest.ts rename to src/libs/vditor/ts/util/hasClosest.ts diff --git a/src/libs/vditor/src/ts/util/hasClosestByHeadings.ts b/src/libs/vditor/ts/util/hasClosestByHeadings.ts similarity index 100% rename from src/libs/vditor/src/ts/util/hasClosestByHeadings.ts rename to src/libs/vditor/ts/util/hasClosestByHeadings.ts diff --git a/src/libs/vditor/src/ts/util/highlightToolbar.ts b/src/libs/vditor/ts/util/highlightToolbar.ts similarity index 100% rename from src/libs/vditor/src/ts/util/highlightToolbar.ts rename to src/libs/vditor/ts/util/highlightToolbar.ts diff --git a/src/libs/vditor/src/ts/util/hotKey.ts b/src/libs/vditor/ts/util/hotKey.ts similarity index 100% rename from src/libs/vditor/src/ts/util/hotKey.ts rename to src/libs/vditor/ts/util/hotKey.ts diff --git a/src/libs/vditor/src/ts/util/log.ts b/src/libs/vditor/ts/util/log.ts similarity index 100% rename from src/libs/vditor/src/ts/util/log.ts rename to src/libs/vditor/ts/util/log.ts diff --git a/src/libs/vditor/src/ts/util/merge.ts b/src/libs/vditor/ts/util/merge.ts similarity index 100% rename from src/libs/vditor/src/ts/util/merge.ts rename to src/libs/vditor/ts/util/merge.ts diff --git a/src/libs/vditor/src/ts/util/processCode.ts b/src/libs/vditor/ts/util/processCode.ts similarity index 100% rename from src/libs/vditor/src/ts/util/processCode.ts rename to src/libs/vditor/ts/util/processCode.ts diff --git a/src/libs/vditor/src/ts/util/selection.ts b/src/libs/vditor/ts/util/selection.ts similarity index 100% rename from src/libs/vditor/src/ts/util/selection.ts rename to src/libs/vditor/ts/util/selection.ts diff --git a/src/libs/vditor/src/ts/util/toc.ts b/src/libs/vditor/ts/util/toc.ts similarity index 100% rename from src/libs/vditor/src/ts/util/toc.ts rename to src/libs/vditor/ts/util/toc.ts diff --git a/src/libs/vditor/src/ts/wysiwyg/afterRenderEvent.ts b/src/libs/vditor/ts/wysiwyg/afterRenderEvent.ts similarity index 100% rename from src/libs/vditor/src/ts/wysiwyg/afterRenderEvent.ts rename to src/libs/vditor/ts/wysiwyg/afterRenderEvent.ts diff --git a/src/libs/vditor/src/ts/wysiwyg/highlightToolbarWYSIWYG.ts b/src/libs/vditor/ts/wysiwyg/highlightToolbarWYSIWYG.ts similarity index 100% rename from src/libs/vditor/src/ts/wysiwyg/highlightToolbarWYSIWYG.ts rename to src/libs/vditor/ts/wysiwyg/highlightToolbarWYSIWYG.ts diff --git a/src/libs/vditor/src/ts/wysiwyg/index.ts b/src/libs/vditor/ts/wysiwyg/index.ts similarity index 100% rename from src/libs/vditor/src/ts/wysiwyg/index.ts rename to src/libs/vditor/ts/wysiwyg/index.ts diff --git a/src/libs/vditor/src/ts/wysiwyg/inlineTag.ts b/src/libs/vditor/ts/wysiwyg/inlineTag.ts similarity index 100% rename from src/libs/vditor/src/ts/wysiwyg/inlineTag.ts rename to src/libs/vditor/ts/wysiwyg/inlineTag.ts diff --git a/src/libs/vditor/src/ts/wysiwyg/input.ts b/src/libs/vditor/ts/wysiwyg/input.ts similarity index 100% rename from src/libs/vditor/src/ts/wysiwyg/input.ts rename to src/libs/vditor/ts/wysiwyg/input.ts diff --git a/src/libs/vditor/src/ts/wysiwyg/processKeydown.ts b/src/libs/vditor/ts/wysiwyg/processKeydown.ts similarity index 100% rename from src/libs/vditor/src/ts/wysiwyg/processKeydown.ts rename to src/libs/vditor/ts/wysiwyg/processKeydown.ts diff --git a/src/libs/vditor/src/ts/wysiwyg/renderDomByMd.ts b/src/libs/vditor/ts/wysiwyg/renderDomByMd.ts similarity index 100% rename from src/libs/vditor/src/ts/wysiwyg/renderDomByMd.ts rename to src/libs/vditor/ts/wysiwyg/renderDomByMd.ts diff --git a/src/libs/vditor/src/ts/wysiwyg/setHeading.ts b/src/libs/vditor/ts/wysiwyg/setHeading.ts similarity index 100% rename from src/libs/vditor/src/ts/wysiwyg/setHeading.ts rename to src/libs/vditor/ts/wysiwyg/setHeading.ts diff --git a/src/libs/vditor/src/ts/wysiwyg/showCode.ts b/src/libs/vditor/ts/wysiwyg/showCode.ts similarity index 100% rename from src/libs/vditor/src/ts/wysiwyg/showCode.ts rename to src/libs/vditor/ts/wysiwyg/showCode.ts diff --git a/src/libs/vditor/src/ts/wysiwyg/toolbarEvent.ts b/src/libs/vditor/ts/wysiwyg/toolbarEvent.ts similarity index 100% rename from src/libs/vditor/src/ts/wysiwyg/toolbarEvent.ts rename to src/libs/vditor/ts/wysiwyg/toolbarEvent.ts diff --git a/src/pages/editor/article/Detail.vue b/src/pages/editor/article/Detail.vue index 00d3f412..0f397735 100644 --- a/src/pages/editor/article/Detail.vue +++ b/src/pages/editor/article/Detail.vue @@ -9,10 +9,10 @@