@doist/typist 9.0.3 → 10.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/typist-editor.d.ts +126 -123
- package/dist/components/typist-editor.d.ts.map +1 -1
- package/dist/components/typist-editor.helper.d.ts +8 -11
- package/dist/components/typist-editor.helper.d.ts.map +1 -1
- package/dist/components/typist-editor.helper.js +21 -19
- package/dist/components/typist-editor.helper.js.map +1 -0
- package/dist/components/typist-editor.js +133 -135
- package/dist/components/typist-editor.js.map +1 -0
- package/dist/constants/common.js +9 -5
- package/dist/constants/common.js.map +1 -0
- package/dist/constants/extension-priorities.d.ts +3 -1
- package/dist/constants/extension-priorities.d.ts.map +1 -1
- package/dist/constants/extension-priorities.js +34 -30
- package/dist/constants/extension-priorities.js.map +1 -0
- package/dist/constants/regular-expressions.js +14 -10
- package/dist/constants/regular-expressions.js.map +1 -0
- package/dist/extensions/core/extra-editor-commands/commands/create-paragraph-end.d.ts +12 -9
- package/dist/extensions/core/extra-editor-commands/commands/create-paragraph-end.d.ts.map +1 -1
- package/dist/extensions/core/extra-editor-commands/commands/create-paragraph-end.js +16 -19
- package/dist/extensions/core/extra-editor-commands/commands/create-paragraph-end.js.map +1 -0
- package/dist/extensions/core/extra-editor-commands/commands/extend-word-range.d.ts +12 -9
- package/dist/extensions/core/extra-editor-commands/commands/extend-word-range.d.ts.map +1 -1
- package/dist/extensions/core/extra-editor-commands/commands/extend-word-range.js +25 -28
- package/dist/extensions/core/extra-editor-commands/commands/extend-word-range.js.map +1 -0
- package/dist/extensions/core/extra-editor-commands/commands/insert-markdown-content-at.d.ts +24 -22
- package/dist/extensions/core/extra-editor-commands/commands/insert-markdown-content-at.d.ts.map +1 -1
- package/dist/extensions/core/extra-editor-commands/commands/insert-markdown-content-at.js +34 -36
- package/dist/extensions/core/extra-editor-commands/commands/insert-markdown-content-at.js.map +1 -0
- package/dist/extensions/core/extra-editor-commands/commands/insert-markdown-content.d.ts +23 -20
- package/dist/extensions/core/extra-editor-commands/commands/insert-markdown-content.d.ts.map +1 -1
- package/dist/extensions/core/extra-editor-commands/commands/insert-markdown-content.js +15 -8
- package/dist/extensions/core/extra-editor-commands/commands/insert-markdown-content.js.map +1 -0
- package/dist/extensions/core/extra-editor-commands/extra-editor-commands.js +22 -18
- package/dist/extensions/core/extra-editor-commands/extra-editor-commands.js.map +1 -0
- package/dist/extensions/core/view-event-handlers.d.ts +14 -13
- package/dist/extensions/core/view-event-handlers.d.ts.map +1 -1
- package/dist/extensions/core/view-event-handlers.js +33 -31
- package/dist/extensions/core/view-event-handlers.js.map +1 -0
- package/dist/extensions/plain-text/paste-multiline-text.js +45 -59
- package/dist/extensions/plain-text/paste-multiline-text.js.map +1 -0
- package/dist/extensions/plain-text/plain-text-document.d.ts +7 -7
- package/dist/extensions/plain-text/plain-text-document.d.ts.map +1 -1
- package/dist/extensions/plain-text/plain-text-document.js +14 -13
- package/dist/extensions/plain-text/plain-text-document.js.map +1 -0
- package/dist/extensions/plain-text/plain-text-kit.d.ts +35 -33
- package/dist/extensions/plain-text/plain-text-kit.d.ts.map +1 -1
- package/dist/extensions/plain-text/plain-text-kit.js +33 -48
- package/dist/extensions/plain-text/plain-text-kit.js.map +1 -0
- package/dist/extensions/plain-text/plain-text-paragraph.d.ts +2 -9
- package/dist/extensions/plain-text/plain-text-paragraph.js +11 -11
- package/dist/extensions/plain-text/plain-text-paragraph.js.map +1 -0
- package/dist/extensions/plain-text/smart-markdown-typing/plugins/smart-lists.js +37 -81
- package/dist/extensions/plain-text/smart-markdown-typing/plugins/smart-lists.js.map +1 -0
- package/dist/extensions/plain-text/smart-markdown-typing/plugins/smart-select-wrap.js +32 -42
- package/dist/extensions/plain-text/smart-markdown-typing/plugins/smart-select-wrap.js.map +1 -0
- package/dist/extensions/plain-text/smart-markdown-typing/plugins/smart-url-pasting.js +24 -37
- package/dist/extensions/plain-text/smart-markdown-typing/plugins/smart-url-pasting.js.map +1 -0
- package/dist/extensions/plain-text/smart-markdown-typing/smart-markdown-typing.js +21 -13
- package/dist/extensions/plain-text/smart-markdown-typing/smart-markdown-typing.js.map +1 -0
- package/dist/extensions/rich-text/bold-and-italics.js +42 -40
- package/dist/extensions/rich-text/bold-and-italics.js.map +1 -0
- package/dist/extensions/rich-text/curvenote-codemark.js +16 -14
- package/dist/extensions/rich-text/curvenote-codemark.js.map +1 -0
- package/dist/extensions/rich-text/paste-emojis.js +20 -22
- package/dist/extensions/rich-text/paste-emojis.js.map +1 -0
- package/dist/extensions/rich-text/paste-markdown.js +46 -86
- package/dist/extensions/rich-text/paste-markdown.js.map +1 -0
- package/dist/extensions/rich-text/rich-text-bullet-list.d.ts +10 -9
- package/dist/extensions/rich-text/rich-text-bullet-list.d.ts.map +1 -1
- package/dist/extensions/rich-text/rich-text-bullet-list.js +42 -56
- package/dist/extensions/rich-text/rich-text-bullet-list.js.map +1 -0
- package/dist/extensions/rich-text/rich-text-code.js +34 -34
- package/dist/extensions/rich-text/rich-text-code.js.map +1 -0
- package/dist/extensions/rich-text/rich-text-document.d.ts +7 -7
- package/dist/extensions/rich-text/rich-text-document.d.ts.map +1 -1
- package/dist/extensions/rich-text/rich-text-document.js +14 -13
- package/dist/extensions/rich-text/rich-text-document.js.map +1 -0
- package/dist/extensions/rich-text/rich-text-heading.d.ts +5 -4
- package/dist/extensions/rich-text/rich-text-heading.d.ts.map +1 -1
- package/dist/extensions/rich-text/rich-text-heading.js +25 -25
- package/dist/extensions/rich-text/rich-text-heading.js.map +1 -0
- package/dist/extensions/rich-text/rich-text-image.d.ts +53 -52
- package/dist/extensions/rich-text/rich-text-image.d.ts.map +1 -1
- package/dist/extensions/rich-text/rich-text-image.js +88 -105
- package/dist/extensions/rich-text/rich-text-image.js.map +1 -0
- package/dist/extensions/rich-text/rich-text-kit.d.ts +127 -125
- package/dist/extensions/rich-text/rich-text-kit.d.ts.map +1 -1
- package/dist/extensions/rich-text/rich-text-kit.js +73 -135
- package/dist/extensions/rich-text/rich-text-kit.js.map +1 -0
- package/dist/extensions/rich-text/rich-text-link.d.ts +5 -4
- package/dist/extensions/rich-text/rich-text-link.d.ts.map +1 -1
- package/dist/extensions/rich-text/rich-text-link.js +82 -90
- package/dist/extensions/rich-text/rich-text-link.js.map +1 -0
- package/dist/extensions/rich-text/rich-text-ordered-list.d.ts +10 -9
- package/dist/extensions/rich-text/rich-text-ordered-list.d.ts.map +1 -1
- package/dist/extensions/rich-text/rich-text-ordered-list.js +42 -56
- package/dist/extensions/rich-text/rich-text-ordered-list.js.map +1 -0
- package/dist/extensions/rich-text/rich-text-strikethrough.d.ts +5 -4
- package/dist/extensions/rich-text/rich-text-strikethrough.d.ts.map +1 -1
- package/dist/extensions/rich-text/rich-text-strikethrough.js +10 -10
- package/dist/extensions/rich-text/rich-text-strikethrough.js.map +1 -0
- package/dist/extensions/shared/copy-markdown-source.js +22 -31
- package/dist/extensions/shared/copy-markdown-source.js.map +1 -0
- package/dist/extensions/shared/paste-html-table-as-string.js +47 -60
- package/dist/extensions/shared/paste-html-table-as-string.js.map +1 -0
- package/dist/extensions/shared/paste-singleline-text.js +31 -39
- package/dist/extensions/shared/paste-singleline-text.js.map +1 -0
- package/dist/factories/create-suggestion-extension.d.ts +74 -74
- package/dist/factories/create-suggestion-extension.d.ts.map +1 -1
- package/dist/factories/create-suggestion-extension.js +139 -161
- package/dist/factories/create-suggestion-extension.js.map +1 -0
- package/dist/helpers/dom.js +9 -5
- package/dist/helpers/dom.js.map +1 -0
- package/dist/helpers/schema.d.ts +5 -3
- package/dist/helpers/schema.d.ts.map +1 -1
- package/dist/helpers/schema.js +25 -21
- package/dist/helpers/schema.js.map +1 -0
- package/dist/helpers/serializer.js +24 -28
- package/dist/helpers/serializer.js.map +1 -0
- package/dist/helpers/unified.js +24 -17
- package/dist/helpers/unified.js.map +1 -0
- package/dist/hooks/use-editor.js +50 -53
- package/dist/hooks/use-editor.js.map +1 -0
- package/dist/index.d.ts +25 -31
- package/dist/index.js +24 -24
- package/dist/serializers/html/html.d.ts +12 -10
- package/dist/serializers/html/html.d.ts.map +1 -1
- package/dist/serializers/html/html.js +67 -127
- package/dist/serializers/html/html.js.map +1 -0
- package/dist/serializers/html/plugins/rehype-code-block.js +17 -17
- package/dist/serializers/html/plugins/rehype-code-block.js.map +1 -0
- package/dist/serializers/html/plugins/rehype-image.js +20 -30
- package/dist/serializers/html/plugins/rehype-image.js.map +1 -0
- package/dist/serializers/html/plugins/rehype-suggestions.js +31 -32
- package/dist/serializers/html/plugins/rehype-suggestions.js.map +1 -0
- package/dist/serializers/html/plugins/rehype-task-list.js +31 -32
- package/dist/serializers/html/plugins/rehype-task-list.js.map +1 -0
- package/dist/serializers/html/plugins/remark-autolink-literal.d.ts +4 -1
- package/dist/serializers/html/plugins/remark-autolink-literal.d.ts.map +1 -1
- package/dist/serializers/html/plugins/remark-autolink-literal.js +25 -21
- package/dist/serializers/html/plugins/remark-autolink-literal.js.map +1 -0
- package/dist/serializers/html/plugins/remark-disable-constructs.js +21 -41
- package/dist/serializers/html/plugins/remark-disable-constructs.js.map +1 -0
- package/dist/serializers/html/plugins/remark-strikethrough.d.ts +5 -2
- package/dist/serializers/html/plugins/remark-strikethrough.d.ts.map +1 -1
- package/dist/serializers/html/plugins/remark-strikethrough.js +25 -21
- package/dist/serializers/html/plugins/remark-strikethrough.js.map +1 -0
- package/dist/serializers/markdown/markdown.d.ts +13 -12
- package/dist/serializers/markdown/markdown.d.ts.map +1 -1
- package/dist/serializers/markdown/markdown.js +78 -154
- package/dist/serializers/markdown/markdown.js.map +1 -0
- package/dist/serializers/markdown/plugins/image.js +27 -24
- package/dist/serializers/markdown/plugins/image.js.map +1 -0
- package/dist/serializers/markdown/plugins/list-item.js +32 -37
- package/dist/serializers/markdown/plugins/list-item.js.map +1 -0
- package/dist/serializers/markdown/plugins/paragraph.js +19 -19
- package/dist/serializers/markdown/plugins/paragraph.js.map +1 -0
- package/dist/serializers/markdown/plugins/strikethrough.js +23 -19
- package/dist/serializers/markdown/plugins/strikethrough.js.map +1 -0
- package/dist/serializers/markdown/plugins/suggestion.js +21 -19
- package/dist/serializers/markdown/plugins/suggestion.js.map +1 -0
- package/dist/serializers/markdown/plugins/task-item.js +31 -35
- package/dist/serializers/markdown/plugins/task-item.js.map +1 -0
- package/dist/utilities/can-insert-node-at.d.ts +12 -5
- package/dist/utilities/can-insert-node-at.d.ts.map +1 -1
- package/dist/utilities/can-insert-node-at.js +10 -8
- package/dist/utilities/can-insert-node-at.js.map +1 -0
- package/dist/utilities/can-insert-suggestion.d.ts +11 -5
- package/dist/utilities/can-insert-suggestion.d.ts.map +1 -1
- package/dist/utilities/can-insert-suggestion.js +15 -12
- package/dist/utilities/can-insert-suggestion.js.map +1 -0
- package/package.json +26 -13
- package/dist/constants/common.d.ts +0 -10
- package/dist/constants/common.d.ts.map +0 -1
- package/dist/constants/regular-expressions.d.ts +0 -18
- package/dist/constants/regular-expressions.d.ts.map +0 -1
- package/dist/extensions/core/extra-editor-commands/extra-editor-commands.d.ts +0 -9
- package/dist/extensions/core/extra-editor-commands/extra-editor-commands.d.ts.map +0 -1
- package/dist/extensions/plain-text/paste-multiline-text.d.ts +0 -10
- package/dist/extensions/plain-text/paste-multiline-text.d.ts.map +0 -1
- package/dist/extensions/plain-text/plain-text-paragraph.d.ts.map +0 -1
- package/dist/extensions/plain-text/smart-markdown-typing/plugins/smart-lists.d.ts +0 -9
- package/dist/extensions/plain-text/smart-markdown-typing/plugins/smart-lists.d.ts.map +0 -1
- package/dist/extensions/plain-text/smart-markdown-typing/plugins/smart-select-wrap.d.ts +0 -9
- package/dist/extensions/plain-text/smart-markdown-typing/plugins/smart-select-wrap.d.ts.map +0 -1
- package/dist/extensions/plain-text/smart-markdown-typing/plugins/smart-url-pasting.d.ts +0 -9
- package/dist/extensions/plain-text/smart-markdown-typing/plugins/smart-url-pasting.d.ts.map +0 -1
- package/dist/extensions/plain-text/smart-markdown-typing/smart-markdown-typing.d.ts +0 -8
- package/dist/extensions/plain-text/smart-markdown-typing/smart-markdown-typing.d.ts.map +0 -1
- package/dist/extensions/rich-text/bold-and-italics.d.ts +0 -8
- package/dist/extensions/rich-text/bold-and-italics.d.ts.map +0 -1
- package/dist/extensions/rich-text/curvenote-codemark.d.ts +0 -11
- package/dist/extensions/rich-text/curvenote-codemark.d.ts.map +0 -1
- package/dist/extensions/rich-text/paste-emojis.d.ts +0 -9
- package/dist/extensions/rich-text/paste-emojis.d.ts.map +0 -1
- package/dist/extensions/rich-text/paste-markdown.d.ts +0 -11
- package/dist/extensions/rich-text/paste-markdown.d.ts.map +0 -1
- package/dist/extensions/rich-text/rich-text-code.d.ts +0 -17
- package/dist/extensions/rich-text/rich-text-code.d.ts.map +0 -1
- package/dist/extensions/shared/copy-markdown-source.d.ts +0 -20
- package/dist/extensions/shared/copy-markdown-source.d.ts.map +0 -1
- package/dist/extensions/shared/paste-html-table-as-string.d.ts +0 -20
- package/dist/extensions/shared/paste-html-table-as-string.d.ts.map +0 -1
- package/dist/extensions/shared/paste-singleline-text.d.ts +0 -10
- package/dist/extensions/shared/paste-singleline-text.d.ts.map +0 -1
- package/dist/helpers/dom.d.ts +0 -8
- package/dist/helpers/dom.d.ts.map +0 -1
- package/dist/helpers/serializer.d.ts +0 -21
- package/dist/helpers/serializer.d.ts.map +0 -1
- package/dist/helpers/unified.d.ts +0 -21
- package/dist/helpers/unified.d.ts.map +0 -1
- package/dist/hooks/use-editor.d.ts +0 -19
- package/dist/hooks/use-editor.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/serializers/html/plugins/rehype-code-block.d.ts +0 -10
- package/dist/serializers/html/plugins/rehype-code-block.d.ts.map +0 -1
- package/dist/serializers/html/plugins/rehype-image.d.ts +0 -11
- package/dist/serializers/html/plugins/rehype-image.d.ts.map +0 -1
- package/dist/serializers/html/plugins/rehype-suggestions.d.ts +0 -10
- package/dist/serializers/html/plugins/rehype-suggestions.d.ts.map +0 -1
- package/dist/serializers/html/plugins/rehype-task-list.d.ts +0 -7
- package/dist/serializers/html/plugins/rehype-task-list.d.ts.map +0 -1
- package/dist/serializers/html/plugins/remark-disable-constructs.d.ts +0 -11
- package/dist/serializers/html/plugins/remark-disable-constructs.d.ts.map +0 -1
- package/dist/serializers/markdown/plugins/image.d.ts +0 -12
- package/dist/serializers/markdown/plugins/image.d.ts.map +0 -1
- package/dist/serializers/markdown/plugins/list-item.d.ts +0 -14
- package/dist/serializers/markdown/plugins/list-item.d.ts.map +0 -1
- package/dist/serializers/markdown/plugins/paragraph.d.ts +0 -13
- package/dist/serializers/markdown/plugins/paragraph.d.ts.map +0 -1
- package/dist/serializers/markdown/plugins/strikethrough.d.ts +0 -13
- package/dist/serializers/markdown/plugins/strikethrough.d.ts.map +0 -1
- package/dist/serializers/markdown/plugins/suggestion.d.ts +0 -11
- package/dist/serializers/markdown/plugins/suggestion.d.ts.map +0 -1
- package/dist/serializers/markdown/plugins/task-item.d.ts +0 -14
- package/dist/serializers/markdown/plugins/task-item.d.ts.map +0 -1
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
import { ViewEventHandlersOptions } from
|
|
2
|
-
import { getAllNodesAttributesByType } from
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { ViewEventHandlersOptions } from "../extensions/core/view-event-handlers.js";
|
|
2
|
+
import { getAllNodesAttributesByType } from "./typist-editor.helper.js";
|
|
3
|
+
import * as react from "react";
|
|
4
|
+
import { Editor, EditorEvents, Extensions } from "@tiptap/core";
|
|
5
|
+
import { Selection } from "@tiptap/pm/state";
|
|
6
|
+
|
|
7
|
+
//#region src/components/typist-editor.d.ts
|
|
5
8
|
/**
|
|
6
9
|
* The forwarded ref that describes the helper methods that the `TypistEditor` parent component
|
|
7
10
|
* will have access to.
|
|
8
11
|
*/
|
|
9
12
|
type TypistEditorRef = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Returns the `Editor` instance associated to the `TypistEditor` component.
|
|
15
|
+
*/
|
|
16
|
+
getEditor: () => Editor;
|
|
17
|
+
/**
|
|
18
|
+
* Returns the current editor document output as Markdown.
|
|
19
|
+
*/
|
|
20
|
+
getMarkdown: () => string;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the attributes of a given node type for all the nodes in the editor document.
|
|
23
|
+
*/
|
|
24
|
+
getAllNodesAttributesByType: (nodeType: string) => ReturnType<typeof getAllNodesAttributesByType>;
|
|
22
25
|
};
|
|
23
26
|
/**
|
|
24
27
|
* The properties that describe the `beforeCreate` editor event.
|
|
@@ -57,116 +60,116 @@ type DestroyProps = EditorEvents['destroy'];
|
|
|
57
60
|
* the supported WAI-ARIA 1.1 attributes.
|
|
58
61
|
*/
|
|
59
62
|
type TypistEditorProps = {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
63
|
+
/**
|
|
64
|
+
* Auto focus the editor to the end of the document on initialization.
|
|
65
|
+
*/
|
|
66
|
+
autoFocus?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* The CSS class for the container surrounding the editor DOM element.
|
|
69
|
+
*/
|
|
70
|
+
className?: string;
|
|
71
|
+
/**
|
|
72
|
+
* The initial Markdown content for the editor.
|
|
73
|
+
*/
|
|
74
|
+
content?: string;
|
|
75
|
+
/**
|
|
76
|
+
* The initial content selection (only applied if `autoFocus` is `true`).
|
|
77
|
+
*/
|
|
78
|
+
contentSelection?: Selection;
|
|
79
|
+
/**
|
|
80
|
+
* Determines if users can write into the editor.
|
|
81
|
+
*/
|
|
82
|
+
editable?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* The list of required extensions to initialize the editor.
|
|
85
|
+
*
|
|
86
|
+
* You may consider wrapping this prop with `useMemo` to prevent unnecessary re-renders.
|
|
87
|
+
*/
|
|
88
|
+
extensions: Extensions;
|
|
89
|
+
/**
|
|
90
|
+
* A short hint that gives users an idea what can be entered in the editor.
|
|
91
|
+
*/
|
|
92
|
+
placeholder?: string;
|
|
93
|
+
/**
|
|
94
|
+
* The event handler that is fired before the editor view is created.
|
|
95
|
+
*
|
|
96
|
+
* You may consider wrapping this prop with `useCallback` to prevent unnecessary re-renders.
|
|
97
|
+
*/
|
|
98
|
+
onBeforeCreate?: (props: BeforeCreateProps) => void;
|
|
99
|
+
/**
|
|
100
|
+
* The event handler that is fired when the editor view is ready.
|
|
101
|
+
*
|
|
102
|
+
* You may consider wrapping this prop with `useCallback` to prevent unnecessary re-renders.
|
|
103
|
+
*/
|
|
104
|
+
onCreate?: (props: CreateProps) => void;
|
|
105
|
+
/**
|
|
106
|
+
* The event handler that is fired when the editor content has changed.
|
|
107
|
+
*
|
|
108
|
+
* You may consider wrapping this prop with `useCallback` to prevent unnecessary re-renders.
|
|
109
|
+
*/
|
|
110
|
+
onUpdate?: (props: UpdateProps) => void;
|
|
111
|
+
/**
|
|
112
|
+
* The event handler that is fired when the editor selection has changed.
|
|
113
|
+
*
|
|
114
|
+
* You may consider wrapping this prop with `useCallback` to prevent unnecessary re-renders.
|
|
115
|
+
*/
|
|
116
|
+
onSelectionUpdate?: (props: SelectionUpdateProps) => void;
|
|
117
|
+
/**
|
|
118
|
+
* The event handler that is fired when the editor state has changed.
|
|
119
|
+
*
|
|
120
|
+
* You may consider wrapping this prop with `useCallback` to prevent unnecessary re-renders.
|
|
121
|
+
*/
|
|
122
|
+
onTransaction?: (props: TransacationProps) => void;
|
|
123
|
+
/**
|
|
124
|
+
* The event handler that is fired when the editor view gains focus.
|
|
125
|
+
*
|
|
126
|
+
* You may consider wrapping this prop with `useCallback` to prevent unnecessary re-renders.
|
|
127
|
+
*/
|
|
128
|
+
onFocus?: (props: FocusProps) => void;
|
|
129
|
+
/**
|
|
130
|
+
* The event handler that is fired when the editor view loses focus.
|
|
131
|
+
*
|
|
132
|
+
* You may consider wrapping this prop with `useCallback` to prevent unnecessary re-renders.
|
|
133
|
+
*/
|
|
134
|
+
onBlur?: (props: BlurProps) => void;
|
|
135
|
+
/**
|
|
136
|
+
* The event handler that is fired when the editor view is being destroyed.
|
|
137
|
+
*
|
|
138
|
+
* You may consider wrapping this prop with `useCallback` to prevent unnecessary re-renders.
|
|
139
|
+
*/
|
|
140
|
+
onDestroy?: (props: DestroyProps) => void;
|
|
141
|
+
/**
|
|
142
|
+
* Identifies the element (or elements) that describes the object.
|
|
143
|
+
*
|
|
144
|
+
* @see aria-labelledby
|
|
145
|
+
*/
|
|
146
|
+
'aria-describedby'?: React.AriaAttributes['aria-describedby'];
|
|
147
|
+
/**
|
|
148
|
+
* Defines a string value that labels the current element.
|
|
149
|
+
*
|
|
150
|
+
* @see aria-labelledby.
|
|
151
|
+
*/
|
|
152
|
+
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
153
|
+
/**
|
|
154
|
+
* Identifies the element (or elements) that labels the current element.
|
|
155
|
+
*
|
|
156
|
+
* @see aria-describedby.
|
|
157
|
+
*/
|
|
158
|
+
'aria-labelledby'?: React.AriaAttributes['aria-labelledby'];
|
|
159
|
+
/**
|
|
160
|
+
* The event handler that processes `click` events in the editor.
|
|
161
|
+
*/
|
|
162
|
+
onClick?: ViewEventHandlersOptions['onClick'];
|
|
163
|
+
/**
|
|
164
|
+
* The event handler that processes `keydown` events in the editor.
|
|
165
|
+
*/
|
|
166
|
+
onKeyDown?: ViewEventHandlersOptions['onKeyDown'];
|
|
164
167
|
};
|
|
165
168
|
/**
|
|
166
169
|
* The `TypistEditor` component represents a plain-text or a rich-text editing control, built on
|
|
167
170
|
* top of the amazing [Tiptap](https://tiptap.dev/) library.
|
|
168
171
|
*/
|
|
169
|
-
declare const TypistEditor:
|
|
170
|
-
|
|
171
|
-
export type
|
|
172
|
+
declare const TypistEditor: react.ForwardRefExoticComponent<TypistEditorProps & react.RefAttributes<TypistEditorRef>>;
|
|
173
|
+
//#endregion
|
|
174
|
+
export { type BeforeCreateProps, type BlurProps, type CreateProps, type DestroyProps, type FocusProps, type SelectionUpdateProps, type TransacationProps, TypistEditor, type TypistEditorProps, type TypistEditorRef, type UpdateProps };
|
|
172
175
|
//# sourceMappingURL=typist-editor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typist-editor.d.ts","
|
|
1
|
+
{"version":3,"file":"typist-editor.d.ts","names":[],"sources":["../../src/components/typist-editor.tsx"],"mappings":";;;;;;;;;;AAgBiD;KAM5C,eAAA;;;;EAID,SAAA,QAAiB,MAAA;EAYF;;;EAPf,WAAA;EAAA;;;EAKA,2BAAA,GACI,QAAA,aACC,UAAA,QAAkB,2BAAA;AAAA;;;AAA2B;KAMjD,iBAAA,GAAoB,YAAA;;;;KAKpB,WAAA,GAAc,YAAA;;;;KAKd,WAAA,GAAc,YAAA,aAAyB,IAAA,CAAK,eAAA;AALlB;;;AAAA,KAU1B,oBAAA,GAAuB,YAAA;;;;KAKvB,iBAAA,GAAoB,YAAA;;;;KAKpB,UAAA,GAAa,YAAA;;AAf8C;;KAoB3D,SAAA,GAAY,YAAA;;;AAfuB;KAoBnC,YAAA,GAAe,YAAA;;;;AAfiB;KAqBhC,iBAAA;;;;EAID,SAAA;EAfU;;;EAoBV,SAAA;EAfC;;;EAoBD,OAAA;EApB4B;AAAA;;EAyB5B,gBAAA,GAAmB,SAAA;EAAA;;;EAKnB,QAAA;EAiCmB;;;;;EA1BnB,UAAA,EAAY,UAAA;EAoES;;;EA/DrB,WAAA;EAuFY;;;;;EAhFZ,cAAA,IAAkB,KAAA,EAAO,iBAAA;EAxBzB;;;;;EA+BA,QAAA,IAAY,KAAA,EAAO,WAAA;EAPnB;;;;;EAcA,QAAA,IAAY,KAAA,EAAO,WAAA;EAAnB;;;;;EAOA,iBAAA,IAAqB,KAAA,EAAO,oBAAA;EAO5B;;;;;EAAA,aAAA,IAAiB,KAAA,EAAO,iBAAA;EAcxB;;;;;EAPA,OAAA,IAAW,KAAA,EAAO,UAAA;EAqBlB;;;;;EAdA,MAAA,IAAU,KAAA,EAAO,SAAA;EA4BjB;;;;;EArBA,SAAA,IAAa,KAAA,EAAO,YAAA;EA+BR;;;AAAwB;;EAxBpC,kBAAA,GAAqB,KAAA,CAAM,cAAA;EA+Bb;;;;;EAxBd,YAAA,GAAe,KAAA,CAAM,cAAA;EAwBP;;;;;EAjBd,iBAAA,GAAoB,KAAA,CAAM,cAAA;;;;EAK1B,OAAA,GAAU,wBAAA;;;;EAKV,SAAA,GAAY,wBAAA;AAAA;;;;;cAOV,YAAA,EAAY,KAAA,CAAA,yBAAA,CAAA,iBAAA,GAAA,KAAA,CAAA,aAAA,CAAA,eAAA"}
|
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
import { Selection } from
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* document size. This works similarly to the official `autoFocus` implementation.
|
|
6
|
-
*/
|
|
7
|
-
declare function resolveContentSelection(doc: ProseMirrorNode, selection: Selection): Selection;
|
|
1
|
+
import { Selection } from "@tiptap/pm/state";
|
|
2
|
+
import { Node } from "@tiptap/pm/model";
|
|
3
|
+
|
|
4
|
+
//#region src/components/typist-editor.helper.d.ts
|
|
8
5
|
/**
|
|
9
6
|
* The return type for the node attributes, an object mapping attribute names to values.
|
|
10
7
|
*/
|
|
11
8
|
type NodeAttributes = {
|
|
12
|
-
|
|
9
|
+
[key: string]: unknown;
|
|
13
10
|
};
|
|
14
11
|
/**
|
|
15
12
|
* Given a ProseMirror document and a node type, returns the attributes of the given node type for
|
|
16
13
|
* all the nodes in the document. This is based on the official implementation for the
|
|
17
14
|
* `findChildren` helper function.
|
|
18
15
|
*/
|
|
19
|
-
declare function getAllNodesAttributesByType(doc:
|
|
20
|
-
|
|
21
|
-
export
|
|
16
|
+
declare function getAllNodesAttributesByType(doc: Node, nodeType: string): Array<NodeAttributes>;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { getAllNodesAttributesByType };
|
|
22
19
|
//# sourceMappingURL=typist-editor.helper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typist-editor.helper.d.ts","
|
|
1
|
+
{"version":3,"file":"typist-editor.helper.d.ts","names":[],"sources":["../../src/components/typist-editor.helper.ts"],"mappings":";;;;;;AAwBgB;KADX,cAAA;EAAA,CACA,GAAA;AAAA;;;;;;iBAQI,2BAAA,CACL,GAAA,EAAK,IAAA,EACL,QAAA,WACD,KAAA,CAAM,cAAA"}
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import { Selection, TextSelection } from
|
|
2
|
-
import { clamp } from
|
|
1
|
+
import { Selection, TextSelection } from "@tiptap/pm/state";
|
|
2
|
+
import { clamp } from "lodash-es";
|
|
3
|
+
//#region src/components/typist-editor.helper.ts
|
|
3
4
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
* Given a ProseMirror document, and a selection, resolves that selection within the bounds of the
|
|
6
|
+
* document size. This works similarly to the official `autoFocus` implementation.
|
|
7
|
+
*/
|
|
7
8
|
function resolveContentSelection(doc, selection) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const minPos = Selection.atStart(doc).from;
|
|
10
|
+
const maxPos = Selection.atEnd(doc).to;
|
|
11
|
+
return TextSelection.create(doc, clamp(selection.anchor, minPos, maxPos), clamp(selection.head, minPos, maxPos));
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
* Given a ProseMirror document and a node type, returns the attributes of the given node type for
|
|
15
|
+
* all the nodes in the document. This is based on the official implementation for the
|
|
16
|
+
* `findChildren` helper function.
|
|
17
|
+
*/
|
|
17
18
|
function getAllNodesAttributesByType(doc, nodeType) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
});
|
|
24
|
-
return result;
|
|
19
|
+
const result = [];
|
|
20
|
+
doc.descendants((node) => {
|
|
21
|
+
if (node.type.name === nodeType) result.push(node.attrs);
|
|
22
|
+
});
|
|
23
|
+
return result;
|
|
25
24
|
}
|
|
25
|
+
//#endregion
|
|
26
26
|
export { getAllNodesAttributesByType, resolveContentSelection };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=typist-editor.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typist-editor.helper.js","names":[],"sources":["../../src/components/typist-editor.helper.ts"],"sourcesContent":["import { Selection, TextSelection } from '@tiptap/pm/state'\nimport { clamp } from 'lodash-es'\n\nimport type { Node as ProseMirrorNode } from '@tiptap/pm/model'\n\n/**\n * Given a ProseMirror document, and a selection, resolves that selection within the bounds of the\n * document size. This works similarly to the official `autoFocus` implementation.\n */\nfunction resolveContentSelection(doc: ProseMirrorNode, selection: Selection): Selection {\n const minPos = Selection.atStart(doc).from\n const maxPos = Selection.atEnd(doc).to\n\n return TextSelection.create(\n doc,\n clamp(selection.anchor, minPos, maxPos),\n clamp(selection.head, minPos, maxPos),\n )\n}\n\n/**\n * The return type for the node attributes, an object mapping attribute names to values.\n */\ntype NodeAttributes = {\n [key: string]: unknown\n}\n\n/**\n * Given a ProseMirror document and a node type, returns the attributes of the given node type for\n * all the nodes in the document. This is based on the official implementation for the\n * `findChildren` helper function.\n */\nfunction getAllNodesAttributesByType(\n doc: ProseMirrorNode,\n nodeType: string,\n): Array<NodeAttributes> {\n const result: Array<NodeAttributes> = []\n\n doc.descendants((node) => {\n if (node.type.name === nodeType) {\n result.push(node.attrs)\n }\n })\n\n return result\n}\n\nexport { getAllNodesAttributesByType, resolveContentSelection }\n\nexport type { NodeAttributes }\n"],"mappings":";;;;;;;AASA,SAAS,wBAAwB,KAAsB,WAAiC;CACpF,MAAM,SAAS,UAAU,QAAQ,IAAI,CAAC;CACtC,MAAM,SAAS,UAAU,MAAM,IAAI,CAAC;AAEpC,QAAO,cAAc,OACjB,KACA,MAAM,UAAU,QAAQ,QAAQ,OAAO,EACvC,MAAM,UAAU,MAAM,QAAQ,OAAO,CACxC;;;;;;;AAeL,SAAS,4BACL,KACA,UACqB;CACrB,MAAM,SAAgC,EAAE;AAExC,KAAI,aAAa,SAAS;AACtB,MAAI,KAAK,KAAK,SAAS,SACnB,QAAO,KAAK,KAAK,MAAM;GAE7B;AAEF,QAAO"}
|