@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/types/index.d.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Type definitions for TOAST UI Editor v3.2.3
|
|
2
|
+
// TypeScript Version: 4.2.3
|
|
3
|
+
import {
|
|
4
|
+
EditorCore,
|
|
5
|
+
Editor,
|
|
6
|
+
Viewer,
|
|
7
|
+
EditorOptions,
|
|
8
|
+
ViewerOptions,
|
|
9
|
+
ExtendedAutolinks,
|
|
10
|
+
LinkAttributes,
|
|
11
|
+
Sanitizer,
|
|
12
|
+
EditorType,
|
|
13
|
+
PreviewStyle,
|
|
14
|
+
EventMap,
|
|
15
|
+
HookMap,
|
|
16
|
+
WidgetStyle,
|
|
17
|
+
WidgetRuleMap,
|
|
18
|
+
WidgetRule,
|
|
19
|
+
PluginContext,
|
|
20
|
+
I18n,
|
|
21
|
+
CustomHTMLRenderer,
|
|
22
|
+
HTMLMdNodeConvertor,
|
|
23
|
+
HTMLMdNodeConvertorMap,
|
|
24
|
+
} from './editor';
|
|
25
|
+
import './toastui-editor-viewer';
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
MdNode,
|
|
29
|
+
MdNodeType,
|
|
30
|
+
ListMdNode,
|
|
31
|
+
ListItemMdNode,
|
|
32
|
+
TableMdNode,
|
|
33
|
+
TableCellMdNode,
|
|
34
|
+
CodeBlockMdNode,
|
|
35
|
+
LinkMdNode,
|
|
36
|
+
ListData,
|
|
37
|
+
HeadingMdNode,
|
|
38
|
+
CodeMdNode,
|
|
39
|
+
HTMLConvertorMap,
|
|
40
|
+
} from './toastmark';
|
|
41
|
+
export { ToMdConvertorMap } from './convertor';
|
|
42
|
+
export { Emitter, Handler } from './event';
|
|
43
|
+
export {
|
|
44
|
+
EditorOptions,
|
|
45
|
+
ViewerOptions,
|
|
46
|
+
ExtendedAutolinks,
|
|
47
|
+
LinkAttributes,
|
|
48
|
+
Sanitizer,
|
|
49
|
+
EditorType,
|
|
50
|
+
PreviewStyle,
|
|
51
|
+
EventMap,
|
|
52
|
+
HookMap,
|
|
53
|
+
WidgetStyle,
|
|
54
|
+
WidgetRuleMap,
|
|
55
|
+
WidgetRule,
|
|
56
|
+
PluginContext,
|
|
57
|
+
I18n,
|
|
58
|
+
CustomHTMLRenderer,
|
|
59
|
+
HTMLMdNodeConvertor,
|
|
60
|
+
HTMLMdNodeConvertorMap,
|
|
61
|
+
};
|
|
62
|
+
export { Dispatch } from './spec';
|
|
63
|
+
export { PluginInfo, PluginNodeViews, CommandFn, PluginCommandMap } from './plugin';
|
|
64
|
+
export { MdLikeNode, HTMLMdNode } from './markdown';
|
|
65
|
+
export { Editor, EditorCore, Viewer };
|
|
66
|
+
export default Editor;
|
|
67
|
+
|
|
68
|
+
export declare namespace toastui {
|
|
69
|
+
export { Editor };
|
|
70
|
+
}
|
package/types/map.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { MdNode, TableMdNode, Sourcepos, NodeWalker } from './toastmark';
|
|
2
|
+
|
|
3
|
+
export interface TableRowMdNode extends MdNode {
|
|
4
|
+
parent: TableBodyMdNode | TableHeadMdNode;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface TableBodyMdNode extends MdNode {
|
|
8
|
+
parent: TableMdNode;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface TableHeadMdNode extends MdNode {
|
|
12
|
+
parent: TableMdNode;
|
|
13
|
+
firstChild: TableRowMdNode;
|
|
14
|
+
lastChild: TableRowMdNode;
|
|
15
|
+
next: TableBodyMdNode;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface MdLikeNode {
|
|
19
|
+
type: string;
|
|
20
|
+
literal: string | null;
|
|
21
|
+
wysiwygNode?: boolean;
|
|
22
|
+
level?: number;
|
|
23
|
+
destination?: string;
|
|
24
|
+
title?: string;
|
|
25
|
+
info?: string;
|
|
26
|
+
cellType?: 'head' | 'body';
|
|
27
|
+
align?: 'left' | 'center' | 'right';
|
|
28
|
+
listData?: {
|
|
29
|
+
type?: 'bullet' | 'ordered';
|
|
30
|
+
start?: number;
|
|
31
|
+
task?: boolean;
|
|
32
|
+
checked?: boolean;
|
|
33
|
+
};
|
|
34
|
+
attrs?: Record<string, string | null>;
|
|
35
|
+
childrenHTML?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface HTMLMdNode {
|
|
39
|
+
type: string;
|
|
40
|
+
id: number;
|
|
41
|
+
parent: MdNode | null;
|
|
42
|
+
prev: MdNode | null;
|
|
43
|
+
next: MdNode | null;
|
|
44
|
+
sourcepos?: Sourcepos;
|
|
45
|
+
firstChild: MdNode | null;
|
|
46
|
+
lastChild: MdNode | null;
|
|
47
|
+
literal: string | null;
|
|
48
|
+
|
|
49
|
+
isContainer(): boolean;
|
|
50
|
+
unlink(): void;
|
|
51
|
+
replaceWith(node: MdNode): void;
|
|
52
|
+
insertAfter(node: MdNode): void;
|
|
53
|
+
insertBefore(node: MdNode): void;
|
|
54
|
+
appendChild(child: MdNode): void;
|
|
55
|
+
prependChild(child: MdNode): void;
|
|
56
|
+
walker(): NodeWalker;
|
|
57
|
+
|
|
58
|
+
attrs?: Record<string, string | null>;
|
|
59
|
+
childrenHTML?: string;
|
|
60
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Plugin, EditorState } from 'prosemirror-state';
|
|
2
|
+
import { EditorView, NodeView } from 'prosemirror-view';
|
|
3
|
+
import { Node } from 'prosemirror-model';
|
|
4
|
+
|
|
5
|
+
import { CustomParserMap } from './toastmark';
|
|
6
|
+
import { CustomHTMLRenderer } from './editor';
|
|
7
|
+
import { Emitter } from './event';
|
|
8
|
+
import { ToMdConvertorMap } from './convertor';
|
|
9
|
+
import { Dispatch, Payload, DefaultPayload } from './spec';
|
|
10
|
+
import { ToolbarItemOptions } from './ui';
|
|
11
|
+
|
|
12
|
+
export type PluginProp = (eventEmitter?: Emitter) => Plugin;
|
|
13
|
+
|
|
14
|
+
export type PluginNodeViews = (
|
|
15
|
+
node: Node,
|
|
16
|
+
view: EditorView,
|
|
17
|
+
getPos: () => number,
|
|
18
|
+
eventEmitter: Emitter
|
|
19
|
+
) => NodeView;
|
|
20
|
+
|
|
21
|
+
type NodeViewPropMap = Record<string, PluginNodeViews>;
|
|
22
|
+
|
|
23
|
+
export type CommandFn<T = DefaultPayload> = (
|
|
24
|
+
payload: Payload<T>,
|
|
25
|
+
state: EditorState,
|
|
26
|
+
dispatch: Dispatch,
|
|
27
|
+
view: EditorView
|
|
28
|
+
) => boolean;
|
|
29
|
+
export type PluginCommandMap = Record<string, CommandFn>;
|
|
30
|
+
|
|
31
|
+
interface PluginToolbarItem {
|
|
32
|
+
groupIndex: number;
|
|
33
|
+
itemIndex: number;
|
|
34
|
+
item: string | ToolbarItemOptions;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface PluginInfo {
|
|
38
|
+
toHTMLRenderers?: CustomHTMLRenderer;
|
|
39
|
+
toMarkdownRenderers?: ToMdConvertorMap;
|
|
40
|
+
markdownPlugins?: PluginProp[];
|
|
41
|
+
wysiwygPlugins?: PluginProp[];
|
|
42
|
+
wysiwygNodeViews?: NodeViewPropMap;
|
|
43
|
+
markdownCommands?: PluginCommandMap;
|
|
44
|
+
wysiwygCommands?: PluginCommandMap;
|
|
45
|
+
toolbarItems?: PluginToolbarItem[];
|
|
46
|
+
markdownParsers?: CustomParserMap;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface PluginInfoResult {
|
|
50
|
+
toHTMLRenderers: CustomHTMLRenderer;
|
|
51
|
+
toMarkdownRenderers: ToMdConvertorMap;
|
|
52
|
+
mdPlugins: PluginProp[];
|
|
53
|
+
wwPlugins: PluginProp[];
|
|
54
|
+
wwNodeViews: NodeViewPropMap;
|
|
55
|
+
mdCommands: PluginCommandMap;
|
|
56
|
+
wwCommands: PluginCommandMap;
|
|
57
|
+
toolbarItems: PluginToolbarItem[];
|
|
58
|
+
markdownParsers: CustomParserMap;
|
|
59
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { EditorState, Transaction } from 'prosemirror-state';
|
|
2
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
|
+
import { Schema } from 'prosemirror-model';
|
|
4
|
+
|
|
5
|
+
import 'prosemirror-commands';
|
|
6
|
+
|
|
7
|
+
declare module 'prosemirror-commands' {
|
|
8
|
+
export interface Command<S extends Schema = any> {
|
|
9
|
+
(state: EditorState<S>, dispatch?: (tr: Transaction<S>) => void, view?: EditorView<S>): boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface Keymap<S extends Schema = any> {
|
|
13
|
+
[key: string]: Command<S>;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as Model from 'prosemirror-model';
|
|
2
|
+
|
|
3
|
+
declare module 'prosemirror-model' {
|
|
4
|
+
export interface Fragment {
|
|
5
|
+
textBetween(from: number, to: number, blockSeparator?: string, leafText?: string): string;
|
|
6
|
+
findIndex(pos: number, round?: number): { index: number; offset: number };
|
|
7
|
+
findDiffEnd(other: ProsemirrorNode | Fragment): { a: number; b: number } | null | undefined;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type ProsemirrorNode = Model.Node;
|
|
11
|
+
|
|
12
|
+
export interface NodeType {
|
|
13
|
+
compatibleContent(node: NodeType): boolean;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Slice, Node, Mark, NodeType } from 'prosemirror-model';
|
|
2
|
+
import 'prosemirror-transform';
|
|
3
|
+
|
|
4
|
+
declare module 'prosemirror-transform' {
|
|
5
|
+
export interface Step {
|
|
6
|
+
slice: Slice;
|
|
7
|
+
from: number;
|
|
8
|
+
to: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface Transform {
|
|
12
|
+
setNodeMarkup(
|
|
13
|
+
pos: number,
|
|
14
|
+
type: Node | null,
|
|
15
|
+
attrs?: { [key: string]: any },
|
|
16
|
+
marks?: Mark[]
|
|
17
|
+
): Transform;
|
|
18
|
+
|
|
19
|
+
split(
|
|
20
|
+
pos: number,
|
|
21
|
+
depth?: number | undefined,
|
|
22
|
+
typesAfter?:
|
|
23
|
+
| ({
|
|
24
|
+
type: NodeType;
|
|
25
|
+
attrs?:
|
|
26
|
+
| {
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
}
|
|
29
|
+
| null
|
|
30
|
+
| undefined;
|
|
31
|
+
} | null)[]
|
|
32
|
+
| undefined
|
|
33
|
+
): Transform;
|
|
34
|
+
}
|
|
35
|
+
}
|
package/types/spec.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Schema } from 'prosemirror-model';
|
|
2
|
+
import { Transaction, Plugin, Command } from 'prosemirror-state';
|
|
3
|
+
import { EditorView } from 'prosemirror-view';
|
|
4
|
+
import { ToastMark } from './toastmark';
|
|
5
|
+
import { Emitter } from './event';
|
|
6
|
+
|
|
7
|
+
export interface Context {
|
|
8
|
+
schema: Schema;
|
|
9
|
+
eventEmitter: Emitter;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface MdContext extends Context {
|
|
13
|
+
toastMark: ToastMark;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface SpecContext extends Context {
|
|
17
|
+
view: EditorView;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface MdSpecContext extends SpecContext {
|
|
21
|
+
toastMark: ToastMark;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type DefaultPayload = Record<string, any>;
|
|
25
|
+
export type Payload<T> = T extends infer P ? P : any;
|
|
26
|
+
|
|
27
|
+
export type Dispatch = (tr: Transaction) => void;
|
|
28
|
+
export type EditorCommand<T = DefaultPayload> = (payload?: Payload<T>) => Command;
|
|
29
|
+
export type EditorCommandMap<T = DefaultPayload> = Record<string, EditorCommand<T>>;
|
|
30
|
+
export type EditorCommandFn<T = DefaultPayload> = (payload?: Payload<T>) => boolean | void;
|
|
31
|
+
export type EditorAllCommandMap<T = DefaultPayload> = Record<string, EditorCommandFn<T>>;
|
|
32
|
+
|
|
33
|
+
export interface SpecManager {
|
|
34
|
+
commands(
|
|
35
|
+
view: EditorView,
|
|
36
|
+
addedCommands?: Record<string, EditorCommand>
|
|
37
|
+
): EditorAllCommandMap<DefaultPayload>;
|
|
38
|
+
|
|
39
|
+
keymaps(useCommandShortcut: boolean): Plugin<any, any>[];
|
|
40
|
+
|
|
41
|
+
setContext(context: SpecContext): void;
|
|
42
|
+
}
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
// @TODO replace these definition for Definitely Type
|
|
2
|
+
export type BlockNodeType =
|
|
3
|
+
| 'document'
|
|
4
|
+
| 'list'
|
|
5
|
+
| 'blockQuote'
|
|
6
|
+
| 'item'
|
|
7
|
+
| 'heading'
|
|
8
|
+
| 'thematicBreak'
|
|
9
|
+
| 'paragraph'
|
|
10
|
+
| 'codeBlock'
|
|
11
|
+
| 'htmlBlock'
|
|
12
|
+
| 'table'
|
|
13
|
+
| 'tableHead'
|
|
14
|
+
| 'tableBody'
|
|
15
|
+
| 'tableRow'
|
|
16
|
+
| 'tableCell'
|
|
17
|
+
| 'tableDelimRow'
|
|
18
|
+
| 'tableDelimCell'
|
|
19
|
+
| 'refDef'
|
|
20
|
+
| 'customBlock'
|
|
21
|
+
| 'frontMatter';
|
|
22
|
+
|
|
23
|
+
export type InlineNodeType =
|
|
24
|
+
| 'code'
|
|
25
|
+
| 'text'
|
|
26
|
+
| 'emph'
|
|
27
|
+
| 'strong'
|
|
28
|
+
| 'strike'
|
|
29
|
+
| 'link'
|
|
30
|
+
| 'image'
|
|
31
|
+
| 'htmlInline'
|
|
32
|
+
| 'linebreak'
|
|
33
|
+
| 'softbreak'
|
|
34
|
+
| 'customInline';
|
|
35
|
+
|
|
36
|
+
export type MdNodeType = BlockNodeType | InlineNodeType;
|
|
37
|
+
|
|
38
|
+
export type Pos = [number, number];
|
|
39
|
+
export type MdPos = Pos;
|
|
40
|
+
export type Sourcepos = [Pos, Pos];
|
|
41
|
+
|
|
42
|
+
export interface NodeWalker {
|
|
43
|
+
current: MdNode | null;
|
|
44
|
+
root: MdNode;
|
|
45
|
+
entering: boolean;
|
|
46
|
+
|
|
47
|
+
next(): { entering: boolean; node: MdNode } | null;
|
|
48
|
+
resumeAt(node: MdNode, entering: boolean): void;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface MdNode {
|
|
52
|
+
type: MdNodeType;
|
|
53
|
+
id: number;
|
|
54
|
+
parent: MdNode | null;
|
|
55
|
+
prev: MdNode | null;
|
|
56
|
+
next: MdNode | null;
|
|
57
|
+
sourcepos?: Sourcepos;
|
|
58
|
+
firstChild: MdNode | null;
|
|
59
|
+
lastChild: MdNode | null;
|
|
60
|
+
literal: string | null;
|
|
61
|
+
|
|
62
|
+
isContainer(): boolean;
|
|
63
|
+
unlink(): void;
|
|
64
|
+
replaceWith(node: MdNode): void;
|
|
65
|
+
insertAfter(node: MdNode): void;
|
|
66
|
+
insertBefore(node: MdNode): void;
|
|
67
|
+
appendChild(child: MdNode): void;
|
|
68
|
+
prependChild(child: MdNode): void;
|
|
69
|
+
walker(): NodeWalker;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface BlockMdNode extends MdNode {
|
|
73
|
+
type: BlockNodeType;
|
|
74
|
+
|
|
75
|
+
// temporal data (for parsing)
|
|
76
|
+
open: boolean;
|
|
77
|
+
lineOffsets: number[] | null;
|
|
78
|
+
stringContent: string | null;
|
|
79
|
+
lastLineBlank: boolean;
|
|
80
|
+
lastLineChecked: boolean;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface ListData {
|
|
84
|
+
type: 'ordered' | 'bullet';
|
|
85
|
+
tight: boolean;
|
|
86
|
+
start: number;
|
|
87
|
+
bulletChar: string;
|
|
88
|
+
delimiter: string;
|
|
89
|
+
markerOffset: number;
|
|
90
|
+
padding: number;
|
|
91
|
+
task: boolean;
|
|
92
|
+
checked: boolean;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface ListMdNode extends BlockMdNode {
|
|
96
|
+
listData: ListData | null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface ListItemMdNode extends BlockMdNode {
|
|
100
|
+
parent: MdNode;
|
|
101
|
+
listData: ListData;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface HeadingMdNode extends BlockMdNode {
|
|
105
|
+
level: number;
|
|
106
|
+
headingType: 'atx' | 'setext';
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface CodeBlockMdNode extends BlockMdNode {
|
|
110
|
+
fenceOffset: number;
|
|
111
|
+
fenceLength: number;
|
|
112
|
+
fenceChar: string | null;
|
|
113
|
+
info: string | null;
|
|
114
|
+
infoPadding: number;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface TableColumn {
|
|
118
|
+
align: 'left' | 'center' | 'right' | null;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface TableMdNode extends BlockMdNode {
|
|
122
|
+
columns: TableColumn[];
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface TableCellMdNode extends BlockMdNode {
|
|
126
|
+
startIdx: number;
|
|
127
|
+
endIdx: number;
|
|
128
|
+
paddingLeft: number;
|
|
129
|
+
paddingRight: number;
|
|
130
|
+
ignored: boolean;
|
|
131
|
+
attrs?: Record<string, any>;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface RefDefMdNode extends BlockMdNode {
|
|
135
|
+
title: string;
|
|
136
|
+
dest: string;
|
|
137
|
+
label: string;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface CustomBlockMdNode extends BlockMdNode {
|
|
141
|
+
syntaxLength: number;
|
|
142
|
+
offset: number;
|
|
143
|
+
info: string;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export interface HtmlBlockMdNode extends BlockMdNode {
|
|
147
|
+
htmlBlockType: number;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export interface LinkMdNode extends MdNode {
|
|
151
|
+
destination: string | null;
|
|
152
|
+
title: string | null;
|
|
153
|
+
extendedAutolink: boolean;
|
|
154
|
+
lastChild: MdNode;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export interface CodeMdNode extends MdNode {
|
|
158
|
+
tickCount: number;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export interface CustomInlineMdNode extends MdNode {
|
|
162
|
+
info: string;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export type AutolinkParser = (
|
|
166
|
+
content: string
|
|
167
|
+
) => {
|
|
168
|
+
url: string;
|
|
169
|
+
text: string;
|
|
170
|
+
range: [number, number];
|
|
171
|
+
}[];
|
|
172
|
+
|
|
173
|
+
export type CustomParser = (
|
|
174
|
+
node: MdNode,
|
|
175
|
+
context: { entering: boolean; options: ParserOptions }
|
|
176
|
+
) => void;
|
|
177
|
+
export type CustomParserMap = Partial<Record<MdNodeType, CustomParser>>;
|
|
178
|
+
|
|
179
|
+
type RefDefState = {
|
|
180
|
+
id: number;
|
|
181
|
+
destination: string;
|
|
182
|
+
title: string;
|
|
183
|
+
unlinked: boolean;
|
|
184
|
+
sourcepos: Sourcepos;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export type RefMap = {
|
|
188
|
+
[k: string]: RefDefState;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
export type RefLinkCandidateMap = {
|
|
192
|
+
[k: number]: {
|
|
193
|
+
node: BlockMdNode;
|
|
194
|
+
refLabel: string;
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
export type RefDefCandidateMap = {
|
|
199
|
+
[k: number]: RefDefMdNode;
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
export interface ParserOptions {
|
|
203
|
+
smart: boolean;
|
|
204
|
+
tagFilter: boolean;
|
|
205
|
+
extendedAutolinks: boolean | AutolinkParser;
|
|
206
|
+
disallowedHtmlBlockTags: string[];
|
|
207
|
+
referenceDefinition: boolean;
|
|
208
|
+
disallowDeepHeading: boolean;
|
|
209
|
+
frontMatter: boolean;
|
|
210
|
+
customParser: CustomParserMap | null;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export class Parser {
|
|
214
|
+
constructor(options?: Partial<ParserOptions>);
|
|
215
|
+
|
|
216
|
+
advanceOffset(count: number, columns?: boolean): void;
|
|
217
|
+
|
|
218
|
+
advanceNextNonspace(): void;
|
|
219
|
+
|
|
220
|
+
findNextNonspace(): void;
|
|
221
|
+
|
|
222
|
+
addLine(): void;
|
|
223
|
+
|
|
224
|
+
addChild(tag: BlockNodeType, offset: number): BlockMdNode;
|
|
225
|
+
|
|
226
|
+
closeUnmatchedBlocks(): void;
|
|
227
|
+
|
|
228
|
+
finalize(block: BlockMdNode, lineNumber: number): void;
|
|
229
|
+
|
|
230
|
+
processInlines(block: BlockMdNode): void;
|
|
231
|
+
|
|
232
|
+
incorporateLine(ln: string): void;
|
|
233
|
+
|
|
234
|
+
// The main parsing function. Returns a parsed document AST.
|
|
235
|
+
parse(input: string, lineTexts?: string[]): MdNode;
|
|
236
|
+
|
|
237
|
+
partialParseStart(lineNumber: number, lines: string[]): MdNode;
|
|
238
|
+
|
|
239
|
+
partialParseExtends(lines: string[]): void;
|
|
240
|
+
|
|
241
|
+
partialParseFinish(): void;
|
|
242
|
+
|
|
243
|
+
setRefMaps(
|
|
244
|
+
refMap: RefMap,
|
|
245
|
+
refLinkCandidateMap: RefLinkCandidateMap,
|
|
246
|
+
refDefCandidateMap: RefDefCandidateMap
|
|
247
|
+
): void;
|
|
248
|
+
|
|
249
|
+
clearRefMaps(): void;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export type HTMLConvertor = (
|
|
253
|
+
node: MdNode,
|
|
254
|
+
context: Context,
|
|
255
|
+
convertors?: HTMLConvertorMap
|
|
256
|
+
) => HTMLToken | HTMLToken[] | null;
|
|
257
|
+
|
|
258
|
+
export type HTMLConvertorMap = Partial<Record<string, HTMLConvertor>>;
|
|
259
|
+
|
|
260
|
+
interface RendererOptions {
|
|
261
|
+
gfm: boolean;
|
|
262
|
+
softbreak: string;
|
|
263
|
+
nodeId: boolean;
|
|
264
|
+
tagFilter: boolean;
|
|
265
|
+
convertors?: HTMLConvertorMap;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
interface Context {
|
|
269
|
+
entering: boolean;
|
|
270
|
+
leaf: boolean;
|
|
271
|
+
options: Omit<RendererOptions, 'convertors'>;
|
|
272
|
+
getChildrenText: (node: MdNode) => string;
|
|
273
|
+
skipChildren: () => void;
|
|
274
|
+
origin?: () => ReturnType<HTMLConvertor>;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
interface TagToken {
|
|
278
|
+
tagName: string;
|
|
279
|
+
outerNewLine?: boolean;
|
|
280
|
+
innerNewLine?: boolean;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export interface OpenTagToken extends TagToken {
|
|
284
|
+
type: 'openTag';
|
|
285
|
+
classNames?: string[];
|
|
286
|
+
attributes?: Record<string, any>;
|
|
287
|
+
selfClose?: boolean;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export interface CloseTagToken extends TagToken {
|
|
291
|
+
type: 'closeTag';
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export interface TextToken {
|
|
295
|
+
type: 'text';
|
|
296
|
+
content: string;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export interface RawHTMLToken {
|
|
300
|
+
type: 'html';
|
|
301
|
+
content: string;
|
|
302
|
+
outerNewLine?: boolean;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export type HTMLToken = OpenTagToken | CloseTagToken | TextToken | RawHTMLToken;
|
|
306
|
+
|
|
307
|
+
export class Renderer {
|
|
308
|
+
constructor(customOptions?: Partial<RendererOptions>);
|
|
309
|
+
|
|
310
|
+
getConvertors(): HTMLConvertorMap;
|
|
311
|
+
|
|
312
|
+
getOptions(): RendererOptions;
|
|
313
|
+
|
|
314
|
+
render(rootNode: MdNode): string;
|
|
315
|
+
|
|
316
|
+
renderHTMLNode(node: HTMLToken): void;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
export interface RemovedNodeRange {
|
|
320
|
+
id: [number, number];
|
|
321
|
+
line: [number, number];
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
export interface EditResult {
|
|
325
|
+
nodes: MdNode[];
|
|
326
|
+
removedNodeRange: RemovedNodeRange | null;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
type EventName = 'change';
|
|
330
|
+
|
|
331
|
+
type EventHandlerMap = {
|
|
332
|
+
[key in EventName]: Function[];
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
export class ToastMark {
|
|
336
|
+
constructor(contents?: string, options?: Partial<ParserOptions>);
|
|
337
|
+
|
|
338
|
+
lineTexts: string[];
|
|
339
|
+
|
|
340
|
+
editMarkdown(startPos: Pos, endPos: Pos, newText: string): EditResult[];
|
|
341
|
+
|
|
342
|
+
getLineTexts(): string[];
|
|
343
|
+
|
|
344
|
+
getRootNode(): MdNode;
|
|
345
|
+
|
|
346
|
+
findNodeAtPosition(pos: Pos): MdNode | null;
|
|
347
|
+
|
|
348
|
+
findFirstNodeAtLine(line: number): MdNode | null;
|
|
349
|
+
|
|
350
|
+
on(eventName: EventName, callback: () => void): void;
|
|
351
|
+
|
|
352
|
+
off(eventName: EventName, callback: () => void): void;
|
|
353
|
+
|
|
354
|
+
findNodeById(id: number): MdNode | null;
|
|
355
|
+
|
|
356
|
+
removeAllNode(): void;
|
|
357
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
declare module '@licium/editor/dist/toastui-editor-viewer' {
|
|
2
|
+
import {
|
|
3
|
+
Viewer,
|
|
4
|
+
ViewerOptions,
|
|
5
|
+
ExtendedAutolinks,
|
|
6
|
+
LinkAttributes,
|
|
7
|
+
Sanitizer,
|
|
8
|
+
EventMap,
|
|
9
|
+
WidgetRuleMap,
|
|
10
|
+
WidgetRule,
|
|
11
|
+
PluginContext,
|
|
12
|
+
I18n,
|
|
13
|
+
CustomHTMLRenderer,
|
|
14
|
+
HTMLMdNodeConvertor,
|
|
15
|
+
HTMLMdNodeConvertorMap,
|
|
16
|
+
PluginInfo,
|
|
17
|
+
PluginNodeViews,
|
|
18
|
+
PluginCommandMap,
|
|
19
|
+
} from '@licium/editor';
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
ViewerOptions,
|
|
23
|
+
ExtendedAutolinks,
|
|
24
|
+
LinkAttributes,
|
|
25
|
+
Sanitizer,
|
|
26
|
+
EventMap,
|
|
27
|
+
WidgetRuleMap,
|
|
28
|
+
WidgetRule,
|
|
29
|
+
PluginContext,
|
|
30
|
+
I18n,
|
|
31
|
+
CustomHTMLRenderer,
|
|
32
|
+
HTMLMdNodeConvertor,
|
|
33
|
+
HTMLMdNodeConvertorMap,
|
|
34
|
+
PluginInfo,
|
|
35
|
+
PluginNodeViews,
|
|
36
|
+
PluginCommandMap,
|
|
37
|
+
};
|
|
38
|
+
export default Viewer;
|
|
39
|
+
}
|