@mnykj/alleditor-vue 0.0.0-stage → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -2
- package/nuxt.ts +67 -0
- package/package.json +62 -4
- package/scripts/sync-ueditor.mjs +28 -0
- package/src/AllEditor.vue +669 -0
- package/src/DualEditor.vue +7 -0
- package/src/UeHtmlEngine.vue +438 -0
- package/src/assets/iconfont/iconfont.css +27 -0
- package/src/assets/iconfont/iconfont.ttf +0 -0
- package/src/assets/iconfont/iconfont.woff +0 -0
- package/src/assets/iconfont/iconfont.woff2 +0 -0
- package/src/defaultToolbar.ts +115 -0
- package/src/importMenus.ts +158 -0
- package/src/index.ts +58 -0
- package/src/markdown.ts +46 -0
- package/src/stripJavascriptFromHtml.ts +28 -0
- package/src/ueToolbar.ts +257 -0
- package/src/ueditorBase.ts +2 -0
- package/src/ueditorPaths.ts +11 -0
- package/ueditor/dialogs/anchor/anchor.html +40 -0
- package/ueditor/dialogs/attachment/attachment.css +681 -0
- package/ueditor/dialogs/attachment/attachment.html +60 -0
- package/ueditor/dialogs/attachment/attachment.js +760 -0
- package/ueditor/dialogs/attachment/fileTypeImages/icon_chm.gif +0 -0
- package/ueditor/dialogs/attachment/fileTypeImages/icon_default.png +0 -0
- package/ueditor/dialogs/attachment/fileTypeImages/icon_doc.gif +0 -0
- package/ueditor/dialogs/attachment/fileTypeImages/icon_exe.gif +0 -0
- package/ueditor/dialogs/attachment/fileTypeImages/icon_jpg.gif +0 -0
- package/ueditor/dialogs/attachment/fileTypeImages/icon_mp3.gif +0 -0
- package/ueditor/dialogs/attachment/fileTypeImages/icon_mv.gif +0 -0
- package/ueditor/dialogs/attachment/fileTypeImages/icon_pdf.gif +0 -0
- package/ueditor/dialogs/attachment/fileTypeImages/icon_ppt.gif +0 -0
- package/ueditor/dialogs/attachment/fileTypeImages/icon_psd.gif +0 -0
- package/ueditor/dialogs/attachment/fileTypeImages/icon_rar.gif +0 -0
- package/ueditor/dialogs/attachment/fileTypeImages/icon_txt.gif +0 -0
- package/ueditor/dialogs/attachment/fileTypeImages/icon_xls.gif +0 -0
- package/ueditor/dialogs/attachment/images/alignicon.gif +0 -0
- package/ueditor/dialogs/attachment/images/alignicon.png +0 -0
- package/ueditor/dialogs/attachment/images/bg.png +0 -0
- package/ueditor/dialogs/attachment/images/file-icons.gif +0 -0
- package/ueditor/dialogs/attachment/images/file-icons.png +0 -0
- package/ueditor/dialogs/attachment/images/icons.gif +0 -0
- package/ueditor/dialogs/attachment/images/icons.png +0 -0
- package/ueditor/dialogs/attachment/images/image.png +0 -0
- package/ueditor/dialogs/attachment/images/progress.png +0 -0
- package/ueditor/dialogs/attachment/images/success.gif +0 -0
- package/ueditor/dialogs/attachment/images/success.png +0 -0
- package/ueditor/dialogs/background/background.css +94 -0
- package/ueditor/dialogs/background/background.html +56 -0
- package/ueditor/dialogs/background/background.js +376 -0
- package/ueditor/dialogs/background/images/bg.png +0 -0
- package/ueditor/dialogs/background/images/success.png +0 -0
- package/ueditor/dialogs/charts/chart.config.js +65 -0
- package/ueditor/dialogs/charts/charts.css +165 -0
- package/ueditor/dialogs/charts/charts.html +89 -0
- package/ueditor/dialogs/charts/charts.js +519 -0
- package/ueditor/dialogs/charts/images/charts0.png +0 -0
- package/ueditor/dialogs/charts/images/charts1.png +0 -0
- package/ueditor/dialogs/charts/images/charts2.png +0 -0
- package/ueditor/dialogs/charts/images/charts3.png +0 -0
- package/ueditor/dialogs/charts/images/charts4.png +0 -0
- package/ueditor/dialogs/charts/images/charts5.png +0 -0
- package/ueditor/dialogs/emotion/emotion.css +43 -0
- package/ueditor/dialogs/emotion/emotion.html +54 -0
- package/ueditor/dialogs/emotion/emotion.js +186 -0
- package/ueditor/dialogs/emotion/images/0.gif +0 -0
- package/ueditor/dialogs/emotion/images/bface.gif +0 -0
- package/ueditor/dialogs/emotion/images/cface.gif +0 -0
- package/ueditor/dialogs/emotion/images/fface.gif +0 -0
- package/ueditor/dialogs/emotion/images/jxface2.gif +0 -0
- package/ueditor/dialogs/emotion/images/neweditor-tab-bg.png +0 -0
- package/ueditor/dialogs/emotion/images/tface.gif +0 -0
- package/ueditor/dialogs/emotion/images/wface.gif +0 -0
- package/ueditor/dialogs/emotion/images/yface.gif +0 -0
- package/ueditor/dialogs/gmap/gmap.html +89 -0
- package/ueditor/dialogs/help/help.css +7 -0
- package/ueditor/dialogs/help/help.html +82 -0
- package/ueditor/dialogs/help/help.js +56 -0
- package/ueditor/dialogs/image/image.css +894 -0
- package/ueditor/dialogs/image/image.html +120 -0
- package/ueditor/dialogs/image/image.js +1123 -0
- package/ueditor/dialogs/image/images/alignicon.jpg +0 -0
- package/ueditor/dialogs/image/images/bg.png +0 -0
- package/ueditor/dialogs/image/images/icons.gif +0 -0
- package/ueditor/dialogs/image/images/icons.png +0 -0
- package/ueditor/dialogs/image/images/image.png +0 -0
- package/ueditor/dialogs/image/images/progress.png +0 -0
- package/ueditor/dialogs/image/images/success.gif +0 -0
- package/ueditor/dialogs/image/images/success.png +0 -0
- package/ueditor/dialogs/insertframe/insertframe.html +98 -0
- package/ueditor/dialogs/internal.js +81 -0
- package/ueditor/dialogs/link/link.html +132 -0
- package/ueditor/dialogs/map/map.html +135 -0
- package/ueditor/dialogs/map/show.html +118 -0
- package/ueditor/dialogs/music/music.css +30 -0
- package/ueditor/dialogs/music/music.html +32 -0
- package/ueditor/dialogs/music/music.js +192 -0
- package/ueditor/dialogs/preview/preview.html +40 -0
- package/ueditor/dialogs/scrawl/images/addimg.png +0 -0
- package/ueditor/dialogs/scrawl/images/brush.png +0 -0
- package/ueditor/dialogs/scrawl/images/delimg.png +0 -0
- package/ueditor/dialogs/scrawl/images/delimgH.png +0 -0
- package/ueditor/dialogs/scrawl/images/empty.png +0 -0
- package/ueditor/dialogs/scrawl/images/emptyH.png +0 -0
- package/ueditor/dialogs/scrawl/images/eraser.png +0 -0
- package/ueditor/dialogs/scrawl/images/redo.png +0 -0
- package/ueditor/dialogs/scrawl/images/redoH.png +0 -0
- package/ueditor/dialogs/scrawl/images/scale.png +0 -0
- package/ueditor/dialogs/scrawl/images/scaleH.png +0 -0
- package/ueditor/dialogs/scrawl/images/size.png +0 -0
- package/ueditor/dialogs/scrawl/images/undo.png +0 -0
- package/ueditor/dialogs/scrawl/images/undoH.png +0 -0
- package/ueditor/dialogs/scrawl/scrawl.css +72 -0
- package/ueditor/dialogs/scrawl/scrawl.html +95 -0
- package/ueditor/dialogs/scrawl/scrawl.js +670 -0
- package/ueditor/dialogs/searchreplace/searchreplace.html +102 -0
- package/ueditor/dialogs/searchreplace/searchreplace.js +170 -0
- package/ueditor/dialogs/snapscreen/snapscreen.html +58 -0
- package/ueditor/dialogs/spechars/spechars.html +21 -0
- package/ueditor/dialogs/spechars/spechars.js +57 -0
- package/ueditor/dialogs/table/dragicon.png +0 -0
- package/ueditor/dialogs/table/edittable.css +84 -0
- package/ueditor/dialogs/table/edittable.html +64 -0
- package/ueditor/dialogs/table/edittable.js +237 -0
- package/ueditor/dialogs/table/edittd.html +61 -0
- package/ueditor/dialogs/table/edittip.html +33 -0
- package/ueditor/dialogs/template/config.js +42 -0
- package/ueditor/dialogs/template/images/bg.gif +0 -0
- package/ueditor/dialogs/template/images/pre0.png +0 -0
- package/ueditor/dialogs/template/images/pre1.png +0 -0
- package/ueditor/dialogs/template/images/pre2.png +0 -0
- package/ueditor/dialogs/template/images/pre3.png +0 -0
- package/ueditor/dialogs/template/images/pre4.png +0 -0
- package/ueditor/dialogs/template/template.css +18 -0
- package/ueditor/dialogs/template/template.html +26 -0
- package/ueditor/dialogs/template/template.js +53 -0
- package/ueditor/dialogs/video/images/bg.png +0 -0
- package/ueditor/dialogs/video/images/center_focus.jpg +0 -0
- package/ueditor/dialogs/video/images/file-icons.gif +0 -0
- package/ueditor/dialogs/video/images/file-icons.png +0 -0
- package/ueditor/dialogs/video/images/icons.gif +0 -0
- package/ueditor/dialogs/video/images/icons.png +0 -0
- package/ueditor/dialogs/video/images/image.png +0 -0
- package/ueditor/dialogs/video/images/left_focus.jpg +0 -0
- package/ueditor/dialogs/video/images/none_focus.jpg +0 -0
- package/ueditor/dialogs/video/images/progress.png +0 -0
- package/ueditor/dialogs/video/images/right_focus.jpg +0 -0
- package/ueditor/dialogs/video/images/success.gif +0 -0
- package/ueditor/dialogs/video/images/success.png +0 -0
- package/ueditor/dialogs/video/video.css +635 -0
- package/ueditor/dialogs/video/video.html +86 -0
- package/ueditor/dialogs/video/video.js +791 -0
- package/ueditor/dialogs/webapp/webapp.html +53 -0
- package/ueditor/dialogs/wordimage/fClipboard_ueditor.swf +0 -0
- package/ueditor/dialogs/wordimage/imageUploader.swf +0 -0
- package/ueditor/dialogs/wordimage/tangram.js +1495 -0
- package/ueditor/dialogs/wordimage/wordimage.html +111 -0
- package/ueditor/dialogs/wordimage/wordimage.js +157 -0
- package/ueditor/lang/en/en.js +684 -0
- package/ueditor/lang/en/images/addimage.png +0 -0
- package/ueditor/lang/en/images/alldeletebtnhoverskin.png +0 -0
- package/ueditor/lang/en/images/alldeletebtnupskin.png +0 -0
- package/ueditor/lang/en/images/background.png +0 -0
- package/ueditor/lang/en/images/button.png +0 -0
- package/ueditor/lang/en/images/copy.png +0 -0
- package/ueditor/lang/en/images/deletedisable.png +0 -0
- package/ueditor/lang/en/images/deleteenable.png +0 -0
- package/ueditor/lang/en/images/listbackground.png +0 -0
- package/ueditor/lang/en/images/localimage.png +0 -0
- package/ueditor/lang/en/images/music.png +0 -0
- package/ueditor/lang/en/images/rotateleftdisable.png +0 -0
- package/ueditor/lang/en/images/rotateleftenable.png +0 -0
- package/ueditor/lang/en/images/rotaterightdisable.png +0 -0
- package/ueditor/lang/en/images/rotaterightenable.png +0 -0
- package/ueditor/lang/en/images/upload.png +0 -0
- package/ueditor/lang/zh-cn/images/copy.png +0 -0
- package/ueditor/lang/zh-cn/images/localimage.png +0 -0
- package/ueditor/lang/zh-cn/images/music.png +0 -0
- package/ueditor/lang/zh-cn/images/upload.png +0 -0
- package/ueditor/lang/zh-cn/zh-cn.js +669 -0
- package/ueditor/official-demo.html +175 -0
- package/ueditor/themes/default/css/ueditor.css +1906 -0
- package/ueditor/themes/default/css/ueditor.min.css +8 -0
- package/ueditor/themes/default/dialogbase.css +100 -0
- package/ueditor/themes/default/images/anchor.gif +0 -0
- package/ueditor/themes/default/images/arrow.png +0 -0
- package/ueditor/themes/default/images/arrow_down.png +0 -0
- package/ueditor/themes/default/images/arrow_up.png +0 -0
- package/ueditor/themes/default/images/button-bg.gif +0 -0
- package/ueditor/themes/default/images/cancelbutton.gif +0 -0
- package/ueditor/themes/default/images/charts.png +0 -0
- package/ueditor/themes/default/images/cursor_h.gif +0 -0
- package/ueditor/themes/default/images/cursor_h.png +0 -0
- package/ueditor/themes/default/images/cursor_v.gif +0 -0
- package/ueditor/themes/default/images/cursor_v.png +0 -0
- package/ueditor/themes/default/images/dialog-title-bg.png +0 -0
- package/ueditor/themes/default/images/filescan.png +0 -0
- package/ueditor/themes/default/images/highlighted.gif +0 -0
- package/ueditor/themes/default/images/icons-all.gif +0 -0
- package/ueditor/themes/default/images/icons.gif +0 -0
- package/ueditor/themes/default/images/icons.png +0 -0
- package/ueditor/themes/default/images/img-cracked.png +0 -0
- package/ueditor/themes/default/images/loaderror.png +0 -0
- package/ueditor/themes/default/images/loading.gif +0 -0
- package/ueditor/themes/default/images/lock.gif +0 -0
- package/ueditor/themes/default/images/neweditor-tab-bg.png +0 -0
- package/ueditor/themes/default/images/pagebreak.gif +0 -0
- package/ueditor/themes/default/images/scale.png +0 -0
- package/ueditor/themes/default/images/sortable.png +0 -0
- package/ueditor/themes/default/images/spacer.gif +0 -0
- package/ueditor/themes/default/images/sparator_v.png +0 -0
- package/ueditor/themes/default/images/table-cell-align.png +0 -0
- package/ueditor/themes/default/images/tangram-colorpicker.png +0 -0
- package/ueditor/themes/default/images/toolbar_bg.png +0 -0
- package/ueditor/themes/default/images/unhighlighted.gif +0 -0
- package/ueditor/themes/default/images/upload.png +0 -0
- package/ueditor/themes/default/images/videologo.gif +0 -0
- package/ueditor/themes/default/images/word.gif +0 -0
- package/ueditor/themes/default/images/wordpaste.png +0 -0
- package/ueditor/themes/iframe.css +1 -0
- package/ueditor/third-party/SyntaxHighlighter/shCore.js +3655 -0
- package/ueditor/third-party/SyntaxHighlighter/shCoreDefault.css +1 -0
- package/ueditor/third-party/codemirror/codemirror.css +104 -0
- package/ueditor/third-party/codemirror/codemirror.js +3581 -0
- package/ueditor/third-party/highcharts/adapters/mootools-adapter.js +13 -0
- package/ueditor/third-party/highcharts/adapters/mootools-adapter.src.js +313 -0
- package/ueditor/third-party/highcharts/adapters/prototype-adapter.js +15 -0
- package/ueditor/third-party/highcharts/adapters/prototype-adapter.src.js +316 -0
- package/ueditor/third-party/highcharts/adapters/standalone-framework.js +17 -0
- package/ueditor/third-party/highcharts/adapters/standalone-framework.src.js +583 -0
- package/ueditor/third-party/highcharts/highcharts-more.js +50 -0
- package/ueditor/third-party/highcharts/highcharts-more.src.js +2430 -0
- package/ueditor/third-party/highcharts/highcharts.js +283 -0
- package/ueditor/third-party/highcharts/highcharts.src.js +16974 -0
- package/ueditor/third-party/highcharts/modules/annotations.js +7 -0
- package/ueditor/third-party/highcharts/modules/annotations.src.js +401 -0
- package/ueditor/third-party/highcharts/modules/canvas-tools.js +133 -0
- package/ueditor/third-party/highcharts/modules/canvas-tools.src.js +3113 -0
- package/ueditor/third-party/highcharts/modules/data.js +17 -0
- package/ueditor/third-party/highcharts/modules/data.src.js +582 -0
- package/ueditor/third-party/highcharts/modules/drilldown.js +11 -0
- package/ueditor/third-party/highcharts/modules/drilldown.src.js +447 -0
- package/ueditor/third-party/highcharts/modules/exporting.js +22 -0
- package/ueditor/third-party/highcharts/modules/exporting.src.js +709 -0
- package/ueditor/third-party/highcharts/modules/funnel.js +12 -0
- package/ueditor/third-party/highcharts/modules/funnel.src.js +289 -0
- package/ueditor/third-party/highcharts/modules/heatmap.js +1 -0
- package/ueditor/third-party/highcharts/modules/heatmap.src.js +53 -0
- package/ueditor/third-party/highcharts/modules/map.js +27 -0
- package/ueditor/third-party/highcharts/modules/map.src.js +1002 -0
- package/ueditor/third-party/highcharts/modules/no-data-to-display.js +12 -0
- package/ueditor/third-party/highcharts/modules/no-data-to-display.src.js +128 -0
- package/ueditor/third-party/highcharts/themes/dark-blue.js +254 -0
- package/ueditor/third-party/highcharts/themes/dark-green.js +255 -0
- package/ueditor/third-party/highcharts/themes/gray.js +257 -0
- package/ueditor/third-party/highcharts/themes/grid.js +103 -0
- package/ueditor/third-party/highcharts/themes/skies.js +89 -0
- package/ueditor/third-party/jquery-1.10.2.js +9789 -0
- package/ueditor/third-party/jquery-1.10.2.min.js +6 -0
- package/ueditor/third-party/jquery-1.10.2.min.map +1 -0
- package/ueditor/third-party/snapscreen/UEditorSnapscreen.exe +0 -0
- package/ueditor/third-party/video-js/font/vjs.eot +0 -0
- package/ueditor/third-party/video-js/font/vjs.svg +65 -0
- package/ueditor/third-party/video-js/font/vjs.ttf +0 -0
- package/ueditor/third-party/video-js/font/vjs.woff +0 -0
- package/ueditor/third-party/video-js/video-js.css +766 -0
- package/ueditor/third-party/video-js/video-js.min.css +5 -0
- package/ueditor/third-party/video-js/video-js.swf +0 -0
- package/ueditor/third-party/video-js/video.dev.js +7108 -0
- package/ueditor/third-party/video-js/video.js +129 -0
- package/ueditor/third-party/webuploader/Uploader.swf +0 -0
- package/ueditor/third-party/webuploader/webuploader.css +28 -0
- package/ueditor/third-party/webuploader/webuploader.custom.js +5670 -0
- package/ueditor/third-party/webuploader/webuploader.custom.min.js +2 -0
- package/ueditor/third-party/webuploader/webuploader.flashonly.js +4176 -0
- package/ueditor/third-party/webuploader/webuploader.flashonly.min.js +2 -0
- package/ueditor/third-party/webuploader/webuploader.html5only.js +5559 -0
- package/ueditor/third-party/webuploader/webuploader.html5only.min.js +2 -0
- package/ueditor/third-party/webuploader/webuploader.js +6733 -0
- package/ueditor/third-party/webuploader/webuploader.min.js +2 -0
- package/ueditor/third-party/webuploader/webuploader.withoutimage.js +4593 -0
- package/ueditor/third-party/webuploader/webuploader.withoutimage.min.js +2 -0
- package/ueditor/third-party/zeroclipboard/ZeroClipboard.js +1256 -0
- package/ueditor/third-party/zeroclipboard/ZeroClipboard.min.js +9 -0
- package/ueditor/third-party/zeroclipboard/ZeroClipboard.swf +0 -0
- package/ueditor/ueditor.all.js +32931 -0
- package/ueditor/ueditor.all.min.js +17 -0
- package/ueditor/ueditor.config.js +507 -0
- package/ueditor/ueditor.parse.js +1230 -0
- package/ueditor/ueditor.parse.min.js +5 -0
- package/vite.ts +87 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { Boot } from '@mnykj/alleditor-core'
|
|
2
|
+
|
|
3
|
+
/** iconfont 项目 5252173;clearSvgStyle 会去掉 class,故用 unicode + font-family */
|
|
4
|
+
const ICONFONT_STYLE =
|
|
5
|
+
'font-family:iconfont!important;font-size:16px;font-style:normal;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale'
|
|
6
|
+
|
|
7
|
+
function iconfontGlyph(char: string) {
|
|
8
|
+
return `<i style="${ICONFONT_STYLE}" aria-hidden="true">${char}</i>`
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 工具栏「导入 HTML」:导入 .html。
|
|
13
|
+
* 图标:iconfont「html」\ue648。
|
|
14
|
+
*/
|
|
15
|
+
export class SourceCodeMenu {
|
|
16
|
+
title = '导入 HTML'
|
|
17
|
+
tag = 'button'
|
|
18
|
+
iconSvg = iconfontGlyph('\ue648')
|
|
19
|
+
|
|
20
|
+
getValue() {
|
|
21
|
+
return ''
|
|
22
|
+
}
|
|
23
|
+
isActive() {
|
|
24
|
+
return !!(SourceCodeMenu.attrs as { active?: boolean }).active
|
|
25
|
+
}
|
|
26
|
+
isDisabled() {
|
|
27
|
+
return false
|
|
28
|
+
}
|
|
29
|
+
exec() {
|
|
30
|
+
const handler = SourceCodeMenu.attrs.onImport
|
|
31
|
+
if (typeof handler === 'function') handler()
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static attrs: {
|
|
35
|
+
active: boolean
|
|
36
|
+
onImport: null | (() => void)
|
|
37
|
+
onToggle: null | (() => void)
|
|
38
|
+
} = {
|
|
39
|
+
active: false,
|
|
40
|
+
onImport: null,
|
|
41
|
+
onToggle: null,
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 工具栏:导入 Markdown 文件(仅 .md)。
|
|
47
|
+
* 图标:iconfont「markdown-line」\ue8d4。
|
|
48
|
+
*/
|
|
49
|
+
export class ImportMarkdownMenu {
|
|
50
|
+
title = '导入 Markdown'
|
|
51
|
+
tag = 'button'
|
|
52
|
+
iconSvg = iconfontGlyph('\ue8d4')
|
|
53
|
+
|
|
54
|
+
getValue() {
|
|
55
|
+
return ''
|
|
56
|
+
}
|
|
57
|
+
isActive() {
|
|
58
|
+
return false
|
|
59
|
+
}
|
|
60
|
+
isDisabled() {
|
|
61
|
+
return false
|
|
62
|
+
}
|
|
63
|
+
exec() {
|
|
64
|
+
const handler = ImportMarkdownMenu.attrs.onImport
|
|
65
|
+
if (typeof handler === 'function') handler()
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
static attrs: {
|
|
69
|
+
onImport: null | (() => void)
|
|
70
|
+
} = {
|
|
71
|
+
onImport: null,
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* 工具栏「清空文档」:确认后清空正文(始终可点,对齐全屏)。
|
|
77
|
+
* 图标:iconfont「qingkongwendang1」\ue601。
|
|
78
|
+
*/
|
|
79
|
+
export class ClearContentMenu {
|
|
80
|
+
title = '清空文档'
|
|
81
|
+
tag = 'button'
|
|
82
|
+
alwaysEnable = true
|
|
83
|
+
iconSvg = iconfontGlyph('\ue601')
|
|
84
|
+
|
|
85
|
+
getValue() {
|
|
86
|
+
return ''
|
|
87
|
+
}
|
|
88
|
+
isActive() {
|
|
89
|
+
return false
|
|
90
|
+
}
|
|
91
|
+
isDisabled() {
|
|
92
|
+
return false
|
|
93
|
+
}
|
|
94
|
+
exec() {
|
|
95
|
+
const handler = ClearContentMenu.attrs.onClear
|
|
96
|
+
if (typeof handler === 'function') handler()
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
static attrs: {
|
|
100
|
+
onClear: null | (() => void)
|
|
101
|
+
} = {
|
|
102
|
+
onClear: null,
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** 注册导入 / 清空菜单(幂等;HMR 安全,逐项 try 避免漏注册) */
|
|
107
|
+
export function registerImportMenus() {
|
|
108
|
+
try {
|
|
109
|
+
Boot.registerMenu({
|
|
110
|
+
key: 'sourceCode',
|
|
111
|
+
factory() {
|
|
112
|
+
return new SourceCodeMenu()
|
|
113
|
+
},
|
|
114
|
+
})
|
|
115
|
+
} catch {
|
|
116
|
+
/* 重复注册忽略 */
|
|
117
|
+
}
|
|
118
|
+
try {
|
|
119
|
+
Boot.registerMenu({
|
|
120
|
+
key: 'importMarkdown',
|
|
121
|
+
factory() {
|
|
122
|
+
return new ImportMarkdownMenu()
|
|
123
|
+
},
|
|
124
|
+
})
|
|
125
|
+
} catch {
|
|
126
|
+
/* 重复注册忽略 */
|
|
127
|
+
}
|
|
128
|
+
try {
|
|
129
|
+
Boot.registerMenu({
|
|
130
|
+
key: 'clearContent',
|
|
131
|
+
factory() {
|
|
132
|
+
return new ClearContentMenu()
|
|
133
|
+
},
|
|
134
|
+
})
|
|
135
|
+
} catch {
|
|
136
|
+
/* 重复注册忽略 */
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export function bindImportMenuHandlers(handlers: {
|
|
141
|
+
onImportHtml?: null | (() => void)
|
|
142
|
+
onImportMarkdown?: null | (() => void)
|
|
143
|
+
onToggleSource?: null | (() => void)
|
|
144
|
+
onClearContent?: null | (() => void)
|
|
145
|
+
}) {
|
|
146
|
+
if (handlers.onImportHtml !== undefined) {
|
|
147
|
+
SourceCodeMenu.attrs.onImport = handlers.onImportHtml
|
|
148
|
+
}
|
|
149
|
+
if (handlers.onToggleSource !== undefined) {
|
|
150
|
+
SourceCodeMenu.attrs.onToggle = handlers.onToggleSource
|
|
151
|
+
}
|
|
152
|
+
if (handlers.onImportMarkdown !== undefined) {
|
|
153
|
+
ImportMarkdownMenu.attrs.onImport = handlers.onImportMarkdown
|
|
154
|
+
}
|
|
155
|
+
if (handlers.onClearContent !== undefined) {
|
|
156
|
+
ClearContentMenu.attrs.onClear = handlers.onClearContent
|
|
157
|
+
}
|
|
158
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @mnykj/alleditor-vue
|
|
3
|
+
* 桌面 Web 壳:AllEditor(wang + UE)与工具栏适配。
|
|
4
|
+
* 引擎协议见 @mnykj/alleditor-core(与本包同版本锁步)。
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export { default as AllEditor } from './AllEditor.vue'
|
|
8
|
+
/** @deprecated 使用 AllEditor */
|
|
9
|
+
export { default as DualEditor } from './AllEditor.vue'
|
|
10
|
+
export { default as UeHtmlEngine } from './UeHtmlEngine.vue'
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
WANG_MENU_TO_UE,
|
|
14
|
+
routeWangMenuKeyToUe,
|
|
15
|
+
bindUeToolbarAdapter,
|
|
16
|
+
isUeRoutableMenuKey,
|
|
17
|
+
getUeToolbarEnableKeys,
|
|
18
|
+
} from './ueToolbar'
|
|
19
|
+
export type { UeCommandRunner, BindUeToolbarOptions, UeToolbarBinding } from './ueToolbar'
|
|
20
|
+
|
|
21
|
+
export { DEFAULT_UEDITOR_PUBLIC_BASE } from './ueditorBase'
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
SourceCodeMenu,
|
|
25
|
+
ImportMarkdownMenu,
|
|
26
|
+
ClearContentMenu,
|
|
27
|
+
registerImportMenus,
|
|
28
|
+
bindImportMenuHandlers,
|
|
29
|
+
} from './importMenus'
|
|
30
|
+
export {
|
|
31
|
+
DEFAULT_DUAL_TOOLBAR_KEYS,
|
|
32
|
+
DEFAULT_DUAL_TOOLBAR_KEYS as DEFAULT_ALLEDITOR_TOOLBAR_KEYS,
|
|
33
|
+
mergeToolbarConfig,
|
|
34
|
+
} from './defaultToolbar'
|
|
35
|
+
export {
|
|
36
|
+
markdownToHtml,
|
|
37
|
+
extractHtmlBody,
|
|
38
|
+
isEffectivelyEmptyHtml,
|
|
39
|
+
} from './markdown'
|
|
40
|
+
export { stripJavascriptFromHtml } from './stripJavascriptFromHtml'
|
|
41
|
+
|
|
42
|
+
// 协议工具从引擎包再导出,方便只装 vue 壳的调用方
|
|
43
|
+
export type { AllEditorEngine } from '@mnykj/alleditor-core'
|
|
44
|
+
export {
|
|
45
|
+
ALLEDITOR_ENGINE_ATTR,
|
|
46
|
+
ALLEDITOR_ENGINE_CLASS,
|
|
47
|
+
isHeavyFidelityHtml,
|
|
48
|
+
stripLegacyEngineComments,
|
|
49
|
+
parseEditorEngineRoot,
|
|
50
|
+
unwrapEditorEngineHtml,
|
|
51
|
+
detectEditorEngine,
|
|
52
|
+
wrapEditorEngineHtml,
|
|
53
|
+
ensureEditorEngineHtml,
|
|
54
|
+
migrateLegacyEngineMarkers,
|
|
55
|
+
} from '@mnykj/alleditor-core'
|
|
56
|
+
|
|
57
|
+
// 底层 wang 组件,便于单包安装
|
|
58
|
+
export { Editor, Toolbar } from '@mnykj/alleditor-for-vue'
|
package/src/markdown.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** @type {import('markdown-it') | null} */
|
|
2
|
+
let markdownItInstance: any = null
|
|
3
|
+
|
|
4
|
+
export async function markdownToHtml(text: string): Promise<string> {
|
|
5
|
+
if (!markdownItInstance) {
|
|
6
|
+
const mod = await import('markdown-it')
|
|
7
|
+
const MarkdownIt = mod.default || mod
|
|
8
|
+
markdownItInstance = new MarkdownIt({
|
|
9
|
+
html: false,
|
|
10
|
+
linkify: true,
|
|
11
|
+
breaks: true,
|
|
12
|
+
})
|
|
13
|
+
}
|
|
14
|
+
let html = markdownItInstance.render(text || '')
|
|
15
|
+
if (!String(html).trim()) html = '<p><br></p>'
|
|
16
|
+
return html
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** 从完整 HTML 文档取出 body 内片段 */
|
|
20
|
+
export function extractHtmlBody(text: string): string {
|
|
21
|
+
let s = String(text || '').replace(/^\uFEFF/, '')
|
|
22
|
+
const bodyMatch = s.match(/<body[^>]*>([\s\S]*?)<\/body>/i)
|
|
23
|
+
if (bodyMatch) s = bodyMatch[1]
|
|
24
|
+
return s.trim()
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function isEffectivelyEmptyHtml(html: string): boolean {
|
|
28
|
+
const s = String(html ?? '').trim()
|
|
29
|
+
if (!s) return true
|
|
30
|
+
if (
|
|
31
|
+
/<(img|video|audio|iframe|embed|object|source|hr|table|svg|blockquote|pre|ul|ol|h[1-6])\b/i.test(
|
|
32
|
+
s
|
|
33
|
+
)
|
|
34
|
+
) {
|
|
35
|
+
return false
|
|
36
|
+
}
|
|
37
|
+
const text = s
|
|
38
|
+
.replace(/<!--[\s\S]*?-->/g, '')
|
|
39
|
+
.replace(/ /gi, ' ')
|
|
40
|
+
.replace(/<br\s*\/?>/gi, '')
|
|
41
|
+
.replace(/<p>\s*<\/p>/gi, '')
|
|
42
|
+
.replace(/<div[^>]*>\s*<\/div>/gi, '')
|
|
43
|
+
.replace(/<[^>]+>/g, '')
|
|
44
|
+
.trim()
|
|
45
|
+
return text === ''
|
|
46
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 导入 HTML 时剥离 JS:script、事件属性、javascript: 伪协议。
|
|
3
|
+
*/
|
|
4
|
+
export function stripJavascriptFromHtml(html: string): string {
|
|
5
|
+
let s = String(html ?? '')
|
|
6
|
+
|
|
7
|
+
const open = '<' + 'script'
|
|
8
|
+
const close = '<' + '/' + 'script>'
|
|
9
|
+
const blockRe = new RegExp(`${open}\\b[^>]*>[\\s\\S]*?${close}`, 'gi')
|
|
10
|
+
const selfRe = new RegExp(`${open}\\b[^>]*\\/?>`, 'gi')
|
|
11
|
+
|
|
12
|
+
s = s.replace(blockRe, '')
|
|
13
|
+
s = s.replace(selfRe, '')
|
|
14
|
+
|
|
15
|
+
s = s.replace(/\s+on[a-zA-Z]+\s*=\s*(['"])[\s\S]*?\1/g, '')
|
|
16
|
+
s = s.replace(/\s+on[a-zA-Z]+\s*=\s*[^\s>]+/g, '')
|
|
17
|
+
|
|
18
|
+
s = s.replace(
|
|
19
|
+
/\s(href|src|action|formaction|xlink:href)\s*=\s*(['"])\s*javascript:[\s\S]*?\2/gi,
|
|
20
|
+
' $1=$2#$2'
|
|
21
|
+
)
|
|
22
|
+
s = s.replace(
|
|
23
|
+
/\s(href|src|action|formaction|xlink:href)\s*=\s*(['"])?\s*javascript:[^\s>]*/gi,
|
|
24
|
+
' $1="#"'
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
return s
|
|
28
|
+
}
|
package/src/ueToolbar.ts
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 将 wang 工具栏菜单转发到 UE HTML 引擎。
|
|
3
|
+
* UE 模式下:可映射按钮强制去 disabled 灰态,点击走 UE;不可映射项保持灰显。
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export type UeCommandRunner = {
|
|
7
|
+
execCommand?: (cmd: string, ...args: any[]) => any
|
|
8
|
+
focus?: () => void
|
|
9
|
+
getEditor?: () => { focus?: () => void } | null
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** wang menu key → UE execCommand(含工具栏实际 key 别名) */
|
|
13
|
+
export const WANG_MENU_TO_UE: Record<string, string> = {
|
|
14
|
+
bold: 'bold',
|
|
15
|
+
italic: 'italic',
|
|
16
|
+
underline: 'underline',
|
|
17
|
+
through: 'strikethrough',
|
|
18
|
+
code: 'code',
|
|
19
|
+
sub: 'subscript',
|
|
20
|
+
sup: 'superscript',
|
|
21
|
+
undo: 'undo',
|
|
22
|
+
redo: 'redo',
|
|
23
|
+
bulletedList: 'insertunorderedlist',
|
|
24
|
+
numberedList: 'insertorderedlist',
|
|
25
|
+
justifyLeft: 'justifyleft',
|
|
26
|
+
justifyCenter: 'justifycenter',
|
|
27
|
+
justifyRight: 'justifyright',
|
|
28
|
+
justifyJustify: 'justifyjustify',
|
|
29
|
+
indent: 'indent',
|
|
30
|
+
delIndent: 'outdent',
|
|
31
|
+
clearStyle: 'removeformat',
|
|
32
|
+
clearAllFormat: 'removeformat',
|
|
33
|
+
divider: 'horizontal',
|
|
34
|
+
dividerAtCursor: 'horizontal',
|
|
35
|
+
emotion: 'emotion',
|
|
36
|
+
insertTable: 'inserttable',
|
|
37
|
+
blockquote: 'blockquote',
|
|
38
|
+
blockquoteMerged: 'blockquote',
|
|
39
|
+
codeBlock: 'insertcode',
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** 仍走 wang Boot / 宿主回调,不转发 UE */
|
|
43
|
+
const DEFAULT_PASSTHROUGH_KEYS = new Set([
|
|
44
|
+
'sourceCode',
|
|
45
|
+
'importMarkdown',
|
|
46
|
+
'clearContent',
|
|
47
|
+
'fullScreen',
|
|
48
|
+
])
|
|
49
|
+
|
|
50
|
+
/** group 面板本身不拦截,让子菜单展开;子项再按映射转发 */
|
|
51
|
+
function isGroupMenuKey(key: string) {
|
|
52
|
+
return key.startsWith('group-')
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function isUeRoutableMenuKey(
|
|
56
|
+
key: string,
|
|
57
|
+
passthroughKeys?: Set<string>
|
|
58
|
+
): boolean {
|
|
59
|
+
if (!key || isGroupMenuKey(key)) return false
|
|
60
|
+
const pass = passthroughKeys || DEFAULT_PASSTHROUGH_KEYS
|
|
61
|
+
if (pass.has(key)) return false
|
|
62
|
+
if (key === 'insertLink') return true
|
|
63
|
+
if (key === 'insertTable' || key === 'inserttable') return true
|
|
64
|
+
if (key === 'uploadImage' || key === 'insertImage') return false
|
|
65
|
+
if (key === 'uploadVideo' || key === 'insertVideo') return false
|
|
66
|
+
return !!WANG_MENU_TO_UE[key]
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** UE 模式下应保持可点的按钮(视觉上去掉 disabled) */
|
|
70
|
+
export function getUeToolbarEnableKeys(
|
|
71
|
+
passthroughKeys?: Set<string>
|
|
72
|
+
): Set<string> {
|
|
73
|
+
const pass = passthroughKeys || DEFAULT_PASSTHROUGH_KEYS
|
|
74
|
+
return new Set([
|
|
75
|
+
...Object.keys(WANG_MENU_TO_UE),
|
|
76
|
+
'insertLink',
|
|
77
|
+
'insertTable',
|
|
78
|
+
...pass,
|
|
79
|
+
])
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function focusUe(ue: UeCommandRunner | null | undefined) {
|
|
83
|
+
if (!ue) return
|
|
84
|
+
try {
|
|
85
|
+
if (typeof ue.focus === 'function') {
|
|
86
|
+
ue.focus()
|
|
87
|
+
return
|
|
88
|
+
}
|
|
89
|
+
ue.getEditor?.()?.focus?.()
|
|
90
|
+
} catch {
|
|
91
|
+
/* ignore */
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function routeWangMenuKeyToUe(
|
|
96
|
+
key: string,
|
|
97
|
+
ue: UeCommandRunner | null | undefined
|
|
98
|
+
) {
|
|
99
|
+
if (!key || !ue?.execCommand) return
|
|
100
|
+
focusUe(ue)
|
|
101
|
+
if (key === 'insertLink') {
|
|
102
|
+
const href =
|
|
103
|
+
typeof window !== 'undefined'
|
|
104
|
+
? window.prompt('请输入链接地址:', 'https://')
|
|
105
|
+
: ''
|
|
106
|
+
if (!href) return
|
|
107
|
+
ue.execCommand('link', { href })
|
|
108
|
+
return
|
|
109
|
+
}
|
|
110
|
+
if (key === 'insertTable' || key === 'inserttable') {
|
|
111
|
+
ue.execCommand('inserttable', { numRows: 3, numCols: 3 })
|
|
112
|
+
return
|
|
113
|
+
}
|
|
114
|
+
if (key === 'uploadImage' || key === 'insertImage') return
|
|
115
|
+
if (key === 'uploadVideo' || key === 'insertVideo') return
|
|
116
|
+
const cmd = WANG_MENU_TO_UE[key]
|
|
117
|
+
if (cmd) ue.execCommand(cmd)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export type BindUeToolbarOptions = {
|
|
121
|
+
/** 工具栏根节点,或 CSS 选择器 */
|
|
122
|
+
toolbar: Element | string
|
|
123
|
+
getUe: () => UeCommandRunner | null | undefined
|
|
124
|
+
/** 返回 false 时不拦截、也不强制启用(例如当前不是 UE 模式) */
|
|
125
|
+
shouldCapture?: () => boolean
|
|
126
|
+
passthroughKeys?: Set<string>
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export type UeToolbarBinding = {
|
|
130
|
+
unbind: () => void
|
|
131
|
+
/** 立刻按 UE 模式同步一次按钮可用态 */
|
|
132
|
+
syncEnabled: () => void
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function bindUeToolbarAdapter(
|
|
136
|
+
options: BindUeToolbarOptions
|
|
137
|
+
): UeToolbarBinding {
|
|
138
|
+
const passthrough = options.passthroughKeys || DEFAULT_PASSTHROUGH_KEYS
|
|
139
|
+
const enableKeys = getUeToolbarEnableKeys(passthrough)
|
|
140
|
+
|
|
141
|
+
const resolveBar = () => {
|
|
142
|
+
if (typeof options.toolbar === 'string') {
|
|
143
|
+
return typeof document !== 'undefined'
|
|
144
|
+
? document.querySelector(options.toolbar)
|
|
145
|
+
: null
|
|
146
|
+
}
|
|
147
|
+
return options.toolbar
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const shouldCapture = () =>
|
|
151
|
+
!options.shouldCapture || !!options.shouldCapture()
|
|
152
|
+
|
|
153
|
+
const syncEnabled = () => {
|
|
154
|
+
const bar = resolveBar()
|
|
155
|
+
if (!bar) return
|
|
156
|
+
if (!shouldCapture()) return
|
|
157
|
+
bar.querySelectorAll('button[data-menu-key]').forEach((node) => {
|
|
158
|
+
const btn = node as HTMLElement
|
|
159
|
+
const key = btn.getAttribute('data-menu-key') || ''
|
|
160
|
+
if (!key || isGroupMenuKey(key)) return
|
|
161
|
+
if (enableKeys.has(key)) {
|
|
162
|
+
btn.classList.remove('disabled')
|
|
163
|
+
btn.removeAttribute('disabled')
|
|
164
|
+
btn.removeAttribute('aria-disabled')
|
|
165
|
+
}
|
|
166
|
+
})
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// bold 等是 toggle:pointerdown + click 各 exec 一次会「闪一下又还原」
|
|
170
|
+
let lastRouteAt = 0
|
|
171
|
+
let lastRouteKey = ''
|
|
172
|
+
|
|
173
|
+
const onCapture = (e: Event) => {
|
|
174
|
+
if (!shouldCapture()) return
|
|
175
|
+
const t = e.target as HTMLElement | null
|
|
176
|
+
const btn = t?.closest?.(
|
|
177
|
+
'button[data-menu-key], .w-e-bar-item button'
|
|
178
|
+
) as HTMLElement | null
|
|
179
|
+
if (!btn) return
|
|
180
|
+
const key =
|
|
181
|
+
btn.getAttribute?.('data-menu-key') ||
|
|
182
|
+
btn.closest?.('[data-menu-key]')?.getAttribute?.('data-menu-key')
|
|
183
|
+
if (!key || !isUeRoutableMenuKey(key, passthrough)) return
|
|
184
|
+
// 即使仍带 disabled class,也拦截(wang BaseButton 内部 disabled 挡不住 capture)
|
|
185
|
+
e.preventDefault()
|
|
186
|
+
e.stopPropagation()
|
|
187
|
+
if (typeof (e as any).stopImmediatePropagation === 'function') {
|
|
188
|
+
;(e as any).stopImmediatePropagation()
|
|
189
|
+
}
|
|
190
|
+
// click 只吞掉,不 exec:bold 等是 toggle,mousedown+click 各一次会抵消
|
|
191
|
+
if (e.type !== 'mousedown') return
|
|
192
|
+
const now = Date.now()
|
|
193
|
+
if (key === lastRouteKey && now - lastRouteAt < 320) return
|
|
194
|
+
lastRouteKey = key
|
|
195
|
+
lastRouteAt = now
|
|
196
|
+
routeWangMenuKeyToUe(key, options.getUe())
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
let bar = resolveBar()
|
|
200
|
+
let bound = false
|
|
201
|
+
/** @type {MutationObserver | null} */
|
|
202
|
+
let classObserver: MutationObserver | null = null
|
|
203
|
+
let syncTimer: ReturnType<typeof setTimeout> | null = null
|
|
204
|
+
|
|
205
|
+
const scheduleSync = () => {
|
|
206
|
+
if (syncTimer) clearTimeout(syncTimer)
|
|
207
|
+
// 晚于 wang Toolbar changeToolbarState 的 200ms debounce
|
|
208
|
+
syncTimer = setTimeout(() => {
|
|
209
|
+
syncTimer = null
|
|
210
|
+
syncEnabled()
|
|
211
|
+
}, 220)
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const attach = (el: Element) => {
|
|
215
|
+
// 仅 mousedown 执行命令(保选区);click 只拦截,避免与 wang / pointer 二次触发把 toggle 命令抵消
|
|
216
|
+
el.addEventListener('mousedown', onCapture, true)
|
|
217
|
+
el.addEventListener('click', onCapture, true)
|
|
218
|
+
classObserver = new MutationObserver(() => {
|
|
219
|
+
if (!shouldCapture()) return
|
|
220
|
+
scheduleSync()
|
|
221
|
+
})
|
|
222
|
+
classObserver.observe(el, {
|
|
223
|
+
subtree: true,
|
|
224
|
+
attributes: true,
|
|
225
|
+
attributeFilter: ['class'],
|
|
226
|
+
})
|
|
227
|
+
bound = true
|
|
228
|
+
syncEnabled()
|
|
229
|
+
scheduleSync()
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (bar) {
|
|
233
|
+
attach(bar)
|
|
234
|
+
} else if (typeof requestAnimationFrame !== 'undefined') {
|
|
235
|
+
requestAnimationFrame(() => {
|
|
236
|
+
bar = resolveBar()
|
|
237
|
+
if (bar && !bound) attach(bar)
|
|
238
|
+
})
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return {
|
|
242
|
+
syncEnabled,
|
|
243
|
+
unbind() {
|
|
244
|
+
if (syncTimer) {
|
|
245
|
+
clearTimeout(syncTimer)
|
|
246
|
+
syncTimer = null
|
|
247
|
+
}
|
|
248
|
+
classObserver?.disconnect()
|
|
249
|
+
classObserver = null
|
|
250
|
+
const el = bar || resolveBar()
|
|
251
|
+
if (!el || !bound) return
|
|
252
|
+
el.removeEventListener('mousedown', onCapture, true)
|
|
253
|
+
el.removeEventListener('click', onCapture, true)
|
|
254
|
+
bound = false
|
|
255
|
+
},
|
|
256
|
+
}
|
|
257
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { dirname, join } from 'node:path'
|
|
2
|
+
import { fileURLToPath } from 'node:url'
|
|
3
|
+
import { DEFAULT_UEDITOR_PUBLIC_BASE } from './ueditorBase'
|
|
4
|
+
|
|
5
|
+
export { DEFAULT_UEDITOR_PUBLIC_BASE }
|
|
6
|
+
|
|
7
|
+
/** 包内 ueditor 静态目录的绝对路径(仅 Node / 构建配置用,勿在浏览器组件里 import) */
|
|
8
|
+
export function getUeditorPackageDir(): string {
|
|
9
|
+
const here = dirname(fileURLToPath(import.meta.url))
|
|
10
|
+
return join(here, '..', 'ueditor')
|
|
11
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
|
2
|
+
"http://www.w3.org/TR/html4/loose.dtd">
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
6
|
+
<title></title>
|
|
7
|
+
<style type="text/css">
|
|
8
|
+
*{color: #838383;margin: 0;padding: 0}
|
|
9
|
+
html,body {font-size: 12px;overflow: hidden; }
|
|
10
|
+
.content{padding:5px 0 0 15px;}
|
|
11
|
+
input{width:210px;height:21px;line-height:21px;margin-left: 4px;}
|
|
12
|
+
</style>
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
<div class="content">
|
|
16
|
+
<span><var id="lang_input_anchorName"></var></span><input id="anchorName" value="" />
|
|
17
|
+
</div>
|
|
18
|
+
<script type="text/javascript" src="../internal.js"></script>
|
|
19
|
+
<script type="text/javascript">
|
|
20
|
+
var anchorInput = $G('anchorName'),
|
|
21
|
+
node = editor.selection.getRange().getClosedNode();
|
|
22
|
+
if(node && node.tagName == 'IMG' && (node = node.getAttribute('anchorname'))){
|
|
23
|
+
anchorInput.value = node;
|
|
24
|
+
}
|
|
25
|
+
anchorInput.onkeydown = function(evt){
|
|
26
|
+
evt = evt || window.event;
|
|
27
|
+
if(evt.keyCode == 13){
|
|
28
|
+
editor.execCommand('anchor', anchorInput.value);
|
|
29
|
+
dialog.close();
|
|
30
|
+
domUtils.preventDefault(evt)
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
dialog.onok = function (){
|
|
34
|
+
editor.execCommand('anchor', anchorInput.value);
|
|
35
|
+
dialog.close();
|
|
36
|
+
};
|
|
37
|
+
$focus(anchorInput);
|
|
38
|
+
</script>
|
|
39
|
+
</body>
|
|
40
|
+
</html>
|