@doist/typist 10.0.0-next.1 → 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 +4 -3
- 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,39 +1,35 @@
|
|
|
1
|
-
import { extractTagsFromParseRules } from
|
|
2
|
-
|
|
1
|
+
import { extractTagsFromParseRules } from "../../../helpers/serializer.js";
|
|
2
|
+
//#region src/serializers/markdown/plugins/task-item.ts
|
|
3
3
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
* A Turndown plugin which adds a rule for task list items (i.e., `* [ ] Task`), based on the
|
|
5
|
+
* original list item rule. This rule not only avoids conflicts with standard list items, but also
|
|
6
|
+
* normalizes the Markdown output.
|
|
7
|
+
*
|
|
8
|
+
* @see https://github.com/mixmark-io/turndown/blob/v7.1.1/src/commonmark-rules.js#L61
|
|
9
|
+
*
|
|
10
|
+
* @param nodeType The node object that matches this rule.
|
|
11
|
+
*/
|
|
12
12
|
function taskItem(nodeType) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
.replace(/\n+$/, '\n')
|
|
32
|
-
// Indent list items with 4 spaces
|
|
33
|
-
.replace(/\s*\n/gm, '\n ');
|
|
34
|
-
return `${listItemMarker}${newContent.trim()}${node.nextSibling && !newContent.endsWith('\n') ? '\n' : ''}`;
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
};
|
|
13
|
+
const tags = extractTagsFromParseRules(nodeType.spec.parseDOM);
|
|
14
|
+
return (turndown) => {
|
|
15
|
+
turndown.addRule(nodeType.name, {
|
|
16
|
+
filter(node) {
|
|
17
|
+
return tags.some((tag) => tag.toUpperCase().startsWith(node.nodeName)) && node.getAttribute("data-type") === "taskItem";
|
|
18
|
+
},
|
|
19
|
+
replacement(content, node) {
|
|
20
|
+
const parentNode = node.parentNode;
|
|
21
|
+
let listItemMarker = `- `;
|
|
22
|
+
if (parentNode?.nodeName === "UL") {
|
|
23
|
+
const checked = node.getAttribute("data-checked");
|
|
24
|
+
listItemMarker = `${listItemMarker}${checked === "true" ? "[x]" : "[ ]"} `;
|
|
25
|
+
}
|
|
26
|
+
const newContent = content.replace(/^\n+/, "").replace(/\n+$/, "\n").replace(/\s*\n/gm, "\n ");
|
|
27
|
+
return `${listItemMarker}${newContent.trim()}${node.nextSibling && !newContent.endsWith("\n") ? "\n" : ""}`;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
};
|
|
38
31
|
}
|
|
32
|
+
//#endregion
|
|
39
33
|
export { taskItem };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=task-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-item.js","names":[],"sources":["../../../../src/serializers/markdown/plugins/task-item.ts"],"sourcesContent":["import { extractTagsFromParseRules } from '../../../helpers/serializer'\nimport { BULLET_LIST_MARKER } from '../markdown'\n\nimport type { NodeType } from '@tiptap/pm/model'\nimport type Turndown from 'turndown'\n\n/**\n * A Turndown plugin which adds a rule for task list items (i.e., `* [ ] Task`), based on the\n * original list item rule. This rule not only avoids conflicts with standard list items, but also\n * normalizes the Markdown output.\n *\n * @see https://github.com/mixmark-io/turndown/blob/v7.1.1/src/commonmark-rules.js#L61\n *\n * @param nodeType The node object that matches this rule.\n */\nfunction taskItem(nodeType: NodeType): Turndown.Plugin {\n const tags = extractTagsFromParseRules(nodeType.spec.parseDOM)\n\n return (turndown: Turndown) => {\n turndown.addRule(nodeType.name, {\n filter(node) {\n return (\n tags.some((tag) => tag.toUpperCase().startsWith(node.nodeName)) &&\n node.getAttribute('data-type') === 'taskItem'\n )\n },\n replacement(content, node) {\n const parentNode = node.parentNode as HTMLElement\n let listItemMarker = `${BULLET_LIST_MARKER} `\n\n if (parentNode?.nodeName === 'UL') {\n const checked = (node as HTMLLIElement).getAttribute('data-checked')\n listItemMarker = `${listItemMarker}${checked === 'true' ? '[x]' : '[ ]'} `\n }\n\n const newContent = content\n // Remove leading newlines\n .replace(/^\\n+/, '')\n // Replace trailing newlines with a single one\n .replace(/\\n+$/, '\\n')\n // Indent list items with 4 spaces\n .replace(/\\s*\\n/gm, '\\n ')\n\n return `${listItemMarker}${newContent.trim()}${\n node.nextSibling && !newContent.endsWith('\\n') ? '\\n' : ''\n }`\n },\n })\n }\n}\n\nexport { taskItem }\n"],"mappings":";;;;;;;;;;;AAeA,SAAS,SAAS,UAAqC;CACnD,MAAM,OAAO,0BAA0B,SAAS,KAAK,SAAS;AAE9D,SAAQ,aAAuB;AAC3B,WAAS,QAAQ,SAAS,MAAM;GAC5B,OAAO,MAAM;AACT,WACI,KAAK,MAAM,QAAQ,IAAI,aAAa,CAAC,WAAW,KAAK,SAAS,CAAC,IAC/D,KAAK,aAAa,YAAY,KAAK;;GAG3C,YAAY,SAAS,MAAM;IACvB,MAAM,aAAa,KAAK;IACxB,IAAI,iBAAiB;AAErB,QAAI,YAAY,aAAa,MAAM;KAC/B,MAAM,UAAW,KAAuB,aAAa,eAAe;AACpE,sBAAiB,GAAG,iBAAiB,YAAY,SAAS,QAAQ,MAAM;;IAG5E,MAAM,aAAa,QAEd,QAAQ,QAAQ,GAAG,CAEnB,QAAQ,QAAQ,KAAK,CAErB,QAAQ,WAAW,SAAS;AAEjC,WAAO,GAAG,iBAAiB,WAAW,MAAM,GACxC,KAAK,eAAe,CAAC,WAAW,SAAS,KAAK,GAAG,OAAO;;GAGnE,CAAC"}
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Editor, Range } from "@tiptap/core";
|
|
2
|
+
|
|
3
|
+
//#region src/utilities/can-insert-node-at.d.ts
|
|
2
4
|
/**
|
|
3
5
|
* Check if a node of a specific type can be inserted at a specific position in the editor.
|
|
4
6
|
*
|
|
5
7
|
* @return True if the node can be inserted, false otherwise.
|
|
6
8
|
*/
|
|
7
|
-
declare function canInsertNodeAt({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
declare function canInsertNodeAt({
|
|
10
|
+
editor,
|
|
11
|
+
nodeType,
|
|
12
|
+
range
|
|
13
|
+
}: {
|
|
14
|
+
editor: Editor;
|
|
15
|
+
nodeType: string;
|
|
16
|
+
range: Range;
|
|
11
17
|
}): boolean;
|
|
18
|
+
//#endregion
|
|
12
19
|
export { canInsertNodeAt };
|
|
13
20
|
//# sourceMappingURL=can-insert-node-at.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"can-insert-node-at.d.ts","
|
|
1
|
+
{"version":3,"file":"can-insert-node-at.d.ts","names":[],"sources":["../../src/utilities/can-insert-node-at.ts"],"mappings":";;;;;AAAiD;;;iBAOxC,eAAA,CAAA;EACL,MAAA;EACA,QAAA;EACA;AAAA;EAEA,MAAA,EAAQ,MAAA;EACR,QAAA;EACA,KAAA,EAAO,KAAA;AAAA"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
//#region src/utilities/can-insert-node-at.ts
|
|
1
2
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function canInsertNodeAt({ editor, nodeType, range
|
|
7
|
-
|
|
8
|
-
type: nodeType,
|
|
9
|
-
});
|
|
3
|
+
* Check if a node of a specific type can be inserted at a specific position in the editor.
|
|
4
|
+
*
|
|
5
|
+
* @return True if the node can be inserted, false otherwise.
|
|
6
|
+
*/
|
|
7
|
+
function canInsertNodeAt({ editor, nodeType, range }) {
|
|
8
|
+
return editor.can().insertContentAt(range, { type: nodeType });
|
|
10
9
|
}
|
|
10
|
+
//#endregion
|
|
11
11
|
export { canInsertNodeAt };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=can-insert-node-at.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"can-insert-node-at.js","names":[],"sources":["../../src/utilities/can-insert-node-at.ts"],"sourcesContent":["import type { Editor, Range } from '@tiptap/core'\n\n/**\n * Check if a node of a specific type can be inserted at a specific position in the editor.\n *\n * @return True if the node can be inserted, false otherwise.\n */\nfunction canInsertNodeAt({\n editor,\n nodeType,\n range,\n}: {\n editor: Editor\n nodeType: string\n range: Range\n}) {\n return editor.can().insertContentAt(range, {\n type: nodeType,\n })\n}\n\nexport { canInsertNodeAt }\n"],"mappings":";;;;;;AAOA,SAAS,gBAAgB,EACrB,QACA,UACA,SAKD;AACC,QAAO,OAAO,KAAK,CAAC,gBAAgB,OAAO,EACvC,MAAM,UACT,CAAC"}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { Editor } from "@tiptap/core";
|
|
2
|
+
import { EditorState } from "@tiptap/pm/state";
|
|
3
|
+
|
|
4
|
+
//#region src/utilities/can-insert-suggestion.d.ts
|
|
3
5
|
/**
|
|
4
6
|
* Check if a suggestion can be inserted within the current editor selection.
|
|
5
7
|
*
|
|
6
8
|
* @return True if the suggestion can be inserted, false otherwise.
|
|
7
9
|
*/
|
|
8
|
-
declare function canInsertSuggestion({
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
declare function canInsertSuggestion({
|
|
11
|
+
editor,
|
|
12
|
+
state
|
|
13
|
+
}: {
|
|
14
|
+
editor: Editor;
|
|
15
|
+
state: EditorState;
|
|
11
16
|
}): boolean;
|
|
17
|
+
//#endregion
|
|
12
18
|
export { canInsertSuggestion };
|
|
13
19
|
//# sourceMappingURL=can-insert-suggestion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"can-insert-suggestion.d.ts","
|
|
1
|
+
{"version":3,"file":"can-insert-suggestion.d.ts","names":[],"sources":["../../src/utilities/can-insert-suggestion.ts"],"mappings":";;;;;;AACmD;;;iBAO1C,mBAAA,CAAA;EAAsB,MAAA;EAAQ;AAAA;EAAW,MAAA,EAAQ,MAAA;EAAQ,KAAA,EAAO,WAAA;AAAA"}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
+
//#region src/utilities/can-insert-suggestion.ts
|
|
1
2
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
* Check if a suggestion can be inserted within the current editor selection.
|
|
4
|
+
*
|
|
5
|
+
* @return True if the suggestion can be inserted, false otherwise.
|
|
6
|
+
*/
|
|
6
7
|
function canInsertSuggestion({ editor, state }) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return (!isInsideCodeMark && !isInsideCodeBlockNode && !hasCodeMarkBefore && !isComposingInlineCode);
|
|
8
|
+
const { selection } = state;
|
|
9
|
+
const isInsideCodeMark = editor.isActive("code");
|
|
10
|
+
const isInsideCodeBlockNode = selection.$from.parent.type.name === "codeBlock";
|
|
11
|
+
const wordsBeforeSelection = (selection.$from.nodeBefore?.text ?? "").split(" ");
|
|
12
|
+
const hasCodeMarkBefore = (selection.$from.parent.cut(selection.$from.parentOffset - wordsBeforeSelection.slice(-1)[0].length - 1, selection.$from.parentOffset - 1).content.firstChild?.marks ?? []).some((mark) => mark.type.name === "code");
|
|
13
|
+
const isComposingInlineCode = wordsBeforeSelection.some((word) => word.startsWith("`"));
|
|
14
|
+
return !isInsideCodeMark && !isInsideCodeBlockNode && !hasCodeMarkBefore && !isComposingInlineCode;
|
|
15
15
|
}
|
|
16
|
+
//#endregion
|
|
16
17
|
export { canInsertSuggestion };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=can-insert-suggestion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"can-insert-suggestion.js","names":[],"sources":["../../src/utilities/can-insert-suggestion.ts"],"sourcesContent":["import type { Editor } from '@tiptap/core'\nimport type { EditorState } from '@tiptap/pm/state'\n\n/**\n * Check if a suggestion can be inserted within the current editor selection.\n *\n * @return True if the suggestion can be inserted, false otherwise.\n */\nfunction canInsertSuggestion({ editor, state }: { editor: Editor; state: EditorState }) {\n const { selection } = state\n\n const isInsideCodeMark = editor.isActive('code')\n\n const isInsideCodeBlockNode = selection.$from.parent.type.name === 'codeBlock'\n\n const wordsBeforeSelection = (selection.$from.nodeBefore?.text ?? '').split(' ')\n const nodeBeforeSelection = selection.$from.parent.cut(\n selection.$from.parentOffset - wordsBeforeSelection.slice(-1)[0].length - 1,\n selection.$from.parentOffset - 1,\n ).content.firstChild\n\n const hasCodeMarkBefore = (nodeBeforeSelection?.marks ?? []).some(\n (mark) => mark.type.name === 'code',\n )\n\n const isComposingInlineCode = wordsBeforeSelection.some((word) => word.startsWith('`'))\n\n return (\n !isInsideCodeMark && !isInsideCodeBlockNode && !hasCodeMarkBefore && !isComposingInlineCode\n )\n}\n\nexport { canInsertSuggestion }\n"],"mappings":";;;;;;AAQA,SAAS,oBAAoB,EAAE,QAAQ,SAAiD;CACpF,MAAM,EAAE,cAAc;CAEtB,MAAM,mBAAmB,OAAO,SAAS,OAAO;CAEhD,MAAM,wBAAwB,UAAU,MAAM,OAAO,KAAK,SAAS;CAEnE,MAAM,wBAAwB,UAAU,MAAM,YAAY,QAAQ,IAAI,MAAM,IAAI;CAMhF,MAAM,qBALsB,UAAU,MAAM,OAAO,IAC/C,UAAU,MAAM,eAAe,qBAAqB,MAAM,GAAG,CAAC,GAAG,SAAS,GAC1E,UAAU,MAAM,eAAe,EAClC,CAAC,QAAQ,YAEsC,SAAS,EAAE,EAAE,MACxD,SAAS,KAAK,KAAK,SAAS,OAChC;CAED,MAAM,wBAAwB,qBAAqB,MAAM,SAAS,KAAK,WAAW,IAAI,CAAC;AAEvF,QACI,CAAC,oBAAoB,CAAC,yBAAyB,CAAC,qBAAqB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doist/typist",
|
|
3
3
|
"description": "The mighty Tiptap-based rich-text editor React component that powers Doist products.",
|
|
4
|
-
"version": "10.0.0-next.
|
|
4
|
+
"version": "10.0.0-next.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://typist.doist.dev/",
|
|
7
7
|
"repository": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"sideEffects": false,
|
|
21
21
|
"engines": {
|
|
22
|
-
"node": "^22.
|
|
22
|
+
"node": "^22.18.0 || >= 24.10.0",
|
|
23
23
|
"npm": "^10.9.2 || >= 11.5.1"
|
|
24
24
|
},
|
|
25
25
|
"publishConfig": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"build": "run-s clean:* build:typist",
|
|
38
38
|
"postbuild": "publint",
|
|
39
39
|
"build:storybook": "storybook build",
|
|
40
|
-
"build:typist": "
|
|
40
|
+
"build:typist": "tsdown",
|
|
41
41
|
"check": "run-p check:* -c -l -t",
|
|
42
42
|
"check:eslint": "eslint --format codeframe --cache --cache-location ./.cache/.eslintcache --ext js,jsx,ts,tsx ./",
|
|
43
43
|
"check:prettier": "prettier --check \"./**/*.{js,jsx,ts,tsx,json,css,yml,md}\"",
|
|
@@ -146,6 +146,7 @@
|
|
|
146
146
|
"storybook": "10.2.16",
|
|
147
147
|
"storybook-css-modules": "1.0.8",
|
|
148
148
|
"tippy.js": "6.3.7",
|
|
149
|
+
"tsdown": "0.21.2",
|
|
149
150
|
"type-fest": "5.4.4",
|
|
150
151
|
"typescript": "5.9.3",
|
|
151
152
|
"typescript-plugin-css-modules": "5.2.0",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* An enum-like constant for clipboard `DataTransfer.types` that are supported by the editor.
|
|
3
|
-
*/
|
|
4
|
-
declare const ClipboardDataType: {
|
|
5
|
-
readonly Text: "text/plain";
|
|
6
|
-
readonly HTML: "text/html";
|
|
7
|
-
readonly VSCode: "vscode-editor-data";
|
|
8
|
-
};
|
|
9
|
-
export { ClipboardDataType };
|
|
10
|
-
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/constants/common.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,QAAA,MAAM,iBAAiB;;;;CAIb,CAAA;AAEV,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A common regular expression for all line termination conventions.
|
|
3
|
-
*/
|
|
4
|
-
declare const REGEX_LINE_BREAKS: RegExp;
|
|
5
|
-
/**
|
|
6
|
-
* A regular expression for standard punctuation characters for US-ASCII plus unicode punctuation.
|
|
7
|
-
*
|
|
8
|
-
* @see https://stackoverflow.com/a/25575009
|
|
9
|
-
*/
|
|
10
|
-
declare const REGEX_PUNCTUATION: RegExp;
|
|
11
|
-
/**
|
|
12
|
-
* The perfect URL validation regular expression for Web URLs.
|
|
13
|
-
*
|
|
14
|
-
* @see https://mathiasbynens.be/demo/url-regex
|
|
15
|
-
*/
|
|
16
|
-
declare const REGEX_WEB_URL: RegExp;
|
|
17
|
-
export { REGEX_LINE_BREAKS, REGEX_PUNCTUATION, REGEX_WEB_URL };
|
|
18
|
-
//# sourceMappingURL=regular-expressions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"regular-expressions.d.ts","sourceRoot":"","sources":["../../src/constants/regular-expressions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,QAAA,MAAM,iBAAiB,QAAoB,CAAA;AAE3C;;;;GAIG;AACH,QAAA,MAAM,iBAAiB,QAAoE,CAAA;AAE3F;;;;GAIG;AACH,QAAA,MAAM,aAAa,QACwZ,CAAA;AAE3a,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core';
|
|
2
|
-
/**
|
|
3
|
-
* The `ExtraEditorCommands` extension is a collection of editor commands that provide additional
|
|
4
|
-
* helper commands not available with the built-in commands. This extension was built similarly to
|
|
5
|
-
* the official `Commands` extension.
|
|
6
|
-
*/
|
|
7
|
-
declare const ExtraEditorCommands: Extension<any, any>;
|
|
8
|
-
export { ExtraEditorCommands };
|
|
9
|
-
//# sourceMappingURL=extra-editor-commands.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extra-editor-commands.d.ts","sourceRoot":"","sources":["../../../../src/extensions/core/extra-editor-commands/extra-editor-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAOxC;;;;GAIG;AACH,QAAA,MAAM,mBAAmB,qBAUvB,CAAA;AAEF,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core';
|
|
2
|
-
/**
|
|
3
|
-
* The `MultilineDocumentPaste` extension preserves paragraphs (including empty ones) when
|
|
4
|
-
* copying-and-pasting text into the editor, or when inputting multiline text with some sort of
|
|
5
|
-
* automatic text insertion shortcut. This custom extension is required for a plain-text editor
|
|
6
|
-
* configured with `multiline: true`, so that multiline clipboard text is pasted correctly.
|
|
7
|
-
*/
|
|
8
|
-
declare const PasteMultilineText: Extension<any, any>;
|
|
9
|
-
export { PasteMultilineText };
|
|
10
|
-
//# sourceMappingURL=paste-multiline-text.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paste-multiline-text.d.ts","sourceRoot":"","sources":["../../../src/extensions/plain-text/paste-multiline-text.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AA+CxC;;;;;GAKG;AACH,QAAA,MAAM,kBAAkB,qBA0BtB,CAAA;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plain-text-paragraph.d.ts","sourceRoot":"","sources":["../../../src/extensions/plain-text/plain-text-paragraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAEzE;;;GAGG;AACH,QAAA,MAAM,kBAAkB,oDAMtB,CAAA;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAA;AAE7B,YAAY,EAAE,gBAAgB,IAAI,yBAAyB,EAAE,CAAA"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Plugin } from '@tiptap/pm/state';
|
|
2
|
-
/**
|
|
3
|
-
* This plugin provides a more plesant typing experience for both standard and task lists, adding
|
|
4
|
-
* the list marker automatically when pressing the `Enter` key, and it also supports list items
|
|
5
|
-
* indentation with the `Tab` and `Shift+Tab` keys, forward and backward, respectively.
|
|
6
|
-
*/
|
|
7
|
-
declare const smartLists: Plugin<any>;
|
|
8
|
-
export { smartLists };
|
|
9
|
-
//# sourceMappingURL=smart-lists.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"smart-lists.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/plain-text/smart-markdown-typing/plugins/smart-lists.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAa,MAAM,kBAAkB,CAAA;AAsBpD;;;;GAIG;AACH,QAAA,MAAM,UAAU,aAsFd,CAAA;AAEF,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Plugin } from '@tiptap/pm/state';
|
|
2
|
-
/**
|
|
3
|
-
* This plugin wraps a selection with matching symbols based on the typed character, wrapping the
|
|
4
|
-
* selection with the corresponding opening and closing bracket symbols when appropriate. This
|
|
5
|
-
* plugin does not have support for multiple selection ranges.
|
|
6
|
-
*/
|
|
7
|
-
declare const smartSelectWrap: Plugin<any>;
|
|
8
|
-
export { smartSelectWrap };
|
|
9
|
-
//# sourceMappingURL=smart-select-wrap.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"smart-select-wrap.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/plain-text/smart-markdown-typing/plugins/smart-select-wrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA4B,MAAM,kBAAkB,CAAA;AAsBnE;;;;GAIG;AACH,QAAA,MAAM,eAAe,aA+BnB,CAAA;AAEF,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Plugin } from '@tiptap/pm/state';
|
|
2
|
-
/**
|
|
3
|
-
* This plugin replaces a selection with the pasted URL using proper link syntax; unless the
|
|
4
|
-
* selection is itself a URL, which in that case the selection will just be replaced by the pasted
|
|
5
|
-
* URL. This plugin does not have support for multiple selection ranges.
|
|
6
|
-
*/
|
|
7
|
-
declare const smartUrlPasting: Plugin<any>;
|
|
8
|
-
export { smartUrlPasting };
|
|
9
|
-
//# sourceMappingURL=smart-url-pasting.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"smart-url-pasting.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/plain-text/smart-markdown-typing/plugins/smart-url-pasting.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA4B,MAAM,kBAAkB,CAAA;AAanE;;;;GAIG;AACH,QAAA,MAAM,eAAe,aAsCnB,CAAA;AAEF,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core';
|
|
2
|
-
/**
|
|
3
|
-
* The `SmartMarkdownTyping` extension is a collection of ProseMirror plugins that attempts to mimic
|
|
4
|
-
* a smart GitHub like typing experience, and is only meant to be used with a plain-text editor.
|
|
5
|
-
*/
|
|
6
|
-
declare const SmartMarkdownTyping: Extension<any, any>;
|
|
7
|
-
export { SmartMarkdownTyping };
|
|
8
|
-
//# sourceMappingURL=smart-markdown-typing.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"smart-markdown-typing.d.ts","sourceRoot":"","sources":["../../../../src/extensions/plain-text/smart-markdown-typing/smart-markdown-typing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAQxC;;;GAGG;AACH,QAAA,MAAM,mBAAmB,qBAMvB,CAAA;AAEF,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Mark } from '@tiptap/core';
|
|
2
|
-
/**
|
|
3
|
-
* The `BoldAndItalics` extension adds the ability to use the `***` and `___` Markdown shortcuts
|
|
4
|
-
* when typing and pasting into the editor.
|
|
5
|
-
*/
|
|
6
|
-
declare const BoldAndItalics: Mark<any, any>;
|
|
7
|
-
export { BoldAndItalics };
|
|
8
|
-
//# sourceMappingURL=bold-and-italics.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bold-and-italics.d.ts","sourceRoot":"","sources":["../../../src/extensions/rich-text/bold-and-italics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAgC,MAAM,cAAc,CAAA;AAsBjE;;;GAGG;AACH,QAAA,MAAM,cAAc,gBA6BlB,CAAA;AAEF,OAAO,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core';
|
|
2
|
-
/**
|
|
3
|
-
* The `CurvenoteCodemark` extension adds a plugin for ProseMirror that makes it easier to handle,
|
|
4
|
-
* and navigate inline code marks. The plugin creates a fake cursor (if necessary) to show if the
|
|
5
|
-
* next character to be typed will or will not be inside the inline code mark.
|
|
6
|
-
*
|
|
7
|
-
* @see https://github.com/curvenote/prosemirror-codemark
|
|
8
|
-
*/
|
|
9
|
-
declare const CurvenoteCodemark: Extension<any, any>;
|
|
10
|
-
export { CurvenoteCodemark };
|
|
11
|
-
//# sourceMappingURL=curvenote-codemark.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"curvenote-codemark.d.ts","sourceRoot":"","sources":["../../../src/extensions/rich-text/curvenote-codemark.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAGxC;;;;;;GAMG;AACH,QAAA,MAAM,iBAAiB,qBAOrB,CAAA;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core';
|
|
2
|
-
/**
|
|
3
|
-
* The `PasteEmojis` extension adds the ability to paste HTML image emojis as unicode characters
|
|
4
|
-
* into the editor, ignoring the HTML image source. This extension works by replacing all `<img>`
|
|
5
|
-
* tags with the emoji unicode character, if one is found in the `alt` attribute.
|
|
6
|
-
*/
|
|
7
|
-
declare const PasteEmojis: Extension<any, any>;
|
|
8
|
-
export { PasteEmojis };
|
|
9
|
-
//# sourceMappingURL=paste-emojis.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paste-emojis.d.ts","sourceRoot":"","sources":["../../../src/extensions/rich-text/paste-emojis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAaxC;;;;GAIG;AACH,QAAA,MAAM,WAAW,qBAcf,CAAA;AAEF,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core';
|
|
2
|
-
/**
|
|
3
|
-
* The `PasteMarkdown` extension adds the ability to paste Markdown as HTML into the editor,
|
|
4
|
-
* providing full rich-text support to the pasted content. The pasting behavior was inspired from
|
|
5
|
-
* the GitLab implementation, and adapted to our requirements.
|
|
6
|
-
*
|
|
7
|
-
* @see https://gitlab.com/gitlab-org/gitlab/-/blob/v14.10.0-ee/app/assets/javascripts/content_editor/extensions/paste_markdown.js
|
|
8
|
-
*/
|
|
9
|
-
declare const PasteMarkdown: Extension<any, any>;
|
|
10
|
-
export { PasteMarkdown };
|
|
11
|
-
//# sourceMappingURL=paste-markdown.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paste-markdown.d.ts","sourceRoot":"","sources":["../../../src/extensions/rich-text/paste-markdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAkBxC;;;;;;GAMG;AACH,QAAA,MAAM,aAAa,qBA2GjB,CAAA;AAEF,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { CodeOptions } from '@tiptap/extension-code';
|
|
2
|
-
/**
|
|
3
|
-
* The options available to customize the `RichTextCode` extension.
|
|
4
|
-
*/
|
|
5
|
-
type RichTextCodeOptions = CodeOptions;
|
|
6
|
-
/**
|
|
7
|
-
* Custom extension that extends the built-in `Code` extension to allow all marks (e.g., Bold,
|
|
8
|
-
* Italic, and Strikethrough) to coexist with the `Code` mark (as opposed to disallowing all any
|
|
9
|
-
* other mark by default).
|
|
10
|
-
*
|
|
11
|
-
* @see https://tiptap.dev/api/schema#excludes
|
|
12
|
-
* @see https://prosemirror.net/docs/ref/#model.MarkSpec.excludes
|
|
13
|
-
*/
|
|
14
|
-
declare const RichTextCode: import("@tiptap/core").Mark<CodeOptions, any>;
|
|
15
|
-
export { RichTextCode };
|
|
16
|
-
export type { RichTextCodeOptions };
|
|
17
|
-
//# sourceMappingURL=rich-text-code.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rich-text-code.d.ts","sourceRoot":"","sources":["../../../src/extensions/rich-text/rich-text-code.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEzD;;GAEG;AACH,KAAK,mBAAmB,GAAG,WAAW,CAAA;AActC;;;;;;;GAOG;AACH,QAAA,MAAM,YAAY,+CAmBhB,CAAA;AAEF,OAAO,EAAE,YAAY,EAAE,CAAA;AAEvB,YAAY,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core';
|
|
2
|
-
/**
|
|
3
|
-
* The options available to customize the `CopyMarkdownSource` extension.
|
|
4
|
-
*/
|
|
5
|
-
type CopyMarkdownSourceOptions = {
|
|
6
|
-
/**
|
|
7
|
-
* The keyboard shortcut to copy the editor underlying Markdown source to the system clipboard
|
|
8
|
-
* (default: `Mod-c`).
|
|
9
|
-
*/
|
|
10
|
-
keyboardShortcut: string;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* The `CopyMarkdownSource` extension adds the ability to copy the editor underlying Markdown
|
|
14
|
-
* source, and write it to the system clipboard. This extension has full support for both the
|
|
15
|
-
* plain-text and rich-text editors, considering that it's powered by the Markdown serializer.
|
|
16
|
-
*/
|
|
17
|
-
declare const CopyMarkdownSource: Extension<CopyMarkdownSourceOptions, any>;
|
|
18
|
-
export { CopyMarkdownSource };
|
|
19
|
-
export type { CopyMarkdownSourceOptions };
|
|
20
|
-
//# sourceMappingURL=copy-markdown-source.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"copy-markdown-source.d.ts","sourceRoot":"","sources":["../../../src/extensions/shared/copy-markdown-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAuB,MAAM,cAAc,CAAA;AAI7D;;GAEG;AACH,KAAK,yBAAyB,GAAG;IAC7B;;;OAGG;IACH,gBAAgB,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED;;;;GAIG;AACH,QAAA,MAAM,kBAAkB,2CAkCtB,CAAA;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAA;AAE7B,YAAY,EAAE,yBAAyB,EAAE,CAAA"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core';
|
|
2
|
-
/**
|
|
3
|
-
* Transforms pasted HTML by converting tables to paragraphs while preserving surrounding content.
|
|
4
|
-
*/
|
|
5
|
-
declare function transformPastedHTML(html: string): string;
|
|
6
|
-
/**
|
|
7
|
-
* The `PasteHTMLTableAsString` extension adds the ability to paste a table copied from a spreadsheet
|
|
8
|
-
* web app (e.g., Google Sheets, Microsoft Excel), along with tables rendered by GitHub Flavored
|
|
9
|
-
* Markdown (GFM), into the editor.
|
|
10
|
-
*
|
|
11
|
-
* Since Typist does not yet support tables, this extension simply pastes the table as a string of
|
|
12
|
-
* paragraphs (one paragraph per row), with each cell separated by a space character. However,
|
|
13
|
-
* whenever we do add support for tables, this extension will need to be completely rewritten.
|
|
14
|
-
*
|
|
15
|
-
* Lastly, please note that formatting is lost when the copied table comes from Google Sheets or
|
|
16
|
-
* Microsoft Excel, because unfortunately, these apps style the cell contents using CSS.
|
|
17
|
-
*/
|
|
18
|
-
declare const PasteHTMLTableAsString: Extension<any, any>;
|
|
19
|
-
export { PasteHTMLTableAsString, transformPastedHTML };
|
|
20
|
-
//# sourceMappingURL=paste-html-table-as-string.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paste-html-table-as-string.d.ts","sourceRoot":"","sources":["../../../src/extensions/shared/paste-html-table-as-string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAMxC;;GAEG;AACH,iBAAS,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAwCjD;AAED;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,sBAAsB,qBAa1B,CAAA;AAEF,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core';
|
|
2
|
-
/**
|
|
3
|
-
* The `PasteSinglelineText` extension joins all paragraphs into a single fragment when
|
|
4
|
-
* copying-and-pasting text into the editor, adding spaces as block separators. This custom
|
|
5
|
-
* extension is required for an editor configured with `multiline: false`, so that multiline
|
|
6
|
-
* clipboard text is pasted into the singleline editor correctly.
|
|
7
|
-
*/
|
|
8
|
-
declare const PasteSinglelineText: Extension<any, any>;
|
|
9
|
-
export { PasteSinglelineText };
|
|
10
|
-
//# sourceMappingURL=paste-singleline-text.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paste-singleline-text.d.ts","sourceRoot":"","sources":["../../../src/extensions/shared/paste-singleline-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAQxC;;;;;GAKG;AACH,QAAA,MAAM,mBAAmB,qBAiCvB,CAAA;AAEF,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
|
package/dist/helpers/dom.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parse a given HTML string and returns the `HTMLElement` for the document body.
|
|
3
|
-
*
|
|
4
|
-
* @param html The HTML string to parse.
|
|
5
|
-
*/
|
|
6
|
-
declare function parseHtmlToElement(html: string): HTMLElement;
|
|
7
|
-
export { parseHtmlToElement };
|
|
8
|
-
//# sourceMappingURL=dom.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/helpers/dom.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,iBAAS,kBAAkB,CAAC,IAAI,EAAE,MAAM,eAEvC;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { ParseRule, Schema } from '@tiptap/pm/model';
|
|
2
|
-
/**
|
|
3
|
-
* Builds a partial regular expression that includes valid URL schemas used by all the available
|
|
4
|
-
* suggestion nodes from the given editor schema.
|
|
5
|
-
*
|
|
6
|
-
* @param schema The editor schema to be used for suggestion nodes detection.
|
|
7
|
-
*
|
|
8
|
-
* @returns A partial regular expression with valid URL schemas for the available suggestion nodes,
|
|
9
|
-
* `null` if there are no suggestion nodes in the editor schema.
|
|
10
|
-
*/
|
|
11
|
-
declare function buildSuggestionSchemaPartialRegex(schema: Schema): string | null;
|
|
12
|
-
/**
|
|
13
|
-
* Extract all tags from the given parse rules argument, and returns an array of said tags.
|
|
14
|
-
*
|
|
15
|
-
* @param parseRules The parse rules for a DOM node or inline style.
|
|
16
|
-
*
|
|
17
|
-
* @returns An array of tags extracted from the parse rules.
|
|
18
|
-
*/
|
|
19
|
-
declare function extractTagsFromParseRules(parseRules?: readonly ParseRule[]): (keyof HTMLElementTagNameMap)[];
|
|
20
|
-
export { buildSuggestionSchemaPartialRegex, extractTagsFromParseRules };
|
|
21
|
-
//# sourceMappingURL=serializer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../../src/helpers/serializer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAEzD;;;;;;;;GAQG;AACH,iBAAS,iCAAiC,CAAC,MAAM,EAAE,MAAM,iBAYxD;AAED;;;;;;GAMG;AACH,iBAAS,yBAAyB,CAC9B,UAAU,CAAC,EAAE,SAAS,SAAS,EAAE,GAClC,CAAC,MAAM,qBAAqB,CAAC,EAAE,CAQjC;AAED,OAAO,EAAE,iCAAiC,EAAE,yBAAyB,EAAE,CAAA"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Element, Node as HastNode, Text } from 'hast';
|
|
2
|
-
/**
|
|
3
|
-
* Determines whether a given hast node is an element node with a specific tag name.
|
|
4
|
-
*
|
|
5
|
-
* @param node The hast node to check.
|
|
6
|
-
* @param tagName The tag name to check for.
|
|
7
|
-
*
|
|
8
|
-
* @returns `true` if the hast node is an element node with the specified tag name, `false`
|
|
9
|
-
* otherwise.
|
|
10
|
-
*/
|
|
11
|
-
declare function isHastElementNode(node: HastNode, tagName: Element['tagName']): node is Element;
|
|
12
|
-
/**
|
|
13
|
-
* Determines whether a given hast node is a text node.
|
|
14
|
-
*
|
|
15
|
-
* @param node The hast node to check.
|
|
16
|
-
*
|
|
17
|
-
* @returns `true` if the hast node is a text node, `false` otherwise.
|
|
18
|
-
*/
|
|
19
|
-
declare function isHastTextNode(node: HastNode): node is Text;
|
|
20
|
-
export { isHastElementNode, isHastTextNode };
|
|
21
|
-
//# sourceMappingURL=unified.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unified.d.ts","sourceRoot":"","sources":["../../src/helpers/unified.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAE3D;;;;;;;;GAQG;AACH,iBAAS,iBAAiB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI,IAAI,OAAO,CAEvF;AAED;;;;;;GAMG;AACH,iBAAS,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,IAAI,IAAI,CAEpD;AAED,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,CAAA"}
|