@licium/editor 3.2.3
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 +176 -0
- package/dist/esm/i18n/__test__/integration/ui/layout.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/integration/ui/toolbar.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/integration/vdom/render.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/integration/widget/widgetNode.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/unit/convertor.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/unit/dom.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/unit/editor.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/unit/eventEmitter.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/unit/helper/common.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/unit/helper/image.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/unit/linkXss.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/unit/markdown/keymap.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/unit/markdown/mdCommand.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/unit/markdown/mdEditor.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/unit/markdown/mdPreview.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/unit/markdown/smartTask.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/unit/markdown/syntaxHighlight.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/unit/markdown/util.d.ts +7 -0
- package/dist/esm/i18n/__test__/unit/repro_3296.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/unit/sanitizer.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/unit/utils/escape.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/unit/utils/pollution.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/unit/vdom/template.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/unit/viewer.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/unit/wysiwyg/customBlock.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/unit/wysiwyg/helper/pasteMsoList.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/unit/wysiwyg/imageInsertion.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/unit/wysiwyg/keymap.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/unit/wysiwyg/wwCommand.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/unit/wysiwyg/wwEditor.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/unit/wysiwyg/wwTableCommand.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/unit/wysiwyg/wwToDOMAdaptor.spec.d.ts +1 -0
- package/dist/esm/i18n/__test__/unit/xssSanitizer.spec.d.ts +1 -0
- package/dist/esm/i18n/ar.d.ts +1 -0
- package/dist/esm/i18n/ar.js +63 -0
- package/dist/esm/i18n/base.d.ts +60 -0
- package/dist/esm/i18n/commands/commandManager.d.ts +16 -0
- package/dist/esm/i18n/commands/defaultCommands.d.ts +2 -0
- package/dist/esm/i18n/commands/wwCommands.d.ts +2 -0
- package/dist/esm/i18n/convertors/convertor.d.ts +19 -0
- package/dist/esm/i18n/convertors/toMarkdown/toMdConvertorState.d.ts +30 -0
- package/dist/esm/i18n/convertors/toMarkdown/toMdConvertors.d.ts +7 -0
- package/dist/esm/i18n/convertors/toMarkdown/toMdNodeTypeWriters.d.ts +8 -0
- package/dist/esm/i18n/convertors/toWysiwyg/htmlToWwConvertors.d.ts +7 -0
- package/dist/esm/i18n/convertors/toWysiwyg/toWwConvertorState.d.ts +23 -0
- package/dist/esm/i18n/convertors/toWysiwyg/toWwConvertors.d.ts +4 -0
- package/dist/esm/i18n/cs-cz.d.ts +1 -0
- package/dist/esm/i18n/cs-cz.js +63 -0
- package/dist/esm/i18n/de-de.d.ts +1 -0
- package/dist/esm/i18n/de-de.js +63 -0
- package/dist/esm/i18n/editor.d.ts +36 -0
- package/dist/esm/i18n/editorCore.d.ts +330 -0
- package/dist/esm/i18n/en-us.d.ts +1 -0
- package/dist/esm/i18n/en-us.js +63 -0
- package/dist/esm/i18n/es-es.d.ts +1 -0
- package/dist/esm/i18n/es-es.js +63 -0
- package/dist/esm/i18n/esm/index.d.ts +5 -0
- package/dist/esm/i18n/esm/indexViewer.d.ts +2 -0
- package/dist/esm/i18n/event/eventEmitter.d.ts +73 -0
- package/dist/esm/i18n/fi-fi.d.ts +1 -0
- package/dist/esm/i18n/fi-fi.js +63 -0
- package/dist/esm/i18n/fr-fr.d.ts +1 -0
- package/dist/esm/i18n/fr-fr.js +63 -0
- package/dist/esm/i18n/gl-es.d.ts +5 -0
- package/dist/esm/i18n/gl-es.js +63 -0
- package/dist/esm/i18n/helper/image.d.ts +4 -0
- package/dist/esm/i18n/helper/manipulation.d.ts +16 -0
- package/dist/esm/i18n/helper/plugin.d.ts +3 -0
- package/dist/esm/i18n/hr-hr.d.ts +1 -0
- package/dist/esm/i18n/hr-hr.js +63 -0
- package/dist/esm/i18n/i18n.d.ts +20 -0
- package/dist/esm/i18n/i18n.js +217 -0
- package/dist/esm/i18n/index.d.ts +10 -0
- package/dist/esm/i18n/indexEditorOnlyStyle.d.ts +3 -0
- package/dist/esm/i18n/indexViewer.d.ts +3 -0
- package/dist/esm/i18n/it-it.d.ts +1 -0
- package/dist/esm/i18n/it-it.js +63 -0
- package/dist/esm/i18n/ja-jp.d.ts +1 -0
- package/dist/esm/i18n/ja-jp.js +63 -0
- package/dist/esm/i18n/ko-kr.d.ts +1 -0
- package/dist/esm/i18n/ko-kr.js +63 -0
- package/dist/esm/i18n/markdown/helper/list.d.ts +55 -0
- package/dist/esm/i18n/markdown/helper/mdCommand.d.ts +5 -0
- package/dist/esm/i18n/markdown/helper/pos.d.ts +22 -0
- package/dist/esm/i18n/markdown/helper/query.d.ts +3 -0
- package/dist/esm/i18n/markdown/htmlRenderConvertors.d.ts +5 -0
- package/dist/esm/i18n/markdown/marks/blockQuote.d.ts +19 -0
- package/dist/esm/i18n/markdown/marks/code.d.ts +25 -0
- package/dist/esm/i18n/markdown/marks/codeBlock.d.ts +18 -0
- package/dist/esm/i18n/markdown/marks/customBlock.d.ts +10 -0
- package/dist/esm/i18n/markdown/marks/emph.d.ts +17 -0
- package/dist/esm/i18n/markdown/marks/heading.d.ts +23 -0
- package/dist/esm/i18n/markdown/marks/html.d.ts +8 -0
- package/dist/esm/i18n/markdown/marks/link.d.ts +29 -0
- package/dist/esm/i18n/markdown/marks/listItem.d.ts +42 -0
- package/dist/esm/i18n/markdown/marks/simpleMark.d.ts +32 -0
- package/dist/esm/i18n/markdown/marks/strike.d.ts +14 -0
- package/dist/esm/i18n/markdown/marks/strong.d.ts +18 -0
- package/dist/esm/i18n/markdown/marks/table.d.ts +27 -0
- package/dist/esm/i18n/markdown/marks/thematicBreak.d.ts +17 -0
- package/dist/esm/i18n/markdown/mdEditor.d.ts +48 -0
- package/dist/esm/i18n/markdown/mdPreview.d.ts +50 -0
- package/dist/esm/i18n/markdown/nodes/doc.d.ts +7 -0
- package/dist/esm/i18n/markdown/nodes/paragraph.d.ts +46 -0
- package/dist/esm/i18n/markdown/nodes/text.d.ts +7 -0
- package/dist/esm/i18n/markdown/plugins/helper/markInfo.d.ts +19 -0
- package/dist/esm/i18n/markdown/plugins/previewHighlight.d.ts +3 -0
- package/dist/esm/i18n/markdown/plugins/smartTask.d.ts +3 -0
- package/dist/esm/i18n/markdown/plugins/syntaxHighlight.d.ts +3 -0
- package/dist/esm/i18n/markdown/scroll/animation.d.ts +2 -0
- package/dist/esm/i18n/markdown/scroll/dom.d.ts +16 -0
- package/dist/esm/i18n/markdown/scroll/offset.d.ts +9 -0
- package/dist/esm/i18n/markdown/scroll/scrollSync.d.ts +30 -0
- package/dist/esm/i18n/nb-no.d.ts +1 -0
- package/dist/esm/i18n/nb-no.js +63 -0
- package/dist/esm/i18n/nl-nl.d.ts +1 -0
- package/dist/esm/i18n/nl-nl.js +63 -0
- package/dist/esm/i18n/pl-pl.d.ts +1 -0
- package/dist/esm/i18n/pl-pl.js +63 -0
- package/dist/esm/i18n/plugins/dropImage.d.ts +3 -0
- package/dist/esm/i18n/plugins/placeholder.d.ts +7 -0
- package/dist/esm/i18n/plugins/popupWidget.d.ts +3 -0
- package/dist/esm/i18n/pt-br.d.ts +1 -0
- package/dist/esm/i18n/pt-br.js +63 -0
- package/dist/esm/i18n/queries/queryManager.d.ts +2 -0
- package/dist/esm/i18n/ru-ru.d.ts +1 -0
- package/dist/esm/i18n/ru-ru.js +64 -0
- package/dist/esm/i18n/sanitizer/htmlSanitizer.d.ts +3 -0
- package/dist/esm/i18n/spec/mark.d.ts +12 -0
- package/dist/esm/i18n/spec/node.d.ts +12 -0
- package/dist/esm/i18n/spec/specManager.d.ts +16 -0
- package/dist/esm/i18n/sv-se.d.ts +1 -0
- package/dist/esm/i18n/sv-se.js +63 -0
- package/dist/esm/i18n/tr-tr.d.ts +1 -0
- package/dist/esm/i18n/tr-tr.js +63 -0
- package/dist/esm/i18n/ui/components/contextMenu.d.ts +21 -0
- package/dist/esm/i18n/ui/components/layout.d.ts +36 -0
- package/dist/esm/i18n/ui/components/popup.d.ts +21 -0
- package/dist/esm/i18n/ui/components/switch.d.ts +17 -0
- package/dist/esm/i18n/ui/components/tabs.d.ts +12 -0
- package/dist/esm/i18n/ui/components/toolbar/customPopupBody.d.ts +16 -0
- package/dist/esm/i18n/ui/components/toolbar/headingPopupBody.d.ts +12 -0
- package/dist/esm/i18n/ui/components/toolbar/imagePopupBody.d.ts +30 -0
- package/dist/esm/i18n/ui/components/toolbar/linkPopupBody.d.ts +18 -0
- package/dist/esm/i18n/ui/components/toolbar/tablePopupBody.d.ts +29 -0
- package/dist/esm/i18n/ui/components/toolbar/toolbar.d.ts +45 -0
- package/dist/esm/i18n/ui/components/toolbar/toolbarGroup.d.ts +21 -0
- package/dist/esm/i18n/ui/toolbarItemFactory.d.ts +13 -0
- package/dist/esm/i18n/ui/vdom/commit.d.ts +2 -0
- package/dist/esm/i18n/ui/vdom/component.d.ts +10 -0
- package/dist/esm/i18n/ui/vdom/dom.d.ts +6 -0
- package/dist/esm/i18n/ui/vdom/render.d.ts +4 -0
- package/dist/esm/i18n/ui/vdom/renderer.d.ts +4 -0
- package/dist/esm/i18n/ui/vdom/template.d.ts +3 -0
- package/dist/esm/i18n/ui/vdom/vnode.d.ts +30 -0
- package/dist/esm/i18n/uk-ua.d.ts +1 -0
- package/dist/esm/i18n/uk-ua.js +63 -0
- package/dist/esm/i18n/utils/common.d.ts +19 -0
- package/dist/esm/i18n/utils/constants.d.ts +8 -0
- package/dist/esm/i18n/utils/dom.d.ts +25 -0
- package/dist/esm/i18n/utils/map.d.ts +19 -0
- package/dist/esm/i18n/utils/markdown.d.ts +23 -0
- package/dist/esm/i18n/viewer.d.ts +77 -0
- package/dist/esm/i18n/widget/rules.d.ts +28 -0
- package/dist/esm/i18n/widget/widgetNode.d.ts +28 -0
- package/dist/esm/i18n/wysiwyg/adaptor/mdLikeNode.d.ts +5 -0
- package/dist/esm/i18n/wysiwyg/adaptor/wwToDOMAdaptor.d.ts +13 -0
- package/dist/esm/i18n/wysiwyg/clipboard/paste.d.ts +6 -0
- package/dist/esm/i18n/wysiwyg/clipboard/pasteMsoList.d.ts +2 -0
- package/dist/esm/i18n/wysiwyg/clipboard/pasteTextParser.d.ts +2 -0
- package/dist/esm/i18n/wysiwyg/clipboard/pasteToTable.d.ts +3 -0
- package/dist/esm/i18n/wysiwyg/command/list.d.ts +7 -0
- package/dist/esm/i18n/wysiwyg/command/table.d.ts +16 -0
- package/dist/esm/i18n/wysiwyg/helper/node.d.ts +37 -0
- package/dist/esm/i18n/wysiwyg/helper/table.d.ts +25 -0
- package/dist/esm/i18n/wysiwyg/helper/tableOffsetMap.d.ts +88 -0
- package/dist/esm/i18n/wysiwyg/markdownInputRules.d.ts +3 -0
- package/dist/esm/i18n/wysiwyg/marks/code.d.ts +31 -0
- package/dist/esm/i18n/wysiwyg/marks/emph.d.ts +34 -0
- package/dist/esm/i18n/wysiwyg/marks/link.d.ts +59 -0
- package/dist/esm/i18n/wysiwyg/marks/strike.d.ts +31 -0
- package/dist/esm/i18n/wysiwyg/marks/strong.d.ts +34 -0
- package/dist/esm/i18n/wysiwyg/nodes/blockQuote.d.ts +33 -0
- package/dist/esm/i18n/wysiwyg/nodes/bulletList.d.ts +43 -0
- package/dist/esm/i18n/wysiwyg/nodes/codeBlock.d.ts +45 -0
- package/dist/esm/i18n/wysiwyg/nodes/customBlock.d.ts +26 -0
- package/dist/esm/i18n/wysiwyg/nodes/doc.d.ts +7 -0
- package/dist/esm/i18n/wysiwyg/nodes/frontMatter.d.ts +21 -0
- package/dist/esm/i18n/wysiwyg/nodes/hardBreak.d.ts +14 -0
- package/dist/esm/i18n/wysiwyg/nodes/heading.d.ts +38 -0
- package/dist/esm/i18n/wysiwyg/nodes/html.d.ts +11 -0
- package/dist/esm/i18n/wysiwyg/nodes/htmlComment.d.ts +21 -0
- package/dist/esm/i18n/wysiwyg/nodes/image.d.ts +45 -0
- package/dist/esm/i18n/wysiwyg/nodes/listItem.d.ts +36 -0
- package/dist/esm/i18n/wysiwyg/nodes/orderedList.d.ts +39 -0
- package/dist/esm/i18n/wysiwyg/nodes/paragraph.d.ts +21 -0
- package/dist/esm/i18n/wysiwyg/nodes/table.d.ts +80 -0
- package/dist/esm/i18n/wysiwyg/nodes/tableBody.d.ts +26 -0
- package/dist/esm/i18n/wysiwyg/nodes/tableBodyCell.d.ts +36 -0
- package/dist/esm/i18n/wysiwyg/nodes/tableHead.d.ts +26 -0
- package/dist/esm/i18n/wysiwyg/nodes/tableHeadCell.d.ts +39 -0
- package/dist/esm/i18n/wysiwyg/nodes/tableRow.d.ts +26 -0
- package/dist/esm/i18n/wysiwyg/nodes/text.d.ts +14 -0
- package/dist/esm/i18n/wysiwyg/nodes/thematicBreak.d.ts +33 -0
- package/dist/esm/i18n/wysiwyg/nodeview/codeBlockView.d.ts +29 -0
- package/dist/esm/i18n/wysiwyg/nodeview/customBlockView.d.ts +29 -0
- package/dist/esm/i18n/wysiwyg/nodeview/imageView.d.ts +20 -0
- package/dist/esm/i18n/wysiwyg/plugins/selection/cellSelection.d.ts +14 -0
- package/dist/esm/i18n/wysiwyg/plugins/selection/tableSelection.d.ts +2 -0
- package/dist/esm/i18n/wysiwyg/plugins/selection/tableSelectionView.d.ts +19 -0
- package/dist/esm/i18n/wysiwyg/plugins/tableContextMenu.d.ts +3 -0
- package/dist/esm/i18n/wysiwyg/plugins/task.d.ts +2 -0
- package/dist/esm/i18n/wysiwyg/plugins/toolbarState.d.ts +3 -0
- package/dist/esm/i18n/wysiwyg/specCreator.d.ts +3 -0
- package/dist/esm/i18n/wysiwyg/wwEditor.d.ts +57 -0
- package/dist/esm/i18n/zh-cn.d.ts +1 -0
- package/dist/esm/i18n/zh-cn.js +63 -0
- package/dist/esm/i18n/zh-tw.d.ts +1 -0
- package/dist/esm/i18n/zh-tw.js +63 -0
- package/dist/esm/index.js +25133 -0
- package/dist/esm/indexViewer.js +12757 -0
- package/dist/i18n/ar.js +162 -0
- package/dist/i18n/cs-cz.js +162 -0
- package/dist/i18n/de-de.js +162 -0
- package/dist/i18n/es-es.js +162 -0
- package/dist/i18n/fi-fi.js +162 -0
- package/dist/i18n/fr-fr.js +162 -0
- package/dist/i18n/gl-es.js +162 -0
- package/dist/i18n/hr-hr.js +162 -0
- package/dist/i18n/it-it.js +162 -0
- package/dist/i18n/ja-jp.js +162 -0
- package/dist/i18n/ko-kr.js +162 -0
- package/dist/i18n/nb-no.js +162 -0
- package/dist/i18n/nl-nl.js +162 -0
- package/dist/i18n/pl-pl.js +162 -0
- package/dist/i18n/pt-br.js +162 -0
- package/dist/i18n/ru-ru.js +163 -0
- package/dist/i18n/sv-se.js +162 -0
- package/dist/i18n/tr-tr.js +162 -0
- package/dist/i18n/uk-ua.js +162 -0
- package/dist/i18n/zh-cn.js +162 -0
- package/dist/i18n/zh-tw.js +162 -0
- package/dist/theme/toastui-editor-dark.css +474 -0
- package/dist/toastui-editor-only.css +1068 -0
- package/dist/toastui-editor-viewer.css +492 -0
- package/dist/toastui-editor-viewer.js +14079 -0
- package/dist/toastui-editor.css +1606 -0
- package/dist/toastui-editor.js +26464 -0
- package/package.json +95 -0
- package/types/convertor.d.ts +143 -0
- package/types/editor.d.ts +383 -0
- package/types/event.d.ts +56 -0
- package/types/index.d.ts +70 -0
- package/types/map.d.ts +8 -0
- package/types/markdown.d.ts +60 -0
- package/types/plugin.d.ts +59 -0
- package/types/prosemirror-commands.d.ts +15 -0
- package/types/prosemirror-model.d.ts +15 -0
- package/types/prosemirror-transform.d.ts +35 -0
- package/types/spec.d.ts +42 -0
- package/types/toastmark.d.ts +357 -0
- package/types/toastui-editor-viewer.d.ts +39 -0
- package/types/ui.d.ts +165 -0
- package/types/wysiwyg.d.ts +36 -0
package/package.json
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@licium/editor",
|
|
3
|
+
"version": "3.2.3",
|
|
4
|
+
"description": "GFM Markdown Wysiwyg Editor - Productive and Extensible",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"nhn",
|
|
7
|
+
"nhn cloud",
|
|
8
|
+
"toast",
|
|
9
|
+
"toastui",
|
|
10
|
+
"toast-ui",
|
|
11
|
+
"markdown",
|
|
12
|
+
"wysiwyg",
|
|
13
|
+
"editor",
|
|
14
|
+
"preview",
|
|
15
|
+
"gfm"
|
|
16
|
+
],
|
|
17
|
+
"main": "dist/toastui-editor.js",
|
|
18
|
+
"module": "dist/esm/",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"import": "./dist/esm/index.js",
|
|
22
|
+
"require": "./dist/toastui-editor.js"
|
|
23
|
+
},
|
|
24
|
+
"./viewer": {
|
|
25
|
+
"import": "./dist/esm/indexViewer.js",
|
|
26
|
+
"require": "./dist/toastui-editor-viewer.js"
|
|
27
|
+
},
|
|
28
|
+
"./dist/i18n/*": {
|
|
29
|
+
"import": "./dist/esm/i18n/*.js",
|
|
30
|
+
"require": "./dist/i18n/*.js"
|
|
31
|
+
},
|
|
32
|
+
"./dist/toastui-editor-viewer": "./dist/toastui-editor-viewer.js",
|
|
33
|
+
"./dist/toastui-editor.css": "./dist/toastui-editor.css",
|
|
34
|
+
"./dist/toastui-editor-viewer.css": "./dist/toastui-editor-viewer.css",
|
|
35
|
+
"./dist/toastui-editor-only.css": "./dist/toastui-editor-only.css",
|
|
36
|
+
"./dist/theme/toastui-editor-dark.css": "./dist/theme/toastui-editor-dark.css",
|
|
37
|
+
"./toastui-editor.css": "./dist/toastui-editor.css",
|
|
38
|
+
"./toastui-editor-viewer.css": "./dist/toastui-editor-viewer.css",
|
|
39
|
+
"./toastui-editor-only.css": "./dist/toastui-editor-only.css",
|
|
40
|
+
"./toastui-editor-dark.css": "./dist/theme/toastui-editor-dark.css"
|
|
41
|
+
},
|
|
42
|
+
"types": "types/index.d.ts",
|
|
43
|
+
"files": [
|
|
44
|
+
"dist/*.js",
|
|
45
|
+
"dist/*.css",
|
|
46
|
+
"dist/theme",
|
|
47
|
+
"dist/esm",
|
|
48
|
+
"dist/i18n",
|
|
49
|
+
"types"
|
|
50
|
+
],
|
|
51
|
+
"author": "NHN Cloud FE Development Lab <dl_javascript@nhn.com>",
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": "https://github.com/nhn/tui.editor.git",
|
|
56
|
+
"directory": "apps/editor"
|
|
57
|
+
},
|
|
58
|
+
"bugs": {
|
|
59
|
+
"url": "https://github.com/nhn/tui.editor/issues"
|
|
60
|
+
},
|
|
61
|
+
"homepage": "https://ui.toast.com",
|
|
62
|
+
"browserslist": "last 2 versions, not ie <= 10",
|
|
63
|
+
"scripts": {
|
|
64
|
+
"lint": "eslint .",
|
|
65
|
+
"test:types": "tsc",
|
|
66
|
+
"test": "jest --watch",
|
|
67
|
+
"test:ci": "jest",
|
|
68
|
+
"serve": "snowpack dev",
|
|
69
|
+
"serve:ie": "webpack serve",
|
|
70
|
+
"build:i18n": "cross-env webpack --config scripts/webpack.config.i18n.js && webpack --config scripts/webpack.config.i18n.js --env minify",
|
|
71
|
+
"build:prod": "cross-env webpack build && webpack build --env minify && node tsBannerGenerator.js",
|
|
72
|
+
"build": "npm run build:esm && npm run build:i18n && npm run build:prod",
|
|
73
|
+
"build:esm": "rollup -c",
|
|
74
|
+
"note": "tui-note --tag=$(git describe --tags)",
|
|
75
|
+
"ts2js": "tsc --outDir tmpdoc --sourceMap false --target ES2015 --noEmit false",
|
|
76
|
+
"doc:dev": "npm run ts2js && tuidoc --serv",
|
|
77
|
+
"doc": "npm run ts2js && tuidoc"
|
|
78
|
+
},
|
|
79
|
+
"devDependencies": {
|
|
80
|
+
"@toast-ui/release-notes": "^2.0.1",
|
|
81
|
+
"@types/dompurify": "2.3.3",
|
|
82
|
+
"cross-env": "^6.0.3"
|
|
83
|
+
},
|
|
84
|
+
"dependencies": {
|
|
85
|
+
"dompurify": "^2.3.3",
|
|
86
|
+
"prosemirror-commands": "^1.1.9",
|
|
87
|
+
"prosemirror-history": "^1.1.3",
|
|
88
|
+
"prosemirror-inputrules": "^1.1.3",
|
|
89
|
+
"prosemirror-keymap": "^1.1.4",
|
|
90
|
+
"prosemirror-model": "^1.14.1",
|
|
91
|
+
"prosemirror-state": "^1.3.4",
|
|
92
|
+
"prosemirror-view": "^1.18.7"
|
|
93
|
+
},
|
|
94
|
+
"gitHead": "cbc7cab7b3f081a1aaf1d338b8138512ace132b9"
|
|
95
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { NodeType, MarkType, Schema, ProsemirrorNode, Mark } from 'prosemirror-model';
|
|
2
|
+
import { MdNode, MdNodeType, RendererOptions, HTMLToken, MdPos } from './toastmark';
|
|
3
|
+
import { WwNodeType, WwMarkType } from './wysiwyg';
|
|
4
|
+
|
|
5
|
+
export type Attrs = { [name: string]: any } | null;
|
|
6
|
+
|
|
7
|
+
export interface StackItem {
|
|
8
|
+
type: NodeType;
|
|
9
|
+
attrs: Attrs | null;
|
|
10
|
+
content: ProsemirrorNode[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface ToWwConvertorState {
|
|
14
|
+
schema: Schema;
|
|
15
|
+
top(): StackItem;
|
|
16
|
+
push(node: ProsemirrorNode): void;
|
|
17
|
+
addText(text: string): void;
|
|
18
|
+
openMark(mark: Mark): void;
|
|
19
|
+
closeMark(mark: MarkType): void;
|
|
20
|
+
addNode(type: NodeType, attrs?: Attrs, content?: ProsemirrorNode[]): ProsemirrorNode | null;
|
|
21
|
+
openNode(type: NodeType, attrs?: Attrs): void;
|
|
22
|
+
closeNode(): ProsemirrorNode | null;
|
|
23
|
+
convertNode(mdNode: MdNode, infoForPosSync: InfoForPosSync): ProsemirrorNode | null;
|
|
24
|
+
convertByDOMParser(root: HTMLElement): void;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
type ToWwConvertor = (
|
|
28
|
+
state: ToWwConvertorState,
|
|
29
|
+
node: MdNode,
|
|
30
|
+
context: {
|
|
31
|
+
entering: boolean;
|
|
32
|
+
skipChildren: () => void;
|
|
33
|
+
leaf: boolean;
|
|
34
|
+
options: Omit<RendererOptions, 'convertors'>;
|
|
35
|
+
getChildrenText: (mdNode: MdNode) => string;
|
|
36
|
+
origin?: () => HTMLToken | HTMLToken[] | null;
|
|
37
|
+
},
|
|
38
|
+
customAttrs?: { htmlAttrs?: Record<string, any>; classNames?: string[] }
|
|
39
|
+
) => void;
|
|
40
|
+
|
|
41
|
+
export type ToWwConvertorMap = Partial<Record<string, ToWwConvertor>>;
|
|
42
|
+
|
|
43
|
+
export type FirstDelimFn = (index: number) => string;
|
|
44
|
+
|
|
45
|
+
export interface ToMdConvertorState {
|
|
46
|
+
stopNewline: boolean;
|
|
47
|
+
inTable: boolean;
|
|
48
|
+
getDelim(): string;
|
|
49
|
+
setDelim(delim: string): void;
|
|
50
|
+
flushClose(size?: number): void;
|
|
51
|
+
wrapBlock(delim: string, firstDelim: string | null, node: ProsemirrorNode, fn: () => void): void;
|
|
52
|
+
ensureNewLine(): void;
|
|
53
|
+
write(content?: string): void;
|
|
54
|
+
closeBlock(node: ProsemirrorNode): void;
|
|
55
|
+
text(text: string, escaped?: boolean): void;
|
|
56
|
+
convertBlock(node: ProsemirrorNode, parent: ProsemirrorNode, index: number): void;
|
|
57
|
+
convertInline(parent: ProsemirrorNode): void;
|
|
58
|
+
convertList(node: ProsemirrorNode, delim: string, firstDelimFn: FirstDelimFn): void;
|
|
59
|
+
convertTableCell(node: ProsemirrorNode): void;
|
|
60
|
+
convertNode(parent: ProsemirrorNode, infoForPosSync?: InfoForPosSync): string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface ToDOMAdaptor {
|
|
64
|
+
getToDOMNode(type: string): ((node: ProsemirrorNode | Mark) => Node) | null;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
type HTMLToWwConvertor = (state: ToWwConvertorState, node: MdNode, openTagName: string) => void;
|
|
68
|
+
|
|
69
|
+
export type HTMLToWwConvertorMap = Partial<Record<string, HTMLToWwConvertor>>;
|
|
70
|
+
|
|
71
|
+
export interface FlattenHTMLToWwConvertorMap {
|
|
72
|
+
[k: string]: HTMLToWwConvertor;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface NodeInfo {
|
|
76
|
+
node: ProsemirrorNode;
|
|
77
|
+
parent?: ProsemirrorNode;
|
|
78
|
+
index?: number;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface MarkInfo {
|
|
82
|
+
node: Mark;
|
|
83
|
+
parent?: ProsemirrorNode;
|
|
84
|
+
index?: number;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
interface ToMdConvertorReturnValues {
|
|
88
|
+
delim?: string | string[];
|
|
89
|
+
rawHTML?: string | string[] | null;
|
|
90
|
+
text?: string;
|
|
91
|
+
attrs?: Attrs;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
type ToMdNodeTypeWriter = (
|
|
95
|
+
state: ToMdConvertorState,
|
|
96
|
+
nodeInfo: NodeInfo,
|
|
97
|
+
params: ToMdConvertorReturnValues
|
|
98
|
+
) => void;
|
|
99
|
+
|
|
100
|
+
export type ToMdNodeTypeWriterMap = Partial<Record<WwNodeType, ToMdNodeTypeWriter>>;
|
|
101
|
+
|
|
102
|
+
interface ToMdMarkTypeOption {
|
|
103
|
+
mixable?: boolean;
|
|
104
|
+
removedEnclosingWhitespace?: boolean;
|
|
105
|
+
escape?: boolean;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export type ToMdMarkTypeOptions = Partial<Record<WwMarkType, ToMdMarkTypeOption | null>>;
|
|
109
|
+
|
|
110
|
+
type ToMdNodeTypeConvertor = (state: ToMdConvertorState, nodeInfo: NodeInfo) => void;
|
|
111
|
+
|
|
112
|
+
export type ToMdNodeTypeConvertorMap = Partial<Record<WwNodeType, ToMdNodeTypeConvertor>>;
|
|
113
|
+
|
|
114
|
+
type ToMdMarkTypeConvertor = (
|
|
115
|
+
nodeInfo?: MarkInfo,
|
|
116
|
+
entering?: boolean
|
|
117
|
+
) => ToMdConvertorReturnValues & ToMdMarkTypeOption;
|
|
118
|
+
|
|
119
|
+
export type ToMdMarkTypeConvertorMap = Partial<Record<WwMarkType, ToMdMarkTypeConvertor>>;
|
|
120
|
+
|
|
121
|
+
interface ToMdConvertorContext {
|
|
122
|
+
origin?: () => ReturnType<ToMdConvertor>;
|
|
123
|
+
entering?: boolean;
|
|
124
|
+
inTable?: boolean;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
type ToMdConvertor = (
|
|
128
|
+
nodeInfo: NodeInfo | MarkInfo,
|
|
129
|
+
context: ToMdConvertorContext
|
|
130
|
+
) => ToMdConvertorReturnValues;
|
|
131
|
+
|
|
132
|
+
export type ToMdConvertorMap = Partial<Record<WwNodeType | MdNodeType, ToMdConvertor>>;
|
|
133
|
+
|
|
134
|
+
export interface ToMdConvertors {
|
|
135
|
+
nodeTypeConvertors: ToMdNodeTypeConvertorMap;
|
|
136
|
+
markTypeConvertors: ToMdMarkTypeConvertorMap;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface InfoForPosSync {
|
|
140
|
+
node: MdNode | ProsemirrorNode | null;
|
|
141
|
+
setMappedPos: (pos: MdPos | number) => void;
|
|
142
|
+
offset?: number;
|
|
143
|
+
}
|
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
import { Schema, NodeSpec, MarkSpec, Fragment } from 'prosemirror-model';
|
|
2
|
+
import { EditorView, Decoration, DecorationSet } from 'prosemirror-view';
|
|
3
|
+
import { EditorState, Plugin, PluginKey, Selection, TextSelection } from 'prosemirror-state';
|
|
4
|
+
import { undoInputRule, InputRule, inputRules } from 'prosemirror-inputrules';
|
|
5
|
+
import { keymap } from 'prosemirror-keymap';
|
|
6
|
+
import { Editor } from '@t/index';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
HTMLConvertor,
|
|
10
|
+
MdPos,
|
|
11
|
+
Sourcepos,
|
|
12
|
+
Context as MdContext,
|
|
13
|
+
HTMLToken,
|
|
14
|
+
HTMLConvertorMap,
|
|
15
|
+
} from './toastmark';
|
|
16
|
+
import { Emitter, Handler } from './event';
|
|
17
|
+
import { Context, EditorAllCommandMap, EditorCommandFn, SpecManager } from './spec';
|
|
18
|
+
import { ToMdConvertorMap } from './convertor';
|
|
19
|
+
import { ToolbarItemOptions, IndexList } from './ui';
|
|
20
|
+
import { CommandFn, PluginInfo } from './plugin';
|
|
21
|
+
import { HTMLMdNode } from './markdown';
|
|
22
|
+
|
|
23
|
+
export type PreviewStyle = 'tab' | 'vertical';
|
|
24
|
+
export type EditorType = 'markdown' | 'wysiwyg';
|
|
25
|
+
export type WidgetStyle = 'top' | 'bottom';
|
|
26
|
+
export interface WidgetRule {
|
|
27
|
+
rule: RegExp;
|
|
28
|
+
toDOM: (text: string) => HTMLElement;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type WidgetRuleMap = Record<string, WidgetRule>;
|
|
32
|
+
|
|
33
|
+
export interface EventMap {
|
|
34
|
+
load?: (param: Editor) => void;
|
|
35
|
+
change?: (editorType: EditorType) => void;
|
|
36
|
+
caretChange?: (editorType: EditorType) => void;
|
|
37
|
+
focus?: (editorType: EditorType) => void;
|
|
38
|
+
blur?: (editorType: EditorType) => void;
|
|
39
|
+
keydown?: (editorType: EditorType, ev: KeyboardEvent) => void;
|
|
40
|
+
keyup?: (editorType: EditorType, ev: KeyboardEvent) => void;
|
|
41
|
+
beforePreviewRender?: (html: string) => string;
|
|
42
|
+
beforeConvertWysiwygToMarkdown?: (markdownText: string) => string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
type HookCallback = (url: string, text?: string) => void;
|
|
46
|
+
|
|
47
|
+
export type HookMap = {
|
|
48
|
+
addImageBlobHook?: (blob: Blob | File, callback: HookCallback) => void;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export type AutolinkParser = (
|
|
52
|
+
content: string
|
|
53
|
+
) => {
|
|
54
|
+
url: string;
|
|
55
|
+
text: string;
|
|
56
|
+
range: [number, number];
|
|
57
|
+
}[];
|
|
58
|
+
|
|
59
|
+
export type ExtendedAutolinks = boolean | AutolinkParser;
|
|
60
|
+
|
|
61
|
+
export type LinkAttributeNames = 'rel' | 'target' | 'hreflang' | 'type';
|
|
62
|
+
|
|
63
|
+
// @TODO change option and type name from singular to plural
|
|
64
|
+
export type LinkAttributes = Partial<Record<LinkAttributeNames, string>>;
|
|
65
|
+
|
|
66
|
+
export type Sanitizer = (content: string) => string;
|
|
67
|
+
|
|
68
|
+
export type HTMLMdNodeConvertor = (
|
|
69
|
+
node: HTMLMdNode,
|
|
70
|
+
context: MdContext,
|
|
71
|
+
convertors?: HTMLConvertorMap
|
|
72
|
+
) => HTMLToken | HTMLToken[] | null;
|
|
73
|
+
|
|
74
|
+
export type HTMLMdNodeConvertorMap = Record<string, HTMLMdNodeConvertor>;
|
|
75
|
+
|
|
76
|
+
export type CustomHTMLRenderer = Partial<Record<string, HTMLConvertor | HTMLMdNodeConvertorMap>>;
|
|
77
|
+
|
|
78
|
+
export interface ViewerOptions {
|
|
79
|
+
el: HTMLElement;
|
|
80
|
+
initialValue?: string;
|
|
81
|
+
events?: EventMap;
|
|
82
|
+
plugins?: EditorPlugin[];
|
|
83
|
+
extendedAutolinks?: ExtendedAutolinks;
|
|
84
|
+
linkAttributes?: LinkAttributes;
|
|
85
|
+
customHTMLRenderer?: CustomHTMLRenderer;
|
|
86
|
+
referenceDefinition?: boolean;
|
|
87
|
+
customHTMLSanitizer?: Sanitizer;
|
|
88
|
+
frontMatter?: boolean;
|
|
89
|
+
usageStatistics?: boolean;
|
|
90
|
+
theme?: string;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export class Viewer {
|
|
94
|
+
static isViewer: boolean;
|
|
95
|
+
|
|
96
|
+
constructor(options: ViewerOptions);
|
|
97
|
+
|
|
98
|
+
setMarkdown(markdown: string): void;
|
|
99
|
+
|
|
100
|
+
on(type: string, handler: Handler): void;
|
|
101
|
+
|
|
102
|
+
off(type: string): void;
|
|
103
|
+
|
|
104
|
+
destroy(): void;
|
|
105
|
+
|
|
106
|
+
isViewer(): boolean;
|
|
107
|
+
|
|
108
|
+
isMarkdownMode(): boolean;
|
|
109
|
+
|
|
110
|
+
isWysiwygMode(): boolean;
|
|
111
|
+
|
|
112
|
+
addHook(type: string, handler: Handler): void;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface I18n {
|
|
116
|
+
setCode(code?: string): void;
|
|
117
|
+
|
|
118
|
+
setLanguage(codes: string | string[], data: Record<string, string>): void;
|
|
119
|
+
|
|
120
|
+
get(key: string, code?: string): string;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface PluginContext {
|
|
124
|
+
eventEmitter: Emitter;
|
|
125
|
+
usageStatistics?: boolean;
|
|
126
|
+
i18n: I18n;
|
|
127
|
+
instance: Editor | Viewer;
|
|
128
|
+
pmState: {
|
|
129
|
+
Plugin: typeof Plugin;
|
|
130
|
+
PluginKey: typeof PluginKey;
|
|
131
|
+
Selection: typeof Selection;
|
|
132
|
+
TextSelection: typeof TextSelection;
|
|
133
|
+
};
|
|
134
|
+
pmView: { Decoration: typeof Decoration; DecorationSet: typeof DecorationSet };
|
|
135
|
+
pmModel: { Fragment: typeof Fragment };
|
|
136
|
+
pmRules: {
|
|
137
|
+
inputRules: typeof inputRules;
|
|
138
|
+
InputRule: typeof InputRule;
|
|
139
|
+
undoInputRule: typeof undoInputRule;
|
|
140
|
+
};
|
|
141
|
+
pmKeymap: {
|
|
142
|
+
keymap: typeof keymap;
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export type PluginFn = (context: PluginContext, options?: any) => PluginInfo | null;
|
|
147
|
+
export type EditorPlugin = PluginFn | [PluginFn, any];
|
|
148
|
+
type ContextInfo = {
|
|
149
|
+
eventEmitter: Emitter;
|
|
150
|
+
usageStatistics: boolean;
|
|
151
|
+
instance: Editor | Viewer;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export type EditorPluginInfo = ContextInfo & {
|
|
155
|
+
plugin: EditorPlugin;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export type EditorPluginsInfo = ContextInfo & {
|
|
159
|
+
plugins: EditorPlugin[];
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export interface EditorOptions {
|
|
163
|
+
el: HTMLElement;
|
|
164
|
+
height?: string;
|
|
165
|
+
minHeight?: string;
|
|
166
|
+
initialValue?: string;
|
|
167
|
+
previewStyle?: PreviewStyle;
|
|
168
|
+
initialEditType?: EditorType;
|
|
169
|
+
events?: EventMap;
|
|
170
|
+
hooks?: HookMap;
|
|
171
|
+
language?: string;
|
|
172
|
+
useCommandShortcut?: boolean;
|
|
173
|
+
usageStatistics?: boolean;
|
|
174
|
+
toolbarItems?: (string | ToolbarItemOptions)[][];
|
|
175
|
+
hideModeSwitch?: boolean;
|
|
176
|
+
plugins?: EditorPlugin[];
|
|
177
|
+
extendedAutolinks?: ExtendedAutolinks;
|
|
178
|
+
placeholder?: string;
|
|
179
|
+
linkAttributes?: LinkAttributes;
|
|
180
|
+
customHTMLRenderer?: CustomHTMLRenderer;
|
|
181
|
+
customMarkdownRenderer?: ToMdConvertorMap;
|
|
182
|
+
referenceDefinition?: boolean;
|
|
183
|
+
customHTMLSanitizer?: Sanitizer;
|
|
184
|
+
previewHighlight?: boolean;
|
|
185
|
+
frontMatter?: boolean;
|
|
186
|
+
widgetRules?: WidgetRule[];
|
|
187
|
+
theme?: string;
|
|
188
|
+
autofocus?: boolean;
|
|
189
|
+
viewer?: boolean;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
interface Slots {
|
|
193
|
+
mdEditor: HTMLElement;
|
|
194
|
+
mdPreview: HTMLElement;
|
|
195
|
+
wwEditor: HTMLElement;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export class EditorCore {
|
|
199
|
+
constructor(options: EditorOptions);
|
|
200
|
+
|
|
201
|
+
public eventEmitter: Emitter;
|
|
202
|
+
|
|
203
|
+
public static factory(options: EditorOptions): EditorCore | Viewer;
|
|
204
|
+
|
|
205
|
+
public static setLanguage(code: string, data: Record<string, string>): void;
|
|
206
|
+
|
|
207
|
+
changePreviewStyle(style: PreviewStyle): void;
|
|
208
|
+
|
|
209
|
+
exec(name: string, payload?: Record<string, any>): void;
|
|
210
|
+
|
|
211
|
+
addCommand(type: EditorType, name: string, command: CommandFn): void;
|
|
212
|
+
|
|
213
|
+
on(type: string, handler: Handler): void;
|
|
214
|
+
|
|
215
|
+
off(type: string): void;
|
|
216
|
+
|
|
217
|
+
addHook(type: string, handler: Handler): void;
|
|
218
|
+
|
|
219
|
+
removeHook(type: string): void;
|
|
220
|
+
|
|
221
|
+
focus(): void;
|
|
222
|
+
|
|
223
|
+
blur(): void;
|
|
224
|
+
|
|
225
|
+
moveCursorToEnd(focus?: boolean): void;
|
|
226
|
+
|
|
227
|
+
moveCursorToStart(focus?: boolean): void;
|
|
228
|
+
|
|
229
|
+
setMarkdown(markdown: string, cursorToEnd?: boolean): void;
|
|
230
|
+
|
|
231
|
+
setHTML(html: string, cursorToEnd?: boolean): void;
|
|
232
|
+
|
|
233
|
+
getMarkdown(): string;
|
|
234
|
+
|
|
235
|
+
getHTML(): string;
|
|
236
|
+
|
|
237
|
+
insertText(text: string): void;
|
|
238
|
+
|
|
239
|
+
setSelection(start: EditorPos, end?: EditorPos): void;
|
|
240
|
+
|
|
241
|
+
replaceSelection(text: string, start?: EditorPos, end?: EditorPos): void;
|
|
242
|
+
|
|
243
|
+
deleteSelection(start?: EditorPos, end?: EditorPos): void;
|
|
244
|
+
|
|
245
|
+
getSelectedText(start?: EditorPos, end?: EditorPos): string;
|
|
246
|
+
|
|
247
|
+
getRangeInfoOfNode(pos?: EditorPos): NodeRangeInfo;
|
|
248
|
+
|
|
249
|
+
addWidget(node: Node, style: WidgetStyle, pos?: EditorPos): void;
|
|
250
|
+
|
|
251
|
+
replaceWithWidget(start: EditorPos, end: EditorPos, text: string): void;
|
|
252
|
+
|
|
253
|
+
setHeight(height: string): void;
|
|
254
|
+
|
|
255
|
+
getHeight(): string;
|
|
256
|
+
|
|
257
|
+
setMinHeight(minHeight: string): void;
|
|
258
|
+
|
|
259
|
+
getMinHeight(): string;
|
|
260
|
+
|
|
261
|
+
isMarkdownMode(): boolean;
|
|
262
|
+
|
|
263
|
+
isWysiwygMode(): boolean;
|
|
264
|
+
|
|
265
|
+
isViewer(): boolean;
|
|
266
|
+
|
|
267
|
+
getCurrentPreviewStyle(): PreviewStyle;
|
|
268
|
+
|
|
269
|
+
changeMode(mode: EditorType, isWithoutFocus?: boolean): void;
|
|
270
|
+
|
|
271
|
+
destroy(): void;
|
|
272
|
+
|
|
273
|
+
hide(): void;
|
|
274
|
+
|
|
275
|
+
show(): void;
|
|
276
|
+
|
|
277
|
+
setScrollTop(value: number): void;
|
|
278
|
+
|
|
279
|
+
getScrollTop(): number;
|
|
280
|
+
|
|
281
|
+
reset(): void;
|
|
282
|
+
|
|
283
|
+
getSelection(): SelectionPos;
|
|
284
|
+
|
|
285
|
+
setPlaceholder(placeholder: string): void;
|
|
286
|
+
|
|
287
|
+
getEditorElements(): Slots;
|
|
288
|
+
|
|
289
|
+
convertPosToMatchEditorMode(start: EditorPos, end?: EditorPos, mode?: EditorType): EditorPos[];
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export class Editor extends EditorCore {
|
|
293
|
+
insertToolbarItem({ groupIndex, itemIndex }: IndexList, item: string | ToolbarItemOptions): void;
|
|
294
|
+
|
|
295
|
+
removeToolbarItem(itemName: string): void;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export type SelectionPos = Sourcepos | [from: number, to: number];
|
|
299
|
+
export type EditorPos = MdPos | number;
|
|
300
|
+
export interface NodeRangeInfo {
|
|
301
|
+
range: SelectionPos;
|
|
302
|
+
type: string;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export interface Base {
|
|
306
|
+
el: HTMLElement;
|
|
307
|
+
|
|
308
|
+
editorType: EditorType;
|
|
309
|
+
|
|
310
|
+
eventEmitter: Emitter;
|
|
311
|
+
|
|
312
|
+
context: Context;
|
|
313
|
+
|
|
314
|
+
schema: Schema;
|
|
315
|
+
|
|
316
|
+
keymaps: Plugin[];
|
|
317
|
+
|
|
318
|
+
view: EditorView;
|
|
319
|
+
|
|
320
|
+
commands: EditorAllCommandMap;
|
|
321
|
+
|
|
322
|
+
specs: SpecManager;
|
|
323
|
+
|
|
324
|
+
placeholder: { text: string };
|
|
325
|
+
|
|
326
|
+
createSpecs(): SpecManager;
|
|
327
|
+
|
|
328
|
+
createContext(): Context;
|
|
329
|
+
|
|
330
|
+
createState(): EditorState;
|
|
331
|
+
|
|
332
|
+
createView(): EditorView;
|
|
333
|
+
|
|
334
|
+
createSchema(): Schema;
|
|
335
|
+
|
|
336
|
+
createKeymaps(useCommandShortcut: boolean): Plugin<any, any>[];
|
|
337
|
+
|
|
338
|
+
createCommands(): Record<string, EditorCommandFn<Record<string, any>>>;
|
|
339
|
+
|
|
340
|
+
focus(): void;
|
|
341
|
+
|
|
342
|
+
blur(): void;
|
|
343
|
+
|
|
344
|
+
destroy(): void;
|
|
345
|
+
|
|
346
|
+
moveCursorToStart(focus: boolean): void;
|
|
347
|
+
|
|
348
|
+
moveCursorToEnd(focus: boolean): void;
|
|
349
|
+
|
|
350
|
+
setScrollTop(top: number): void;
|
|
351
|
+
|
|
352
|
+
getScrollTop(): number;
|
|
353
|
+
|
|
354
|
+
setPlaceholder(text: string): void;
|
|
355
|
+
|
|
356
|
+
setHeight(height: number): void;
|
|
357
|
+
|
|
358
|
+
setMinHeight(minHeight: number): void;
|
|
359
|
+
|
|
360
|
+
getElement(): HTMLElement;
|
|
361
|
+
|
|
362
|
+
setSelection(start: EditorPos, end?: EditorPos): void;
|
|
363
|
+
|
|
364
|
+
replaceWithWidget(start: EditorPos, end: EditorPos, text: string): void;
|
|
365
|
+
|
|
366
|
+
addWidget(node: Node, style: WidgetStyle, pos?: EditorPos): void;
|
|
367
|
+
|
|
368
|
+
replaceSelection(text: string, start?: EditorPos, end?: EditorPos): void;
|
|
369
|
+
|
|
370
|
+
deleteSelection(start?: EditorPos, end?: EditorPos): void;
|
|
371
|
+
|
|
372
|
+
getSelectedText(start?: EditorPos, end?: EditorPos): string;
|
|
373
|
+
|
|
374
|
+
getSelection(): SelectionPos;
|
|
375
|
+
|
|
376
|
+
getRangeInfoOfNode(pos?: EditorPos): NodeRangeInfo;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export type SchemaMap = Record<string, NodeSpec | MarkSpec>;
|
|
380
|
+
export interface HTMLSchemaMap {
|
|
381
|
+
nodes: SchemaMap;
|
|
382
|
+
marks: SchemaMap;
|
|
383
|
+
}
|
package/types/event.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Mapable } from './map';
|
|
2
|
+
|
|
3
|
+
export interface Handler {
|
|
4
|
+
(...args: any[]): any;
|
|
5
|
+
namespace?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface Emitter {
|
|
9
|
+
listen(type: string, handler: Handler): void;
|
|
10
|
+
emit(type: string, ...args: any[]): any[];
|
|
11
|
+
emitReduce(type: string, source: any, ...args: any[]): any;
|
|
12
|
+
addEventType(type: string): void;
|
|
13
|
+
removeEventHandler(type: string, handler?: Handler): void;
|
|
14
|
+
getEvents(): Mapable<string, Handler[] | undefined>;
|
|
15
|
+
holdEventInvoke(fn: Function): void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface EmitterConstructor {
|
|
19
|
+
new (): Emitter;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type EventTypes =
|
|
23
|
+
| 'afterPreviewRender'
|
|
24
|
+
| 'updatePreview'
|
|
25
|
+
| 'changeMode'
|
|
26
|
+
| 'needChangeMode'
|
|
27
|
+
| 'command'
|
|
28
|
+
| 'changePreviewStyle'
|
|
29
|
+
| 'changePreviewTabPreview'
|
|
30
|
+
| 'changePreviewTabWrite'
|
|
31
|
+
| 'scroll'
|
|
32
|
+
| 'contextmenu'
|
|
33
|
+
| 'show'
|
|
34
|
+
| 'hide'
|
|
35
|
+
| 'changeLanguage'
|
|
36
|
+
| 'changeToolbarState'
|
|
37
|
+
| 'toggleScrollSync'
|
|
38
|
+
| 'mixinTableOffsetMapPrototype'
|
|
39
|
+
| 'setFocusedNode'
|
|
40
|
+
| 'removePopupWidget'
|
|
41
|
+
| 'query'
|
|
42
|
+
// provide event for user
|
|
43
|
+
| 'openPopup'
|
|
44
|
+
| 'closePopup'
|
|
45
|
+
| 'addImageBlobHook'
|
|
46
|
+
| 'beforePreviewRender'
|
|
47
|
+
| 'beforeConvertWysiwygToMarkdown'
|
|
48
|
+
| 'load'
|
|
49
|
+
| 'loadUI'
|
|
50
|
+
| 'change'
|
|
51
|
+
| 'caretChange'
|
|
52
|
+
| 'destroy'
|
|
53
|
+
| 'focus'
|
|
54
|
+
| 'blur'
|
|
55
|
+
| 'keydown'
|
|
56
|
+
| 'keyup';
|