@tiptap/extension-list-item 2.5.0-beta.2 → 2.5.0-beta.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.
Files changed (167) hide show
  1. package/dist/index.cjs +33 -33
  2. package/dist/index.js +32 -32
  3. package/dist/index.umd.js +33 -33
  4. package/dist/packages/core/src/CommandManager.d.ts +20 -0
  5. package/dist/packages/core/src/Editor.d.ts +161 -0
  6. package/dist/packages/core/src/EventEmitter.d.ts +11 -0
  7. package/dist/packages/core/src/Extension.d.ts +343 -0
  8. package/dist/packages/core/src/ExtensionManager.d.ts +55 -0
  9. package/dist/packages/core/src/InputRule.d.ts +42 -0
  10. package/dist/packages/core/src/Mark.d.ts +451 -0
  11. package/dist/packages/core/src/Node.d.ts +611 -0
  12. package/dist/packages/core/src/NodePos.d.ts +44 -0
  13. package/dist/packages/core/src/NodeView.d.ts +31 -0
  14. package/dist/packages/core/src/PasteRule.d.ts +50 -0
  15. package/dist/packages/core/src/Tracker.d.ts +11 -0
  16. package/dist/packages/core/src/commands/blur.d.ts +13 -0
  17. package/dist/packages/core/src/commands/clearContent.d.ts +14 -0
  18. package/dist/packages/core/src/commands/clearNodes.d.ts +13 -0
  19. package/dist/packages/core/src/commands/command.d.ts +18 -0
  20. package/dist/packages/core/src/commands/createParagraphNear.d.ts +13 -0
  21. package/dist/packages/core/src/commands/cut.d.ts +20 -0
  22. package/dist/packages/core/src/commands/deleteCurrentNode.d.ts +13 -0
  23. package/dist/packages/core/src/commands/deleteNode.d.ts +15 -0
  24. package/dist/packages/core/src/commands/deleteRange.d.ts +14 -0
  25. package/dist/packages/core/src/commands/deleteSelection.d.ts +13 -0
  26. package/dist/packages/core/src/commands/enter.d.ts +13 -0
  27. package/dist/packages/core/src/commands/exitCode.d.ts +13 -0
  28. package/dist/packages/core/src/commands/extendMarkRange.d.ts +25 -0
  29. package/dist/packages/core/src/commands/first.d.ts +14 -0
  30. package/dist/packages/core/src/commands/focus.d.ts +27 -0
  31. package/dist/packages/core/src/commands/forEach.d.ts +14 -0
  32. package/dist/packages/core/src/commands/index.d.ts +55 -0
  33. package/dist/packages/core/src/commands/insertContent.d.ts +34 -0
  34. package/dist/packages/core/src/commands/insertContentAt.d.ts +47 -0
  35. package/dist/packages/core/src/commands/join.d.ts +41 -0
  36. package/dist/packages/core/src/commands/joinItemBackward.d.ts +13 -0
  37. package/dist/packages/core/src/commands/joinItemForward.d.ts +13 -0
  38. package/dist/packages/core/src/commands/joinTextblockBackward.d.ts +12 -0
  39. package/dist/packages/core/src/commands/joinTextblockForward.d.ts +12 -0
  40. package/dist/packages/core/src/commands/keyboardShortcut.d.ts +14 -0
  41. package/dist/packages/core/src/commands/lift.d.ts +17 -0
  42. package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +13 -0
  43. package/dist/packages/core/src/commands/liftListItem.d.ts +15 -0
  44. package/dist/packages/core/src/commands/newlineInCode.d.ts +13 -0
  45. package/dist/packages/core/src/commands/resetAttributes.d.ts +16 -0
  46. package/dist/packages/core/src/commands/scrollIntoView.d.ts +13 -0
  47. package/dist/packages/core/src/commands/selectAll.d.ts +13 -0
  48. package/dist/packages/core/src/commands/selectNodeBackward.d.ts +13 -0
  49. package/dist/packages/core/src/commands/selectNodeForward.d.ts +13 -0
  50. package/dist/packages/core/src/commands/selectParentNode.d.ts +13 -0
  51. package/dist/packages/core/src/commands/selectTextblockEnd.d.ts +13 -0
  52. package/dist/packages/core/src/commands/selectTextblockStart.d.ts +13 -0
  53. package/dist/packages/core/src/commands/setContent.d.ts +40 -0
  54. package/dist/packages/core/src/commands/setMark.d.ts +15 -0
  55. package/dist/packages/core/src/commands/setMeta.d.ts +15 -0
  56. package/dist/packages/core/src/commands/setNode.d.ts +16 -0
  57. package/dist/packages/core/src/commands/setNodeSelection.d.ts +14 -0
  58. package/dist/packages/core/src/commands/setTextSelection.d.ts +14 -0
  59. package/dist/packages/core/src/commands/sinkListItem.d.ts +15 -0
  60. package/dist/packages/core/src/commands/splitBlock.d.ts +17 -0
  61. package/dist/packages/core/src/commands/splitListItem.d.ts +15 -0
  62. package/dist/packages/core/src/commands/toggleList.d.ts +18 -0
  63. package/dist/packages/core/src/commands/toggleMark.d.ts +30 -0
  64. package/dist/packages/core/src/commands/toggleNode.d.ts +17 -0
  65. package/dist/packages/core/src/commands/toggleWrap.d.ts +16 -0
  66. package/dist/packages/core/src/commands/undoInputRule.d.ts +13 -0
  67. package/dist/packages/core/src/commands/unsetAllMarks.d.ts +13 -0
  68. package/dist/packages/core/src/commands/unsetMark.d.ts +25 -0
  69. package/dist/packages/core/src/commands/updateAttributes.d.ts +24 -0
  70. package/dist/packages/core/src/commands/wrapIn.d.ts +16 -0
  71. package/dist/packages/core/src/commands/wrapInList.d.ts +16 -0
  72. package/dist/packages/core/src/extensions/clipboardTextSerializer.d.ts +5 -0
  73. package/dist/packages/core/src/extensions/commands.d.ts +3 -0
  74. package/dist/packages/core/src/extensions/editable.d.ts +2 -0
  75. package/dist/packages/core/src/extensions/focusEvents.d.ts +2 -0
  76. package/dist/packages/core/src/extensions/index.d.ts +6 -0
  77. package/dist/packages/core/src/extensions/keymap.d.ts +2 -0
  78. package/dist/packages/core/src/extensions/tabindex.d.ts +2 -0
  79. package/dist/packages/core/src/helpers/combineTransactionSteps.d.ts +10 -0
  80. package/dist/packages/core/src/helpers/createChainableState.d.ts +10 -0
  81. package/dist/packages/core/src/helpers/createDocument.d.ts +12 -0
  82. package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +15 -0
  83. package/dist/packages/core/src/helpers/defaultBlockAt.d.ts +7 -0
  84. package/dist/packages/core/src/helpers/findChildren.d.ts +9 -0
  85. package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +10 -0
  86. package/dist/packages/core/src/helpers/findParentNode.d.ts +16 -0
  87. package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +17 -0
  88. package/dist/packages/core/src/helpers/generateHTML.d.ts +8 -0
  89. package/dist/packages/core/src/helpers/generateJSON.d.ts +8 -0
  90. package/dist/packages/core/src/helpers/generateText.d.ts +12 -0
  91. package/dist/packages/core/src/helpers/getAttributes.d.ts +9 -0
  92. package/dist/packages/core/src/helpers/getAttributesFromExtensions.d.ts +6 -0
  93. package/dist/packages/core/src/helpers/getChangedRanges.d.ts +11 -0
  94. package/dist/packages/core/src/helpers/getDebugJSON.d.ts +8 -0
  95. package/dist/packages/core/src/helpers/getExtensionField.d.ts +9 -0
  96. package/dist/packages/core/src/helpers/getHTMLFromFragment.d.ts +2 -0
  97. package/dist/packages/core/src/helpers/getMarkAttributes.d.ts +3 -0
  98. package/dist/packages/core/src/helpers/getMarkRange.d.ts +3 -0
  99. package/dist/packages/core/src/helpers/getMarkType.d.ts +2 -0
  100. package/dist/packages/core/src/helpers/getMarksBetween.d.ts +3 -0
  101. package/dist/packages/core/src/helpers/getNodeAtPosition.d.ts +11 -0
  102. package/dist/packages/core/src/helpers/getNodeAttributes.d.ts +3 -0
  103. package/dist/packages/core/src/helpers/getNodeType.d.ts +2 -0
  104. package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +3 -0
  105. package/dist/packages/core/src/helpers/getSchema.d.ts +4 -0
  106. package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +10 -0
  107. package/dist/packages/core/src/helpers/getSchemaTypeByName.d.ts +8 -0
  108. package/dist/packages/core/src/helpers/getSchemaTypeNameByName.d.ts +8 -0
  109. package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +9 -0
  110. package/dist/packages/core/src/helpers/getText.d.ts +15 -0
  111. package/dist/packages/core/src/helpers/getTextBetween.d.ts +14 -0
  112. package/dist/packages/core/src/helpers/getTextContentFromNodes.d.ts +8 -0
  113. package/dist/packages/core/src/helpers/getTextSerializersFromSchema.d.ts +8 -0
  114. package/dist/packages/core/src/helpers/index.d.ts +50 -0
  115. package/dist/packages/core/src/helpers/injectExtensionAttributesToParseRule.d.ts +9 -0
  116. package/dist/packages/core/src/helpers/isActive.d.ts +2 -0
  117. package/dist/packages/core/src/helpers/isAtEndOfNode.d.ts +2 -0
  118. package/dist/packages/core/src/helpers/isAtStartOfNode.d.ts +2 -0
  119. package/dist/packages/core/src/helpers/isExtensionRulesEnabled.d.ts +2 -0
  120. package/dist/packages/core/src/helpers/isList.d.ts +2 -0
  121. package/dist/packages/core/src/helpers/isMarkActive.d.ts +3 -0
  122. package/dist/packages/core/src/helpers/isNodeActive.d.ts +3 -0
  123. package/dist/packages/core/src/helpers/isNodeEmpty.d.ts +2 -0
  124. package/dist/packages/core/src/helpers/isNodeSelection.d.ts +2 -0
  125. package/dist/packages/core/src/helpers/isTextSelection.d.ts +2 -0
  126. package/dist/packages/core/src/helpers/posToDOMRect.d.ts +2 -0
  127. package/dist/packages/core/src/helpers/resolveFocusPosition.d.ts +4 -0
  128. package/dist/packages/core/src/helpers/selectionToInsertionEnd.d.ts +2 -0
  129. package/dist/packages/core/src/helpers/splitExtensions.d.ts +9 -0
  130. package/dist/packages/core/src/index.d.ts +24 -0
  131. package/dist/packages/core/src/inputRules/index.d.ts +5 -0
  132. package/dist/packages/core/src/inputRules/markInputRule.d.ts +13 -0
  133. package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +23 -0
  134. package/dist/packages/core/src/inputRules/textInputRule.d.ts +10 -0
  135. package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +15 -0
  136. package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +28 -0
  137. package/dist/packages/core/src/pasteRules/index.d.ts +3 -0
  138. package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +13 -0
  139. package/dist/packages/core/src/pasteRules/nodePasteRule.d.ts +13 -0
  140. package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +10 -0
  141. package/dist/packages/core/src/style.d.ts +1 -0
  142. package/dist/packages/core/src/types.d.ts +250 -0
  143. package/dist/packages/core/src/utilities/callOrReturn.d.ts +9 -0
  144. package/dist/packages/core/src/utilities/createStyleTag.d.ts +1 -0
  145. package/dist/packages/core/src/utilities/deleteProps.d.ts +6 -0
  146. package/dist/packages/core/src/utilities/elementFromString.d.ts +1 -0
  147. package/dist/packages/core/src/utilities/escapeForRegEx.d.ts +1 -0
  148. package/dist/packages/core/src/utilities/findDuplicates.d.ts +1 -0
  149. package/dist/packages/core/src/utilities/fromString.d.ts +1 -0
  150. package/dist/packages/core/src/utilities/index.d.ts +20 -0
  151. package/dist/packages/core/src/utilities/isAndroid.d.ts +1 -0
  152. package/dist/packages/core/src/utilities/isEmptyObject.d.ts +1 -0
  153. package/dist/packages/core/src/utilities/isFunction.d.ts +1 -0
  154. package/dist/packages/core/src/utilities/isMacOS.d.ts +1 -0
  155. package/dist/packages/core/src/utilities/isNumber.d.ts +1 -0
  156. package/dist/packages/core/src/utilities/isPlainObject.d.ts +1 -0
  157. package/dist/packages/core/src/utilities/isRegExp.d.ts +1 -0
  158. package/dist/packages/core/src/utilities/isString.d.ts +1 -0
  159. package/dist/packages/core/src/utilities/isiOS.d.ts +1 -0
  160. package/dist/packages/core/src/utilities/mergeAttributes.d.ts +1 -0
  161. package/dist/packages/core/src/utilities/mergeDeep.d.ts +1 -0
  162. package/dist/packages/core/src/utilities/minMax.d.ts +1 -0
  163. package/dist/packages/core/src/utilities/objectIncludes.d.ts +8 -0
  164. package/dist/packages/core/src/utilities/removeDuplicates.d.ts +8 -0
  165. package/dist/packages/extension-list-item/src/index.d.ts +3 -3
  166. package/dist/packages/extension-list-item/src/list-item.d.ts +26 -26
  167. package/package.json +2 -2
package/dist/index.cjs CHANGED
@@ -4,40 +4,40 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var core = require('@tiptap/core');
6
6
 
7
- /**
8
- * This extension allows you to create list items.
9
- * @see https://www.tiptap.dev/api/nodes/list-item
10
- */
11
- const ListItem = core.Node.create({
12
- name: 'listItem',
13
- addOptions() {
14
- return {
15
- HTMLAttributes: {},
16
- bulletListTypeName: 'bulletList',
17
- orderedListTypeName: 'orderedList',
18
- };
19
- },
20
- content: 'paragraph block*',
21
- defining: true,
22
- parseHTML() {
23
- return [
24
- {
25
- tag: 'li',
26
- },
27
- ];
28
- },
29
- renderHTML({ HTMLAttributes }) {
30
- return ['li', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
31
- },
32
- addKeyboardShortcuts() {
33
- return {
34
- Enter: () => this.editor.commands.splitListItem(this.name),
35
- Tab: () => this.editor.commands.sinkListItem(this.name),
36
- 'Shift-Tab': () => this.editor.commands.liftListItem(this.name),
37
- };
38
- },
7
+ /**
8
+ * This extension allows you to create list items.
9
+ * @see https://www.tiptap.dev/api/nodes/list-item
10
+ */
11
+ const ListItem = core.Node.create({
12
+ name: 'listItem',
13
+ addOptions() {
14
+ return {
15
+ HTMLAttributes: {},
16
+ bulletListTypeName: 'bulletList',
17
+ orderedListTypeName: 'orderedList',
18
+ };
19
+ },
20
+ content: 'paragraph block*',
21
+ defining: true,
22
+ parseHTML() {
23
+ return [
24
+ {
25
+ tag: 'li',
26
+ },
27
+ ];
28
+ },
29
+ renderHTML({ HTMLAttributes }) {
30
+ return ['li', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
31
+ },
32
+ addKeyboardShortcuts() {
33
+ return {
34
+ Enter: () => this.editor.commands.splitListItem(this.name),
35
+ Tab: () => this.editor.commands.sinkListItem(this.name),
36
+ 'Shift-Tab': () => this.editor.commands.liftListItem(this.name),
37
+ };
38
+ },
39
39
  });
40
40
 
41
41
  exports.ListItem = ListItem;
42
- exports["default"] = ListItem;
42
+ exports.default = ListItem;
43
43
  //# sourceMappingURL=index.cjs.map
package/dist/index.js CHANGED
@@ -1,37 +1,37 @@
1
1
  import { Node, mergeAttributes } from '@tiptap/core';
2
2
 
3
- /**
4
- * This extension allows you to create list items.
5
- * @see https://www.tiptap.dev/api/nodes/list-item
6
- */
7
- const ListItem = Node.create({
8
- name: 'listItem',
9
- addOptions() {
10
- return {
11
- HTMLAttributes: {},
12
- bulletListTypeName: 'bulletList',
13
- orderedListTypeName: 'orderedList',
14
- };
15
- },
16
- content: 'paragraph block*',
17
- defining: true,
18
- parseHTML() {
19
- return [
20
- {
21
- tag: 'li',
22
- },
23
- ];
24
- },
25
- renderHTML({ HTMLAttributes }) {
26
- return ['li', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
27
- },
28
- addKeyboardShortcuts() {
29
- return {
30
- Enter: () => this.editor.commands.splitListItem(this.name),
31
- Tab: () => this.editor.commands.sinkListItem(this.name),
32
- 'Shift-Tab': () => this.editor.commands.liftListItem(this.name),
33
- };
34
- },
3
+ /**
4
+ * This extension allows you to create list items.
5
+ * @see https://www.tiptap.dev/api/nodes/list-item
6
+ */
7
+ const ListItem = Node.create({
8
+ name: 'listItem',
9
+ addOptions() {
10
+ return {
11
+ HTMLAttributes: {},
12
+ bulletListTypeName: 'bulletList',
13
+ orderedListTypeName: 'orderedList',
14
+ };
15
+ },
16
+ content: 'paragraph block*',
17
+ defining: true,
18
+ parseHTML() {
19
+ return [
20
+ {
21
+ tag: 'li',
22
+ },
23
+ ];
24
+ },
25
+ renderHTML({ HTMLAttributes }) {
26
+ return ['li', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
27
+ },
28
+ addKeyboardShortcuts() {
29
+ return {
30
+ Enter: () => this.editor.commands.splitListItem(this.name),
31
+ Tab: () => this.editor.commands.sinkListItem(this.name),
32
+ 'Shift-Tab': () => this.editor.commands.liftListItem(this.name),
33
+ };
34
+ },
35
35
  });
36
36
 
37
37
  export { ListItem, ListItem as default };
package/dist/index.umd.js CHANGED
@@ -4,42 +4,42 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@tiptap/extension-list-item"] = {}, global.core));
5
5
  })(this, (function (exports, core) { 'use strict';
6
6
 
7
- /**
8
- * This extension allows you to create list items.
9
- * @see https://www.tiptap.dev/api/nodes/list-item
10
- */
11
- const ListItem = core.Node.create({
12
- name: 'listItem',
13
- addOptions() {
14
- return {
15
- HTMLAttributes: {},
16
- bulletListTypeName: 'bulletList',
17
- orderedListTypeName: 'orderedList',
18
- };
19
- },
20
- content: 'paragraph block*',
21
- defining: true,
22
- parseHTML() {
23
- return [
24
- {
25
- tag: 'li',
26
- },
27
- ];
28
- },
29
- renderHTML({ HTMLAttributes }) {
30
- return ['li', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
31
- },
32
- addKeyboardShortcuts() {
33
- return {
34
- Enter: () => this.editor.commands.splitListItem(this.name),
35
- Tab: () => this.editor.commands.sinkListItem(this.name),
36
- 'Shift-Tab': () => this.editor.commands.liftListItem(this.name),
37
- };
38
- },
7
+ /**
8
+ * This extension allows you to create list items.
9
+ * @see https://www.tiptap.dev/api/nodes/list-item
10
+ */
11
+ const ListItem = core.Node.create({
12
+ name: 'listItem',
13
+ addOptions() {
14
+ return {
15
+ HTMLAttributes: {},
16
+ bulletListTypeName: 'bulletList',
17
+ orderedListTypeName: 'orderedList',
18
+ };
19
+ },
20
+ content: 'paragraph block*',
21
+ defining: true,
22
+ parseHTML() {
23
+ return [
24
+ {
25
+ tag: 'li',
26
+ },
27
+ ];
28
+ },
29
+ renderHTML({ HTMLAttributes }) {
30
+ return ['li', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
31
+ },
32
+ addKeyboardShortcuts() {
33
+ return {
34
+ Enter: () => this.editor.commands.splitListItem(this.name),
35
+ Tab: () => this.editor.commands.sinkListItem(this.name),
36
+ 'Shift-Tab': () => this.editor.commands.liftListItem(this.name),
37
+ };
38
+ },
39
39
  });
40
40
 
41
41
  exports.ListItem = ListItem;
42
- exports["default"] = ListItem;
42
+ exports.default = ListItem;
43
43
 
44
44
  Object.defineProperty(exports, '__esModule', { value: true });
45
45
 
@@ -0,0 +1,20 @@
1
+ import { EditorState, Transaction } from '@tiptap/pm/state';
2
+ import { Editor } from './Editor.js';
3
+ import { AnyCommands, CanCommands, ChainedCommands, CommandProps, SingleCommands } from './types.js';
4
+ export declare class CommandManager {
5
+ editor: Editor;
6
+ rawCommands: AnyCommands;
7
+ customState?: EditorState;
8
+ constructor(props: {
9
+ editor: Editor;
10
+ state?: EditorState;
11
+ });
12
+ get hasCustomState(): boolean;
13
+ get state(): EditorState;
14
+ get commands(): SingleCommands;
15
+ get chain(): () => ChainedCommands;
16
+ get can(): () => CanCommands;
17
+ createChain(startTr?: Transaction, shouldDispatch?: boolean): ChainedCommands;
18
+ createCan(startTr?: Transaction): CanCommands;
19
+ buildProps(tr: Transaction, shouldDispatch?: boolean): CommandProps;
20
+ }
@@ -0,0 +1,161 @@
1
+ import { MarkType, NodeType, Schema } from '@tiptap/pm/model';
2
+ import { EditorState, Plugin, PluginKey, Transaction } from '@tiptap/pm/state';
3
+ import { EditorView } from '@tiptap/pm/view';
4
+ import { EventEmitter } from './EventEmitter.js';
5
+ import { ExtensionManager } from './ExtensionManager.js';
6
+ import { NodePos } from './NodePos.js';
7
+ import { CanCommands, ChainedCommands, EditorEvents, EditorOptions, JSONContent, SingleCommands, TextSerializer } from './types.js';
8
+ export * as extensions from './extensions/index.js';
9
+ declare global {
10
+ interface HTMLElement {
11
+ editor?: Editor;
12
+ }
13
+ }
14
+ export declare class Editor extends EventEmitter<EditorEvents> {
15
+ private commandManager;
16
+ extensionManager: ExtensionManager;
17
+ private css;
18
+ schema: Schema;
19
+ view: EditorView;
20
+ isFocused: boolean;
21
+ extensionStorage: Record<string, any>;
22
+ options: EditorOptions;
23
+ constructor(options?: Partial<EditorOptions>);
24
+ /**
25
+ * Returns the editor storage.
26
+ */
27
+ get storage(): Record<string, any>;
28
+ /**
29
+ * An object of all registered commands.
30
+ */
31
+ get commands(): SingleCommands;
32
+ /**
33
+ * Create a command chain to call multiple commands at once.
34
+ */
35
+ chain(): ChainedCommands;
36
+ /**
37
+ * Check if a command or a command chain can be executed. Without executing it.
38
+ */
39
+ can(): CanCommands;
40
+ /**
41
+ * Inject CSS styles.
42
+ */
43
+ private injectCSS;
44
+ /**
45
+ * Update editor options.
46
+ *
47
+ * @param options A list of options
48
+ */
49
+ setOptions(options?: Partial<EditorOptions>): void;
50
+ /**
51
+ * Update editable state of the editor.
52
+ */
53
+ setEditable(editable: boolean, emitUpdate?: boolean): void;
54
+ /**
55
+ * Returns whether the editor is editable.
56
+ */
57
+ get isEditable(): boolean;
58
+ /**
59
+ * Returns the editor state.
60
+ */
61
+ get state(): EditorState;
62
+ /**
63
+ * Register a ProseMirror plugin.
64
+ *
65
+ * @param plugin A ProseMirror plugin
66
+ * @param handlePlugins Control how to merge the plugin into the existing plugins.
67
+ */
68
+ registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): void;
69
+ /**
70
+ * Unregister a ProseMirror plugin.
71
+ *
72
+ * @param nameOrPluginKey The plugins name
73
+ */
74
+ unregisterPlugin(nameOrPluginKey: string | PluginKey): void;
75
+ /**
76
+ * Creates an extension manager.
77
+ */
78
+ private createExtensionManager;
79
+ /**
80
+ * Creates an command manager.
81
+ */
82
+ private createCommandManager;
83
+ /**
84
+ * Creates a ProseMirror schema.
85
+ */
86
+ private createSchema;
87
+ /**
88
+ * Creates a ProseMirror view.
89
+ */
90
+ private createView;
91
+ /**
92
+ * Creates all node views.
93
+ */
94
+ createNodeViews(): void;
95
+ /**
96
+ * Prepend class name to element.
97
+ */
98
+ prependClass(): void;
99
+ isCapturingTransaction: boolean;
100
+ private capturedTransaction;
101
+ captureTransaction(fn: Function): Transaction | null;
102
+ /**
103
+ * The callback over which to send transactions (state updates) produced by the view.
104
+ *
105
+ * @param transaction An editor state transaction
106
+ */
107
+ private dispatchTransaction;
108
+ /**
109
+ * Get attributes of the currently selected node or mark.
110
+ */
111
+ getAttributes(nameOrType: string | NodeType | MarkType): Record<string, any>;
112
+ /**
113
+ * Returns if the currently selected node or mark is active.
114
+ *
115
+ * @param name Name of the node or mark
116
+ * @param attributes Attributes of the node or mark
117
+ */
118
+ isActive(name: string, attributes?: {}): boolean;
119
+ isActive(attributes: {}): boolean;
120
+ /**
121
+ * Get the document as JSON.
122
+ */
123
+ getJSON(): JSONContent;
124
+ /**
125
+ * Get the document as HTML.
126
+ */
127
+ getHTML(): string;
128
+ /**
129
+ * Get the document as text.
130
+ */
131
+ getText(options?: {
132
+ blockSeparator?: string;
133
+ textSerializers?: Record<string, TextSerializer>;
134
+ }): string;
135
+ /**
136
+ * Check if there is no content.
137
+ */
138
+ get isEmpty(): boolean;
139
+ /**
140
+ * Get the number of characters for the current document.
141
+ *
142
+ * @deprecated
143
+ */
144
+ getCharacterCount(): number;
145
+ /**
146
+ * Destroy the editor.
147
+ */
148
+ destroy(): void;
149
+ /**
150
+ * Check if the editor is already destroyed.
151
+ */
152
+ get isDestroyed(): boolean;
153
+ $node(selector: string, attributes?: {
154
+ [key: string]: any;
155
+ }): NodePos | null;
156
+ $nodes(selector: string, attributes?: {
157
+ [key: string]: any;
158
+ }): NodePos[] | null;
159
+ $pos(pos: number): NodePos;
160
+ get $doc(): NodePos;
161
+ }
@@ -0,0 +1,11 @@
1
+ type StringKeyOf<T> = Extract<keyof T, string>;
2
+ type CallbackType<T extends Record<string, any>, EventName extends StringKeyOf<T>> = T[EventName] extends any[] ? T[EventName] : [T[EventName]];
3
+ type CallbackFunction<T extends Record<string, any>, EventName extends StringKeyOf<T>> = (...props: CallbackType<T, EventName>) => any;
4
+ export declare class EventEmitter<T extends Record<string, any>> {
5
+ private callbacks;
6
+ on<EventName extends StringKeyOf<T>>(event: EventName, fn: CallbackFunction<T, EventName>): this;
7
+ emit<EventName extends StringKeyOf<T>>(event: EventName, ...args: CallbackType<T, EventName>): this;
8
+ off<EventName extends StringKeyOf<T>>(event: EventName, fn?: CallbackFunction<T, EventName>): this;
9
+ removeAllListeners(): void;
10
+ }
11
+ export {};