@prosekit/extensions 0.14.1 → 0.15.0
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/commit/style.css +1 -3
- package/dist/{drop-indicator-DJq8pF92.js → drop-indicator.js} +2 -4
- package/dist/drop-indicator.js.map +1 -0
- package/dist/{file-upload-I9m1EJAM.js → file.js} +2 -6
- package/dist/file.js.map +1 -0
- package/dist/gap-cursor/style.css +5 -8
- package/dist/{file-upload-dr3IXUty.d.ts → index.d.ts} +1 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/list/style.css +79 -110
- package/dist/loro/style.css +18 -21
- package/dist/{mark-rule-CUnXwBuy.js → mark-rule.js} +3 -6
- package/dist/mark-rule.js.map +1 -0
- package/dist/page/style.css +43 -0
- package/dist/{mark-paste-rule-n_2Ehmb5.js → paste-rule.js} +3 -7
- package/dist/paste-rule.js.map +1 -0
- package/dist/placeholder/style.css +4 -7
- package/dist/prosekit-extensions-autocomplete.d.ts +1 -1
- package/dist/prosekit-extensions-autocomplete.js +17 -21
- package/dist/prosekit-extensions-autocomplete.js.map +1 -1
- package/dist/prosekit-extensions-background-color.d.ts +1 -1
- package/dist/prosekit-extensions-background-color.js +1 -4
- package/dist/prosekit-extensions-background-color.js.map +1 -1
- package/dist/prosekit-extensions-blockquote.d.ts +13 -13
- package/dist/prosekit-extensions-blockquote.d.ts.map +1 -1
- package/dist/prosekit-extensions-blockquote.js +6 -10
- package/dist/prosekit-extensions-blockquote.js.map +1 -1
- package/dist/prosekit-extensions-bold.d.ts +12 -12
- package/dist/prosekit-extensions-bold.d.ts.map +1 -1
- package/dist/prosekit-extensions-bold.js +1 -6
- package/dist/prosekit-extensions-bold.js.map +1 -1
- package/dist/prosekit-extensions-code-block.d.ts +56 -37
- package/dist/prosekit-extensions-code-block.d.ts.map +1 -1
- package/dist/prosekit-extensions-code-block.js +73 -76
- package/dist/prosekit-extensions-code-block.js.map +1 -1
- package/dist/prosekit-extensions-code.d.ts +12 -12
- package/dist/prosekit-extensions-code.d.ts.map +1 -1
- package/dist/prosekit-extensions-code.js +1 -6
- package/dist/prosekit-extensions-code.js.map +1 -1
- package/dist/prosekit-extensions-commit.d.ts +1 -1
- package/dist/prosekit-extensions-commit.js +2 -3
- package/dist/prosekit-extensions-commit.js.map +1 -1
- package/dist/prosekit-extensions-doc.js +1 -2
- package/dist/prosekit-extensions-doc.js.map +1 -1
- package/dist/prosekit-extensions-drop-cursor.js +1 -2
- package/dist/prosekit-extensions-drop-cursor.js.map +1 -1
- package/dist/prosekit-extensions-drop-indicator.js +2 -3
- package/dist/prosekit-extensions-enter-rule.d.ts +2 -2
- package/dist/prosekit-extensions-enter-rule.d.ts.map +1 -1
- package/dist/prosekit-extensions-enter-rule.js +1 -2
- package/dist/prosekit-extensions-enter-rule.js.map +1 -1
- package/dist/prosekit-extensions-file.d.ts +2 -2
- package/dist/prosekit-extensions-file.js +2 -3
- package/dist/prosekit-extensions-gap-cursor.js +1 -2
- package/dist/prosekit-extensions-gap-cursor.js.map +1 -1
- package/dist/prosekit-extensions-hard-break.d.ts +7 -7
- package/dist/prosekit-extensions-hard-break.d.ts.map +1 -1
- package/dist/prosekit-extensions-hard-break.js +1 -5
- package/dist/prosekit-extensions-hard-break.js.map +1 -1
- package/dist/prosekit-extensions-heading.d.ts +15 -15
- package/dist/prosekit-extensions-heading.d.ts.map +1 -1
- package/dist/prosekit-extensions-heading.js +1 -6
- package/dist/prosekit-extensions-heading.js.map +1 -1
- package/dist/prosekit-extensions-horizontal-rule.d.ts +7 -7
- package/dist/prosekit-extensions-horizontal-rule.d.ts.map +1 -1
- package/dist/prosekit-extensions-horizontal-rule.js +12 -14
- package/dist/prosekit-extensions-horizontal-rule.js.map +1 -1
- package/dist/prosekit-extensions-image.d.ts +12 -13
- package/dist/prosekit-extensions-image.d.ts.map +1 -1
- package/dist/prosekit-extensions-image.js +10 -16
- package/dist/prosekit-extensions-image.js.map +1 -1
- package/dist/prosekit-extensions-input-rule.js +1 -2
- package/dist/prosekit-extensions-input-rule.js.map +1 -1
- package/dist/prosekit-extensions-italic.d.ts +12 -12
- package/dist/prosekit-extensions-italic.d.ts.map +1 -1
- package/dist/prosekit-extensions-italic.js +1 -6
- package/dist/prosekit-extensions-italic.js.map +1 -1
- package/dist/prosekit-extensions-link.js +3 -6
- package/dist/prosekit-extensions-link.js.map +1 -1
- package/dist/prosekit-extensions-list.d.ts +26 -26
- package/dist/prosekit-extensions-list.d.ts.map +1 -1
- package/dist/prosekit-extensions-list.js +26 -34
- package/dist/prosekit-extensions-list.js.map +1 -1
- package/dist/prosekit-extensions-loro.d.ts +16 -16
- package/dist/prosekit-extensions-loro.d.ts.map +1 -1
- package/dist/prosekit-extensions-loro.js +3 -9
- package/dist/prosekit-extensions-loro.js.map +1 -1
- package/dist/prosekit-extensions-mark-rule.js +2 -3
- package/dist/prosekit-extensions-math.d.ts +3 -3
- package/dist/prosekit-extensions-math.d.ts.map +1 -1
- package/dist/prosekit-extensions-math.js +5 -5
- package/dist/prosekit-extensions-math.js.map +1 -1
- package/dist/prosekit-extensions-mention.js +1 -2
- package/dist/prosekit-extensions-mention.js.map +1 -1
- package/dist/prosekit-extensions-mod-click-prevention.js +2 -3
- package/dist/prosekit-extensions-mod-click-prevention.js.map +1 -1
- package/dist/prosekit-extensions-page.d.ts +114 -0
- package/dist/prosekit-extensions-page.d.ts.map +1 -0
- package/dist/prosekit-extensions-page.js +324 -0
- package/dist/prosekit-extensions-page.js.map +1 -0
- package/dist/prosekit-extensions-paragraph.d.ts +7 -7
- package/dist/prosekit-extensions-paragraph.d.ts.map +1 -1
- package/dist/prosekit-extensions-paragraph.js +3 -7
- package/dist/prosekit-extensions-paragraph.js.map +1 -1
- package/dist/prosekit-extensions-paste-rule.js +2 -3
- package/dist/prosekit-extensions-placeholder.d.ts +1 -1
- package/dist/prosekit-extensions-placeholder.js +3 -4
- package/dist/prosekit-extensions-placeholder.js.map +1 -1
- package/dist/prosekit-extensions-readonly.js +2 -3
- package/dist/prosekit-extensions-readonly.js.map +1 -1
- package/dist/prosekit-extensions-search.js +1 -2
- package/dist/prosekit-extensions-search.js.map +1 -1
- package/dist/prosekit-extensions-strike.js +1 -2
- package/dist/prosekit-extensions-strike.js.map +1 -1
- package/dist/prosekit-extensions-table.d.ts +47 -47
- package/dist/prosekit-extensions-table.d.ts.map +1 -1
- package/dist/prosekit-extensions-table.js +2 -3
- package/dist/prosekit-extensions-text-align.d.ts +1 -1
- package/dist/prosekit-extensions-text-align.js +1 -2
- package/dist/prosekit-extensions-text-align.js.map +1 -1
- package/dist/prosekit-extensions-text-color.d.ts +1 -1
- package/dist/prosekit-extensions-text-color.js +1 -4
- package/dist/prosekit-extensions-text-color.js.map +1 -1
- package/dist/prosekit-extensions-text.js +1 -2
- package/dist/prosekit-extensions-text.js.map +1 -1
- package/dist/prosekit-extensions-underline.js +1 -2
- package/dist/prosekit-extensions-underline.js.map +1 -1
- package/dist/prosekit-extensions-virtual-selection.js +2 -3
- package/dist/prosekit-extensions-virtual-selection.js.map +1 -1
- package/dist/prosekit-extensions-yjs.d.ts +3 -3
- package/dist/prosekit-extensions-yjs.d.ts.map +1 -1
- package/dist/prosekit-extensions-yjs.js +3 -9
- package/dist/prosekit-extensions-yjs.js.map +1 -1
- package/dist/prosekit-extensions.js +1 -1
- package/dist/search/style.css +4 -8
- package/dist/shiki-highlighter-chunk.js +1 -2
- package/dist/shiki-highlighter-chunk.js.map +1 -1
- package/dist/table/style.css +16 -16
- package/dist/{table-UJVYsrB7.js → table.js} +29 -41
- package/dist/table.js.map +1 -0
- package/dist/virtual-selection/style.css +1 -4
- package/dist/yjs/style.css +14 -20
- package/package.json +30 -16
- package/src/autocomplete/autocomplete-helpers.ts +1 -1
- package/src/autocomplete/autocomplete-plugin.ts +2 -2
- package/src/autocomplete/autocomplete-rule.ts +1 -1
- package/src/autocomplete/autocomplete.spec.ts +4 -4
- package/src/autocomplete/autocomplete.ts +2 -2
- package/src/autocomplete/index.ts +2 -2
- package/src/background-color/background-color-commands.spec.ts +1 -1
- package/src/background-color/background-color-commands.ts +1 -1
- package/src/background-color/background-color-spec.spec.ts +1 -1
- package/src/background-color/background-color.ts +2 -2
- package/src/background-color/index.ts +3 -3
- package/src/blockquote/blockquote-input-rule.ts +1 -1
- package/src/blockquote/blockquote-keymap.spec.ts +1 -1
- package/src/blockquote/blockquote-keymap.ts +9 -7
- package/src/blockquote/blockquote.ts +4 -4
- package/src/blockquote/index.ts +5 -5
- package/src/bold/bold-input-rule.spec.ts +2 -2
- package/src/bold/bold-input-rule.ts +1 -1
- package/src/bold/bold.ts +4 -4
- package/src/bold/index.ts +5 -5
- package/src/code/code-input-rule.ts +1 -1
- package/src/code/code.ts +4 -4
- package/src/code/index.ts +5 -5
- package/src/code-block/code-block-commands.ts +1 -1
- package/src/code-block/code-block-highlight.ts +11 -1
- package/src/code-block/code-block-input-rule.ts +3 -3
- package/src/code-block/code-block-shiki.ts +13 -5
- package/src/code-block/code-block-spec.spec.ts +2 -2
- package/src/code-block/code-block-spec.ts +1 -1
- package/src/code-block/code-block.ts +4 -4
- package/src/code-block/index.ts +9 -9
- package/src/code-block/shiki-highlighter.ts +2 -2
- package/src/code-block/shiki-parser.ts +2 -2
- package/src/drop-cursor/index.ts +1 -1
- package/src/drop-indicator/drop-indicator.ts +1 -1
- package/src/drop-indicator/index.ts +1 -1
- package/src/enter-rule/index.ts +3 -3
- package/src/file/file-drop-handler.ts +1 -1
- package/src/file/file-paste-handler.spec.ts +3 -3
- package/src/file/file-paste-handler.ts +1 -1
- package/src/file/index.ts +3 -3
- package/src/gap-cursor/index.ts +1 -1
- package/src/hard-break/hard-break-keymap.spec.ts +2 -2
- package/src/hard-break/hard-break-keymap.ts +1 -1
- package/src/hard-break/hard-break.ts +3 -3
- package/src/hard-break/index.ts +4 -4
- package/src/heading/heading-commands.ts +1 -1
- package/src/heading/heading-input-rule.ts +2 -2
- package/src/heading/heading-keymap.spec.ts +1 -1
- package/src/heading/heading-spec.ts +1 -1
- package/src/heading/heading.ts +4 -4
- package/src/heading/index.ts +6 -6
- package/src/horizontal-rule/horizontal-rule-commands.spec.ts +1 -1
- package/src/horizontal-rule/horizontal-rule-commands.ts +14 -11
- package/src/horizontal-rule/horizontal-rule-input-rule.spec.ts +2 -2
- package/src/horizontal-rule/horizontal-rule-input-rule.ts +1 -1
- package/src/horizontal-rule/horizontal-rule.ts +3 -3
- package/src/horizontal-rule/index.ts +4 -4
- package/src/image/image-commands/insert-image.ts +1 -1
- package/src/image/image-commands/upload-image.spec.ts +4 -4
- package/src/image/image-commands/upload-image.ts +2 -2
- package/src/image/image-commands.ts +3 -3
- package/src/image/image-upload-handler.ts +2 -2
- package/src/image/image.ts +2 -2
- package/src/image/index.ts +6 -6
- package/src/italic/index.ts +5 -5
- package/src/italic/italic-commands.spec.ts +4 -4
- package/src/italic/italic-input-rule.spec.ts +2 -2
- package/src/italic/italic-input-rule.ts +1 -1
- package/src/italic/italic.ts +4 -4
- package/src/link/index.spec.ts +2 -2
- package/src/link/index.ts +6 -6
- package/src/link/link-paste-rule.spec.ts +2 -2
- package/src/link/link-paste-rule.ts +3 -3
- package/src/link/link-regex.spec.ts +1 -1
- package/src/list/index.ts +8 -8
- package/src/list/list-drop-indicator.ts +2 -2
- package/src/list/list-input-rules.ts +1 -1
- package/src/list/list-keymap.spec.ts +1 -1
- package/src/list/list-spec.ts +1 -1
- package/src/list/list-types.spec.ts +2 -2
- package/src/list/list.spec.ts +6 -6
- package/src/list/list.ts +7 -7
- package/src/loro/index.ts +6 -6
- package/src/loro/loro.ts +8 -7
- package/src/mark-rule/apply.ts +2 -2
- package/src/mark-rule/index.ts +2 -2
- package/src/mark-rule/mark-rule.spec.ts +4 -4
- package/src/mark-rule/mark-rule.ts +2 -2
- package/src/math/index.ts +4 -4
- package/src/math/math-block.ts +8 -1
- package/src/math/math-inline.ts +1 -1
- package/src/math/math.ts +3 -3
- package/src/page/index.ts +5 -0
- package/src/page/page-break-commands.spec.ts +61 -0
- package/src/page/page-break-commands.ts +41 -0
- package/src/page/page-break-keymap.ts +17 -0
- package/src/page/page-break-spec.ts +33 -0
- package/src/page/page-break.ts +23 -0
- package/src/page/page-element.ts +246 -0
- package/src/page/page-rendering.ts +164 -0
- package/src/page/style.css +43 -0
- package/src/paragraph/index.ts +7 -7
- package/src/paragraph/paragraph-keymap.ts +1 -1
- package/src/paragraph/paragraph.ts +6 -5
- package/src/paste-rule/index.ts +2 -2
- package/src/paste-rule/mark-paste-rule.spec.ts +8 -8
- package/src/paste-rule/mark-paste-rule.ts +2 -2
- package/src/paste-rule/paste-rule.spec.ts +2 -2
- package/src/paste-rule/paste-rule.ts +1 -1
- package/src/paste-rule/split-text-by-regex.spec.ts +1 -1
- package/src/placeholder/index.ts +1 -1
- package/src/strike/index.ts +1 -1
- package/src/table/index.ts +14 -14
- package/src/table/table-commands/delete-cell-selection.spec.ts +3 -3
- package/src/table/table-commands/exit-table.spec.ts +2 -2
- package/src/table/table-commands/insert-table.spec.ts +1 -1
- package/src/table/table-commands/move-table-column.spec.ts +2 -2
- package/src/table/table-commands/move-table-row.spec.ts +2 -2
- package/src/table/table-commands/select-table-cell.spec.ts +3 -3
- package/src/table/table-commands/select-table-cell.ts +1 -1
- package/src/table/table-commands/select-table-column.spec.ts +2 -2
- package/src/table/table-commands/select-table-column.ts +1 -1
- package/src/table/table-commands/select-table-row.spec.ts +2 -2
- package/src/table/table-commands/select-table-row.ts +1 -1
- package/src/table/table-commands/select-table.spec.ts +2 -2
- package/src/table/table-commands/select-table.ts +1 -1
- package/src/table/table-commands.ts +9 -9
- package/src/table/table-drop-indicator.ts +2 -2
- package/src/table/table-spec.spec.ts +4 -4
- package/src/table/table.ts +4 -4
- package/src/table/test-utils.ts +1 -1
- package/src/testing/index.ts +24 -24
- package/src/text-color/index.ts +3 -3
- package/src/text-color/text-color-commands.spec.ts +1 -1
- package/src/text-color/text-color-commands.ts +1 -1
- package/src/text-color/text-color-spec.spec.ts +1 -1
- package/src/text-color/text-color.ts +2 -2
- package/src/yjs/index.ts +7 -7
- package/src/yjs/yjs-cursor-plugin.ts +1 -1
- package/src/yjs/yjs-undo-plugin.ts +3 -2
- package/src/yjs/yjs.ts +9 -8
- package/dist/commit/style.css.map +0 -1
- package/dist/commit/style.js +0 -1
- package/dist/drop-indicator-DJq8pF92.js.map +0 -1
- package/dist/file-upload-I9m1EJAM.js.map +0 -1
- package/dist/file-upload-dr3IXUty.d.ts.map +0 -1
- package/dist/gap-cursor/style.css.map +0 -1
- package/dist/gap-cursor/style.js +0 -1
- package/dist/list/style.css.map +0 -1
- package/dist/list/style.js +0 -1
- package/dist/loro/style.css.map +0 -1
- package/dist/loro/style.js +0 -1
- package/dist/mark-paste-rule-n_2Ehmb5.js.map +0 -1
- package/dist/mark-rule-CUnXwBuy.js.map +0 -1
- package/dist/placeholder/style.css.map +0 -1
- package/dist/placeholder/style.js +0 -1
- package/dist/search/style.css.map +0 -1
- package/dist/search/style.js +0 -1
- package/dist/shiki-highlighter-chunk.d.ts +0 -19
- package/dist/shiki-highlighter-chunk.d.ts.map +0 -1
- package/dist/table/style.css.map +0 -1
- package/dist/table/style.js +0 -1
- package/dist/table-UJVYsrB7.js.map +0 -1
- package/dist/virtual-selection/style.css.map +0 -1
- package/dist/virtual-selection/style.js +0 -1
- package/dist/yjs/style.css.map +0 -1
- package/dist/yjs/style.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Extension, PlainExtension, Union } from "@prosekit/core";
|
|
2
1
|
import { Command } from "@prosekit/pm/state";
|
|
2
|
+
import { Extension, PlainExtension, Union } from "@prosekit/core";
|
|
3
3
|
import { Attrs } from "@prosekit/pm/model";
|
|
4
4
|
|
|
5
5
|
//#region src/paragraph/paragraph-commands.d.ts
|
|
@@ -16,6 +16,12 @@ type ParagraphCommandsExtension = Extension<{
|
|
|
16
16
|
*/
|
|
17
17
|
declare function defineParagraphCommands(): ParagraphCommandsExtension;
|
|
18
18
|
//#endregion
|
|
19
|
+
//#region src/paragraph/paragraph-keymap.d.ts
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
declare function defineParagraphKeymap(): PlainExtension;
|
|
24
|
+
//#endregion
|
|
19
25
|
//#region src/paragraph/paragraph-spec.d.ts
|
|
20
26
|
/**
|
|
21
27
|
* @internal
|
|
@@ -47,11 +53,5 @@ type ParagraphExtension = Union<[ParagraphSpecExtension, ParagraphCommandsExtens
|
|
|
47
53
|
*/
|
|
48
54
|
declare function defineParagraph(): ParagraphExtension;
|
|
49
55
|
//#endregion
|
|
50
|
-
//#region src/paragraph/paragraph-keymap.d.ts
|
|
51
|
-
/**
|
|
52
|
-
* @internal
|
|
53
|
-
*/
|
|
54
|
-
declare function defineParagraphKeymap(): PlainExtension;
|
|
55
|
-
//#endregion
|
|
56
56
|
export { type ParagraphCommandsExtension, type ParagraphExtension, type ParagraphSpecExtension, defineParagraph, defineParagraphCommands, defineParagraphKeymap, defineParagraphSpec };
|
|
57
57
|
//# sourceMappingURL=prosekit-extensions-paragraph.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-paragraph.d.ts","names":[],"sources":["../src/paragraph/paragraph-commands.ts","../src/paragraph/paragraph-
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-paragraph.d.ts","names":[],"sources":["../src/paragraph/paragraph-commands.ts","../src/paragraph/paragraph-keymap.ts","../src/paragraph/paragraph-spec.ts","../src/paragraph/paragraph.ts"],"mappings":";;;;;;;;KAMY,0BAAA,GAA6B,SAAA;EACvC,QAAA;IACE,YAAA;EAAA;AAAA;AAcJ;;;AAAA,iBAAgB,uBAAA,CAAA,GAA2B,0BAAA;;;;;;iBCf3B,qBAAA,CAAA,GAAyB,cAAA;;;;;;KCD7B,sBAAA,GAAyB,SAAA;EACnC,KAAA;IACE,SAAA,EAAW,KAAA;EAAA;AAAA;;;;;AFcf;iBELgB,mBAAA,CAAA,GAAuB,sBAAA;;;;;AFXvC;KGIY,kBAAA,GAAqB,KAAA,EAAO,sBAAA,EAAwB,0BAAA;;;;;;;;AHYhE;iBGFgB,eAAA,CAAA,GAAmB,kBAAA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { defineCommands, defineKeymap, defineNodeSpec, setBlockType, union, withPriority } from "@prosekit/core";
|
|
3
2
|
//#region src/paragraph/paragraph-commands.ts
|
|
4
3
|
/**
|
|
5
4
|
* @internal
|
|
@@ -13,7 +12,6 @@ function setParagraph() {
|
|
|
13
12
|
function defineParagraphCommands() {
|
|
14
13
|
return defineCommands({ setParagraph });
|
|
15
14
|
}
|
|
16
|
-
|
|
17
15
|
//#endregion
|
|
18
16
|
//#region src/paragraph/paragraph-keymap.ts
|
|
19
17
|
/**
|
|
@@ -22,7 +20,6 @@ function defineParagraphCommands() {
|
|
|
22
20
|
function defineParagraphKeymap() {
|
|
23
21
|
return defineKeymap({ "Mod-Alt-0": setParagraph() });
|
|
24
22
|
}
|
|
25
|
-
|
|
26
23
|
//#endregion
|
|
27
24
|
//#region src/paragraph/paragraph-spec.ts
|
|
28
25
|
/**
|
|
@@ -41,7 +38,6 @@ function defineParagraphSpec() {
|
|
|
41
38
|
}
|
|
42
39
|
});
|
|
43
40
|
}
|
|
44
|
-
|
|
45
41
|
//#endregion
|
|
46
42
|
//#region src/paragraph/paragraph.ts
|
|
47
43
|
/**
|
|
@@ -53,9 +49,9 @@ function defineParagraphSpec() {
|
|
|
53
49
|
* default block node for most cases.
|
|
54
50
|
*/
|
|
55
51
|
function defineParagraph() {
|
|
56
|
-
return union(withPriority(defineParagraphSpec(),
|
|
52
|
+
return union(withPriority(defineParagraphSpec(), 4), defineParagraphCommands(), defineParagraphKeymap());
|
|
57
53
|
}
|
|
58
|
-
|
|
59
54
|
//#endregion
|
|
60
55
|
export { defineParagraph, defineParagraphCommands, defineParagraphKeymap, defineParagraphSpec };
|
|
56
|
+
|
|
61
57
|
//# sourceMappingURL=prosekit-extensions-paragraph.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-paragraph.js","names":[],"sources":["../src/paragraph/paragraph-commands.ts","../src/paragraph/paragraph-keymap.ts","../src/paragraph/paragraph-spec.ts","../src/paragraph/paragraph.ts"],"sourcesContent":["import { defineCommands, setBlockType, type Extension } from '@prosekit/core'\nimport type { Command } from '@prosekit/pm/state'\n\n/**\n * @internal\n */\nexport type ParagraphCommandsExtension = Extension<{\n Commands: {\n setParagraph: []\n }\n}>\n\n/**\n * @internal\n */\nexport function setParagraph(): Command {\n return setBlockType({ type: 'paragraph' })\n}\n\n/**\n * @internal\n */\nexport function defineParagraphCommands(): ParagraphCommandsExtension {\n return defineCommands({ setParagraph })\n}\n","import { defineKeymap, type PlainExtension } from '@prosekit/core'\n\nimport { setParagraph } from './paragraph-commands'\n\n/**\n * @internal\n */\nexport function defineParagraphKeymap(): PlainExtension {\n return defineKeymap({\n 'Mod-Alt-0': setParagraph(),\n })\n}\n","import { defineNodeSpec, type Extension } from '@prosekit/core'\nimport type { Attrs } from '@prosekit/pm/model'\n\n/**\n * @internal\n */\nexport type ParagraphSpecExtension = Extension<{\n Nodes: {\n paragraph: Attrs\n }\n}>\n\n/**\n * @internal\n *\n * Defines a paragraph node spec.\n */\nexport function defineParagraphSpec(): ParagraphSpecExtension {\n return defineNodeSpec({\n name: 'paragraph',\n content: 'inline*',\n group: 'block',\n parseDOM: [{ tag: 'p' }],\n toDOM() {\n return ['p', 0]\n },\n })\n}\n","import { Priority
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-paragraph.js","names":[],"sources":["../src/paragraph/paragraph-commands.ts","../src/paragraph/paragraph-keymap.ts","../src/paragraph/paragraph-spec.ts","../src/paragraph/paragraph.ts"],"sourcesContent":["import { defineCommands, setBlockType, type Extension } from '@prosekit/core'\nimport type { Command } from '@prosekit/pm/state'\n\n/**\n * @internal\n */\nexport type ParagraphCommandsExtension = Extension<{\n Commands: {\n setParagraph: []\n }\n}>\n\n/**\n * @internal\n */\nexport function setParagraph(): Command {\n return setBlockType({ type: 'paragraph' })\n}\n\n/**\n * @internal\n */\nexport function defineParagraphCommands(): ParagraphCommandsExtension {\n return defineCommands({ setParagraph })\n}\n","import { defineKeymap, type PlainExtension } from '@prosekit/core'\n\nimport { setParagraph } from './paragraph-commands.ts'\n\n/**\n * @internal\n */\nexport function defineParagraphKeymap(): PlainExtension {\n return defineKeymap({\n 'Mod-Alt-0': setParagraph(),\n })\n}\n","import { defineNodeSpec, type Extension } from '@prosekit/core'\nimport type { Attrs } from '@prosekit/pm/model'\n\n/**\n * @internal\n */\nexport type ParagraphSpecExtension = Extension<{\n Nodes: {\n paragraph: Attrs\n }\n}>\n\n/**\n * @internal\n *\n * Defines a paragraph node spec.\n */\nexport function defineParagraphSpec(): ParagraphSpecExtension {\n return defineNodeSpec({\n name: 'paragraph',\n content: 'inline*',\n group: 'block',\n parseDOM: [{ tag: 'p' }],\n toDOM() {\n return ['p', 0]\n },\n })\n}\n","import type { Priority } from '@prosekit/core'\nimport { union, withPriority, type Union } from '@prosekit/core'\n\nimport { defineParagraphCommands, type ParagraphCommandsExtension } from './paragraph-commands.ts'\nimport { defineParagraphKeymap } from './paragraph-keymap.ts'\nimport { defineParagraphSpec, type ParagraphSpecExtension } from './paragraph-spec.ts'\n\n/**\n * @internal\n */\nexport type ParagraphExtension = Union<[ParagraphSpecExtension, ParagraphCommandsExtension]>\n\n/**\n * @public\n *\n * Defines a paragraph node.\n *\n * The paragraph node spec has the highest priority, because it should be the\n * default block node for most cases.\n */\nexport function defineParagraph(): ParagraphExtension {\n return union(\n withPriority(defineParagraphSpec(), 4 satisfies typeof Priority.highest),\n defineParagraphCommands(),\n defineParagraphKeymap(),\n )\n}\n"],"mappings":";;;;;AAeA,SAAgB,eAAwB;AACtC,QAAO,aAAa,EAAE,MAAM,aAAa,CAAC;;;;;AAM5C,SAAgB,0BAAsD;AACpE,QAAO,eAAe,EAAE,cAAc,CAAC;;;;;;;AChBzC,SAAgB,wBAAwC;AACtD,QAAO,aAAa,EAClB,aAAa,cAAc,EAC5B,CAAC;;;;;;;;;ACOJ,SAAgB,sBAA8C;AAC5D,QAAO,eAAe;EACpB,MAAM;EACN,SAAS;EACT,OAAO;EACP,UAAU,CAAC,EAAE,KAAK,KAAK,CAAC;EACxB,QAAQ;AACN,UAAO,CAAC,KAAK,EAAE;;EAElB,CAAC;;;;;;;;;;;;ACNJ,SAAgB,kBAAsC;AACpD,QAAO,MACL,aAAa,qBAAqB,EAAE,EAAoC,EACxE,yBAAyB,EACzB,uBAAuB,CACxB"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { n as definePasteRule, t as defineMarkPasteRule } from "./
|
|
2
|
-
|
|
3
|
-
export { defineMarkPasteRule, definePasteRule };
|
|
1
|
+
import { n as definePasteRule, t as defineMarkPasteRule } from "./paste-rule.js";
|
|
2
|
+
export { defineMarkPasteRule, definePasteRule };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { p as findTable } from "./table
|
|
2
|
-
import { definePlugin, isInCodeBlock, isTextSelection, maybeRun } from "@prosekit/core";
|
|
1
|
+
import { p as findTable } from "./table.js";
|
|
3
2
|
import { Plugin, PluginKey } from "@prosekit/pm/state";
|
|
3
|
+
import { definePlugin, isInCodeBlock, isTextSelection, maybeRun } from "@prosekit/core";
|
|
4
4
|
import { Decoration, DecorationSet } from "@prosekit/pm/view";
|
|
5
|
-
|
|
6
5
|
//#region src/placeholder/index.ts
|
|
7
6
|
/**
|
|
8
7
|
* Add a placeholder text to the editor when the current block or document is
|
|
@@ -44,7 +43,7 @@ function createPlaceholderDecoration(state, placeholderText) {
|
|
|
44
43
|
"data-placeholder": placeholderText
|
|
45
44
|
});
|
|
46
45
|
}
|
|
47
|
-
|
|
48
46
|
//#endregion
|
|
49
47
|
export { definePlaceholder };
|
|
48
|
+
|
|
50
49
|
//# sourceMappingURL=prosekit-extensions-placeholder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-placeholder.js","names":[],"sources":["../src/placeholder/index.ts"],"sourcesContent":["import { definePlugin, isInCodeBlock, isTextSelection, maybeRun, type PlainExtension } from '@prosekit/core'\nimport type { ProseMirrorNode } from '@prosekit/pm/model'\nimport { Plugin, PluginKey, type EditorState } from '@prosekit/pm/state'\nimport { Decoration, DecorationSet } from '@prosekit/pm/view'\n\nimport { findTable } from '../table'\n\nexport interface PlaceholderOptions {\n /**\n * The placeholder to use. It can be a static string or a function that\n * receives the current editor state and returns a string.\n */\n placeholder: string | ((state: EditorState) => string)\n\n /**\n * By default, the placeholder text will be shown whenever the current text\n * cursor is in an empty text node and it's not inside a code block or a\n * table node.\n *\n * If you only want to show the placeholder when the whole doc is empty, you\n * can set this option to 'doc'.\n *\n * You can also pass a function that receives the current editor state and\n * returns a boolean value to determine whether the placeholder should be\n * shown.\n *\n * @default 'block'\n */\n strategy?: 'doc' | 'block' | ((state: EditorState) => boolean)\n}\n\n/**\n * Add a placeholder text to the editor when the current block or document is\n * empty.\n */\nexport function definePlaceholder(options: PlaceholderOptions): PlainExtension {\n return definePlugin(createPlaceholderPlugin(options))\n}\n\nfunction createPlaceholderPlugin({\n placeholder,\n strategy = 'block',\n}: PlaceholderOptions): Plugin {\n return new Plugin({\n key: new PluginKey('prosekit-placeholder'),\n props: {\n decorations: (state) => {\n const strategyFn = typeof strategy === 'function'\n ? strategy\n : strategy === 'doc'\n ? docStrategy\n : defaultStrategy\n\n if (!strategyFn(state)) {\n return null\n }\n\n const placeholderText: string = maybeRun(placeholder, state)\n const deco = createPlaceholderDecoration(state, placeholderText)\n if (!deco) {\n return null\n }\n\n return DecorationSet.create(state.doc, [deco])\n },\n },\n })\n}\n\nfunction defaultStrategy(state: EditorState): boolean {\n return !isInCodeBlock(state.selection) && !findTable(state.selection.$from)\n}\n\nfunction docStrategy(state: EditorState): boolean {\n return isDocEmpty(state.doc) && defaultStrategy(state)\n}\n\nfunction isDocEmpty(doc: ProseMirrorNode) {\n return doc.childCount <= 1 && !doc.firstChild?.content.size\n}\n\nfunction createPlaceholderDecoration(\n state: EditorState,\n placeholderText: string,\n): Decoration | null {\n if (!placeholderText) return null\n\n const { selection } = state\n if (!selection.empty || !isTextSelection(selection)) return null\n\n const $pos = selection.$anchor\n const node = $pos.parent\n if (node.content.size > 0) return null\n\n const before = $pos.before()\n\n return Decoration.node(before, before + node.nodeSize, {\n 'class': 'prosekit-placeholder',\n 'data-placeholder': placeholderText,\n })\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-placeholder.js","names":[],"sources":["../src/placeholder/index.ts"],"sourcesContent":["import { definePlugin, isInCodeBlock, isTextSelection, maybeRun, type PlainExtension } from '@prosekit/core'\nimport type { ProseMirrorNode } from '@prosekit/pm/model'\nimport { Plugin, PluginKey, type EditorState } from '@prosekit/pm/state'\nimport { Decoration, DecorationSet } from '@prosekit/pm/view'\n\nimport { findTable } from '../table/index.ts'\n\nexport interface PlaceholderOptions {\n /**\n * The placeholder to use. It can be a static string or a function that\n * receives the current editor state and returns a string.\n */\n placeholder: string | ((state: EditorState) => string)\n\n /**\n * By default, the placeholder text will be shown whenever the current text\n * cursor is in an empty text node and it's not inside a code block or a\n * table node.\n *\n * If you only want to show the placeholder when the whole doc is empty, you\n * can set this option to 'doc'.\n *\n * You can also pass a function that receives the current editor state and\n * returns a boolean value to determine whether the placeholder should be\n * shown.\n *\n * @default 'block'\n */\n strategy?: 'doc' | 'block' | ((state: EditorState) => boolean)\n}\n\n/**\n * Add a placeholder text to the editor when the current block or document is\n * empty.\n */\nexport function definePlaceholder(options: PlaceholderOptions): PlainExtension {\n return definePlugin(createPlaceholderPlugin(options))\n}\n\nfunction createPlaceholderPlugin({\n placeholder,\n strategy = 'block',\n}: PlaceholderOptions): Plugin {\n return new Plugin({\n key: new PluginKey('prosekit-placeholder'),\n props: {\n decorations: (state) => {\n const strategyFn = typeof strategy === 'function'\n ? strategy\n : strategy === 'doc'\n ? docStrategy\n : defaultStrategy\n\n if (!strategyFn(state)) {\n return null\n }\n\n const placeholderText: string = maybeRun(placeholder, state)\n const deco = createPlaceholderDecoration(state, placeholderText)\n if (!deco) {\n return null\n }\n\n return DecorationSet.create(state.doc, [deco])\n },\n },\n })\n}\n\nfunction defaultStrategy(state: EditorState): boolean {\n return !isInCodeBlock(state.selection) && !findTable(state.selection.$from)\n}\n\nfunction docStrategy(state: EditorState): boolean {\n return isDocEmpty(state.doc) && defaultStrategy(state)\n}\n\nfunction isDocEmpty(doc: ProseMirrorNode) {\n return doc.childCount <= 1 && !doc.firstChild?.content.size\n}\n\nfunction createPlaceholderDecoration(\n state: EditorState,\n placeholderText: string,\n): Decoration | null {\n if (!placeholderText) return null\n\n const { selection } = state\n if (!selection.empty || !isTextSelection(selection)) return null\n\n const $pos = selection.$anchor\n const node = $pos.parent\n if (node.content.size > 0) return null\n\n const before = $pos.before()\n\n return Decoration.node(before, before + node.nodeSize, {\n 'class': 'prosekit-placeholder',\n 'data-placeholder': placeholderText,\n })\n}\n"],"mappings":";;;;;;;;;AAmCA,SAAgB,kBAAkB,SAA6C;AAC7E,QAAO,aAAa,wBAAwB,QAAQ,CAAC;;AAGvD,SAAS,wBAAwB,EAC/B,aACA,WAAW,WACkB;AAC7B,QAAO,IAAI,OAAO;EAChB,KAAK,IAAI,UAAU,uBAAuB;EAC1C,OAAO,EACL,cAAc,UAAU;AAOtB,OAAI,EANe,OAAO,aAAa,aACnC,WACA,aAAa,QACb,cACA,iBAEY,MAAM,CACpB,QAAO;GAIT,MAAM,OAAO,4BAA4B,OADT,SAAS,aAAa,MAAM,CACI;AAChE,OAAI,CAAC,KACH,QAAO;AAGT,UAAO,cAAc,OAAO,MAAM,KAAK,CAAC,KAAK,CAAC;KAEjD;EACF,CAAC;;AAGJ,SAAS,gBAAgB,OAA6B;AACpD,QAAO,CAAC,cAAc,MAAM,UAAU,IAAI,CAAC,UAAU,MAAM,UAAU,MAAM;;AAG7E,SAAS,YAAY,OAA6B;AAChD,QAAO,WAAW,MAAM,IAAI,IAAI,gBAAgB,MAAM;;AAGxD,SAAS,WAAW,KAAsB;AACxC,QAAO,IAAI,cAAc,KAAK,CAAC,IAAI,YAAY,QAAQ;;AAGzD,SAAS,4BACP,OACA,iBACmB;AACnB,KAAI,CAAC,gBAAiB,QAAO;CAE7B,MAAM,EAAE,cAAc;AACtB,KAAI,CAAC,UAAU,SAAS,CAAC,gBAAgB,UAAU,CAAE,QAAO;CAE5D,MAAM,OAAO,UAAU;CACvB,MAAM,OAAO,KAAK;AAClB,KAAI,KAAK,QAAQ,OAAO,EAAG,QAAO;CAElC,MAAM,SAAS,KAAK,QAAQ;AAE5B,QAAO,WAAW,KAAK,QAAQ,SAAS,KAAK,UAAU;EACrD,SAAS;EACT,oBAAoB;EACrB,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { definePlugin } from "@prosekit/core";
|
|
2
1
|
import { PluginKey, ProseMirrorPlugin } from "@prosekit/pm/state";
|
|
3
|
-
|
|
2
|
+
import { definePlugin } from "@prosekit/core";
|
|
4
3
|
//#region src/readonly/index.ts
|
|
5
4
|
/**
|
|
6
5
|
* Make the editor read-only.
|
|
@@ -12,7 +11,7 @@ const plugin = new ProseMirrorPlugin({
|
|
|
12
11
|
key: new PluginKey("prosekey-readonly"),
|
|
13
12
|
props: { editable: () => false }
|
|
14
13
|
});
|
|
15
|
-
|
|
16
14
|
//#endregion
|
|
17
15
|
export { defineReadonly };
|
|
16
|
+
|
|
18
17
|
//# sourceMappingURL=prosekit-extensions-readonly.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-readonly.js","names":[],"sources":["../src/readonly/index.ts"],"sourcesContent":["import { definePlugin, type PlainExtension } from '@prosekit/core'\nimport { PluginKey, ProseMirrorPlugin } from '@prosekit/pm/state'\n\n/**\n * Make the editor read-only.\n */\nexport function defineReadonly(): PlainExtension {\n return definePlugin(plugin)\n}\n\nconst plugin = new ProseMirrorPlugin({\n key: new PluginKey('prosekey-readonly'),\n props: {\n editable: () => false,\n },\n})\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-readonly.js","names":[],"sources":["../src/readonly/index.ts"],"sourcesContent":["import { definePlugin, type PlainExtension } from '@prosekit/core'\nimport { PluginKey, ProseMirrorPlugin } from '@prosekit/pm/state'\n\n/**\n * Make the editor read-only.\n */\nexport function defineReadonly(): PlainExtension {\n return definePlugin(plugin)\n}\n\nconst plugin = new ProseMirrorPlugin({\n key: new PluginKey('prosekey-readonly'),\n props: {\n editable: () => false,\n },\n})\n"],"mappings":";;;;;;AAMA,SAAgB,iBAAiC;AAC/C,QAAO,aAAa,OAAO;;AAG7B,MAAM,SAAS,IAAI,kBAAkB;CACnC,KAAK,IAAI,UAAU,oBAAoB;CACvC,OAAO,EACL,gBAAgB,OACjB;CACF,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { defineCommands, definePlugin } from "@prosekit/core";
|
|
2
2
|
import { SearchQuery, findNext, findNextNoWrap, findPrev, findPrevNoWrap, replaceAll, replaceCurrent, replaceNext, replaceNextNoWrap, search } from "prosemirror-search";
|
|
3
|
-
|
|
4
3
|
//#region src/search/index.ts
|
|
5
4
|
/**
|
|
6
5
|
* Defines an extension that stores a current search query and replace string.
|
|
@@ -49,7 +48,7 @@ function defineSearchCommands() {
|
|
|
49
48
|
replaceAll: () => withScrollActiveIntoView(replaceAll)
|
|
50
49
|
});
|
|
51
50
|
}
|
|
52
|
-
|
|
53
51
|
//#endregion
|
|
54
52
|
export { defineSearchCommands, defineSearchQuery };
|
|
53
|
+
|
|
55
54
|
//# sourceMappingURL=prosekit-extensions-search.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-search.js","names":[],"sources":["../src/search/index.ts"],"sourcesContent":["import { defineCommands, definePlugin, type Extension, type PlainExtension } from '@prosekit/core'\nimport type { Command } from '@prosekit/pm/state'\nimport type { EditorView } from '@prosekit/pm/view'\nimport {\n findNext,\n findNextNoWrap,\n findPrev,\n findPrevNoWrap,\n replaceAll,\n replaceCurrent,\n replaceNext,\n replaceNextNoWrap,\n search,\n SearchQuery,\n} from 'prosemirror-search'\n\n/**\n * Options for {@link defineSearchQuery}\n *\n * @public\n */\nexport interface SearchQueryOptions {\n /**\n * The search string (or regular expression).\n */\n search: string\n\n /**\n * The replace text.\n */\n replace?: string\n\n /**\n * Indicates whether the search is case-sensitive\n *\n * @default false\n */\n caseSensitive?: boolean\n\n /**\n * By default, string search will replace `\\n`, `\\r`, and `\\t` in the query\n * with newline, return, and tab characters. When this is set to true, that\n * behavior is disabled.\n *\n * @default false\n */\n literal?: boolean\n\n /**\n * When true, the search string is interpreted as a regular expression.\n *\n * @default false\n */\n regexp?: boolean\n\n /**\n * Enable whole-word matching.\n *\n * @default false\n */\n wholeWord?: boolean\n}\n\n/**\n * Defines an extension that stores a current search query and replace string.\n *\n * @public\n */\nexport function defineSearchQuery(options: SearchQueryOptions): PlainExtension {\n const query = new SearchQuery(options)\n return definePlugin(search({ initialQuery: query }))\n}\n\n/**\n * Scrolls the active search match into view.\n */\nfunction scrollActiveIntoView(view: EditorView) {\n if (view.isDestroyed) return\n const active = view.dom.querySelector('.ProseMirror-active-search-match')\n active?.scrollIntoView({\n block: 'nearest',\n inline: 'nearest',\n behavior: 'smooth',\n })\n}\n\n/**\n * Wraps a command and scrolls the active search match into view when the command\n * is applied.\n */\nfunction withScrollActiveIntoView(command: Command): Command {\n return (state, dispatch, view) => {\n const result = command(state, dispatch, view)\n if (result && dispatch && view) {\n // Add a small delay because the command itself will handle scrolling if\n // the view is focused.\n setTimeout(() => scrollActiveIntoView(view), 50)\n }\n return result\n }\n}\n\n/**\n * @internal\n */\nexport type SearchCommandsExtension = Extension<{\n Commands: {\n findNext: []\n findPrev: []\n findNextNoWrap: []\n findPrevNoWrap: []\n replaceNext: []\n replaceNextNoWrap: []\n replaceCurrent: []\n replaceAll: []\n }\n}>\n\n/**\n * Defines commands for search and replace.\n *\n * @public\n */\nexport function defineSearchCommands(): SearchCommandsExtension {\n return defineCommands({\n findNext: () => withScrollActiveIntoView(findNext),\n findPrev: () => withScrollActiveIntoView(findPrev),\n findNextNoWrap: () => withScrollActiveIntoView(findNextNoWrap),\n findPrevNoWrap: () => withScrollActiveIntoView(findPrevNoWrap),\n replaceNext: () => withScrollActiveIntoView(replaceNext),\n replaceNextNoWrap: () => withScrollActiveIntoView(replaceNextNoWrap),\n replaceCurrent: () => withScrollActiveIntoView(replaceCurrent),\n replaceAll: () => withScrollActiveIntoView(replaceAll),\n })\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-search.js","names":[],"sources":["../src/search/index.ts"],"sourcesContent":["import { defineCommands, definePlugin, type Extension, type PlainExtension } from '@prosekit/core'\nimport type { Command } from '@prosekit/pm/state'\nimport type { EditorView } from '@prosekit/pm/view'\nimport {\n findNext,\n findNextNoWrap,\n findPrev,\n findPrevNoWrap,\n replaceAll,\n replaceCurrent,\n replaceNext,\n replaceNextNoWrap,\n search,\n SearchQuery,\n} from 'prosemirror-search'\n\n/**\n * Options for {@link defineSearchQuery}\n *\n * @public\n */\nexport interface SearchQueryOptions {\n /**\n * The search string (or regular expression).\n */\n search: string\n\n /**\n * The replace text.\n */\n replace?: string\n\n /**\n * Indicates whether the search is case-sensitive\n *\n * @default false\n */\n caseSensitive?: boolean\n\n /**\n * By default, string search will replace `\\n`, `\\r`, and `\\t` in the query\n * with newline, return, and tab characters. When this is set to true, that\n * behavior is disabled.\n *\n * @default false\n */\n literal?: boolean\n\n /**\n * When true, the search string is interpreted as a regular expression.\n *\n * @default false\n */\n regexp?: boolean\n\n /**\n * Enable whole-word matching.\n *\n * @default false\n */\n wholeWord?: boolean\n}\n\n/**\n * Defines an extension that stores a current search query and replace string.\n *\n * @public\n */\nexport function defineSearchQuery(options: SearchQueryOptions): PlainExtension {\n const query = new SearchQuery(options)\n return definePlugin(search({ initialQuery: query }))\n}\n\n/**\n * Scrolls the active search match into view.\n */\nfunction scrollActiveIntoView(view: EditorView) {\n if (view.isDestroyed) return\n const active = view.dom.querySelector('.ProseMirror-active-search-match')\n active?.scrollIntoView({\n block: 'nearest',\n inline: 'nearest',\n behavior: 'smooth',\n })\n}\n\n/**\n * Wraps a command and scrolls the active search match into view when the command\n * is applied.\n */\nfunction withScrollActiveIntoView(command: Command): Command {\n return (state, dispatch, view) => {\n const result = command(state, dispatch, view)\n if (result && dispatch && view) {\n // Add a small delay because the command itself will handle scrolling if\n // the view is focused.\n setTimeout(() => scrollActiveIntoView(view), 50)\n }\n return result\n }\n}\n\n/**\n * @internal\n */\nexport type SearchCommandsExtension = Extension<{\n Commands: {\n findNext: []\n findPrev: []\n findNextNoWrap: []\n findPrevNoWrap: []\n replaceNext: []\n replaceNextNoWrap: []\n replaceCurrent: []\n replaceAll: []\n }\n}>\n\n/**\n * Defines commands for search and replace.\n *\n * @public\n */\nexport function defineSearchCommands(): SearchCommandsExtension {\n return defineCommands({\n findNext: () => withScrollActiveIntoView(findNext),\n findPrev: () => withScrollActiveIntoView(findPrev),\n findNextNoWrap: () => withScrollActiveIntoView(findNextNoWrap),\n findPrevNoWrap: () => withScrollActiveIntoView(findPrevNoWrap),\n replaceNext: () => withScrollActiveIntoView(replaceNext),\n replaceNextNoWrap: () => withScrollActiveIntoView(replaceNextNoWrap),\n replaceCurrent: () => withScrollActiveIntoView(replaceCurrent),\n replaceAll: () => withScrollActiveIntoView(replaceAll),\n })\n}\n"],"mappings":";;;;;;;;AAoEA,SAAgB,kBAAkB,SAA6C;AAE7E,QAAO,aAAa,OAAO,EAAE,cADf,IAAI,YAAY,QAAQ,EACY,CAAC,CAAC;;;;;AAMtD,SAAS,qBAAqB,MAAkB;AAC9C,KAAI,KAAK,YAAa;AACP,MAAK,IAAI,cAAc,mCAAmC,EACjE,eAAe;EACrB,OAAO;EACP,QAAQ;EACR,UAAU;EACX,CAAC;;;;;;AAOJ,SAAS,yBAAyB,SAA2B;AAC3D,SAAQ,OAAO,UAAU,SAAS;EAChC,MAAM,SAAS,QAAQ,OAAO,UAAU,KAAK;AAC7C,MAAI,UAAU,YAAY,KAGxB,kBAAiB,qBAAqB,KAAK,EAAE,GAAG;AAElD,SAAO;;;;;;;;AAyBX,SAAgB,uBAAgD;AAC9D,QAAO,eAAe;EACpB,gBAAgB,yBAAyB,SAAS;EAClD,gBAAgB,yBAAyB,SAAS;EAClD,sBAAsB,yBAAyB,eAAe;EAC9D,sBAAsB,yBAAyB,eAAe;EAC9D,mBAAmB,yBAAyB,YAAY;EACxD,yBAAyB,yBAAyB,kBAAkB;EACpE,sBAAsB,yBAAyB,eAAe;EAC9D,kBAAkB,yBAAyB,WAAW;EACvD,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { defineMarkInputRule } from "./prosekit-extensions-input-rule.js";
|
|
2
2
|
import { canUseRegexLookbehind, defineCommands, defineKeymap, defineMarkSpec, toggleMark, union } from "@prosekit/core";
|
|
3
|
-
|
|
4
3
|
//#region src/strike/index.ts
|
|
5
4
|
/**
|
|
6
5
|
* @internal
|
|
@@ -50,7 +49,7 @@ function defineStrikeInputRule() {
|
|
|
50
49
|
function defineStrike() {
|
|
51
50
|
return union(defineStrikeSpec(), defineStrikeCommands(), defineStrikeKeymap(), defineStrikeInputRule());
|
|
52
51
|
}
|
|
53
|
-
|
|
54
52
|
//#endregion
|
|
55
53
|
export { defineStrike, defineStrikeCommands, defineStrikeInputRule, defineStrikeKeymap, defineStrikeSpec };
|
|
54
|
+
|
|
56
55
|
//# sourceMappingURL=prosekit-extensions-strike.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-strike.js","names":[],"sources":["../src/strike/index.ts"],"sourcesContent":["import {\n canUseRegexLookbehind,\n defineCommands,\n defineKeymap,\n defineMarkSpec,\n toggleMark,\n union,\n type Extension,\n type PlainExtension,\n type Union,\n} from '@prosekit/core'\nimport type { Attrs } from '@prosekit/pm/model'\n\nimport { defineMarkInputRule } from '../input-rule'\n\n/**\n * @internal\n */\nexport type StrikeSpecExtension = Extension<{\n Marks: {\n strike: Attrs\n }\n}>\n\n/**\n * @internal\n */\nexport function defineStrikeSpec(): StrikeSpecExtension {\n return defineMarkSpec({\n name: 'strike',\n parseDOM: [\n { tag: 's' },\n { tag: 'strike' },\n { tag: 'del' },\n { style: 'text-decoration=line-through' },\n { style: 'text-decoration-line=line-through' },\n ],\n toDOM() {\n return ['s', 0]\n },\n })\n}\n\n/**\n * @internal\n */\nexport type StrikeCommandsExtension = Extension<{\n Commands: {\n toggleStrike: []\n }\n}>\n\n/**\n * @internal\n */\nexport function defineStrikeCommands(): StrikeCommandsExtension {\n return defineCommands({\n toggleStrike: () => toggleMark({ type: 'strike' }),\n })\n}\n\n/**\n * @internal\n */\nexport function defineStrikeKeymap(): PlainExtension {\n return defineKeymap({\n 'Mod-S': toggleMark({ type: 'strike' }),\n 'Mod-X': toggleMark({ type: 'strike' }),\n })\n}\n\n/**\n * @internal\n */\nexport function defineStrikeInputRule(): PlainExtension {\n return defineMarkInputRule({\n regex: canUseRegexLookbehind()\n ? /(?<=\\s|^)~~([^\\s~]|[^\\s~][^~]*[^\\s~])~~$/\n : /~~([^\\s~]|[^\\s~][^~]*[^\\s~])~~$/,\n type: 'strike',\n })\n}\n\n/**\n * @internal\n */\nexport type StrikeExtension = Union<\n [StrikeSpecExtension, StrikeCommandsExtension]\n>\n\n/**\n * @public\n */\nexport function defineStrike(): StrikeExtension {\n return union(\n defineStrikeSpec(),\n defineStrikeCommands(),\n defineStrikeKeymap(),\n defineStrikeInputRule(),\n )\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-strike.js","names":[],"sources":["../src/strike/index.ts"],"sourcesContent":["import {\n canUseRegexLookbehind,\n defineCommands,\n defineKeymap,\n defineMarkSpec,\n toggleMark,\n union,\n type Extension,\n type PlainExtension,\n type Union,\n} from '@prosekit/core'\nimport type { Attrs } from '@prosekit/pm/model'\n\nimport { defineMarkInputRule } from '../input-rule/index.ts'\n\n/**\n * @internal\n */\nexport type StrikeSpecExtension = Extension<{\n Marks: {\n strike: Attrs\n }\n}>\n\n/**\n * @internal\n */\nexport function defineStrikeSpec(): StrikeSpecExtension {\n return defineMarkSpec({\n name: 'strike',\n parseDOM: [\n { tag: 's' },\n { tag: 'strike' },\n { tag: 'del' },\n { style: 'text-decoration=line-through' },\n { style: 'text-decoration-line=line-through' },\n ],\n toDOM() {\n return ['s', 0]\n },\n })\n}\n\n/**\n * @internal\n */\nexport type StrikeCommandsExtension = Extension<{\n Commands: {\n toggleStrike: []\n }\n}>\n\n/**\n * @internal\n */\nexport function defineStrikeCommands(): StrikeCommandsExtension {\n return defineCommands({\n toggleStrike: () => toggleMark({ type: 'strike' }),\n })\n}\n\n/**\n * @internal\n */\nexport function defineStrikeKeymap(): PlainExtension {\n return defineKeymap({\n 'Mod-S': toggleMark({ type: 'strike' }),\n 'Mod-X': toggleMark({ type: 'strike' }),\n })\n}\n\n/**\n * @internal\n */\nexport function defineStrikeInputRule(): PlainExtension {\n return defineMarkInputRule({\n regex: canUseRegexLookbehind()\n ? /(?<=\\s|^)~~([^\\s~]|[^\\s~][^~]*[^\\s~])~~$/\n : /~~([^\\s~]|[^\\s~][^~]*[^\\s~])~~$/,\n type: 'strike',\n })\n}\n\n/**\n * @internal\n */\nexport type StrikeExtension = Union<\n [StrikeSpecExtension, StrikeCommandsExtension]\n>\n\n/**\n * @public\n */\nexport function defineStrike(): StrikeExtension {\n return union(\n defineStrikeSpec(),\n defineStrikeCommands(),\n defineStrikeKeymap(),\n defineStrikeInputRule(),\n )\n}\n"],"mappings":";;;;;;AA2BA,SAAgB,mBAAwC;AACtD,QAAO,eAAe;EACpB,MAAM;EACN,UAAU;GACR,EAAE,KAAK,KAAK;GACZ,EAAE,KAAK,UAAU;GACjB,EAAE,KAAK,OAAO;GACd,EAAE,OAAO,gCAAgC;GACzC,EAAE,OAAO,qCAAqC;GAC/C;EACD,QAAQ;AACN,UAAO,CAAC,KAAK,EAAE;;EAElB,CAAC;;;;;AAeJ,SAAgB,uBAAgD;AAC9D,QAAO,eAAe,EACpB,oBAAoB,WAAW,EAAE,MAAM,UAAU,CAAC,EACnD,CAAC;;;;;AAMJ,SAAgB,qBAAqC;AACnD,QAAO,aAAa;EAClB,SAAS,WAAW,EAAE,MAAM,UAAU,CAAC;EACvC,SAAS,WAAW,EAAE,MAAM,UAAU,CAAC;EACxC,CAAC;;;;;AAMJ,SAAgB,wBAAwC;AACtD,QAAO,oBAAoB;EACzB,OAAO,uBAAuB,GAC1B,6CACA;EACJ,MAAM;EACP,CAAC;;;;;AAaJ,SAAgB,eAAgC;AAC9C,QAAO,MACL,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,uBAAuB,CACxB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Extension, PlainExtension, Union } from "@prosekit/core";
|
|
2
1
|
import { Command } from "@prosekit/pm/state";
|
|
2
|
+
import { Extension, PlainExtension, Union } from "@prosekit/core";
|
|
3
3
|
import { Attrs } from "@prosekit/pm/model";
|
|
4
4
|
import { CellSelection, MoveTableColumnOptions, MoveTableRowOptions, findTable, moveTableColumn, moveTableRow } from "prosemirror-tables";
|
|
5
5
|
|
|
@@ -33,22 +33,6 @@ interface InsertTableOptions {
|
|
|
33
33
|
*/
|
|
34
34
|
declare function insertTable(options: InsertTableOptions): Command;
|
|
35
35
|
//#endregion
|
|
36
|
-
//#region src/table/table-commands/select-table.d.ts
|
|
37
|
-
/**
|
|
38
|
-
* @public
|
|
39
|
-
*/
|
|
40
|
-
interface SelectTableOptions {
|
|
41
|
-
/**
|
|
42
|
-
* A hit position of the table to select from. By default, the selection
|
|
43
|
-
* anchor will be used.
|
|
44
|
-
*/
|
|
45
|
-
pos?: number;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* @public
|
|
49
|
-
*/
|
|
50
|
-
declare function selectTable(options?: SelectTableOptions): Command;
|
|
51
|
-
//#endregion
|
|
52
36
|
//#region src/table/table-commands/select-table-cell.d.ts
|
|
53
37
|
/**
|
|
54
38
|
* @public
|
|
@@ -107,6 +91,22 @@ interface SelectTableRowOptions {
|
|
|
107
91
|
*/
|
|
108
92
|
declare function selectTableRow(options?: SelectTableRowOptions): Command;
|
|
109
93
|
//#endregion
|
|
94
|
+
//#region src/table/table-commands/select-table.d.ts
|
|
95
|
+
/**
|
|
96
|
+
* @public
|
|
97
|
+
*/
|
|
98
|
+
interface SelectTableOptions {
|
|
99
|
+
/**
|
|
100
|
+
* A hit position of the table to select from. By default, the selection
|
|
101
|
+
* anchor will be used.
|
|
102
|
+
*/
|
|
103
|
+
pos?: number;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* @public
|
|
107
|
+
*/
|
|
108
|
+
declare function selectTable(options?: SelectTableOptions): Command;
|
|
109
|
+
//#endregion
|
|
110
110
|
//#region src/table/table-commands.d.ts
|
|
111
111
|
/**
|
|
112
112
|
* @internal
|
|
@@ -140,6 +140,30 @@ type TableCommandsExtension = Extension<{
|
|
|
140
140
|
*/
|
|
141
141
|
declare function defineTableCommands(): TableCommandsExtension;
|
|
142
142
|
//#endregion
|
|
143
|
+
//#region src/table/table-commands/exit-table.d.ts
|
|
144
|
+
/**
|
|
145
|
+
* When the selection is in a table node, create a default block after the table
|
|
146
|
+
* table, and move the cursor there.
|
|
147
|
+
*
|
|
148
|
+
* @public
|
|
149
|
+
*/
|
|
150
|
+
declare const exitTable: Command;
|
|
151
|
+
//#endregion
|
|
152
|
+
//#region src/table/table-drop-indicator.d.ts
|
|
153
|
+
/**
|
|
154
|
+
* Hides the drop indicator when dragging a table column or row by using the
|
|
155
|
+
* table handle.
|
|
156
|
+
*
|
|
157
|
+
* @internal
|
|
158
|
+
*/
|
|
159
|
+
declare function defineTableDropIndicator(): PlainExtension;
|
|
160
|
+
//#endregion
|
|
161
|
+
//#region src/table/table-plugins.d.ts
|
|
162
|
+
/**
|
|
163
|
+
* @public
|
|
164
|
+
*/
|
|
165
|
+
declare function defineTablePlugins(): PlainExtension;
|
|
166
|
+
//#endregion
|
|
143
167
|
//#region src/table/table-spec.d.ts
|
|
144
168
|
/**
|
|
145
169
|
* @public
|
|
@@ -195,47 +219,23 @@ type TableHeaderCellSpecExtension = Extension<{
|
|
|
195
219
|
}>;
|
|
196
220
|
declare function defineTableHeaderCellSpec(): TableHeaderCellSpecExtension;
|
|
197
221
|
//#endregion
|
|
198
|
-
//#region src/table/table.d.ts
|
|
199
|
-
/**
|
|
200
|
-
* @internal
|
|
201
|
-
*/
|
|
202
|
-
type TableExtension = Union<[TableSpecExtension, TableRowSpecExtension, TableCellSpecExtension, TableHeaderCellSpecExtension, TableCommandsExtension]>;
|
|
203
|
-
/**
|
|
204
|
-
* @public
|
|
205
|
-
*/
|
|
206
|
-
declare function defineTable(): TableExtension;
|
|
207
|
-
//#endregion
|
|
208
|
-
//#region src/table/table-commands/exit-table.d.ts
|
|
222
|
+
//#region src/table/table-utils.d.ts
|
|
209
223
|
/**
|
|
210
|
-
*
|
|
211
|
-
* table, and move the cursor there.
|
|
224
|
+
* Checks if the given object is a `CellSelection` instance.
|
|
212
225
|
*
|
|
213
226
|
* @public
|
|
214
227
|
*/
|
|
215
|
-
declare
|
|
228
|
+
declare function isCellSelection(value: unknown): value is CellSelection;
|
|
216
229
|
//#endregion
|
|
217
|
-
//#region src/table/table
|
|
230
|
+
//#region src/table/table.d.ts
|
|
218
231
|
/**
|
|
219
|
-
* Hides the drop indicator when dragging a table column or row by using the
|
|
220
|
-
* table handle.
|
|
221
|
-
*
|
|
222
232
|
* @internal
|
|
223
233
|
*/
|
|
224
|
-
|
|
225
|
-
//#endregion
|
|
226
|
-
//#region src/table/table-plugins.d.ts
|
|
227
|
-
/**
|
|
228
|
-
* @public
|
|
229
|
-
*/
|
|
230
|
-
declare function defineTablePlugins(): PlainExtension;
|
|
231
|
-
//#endregion
|
|
232
|
-
//#region src/table/table-utils.d.ts
|
|
234
|
+
type TableExtension = Union<[TableSpecExtension, TableRowSpecExtension, TableCellSpecExtension, TableHeaderCellSpecExtension, TableCommandsExtension]>;
|
|
233
235
|
/**
|
|
234
|
-
* Checks if the given object is a `CellSelection` instance.
|
|
235
|
-
*
|
|
236
236
|
* @public
|
|
237
237
|
*/
|
|
238
|
-
declare function
|
|
238
|
+
declare function defineTable(): TableExtension;
|
|
239
239
|
//#endregion
|
|
240
240
|
export { type InsertTableOptions, type MoveTableColumnOptions, type MoveTableRowOptions, type SelectTableCellOptions, type SelectTableColumnOptions, type SelectTableOptions, type SelectTableRowOptions, type TableCellSpecExtension, type TableCommandsExtension, type TableExtension, type TableHeaderCellSpecExtension, type TableRowSpecExtension, type TableSpecExtension, defineTable, defineTableCellSpec, defineTableCommands, defineTableDropIndicator, defineTableHeaderCellSpec, defineTablePlugins, defineTableRowSpec, defineTableSpec, exitTable, findTable, insertTable, isCellSelection, moveTableColumn, moveTableRow, selectTable, selectTableCell, selectTableColumn, selectTableRow };
|
|
241
241
|
//# sourceMappingURL=prosekit-extensions-table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-table.d.ts","names":[],"sources":["../src/table/table-commands/insert-table.ts","../src/table/table-commands/select-table.ts","../src/table/table-commands/select-table-
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-table.d.ts","names":[],"sources":["../src/table/table-commands/insert-table.ts","../src/table/table-commands/select-table-cell.ts","../src/table/table-commands/select-table-column.ts","../src/table/table-commands/select-table-row.ts","../src/table/table-commands/select-table.ts","../src/table/table-commands.ts","../src/table/table-commands/exit-table.ts","../src/table/table-drop-indicator.ts","../src/table/table-plugins.ts","../src/table/table-spec.ts","../src/table/table-utils.ts","../src/table/table.ts"],"mappings":";;;;;;;;;UA2CiB,kBAAA;;AAAjB;;EAIE,GAAA;EAJiC;;;EASjC,GAAA;EAOM;;AAWR;;;EAXE,MAAA;AAAA;;;;;;;;ACnDF;iBD8DgB,WAAA,CAAY,OAAA,EAAS,kBAAA,GAAqB,OAAA;;;;;;UC9DzC,sBAAA;;ADmCjB;;;EC9BE,GAAA;AAAA;;;;iBAMc,eAAA,CAAgB,OAAA,GAAU,sBAAA,GAAyB,OAAA;;;;;;UCXlD,wBAAA;;AFmCjB;;;EE9BE,MAAA;EFkCA;;;;EE5BA,IAAA;AAAA;;;;iBAMc,iBAAA,CAAkB,OAAA,GAAU,wBAAA,GAA2B,OAAA;;;;;;UCjBtD,qBAAA;;AHmCjB;;;EG9BE,MAAA;EHkCA;;;;EG5BA,IAAA;AAAA;;;;iBAMc,cAAA,CAAe,OAAA,GAAU,qBAAA,GAAwB,OAAA;;;;;;UCjBhD,kBAAA;;AJmCjB;;;EI9BE,GAAA;AAAA;;;;iBAMc,WAAA,CAAY,OAAA,GAAU,kBAAA,GAAqB,OAAA;;;;;;KCO/C,sBAAA,GAAyB,SAAA;EACnC,QAAA;IACE,WAAA,GAAc,OAAA,EAAS,kBAAA;IACvB,SAAA;IAEA,WAAA,GAAc,OAAA,GAAU,kBAAA;IACxB,eAAA,GAAkB,OAAA,GAAU,sBAAA;IAC5B,iBAAA,GAAoB,OAAA,GAAU,wBAAA;IAC9B,cAAA,GAAiB,OAAA,GAAU,qBAAA;IAE3B,oBAAA;IACA,mBAAA;IACA,gBAAA;IACA,gBAAA;IAEA,WAAA;IACA,iBAAA;IACA,cAAA;IACA,mBAAA;IAEA,eAAA;IACA,cAAA;IAEA,YAAA,GAAe,OAAA,EAAS,mBAAA;IACxB,eAAA,GAAkB,OAAA,EAAS,sBAAA;EAAA;AAAA;;;;;;iBASf,mBAAA,CAAA,GAAuB,sBAAA;;;;;;;;ALhBvC;cMhCa,SAAA,EAAW,OAAA;;;;;;;;ANgCxB;iBOhCgB,wBAAA,CAAA,GAA4B,cAAA;;;;;;iBCL5B,kBAAA,CAAA,GAAsB,cAAA;;;;;;UCGrB,SAAA;EACf,OAAA;EACA,OAAA;EACA,QAAA;AAAA;;;;KAYU,kBAAA,GAAqB,SAAA;EAC/B,KAAA;IACE,KAAA,EAAO,KAAA;EAAA;AAAA;;;;iBAaK,eAAA,CAAA,GAAmB,kBAAA;;;;KAWvB,qBAAA,GAAwB,SAAA;EAClC,KAAA;IACE,QAAA,EAAU,KAAA;EAAA;AAAA;;;ARjCd;iBQwCgB,kBAAA,CAAA,GAAsB,qBAAA;;;;KAW1B,sBAAA,GAAyB,SAAA;EACnC,KAAA;IACE,SAAA,EAAW,SAAA;EAAA;AAAA;;;APhEf;iBOuEgB,mBAAA,CAAA,GAAuB,sBAAA;;;;KAW3B,4BAAA,GAA+B,SAAA;EACzC,KAAA;IACE,eAAA,EAAiB,SAAA;EAAA;AAAA;AAAA,iBAIL,yBAAA,CAAA,GAA6B,4BAAA;;;;;;;ATrD7C;iBUlCgB,eAAA,CAAgB,KAAA,YAAiB,KAAA,IAAS,aAAA;;;;;;KCU9C,cAAA,GAAiB,KAAA,EAEzB,kBAAA,EACA,qBAAA,EACA,sBAAA,EACA,4BAAA,EACA,sBAAA;;;AX6CJ;iBWtCgB,WAAA,CAAA,GAAe,cAAA"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { _ as insertTable, a as defineTableSpec, c as defineTableCommands, d as
|
|
2
|
-
|
|
3
|
-
export { defineTable, defineTableCellSpec, defineTableCommands, defineTableDropIndicator, defineTableHeaderCellSpec, defineTablePlugins, defineTableRowSpec, defineTableSpec, exitTable, findTable, insertTable, isCellSelection, moveTableColumn, moveTableRow, selectTable, selectTableCell, selectTableColumn, selectTableRow };
|
|
1
|
+
import { _ as insertTable, a as defineTableSpec, c as defineTableCommands, d as selectTableColumn, f as selectTableCell, g as moveTableColumn, h as moveTableRow, i as defineTableRowSpec, l as selectTable, m as isCellSelection, n as defineTableCellSpec, o as defineTablePlugins, p as findTable, r as defineTableHeaderCellSpec, s as defineTableDropIndicator, t as defineTable, u as selectTableRow, v as exitTable } from "./table.js";
|
|
2
|
+
export { defineTable, defineTableCellSpec, defineTableCommands, defineTableDropIndicator, defineTableHeaderCellSpec, defineTablePlugins, defineTableRowSpec, defineTableSpec, exitTable, findTable, insertTable, isCellSelection, moveTableColumn, moveTableRow, selectTable, selectTableCell, selectTableColumn, selectTableRow };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { defineCommands, defineKeymap, defineNodeAttr, setNodeAttrsBetween, union } from "@prosekit/core";
|
|
2
|
-
|
|
3
2
|
//#region src/text-align/index.ts
|
|
4
3
|
function defineTextAlignAttr(type, defaultValue) {
|
|
5
4
|
return defineNodeAttr({
|
|
@@ -69,7 +68,7 @@ function defineTextAlignKeymap(types) {
|
|
|
69
68
|
function defineTextAlign(options) {
|
|
70
69
|
return union(defineTextAlignAttrs(options.types, options.default || "left"), defineTextAlignKeymap(options.types), defineTextAlignCommands(options.types));
|
|
71
70
|
}
|
|
72
|
-
|
|
73
71
|
//#endregion
|
|
74
72
|
export { defineTextAlign, defineTextAlignCommands, defineTextAlignKeymap, setTextAlign };
|
|
73
|
+
|
|
75
74
|
//# sourceMappingURL=prosekit-extensions-text-align.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-text-align.js","names":[],"sources":["../src/text-align/index.ts"],"sourcesContent":["import {\n defineCommands,\n defineKeymap,\n defineNodeAttr,\n setNodeAttrsBetween,\n union,\n type Extension,\n type PlainExtension,\n type Union,\n} from '@prosekit/core'\nimport type { Command } from '@prosekit/pm/state'\n\n/**\n * @public\n */\nexport interface TextAlignOptions<NodeName extends string = string> {\n /**\n * The names of node to add the attribute to.\n *\n * @example\n *\n * [\"paragraph\", \"heading\"]\n */\n types: NodeName[]\n\n /**\n * The default value for the attribute.\n *\n * @default \"left\"\n */\n default?: string\n}\n\nfunction defineTextAlignAttr<NodeName extends string>(\n type: NodeName,\n defaultValue: string | null,\n) {\n return defineNodeAttr<NodeName, 'textAlign', string | null>({\n type,\n attr: 'textAlign',\n default: defaultValue,\n splittable: true,\n toDOM: (value: any) => (value ? ['style', `text-align:${value};`] : null),\n parseDOM: (node: HTMLElement) => {\n return node.style.getPropertyValue('text-align') || null\n },\n })\n}\n\n/**\n * @internal\n */\nexport type TextAlignAttrsExtension<NodeName extends string> = Extension<{\n Nodes: { [K in NodeName]: { textAlign: string | null } }\n}>\n\n/**\n * @internal\n */\nfunction defineTextAlignAttrs<NodeName extends string>(\n types: NodeName[],\n defaultValue: string | null,\n): TextAlignAttrsExtension<NodeName> {\n return union(types.map((type) => defineTextAlignAttr(type, defaultValue)))\n}\n\n/**\n * @internal\n */\nexport function setTextAlign({\n types,\n value,\n}: {\n types: string[]\n value: string | null\n}): Command {\n return setNodeAttrsBetween({ type: types, attrs: { textAlign: value } })\n}\n\n/**\n * @internal\n */\nexport type TextAlignCommandsExtension = Extension<{\n Commands: {\n setTextAlign: [value: string | null]\n }\n}>\n\n/**\n * @internal\n */\nexport function defineTextAlignCommands(\n types: string[],\n): TextAlignCommandsExtension {\n return defineCommands({\n setTextAlign: (value: string | null) => setTextAlign({ types, value }),\n })\n}\n\n/**\n * @internal\n */\nexport function defineTextAlignKeymap(types: string[]): PlainExtension {\n return defineKeymap({\n 'Mod-L': setTextAlign({ types, value: 'left' }),\n 'Mod-E': setTextAlign({ types, value: 'center' }),\n 'Mod-R': setTextAlign({ types, value: 'right' }),\n 'Mod-J': setTextAlign({ types, value: 'justify' }),\n })\n}\n\n/**\n * @internal\n */\nexport type TextAlignExtension<NodeName extends string> = Union<\n [TextAlignAttrsExtension<NodeName>, TextAlignCommandsExtension]\n>\n\n/**\n * Adds a `textAlign` attribute to the specified nodes. This will be rendered as\n * a CSS `text-align` style.\n *\n * @public\n */\nexport function defineTextAlign<NodeName extends string = string>(\n options: TextAlignOptions<NodeName>,\n): TextAlignExtension<NodeName> {\n return union(\n defineTextAlignAttrs<NodeName>(options.types, options.default || 'left'),\n defineTextAlignKeymap(options.types),\n defineTextAlignCommands(options.types),\n )\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-text-align.js","names":[],"sources":["../src/text-align/index.ts"],"sourcesContent":["import {\n defineCommands,\n defineKeymap,\n defineNodeAttr,\n setNodeAttrsBetween,\n union,\n type Extension,\n type PlainExtension,\n type Union,\n} from '@prosekit/core'\nimport type { Command } from '@prosekit/pm/state'\n\n/**\n * @public\n */\nexport interface TextAlignOptions<NodeName extends string = string> {\n /**\n * The names of node to add the attribute to.\n *\n * @example\n *\n * [\"paragraph\", \"heading\"]\n */\n types: NodeName[]\n\n /**\n * The default value for the attribute.\n *\n * @default \"left\"\n */\n default?: string\n}\n\nfunction defineTextAlignAttr<NodeName extends string>(\n type: NodeName,\n defaultValue: string | null,\n) {\n return defineNodeAttr<NodeName, 'textAlign', string | null>({\n type,\n attr: 'textAlign',\n default: defaultValue,\n splittable: true,\n toDOM: (value: any) => (value ? ['style', `text-align:${value};`] : null),\n parseDOM: (node: HTMLElement) => {\n return node.style.getPropertyValue('text-align') || null\n },\n })\n}\n\n/**\n * @internal\n */\nexport type TextAlignAttrsExtension<NodeName extends string> = Extension<{\n Nodes: { [K in NodeName]: { textAlign: string | null } }\n}>\n\n/**\n * @internal\n */\nfunction defineTextAlignAttrs<NodeName extends string>(\n types: NodeName[],\n defaultValue: string | null,\n): TextAlignAttrsExtension<NodeName> {\n return union(types.map((type) => defineTextAlignAttr(type, defaultValue)))\n}\n\n/**\n * @internal\n */\nexport function setTextAlign({\n types,\n value,\n}: {\n types: string[]\n value: string | null\n}): Command {\n return setNodeAttrsBetween({ type: types, attrs: { textAlign: value } })\n}\n\n/**\n * @internal\n */\nexport type TextAlignCommandsExtension = Extension<{\n Commands: {\n setTextAlign: [value: string | null]\n }\n}>\n\n/**\n * @internal\n */\nexport function defineTextAlignCommands(\n types: string[],\n): TextAlignCommandsExtension {\n return defineCommands({\n setTextAlign: (value: string | null) => setTextAlign({ types, value }),\n })\n}\n\n/**\n * @internal\n */\nexport function defineTextAlignKeymap(types: string[]): PlainExtension {\n return defineKeymap({\n 'Mod-L': setTextAlign({ types, value: 'left' }),\n 'Mod-E': setTextAlign({ types, value: 'center' }),\n 'Mod-R': setTextAlign({ types, value: 'right' }),\n 'Mod-J': setTextAlign({ types, value: 'justify' }),\n })\n}\n\n/**\n * @internal\n */\nexport type TextAlignExtension<NodeName extends string> = Union<\n [TextAlignAttrsExtension<NodeName>, TextAlignCommandsExtension]\n>\n\n/**\n * Adds a `textAlign` attribute to the specified nodes. This will be rendered as\n * a CSS `text-align` style.\n *\n * @public\n */\nexport function defineTextAlign<NodeName extends string = string>(\n options: TextAlignOptions<NodeName>,\n): TextAlignExtension<NodeName> {\n return union(\n defineTextAlignAttrs<NodeName>(options.types, options.default || 'left'),\n defineTextAlignKeymap(options.types),\n defineTextAlignCommands(options.types),\n )\n}\n"],"mappings":";;AAiCA,SAAS,oBACP,MACA,cACA;AACA,QAAO,eAAqD;EAC1D;EACA,MAAM;EACN,SAAS;EACT,YAAY;EACZ,QAAQ,UAAgB,QAAQ,CAAC,SAAS,cAAc,MAAM,GAAG,GAAG;EACpE,WAAW,SAAsB;AAC/B,UAAO,KAAK,MAAM,iBAAiB,aAAa,IAAI;;EAEvD,CAAC;;;;;AAaJ,SAAS,qBACP,OACA,cACmC;AACnC,QAAO,MAAM,MAAM,KAAK,SAAS,oBAAoB,MAAM,aAAa,CAAC,CAAC;;;;;AAM5E,SAAgB,aAAa,EAC3B,OACA,SAIU;AACV,QAAO,oBAAoB;EAAE,MAAM;EAAO,OAAO,EAAE,WAAW,OAAO;EAAE,CAAC;;;;;AAe1E,SAAgB,wBACd,OAC4B;AAC5B,QAAO,eAAe,EACpB,eAAe,UAAyB,aAAa;EAAE;EAAO;EAAO,CAAC,EACvE,CAAC;;;;;AAMJ,SAAgB,sBAAsB,OAAiC;AACrE,QAAO,aAAa;EAClB,SAAS,aAAa;GAAE;GAAO,OAAO;GAAQ,CAAC;EAC/C,SAAS,aAAa;GAAE;GAAO,OAAO;GAAU,CAAC;EACjD,SAAS,aAAa;GAAE;GAAO,OAAO;GAAS,CAAC;EAChD,SAAS,aAAa;GAAE;GAAO,OAAO;GAAW,CAAC;EACnD,CAAC;;;;;;;;AAgBJ,SAAgB,gBACd,SAC8B;AAC9B,QAAO,MACL,qBAA+B,QAAQ,OAAO,QAAQ,WAAW,OAAO,EACxE,sBAAsB,QAAQ,MAAM,EACpC,wBAAwB,QAAQ,MAAM,CACvC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { addMark, defineCommands, defineMarkSpec, removeMark, union } from "@prosekit/core";
|
|
2
|
-
|
|
3
2
|
//#region src/text-color/text-color-commands.ts
|
|
4
3
|
/**
|
|
5
4
|
* @internal
|
|
@@ -25,7 +24,6 @@ function defineTextColorCommands() {
|
|
|
25
24
|
removeTextColor
|
|
26
25
|
});
|
|
27
26
|
}
|
|
28
|
-
|
|
29
27
|
//#endregion
|
|
30
28
|
//#region src/text-color/text-color-spec.ts
|
|
31
29
|
/**
|
|
@@ -59,7 +57,6 @@ function defineTextColorSpec() {
|
|
|
59
57
|
}
|
|
60
58
|
});
|
|
61
59
|
}
|
|
62
|
-
|
|
63
60
|
//#endregion
|
|
64
61
|
//#region src/text-color/text-color.ts
|
|
65
62
|
/**
|
|
@@ -70,7 +67,7 @@ function defineTextColorSpec() {
|
|
|
70
67
|
function defineTextColor() {
|
|
71
68
|
return union(defineTextColorSpec(), defineTextColorCommands());
|
|
72
69
|
}
|
|
73
|
-
|
|
74
70
|
//#endregion
|
|
75
71
|
export { addTextColor, defineTextColor, defineTextColorCommands, defineTextColorSpec, removeTextColor };
|
|
72
|
+
|
|
76
73
|
//# sourceMappingURL=prosekit-extensions-text-color.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-text-color.js","names":[],"sources":["../src/text-color/text-color-commands.ts","../src/text-color/text-color-spec.ts","../src/text-color/text-color.ts"],"sourcesContent":["import { addMark, defineCommands, removeMark, type Extension } from '@prosekit/core'\nimport type { Command } from '@prosekit/pm/state'\n\nimport type { TextColorAttrs } from './text-color-spec'\n\n/**\n * @internal\n */\nexport function addTextColor(attrs: TextColorAttrs): Command {\n return addMark({ type: 'textColor', attrs })\n}\n\n/**\n * @internal\n */\nexport function removeTextColor(): Command {\n return removeMark({ type: 'textColor' })\n}\n\n/**\n * @internal\n */\nexport type TextColorCommandsExtension = Extension<{\n Commands: {\n addTextColor: [attrs: TextColorAttrs]\n removeTextColor: []\n }\n}>\n\n/**\n * @internal\n */\nexport function defineTextColorCommands(): TextColorCommandsExtension {\n return defineCommands({ addTextColor, removeTextColor })\n}\n","import { defineMarkSpec, type Extension } from '@prosekit/core'\n\n/**\n * Attributes for the `textColor` mark.\n *\n * @public\n */\nexport interface TextColorAttrs {\n color: string\n}\n\n/**\n * @internal\n */\nexport type TextColorSpecExtension = Extension<{\n Marks: {\n textColor: TextColorAttrs\n }\n}>\n\n/**\n * @internal\n */\nexport function defineTextColorSpec(): TextColorSpecExtension {\n return defineMarkSpec<'textColor', TextColorAttrs>({\n name: 'textColor',\n attrs: {\n color: {\n validate: 'string',\n },\n },\n parseDOM: [\n {\n tag: ':where([style*=\"color:\"], [data-text-color])',\n getAttrs: (node): TextColorAttrs | false => {\n // When both `data-text-color` and `style=\"color\"` are present, we\n // prioritize the `data-text-color` attribute. This avoids the\n // browser's default behavior of changing hex colors to rgba in style\n // attribute.\n const value = node.getAttribute('data-text-color')\n if (value && value !== 'inherit') {\n return { color: value }\n }\n const color = node.style.color\n if (color && color !== 'inherit') {\n return { color }\n }\n return false\n },\n consuming: false,\n },\n ],\n toDOM(mark) {\n const color = (mark.attrs as TextColorAttrs).color\n return ['span', { 'style': `color: ${color};`, 'data-text-color': color }, 0]\n },\n })\n}\n","import { union, type Union } from '@prosekit/core'\n\nimport { defineTextColorCommands, type TextColorCommandsExtension } from './text-color-commands'\nimport { defineTextColorSpec, type TextColorSpecExtension } from './text-color-spec'\n\n/**\n * @internal\n */\nexport type TextColorExtension = Union<[TextColorSpecExtension, TextColorCommandsExtension]>\n\n/**\n * Defines the `textColor` mark and some commands for it.\n *\n * @public\n */\nexport function defineTextColor(): TextColorExtension {\n return union(\n defineTextColorSpec(),\n defineTextColorCommands(),\n )\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-text-color.js","names":[],"sources":["../src/text-color/text-color-commands.ts","../src/text-color/text-color-spec.ts","../src/text-color/text-color.ts"],"sourcesContent":["import { addMark, defineCommands, removeMark, type Extension } from '@prosekit/core'\nimport type { Command } from '@prosekit/pm/state'\n\nimport type { TextColorAttrs } from './text-color-spec.ts'\n\n/**\n * @internal\n */\nexport function addTextColor(attrs: TextColorAttrs): Command {\n return addMark({ type: 'textColor', attrs })\n}\n\n/**\n * @internal\n */\nexport function removeTextColor(): Command {\n return removeMark({ type: 'textColor' })\n}\n\n/**\n * @internal\n */\nexport type TextColorCommandsExtension = Extension<{\n Commands: {\n addTextColor: [attrs: TextColorAttrs]\n removeTextColor: []\n }\n}>\n\n/**\n * @internal\n */\nexport function defineTextColorCommands(): TextColorCommandsExtension {\n return defineCommands({ addTextColor, removeTextColor })\n}\n","import { defineMarkSpec, type Extension } from '@prosekit/core'\n\n/**\n * Attributes for the `textColor` mark.\n *\n * @public\n */\nexport interface TextColorAttrs {\n color: string\n}\n\n/**\n * @internal\n */\nexport type TextColorSpecExtension = Extension<{\n Marks: {\n textColor: TextColorAttrs\n }\n}>\n\n/**\n * @internal\n */\nexport function defineTextColorSpec(): TextColorSpecExtension {\n return defineMarkSpec<'textColor', TextColorAttrs>({\n name: 'textColor',\n attrs: {\n color: {\n validate: 'string',\n },\n },\n parseDOM: [\n {\n tag: ':where([style*=\"color:\"], [data-text-color])',\n getAttrs: (node): TextColorAttrs | false => {\n // When both `data-text-color` and `style=\"color\"` are present, we\n // prioritize the `data-text-color` attribute. This avoids the\n // browser's default behavior of changing hex colors to rgba in style\n // attribute.\n const value = node.getAttribute('data-text-color')\n if (value && value !== 'inherit') {\n return { color: value }\n }\n const color = node.style.color\n if (color && color !== 'inherit') {\n return { color }\n }\n return false\n },\n consuming: false,\n },\n ],\n toDOM(mark) {\n const color = (mark.attrs as TextColorAttrs).color\n return ['span', { 'style': `color: ${color};`, 'data-text-color': color }, 0]\n },\n })\n}\n","import { union, type Union } from '@prosekit/core'\n\nimport { defineTextColorCommands, type TextColorCommandsExtension } from './text-color-commands.ts'\nimport { defineTextColorSpec, type TextColorSpecExtension } from './text-color-spec.ts'\n\n/**\n * @internal\n */\nexport type TextColorExtension = Union<[TextColorSpecExtension, TextColorCommandsExtension]>\n\n/**\n * Defines the `textColor` mark and some commands for it.\n *\n * @public\n */\nexport function defineTextColor(): TextColorExtension {\n return union(\n defineTextColorSpec(),\n defineTextColorCommands(),\n )\n}\n"],"mappings":";;;;;AAQA,SAAgB,aAAa,OAAgC;AAC3D,QAAO,QAAQ;EAAE,MAAM;EAAa;EAAO,CAAC;;;;;AAM9C,SAAgB,kBAA2B;AACzC,QAAO,WAAW,EAAE,MAAM,aAAa,CAAC;;;;;AAgB1C,SAAgB,0BAAsD;AACpE,QAAO,eAAe;EAAE;EAAc;EAAiB,CAAC;;;;;;;ACV1D,SAAgB,sBAA8C;AAC5D,QAAO,eAA4C;EACjD,MAAM;EACN,OAAO,EACL,OAAO,EACL,UAAU,UACX,EACF;EACD,UAAU,CACR;GACE,KAAK;GACL,WAAW,SAAiC;IAK1C,MAAM,QAAQ,KAAK,aAAa,kBAAkB;AAClD,QAAI,SAAS,UAAU,UACrB,QAAO,EAAE,OAAO,OAAO;IAEzB,MAAM,QAAQ,KAAK,MAAM;AACzB,QAAI,SAAS,UAAU,UACrB,QAAO,EAAE,OAAO;AAElB,WAAO;;GAET,WAAW;GACZ,CACF;EACD,MAAM,MAAM;GACV,MAAM,QAAS,KAAK,MAAyB;AAC7C,UAAO;IAAC;IAAQ;KAAE,SAAS,UAAU,MAAM;KAAI,mBAAmB;KAAO;IAAE;IAAE;;EAEhF,CAAC;;;;;;;;;ACzCJ,SAAgB,kBAAsC;AACpD,QAAO,MACL,qBAAqB,EACrB,yBAAyB,CAC1B"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { defineNodeSpec } from "@prosekit/core";
|
|
2
|
-
|
|
3
2
|
//#region src/text/index.ts
|
|
4
3
|
/**
|
|
5
4
|
* @public
|
|
@@ -10,7 +9,7 @@ function defineText() {
|
|
|
10
9
|
group: "inline"
|
|
11
10
|
});
|
|
12
11
|
}
|
|
13
|
-
|
|
14
12
|
//#endregion
|
|
15
13
|
export { defineText };
|
|
14
|
+
|
|
16
15
|
//# sourceMappingURL=prosekit-extensions-text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-text.js","names":[],"sources":["../src/text/index.ts"],"sourcesContent":["import { defineNodeSpec, type Extension } from '@prosekit/core'\nimport type { Attrs } from '@prosekit/pm/model'\n\n/**\n * @internal\n */\nexport type TextExtension = Extension<{\n Nodes: {\n text: Attrs\n }\n}>\n\n/**\n * @public\n */\nexport function defineText(): TextExtension {\n return defineNodeSpec({\n name: 'text',\n group: 'inline',\n })\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-text.js","names":[],"sources":["../src/text/index.ts"],"sourcesContent":["import { defineNodeSpec, type Extension } from '@prosekit/core'\nimport type { Attrs } from '@prosekit/pm/model'\n\n/**\n * @internal\n */\nexport type TextExtension = Extension<{\n Nodes: {\n text: Attrs\n }\n}>\n\n/**\n * @public\n */\nexport function defineText(): TextExtension {\n return defineNodeSpec({\n name: 'text',\n group: 'inline',\n })\n}\n"],"mappings":";;;;;AAeA,SAAgB,aAA4B;AAC1C,QAAO,eAAe;EACpB,MAAM;EACN,OAAO;EACR,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { defineCommands, defineKeymap, defineMarkSpec, toggleMark, union } from "@prosekit/core";
|
|
2
|
-
|
|
3
2
|
//#region src/underline/index.ts
|
|
4
3
|
/**
|
|
5
4
|
* @internal
|
|
@@ -36,7 +35,7 @@ function defineUnderlineKeymap() {
|
|
|
36
35
|
function defineUnderline() {
|
|
37
36
|
return union(defineUnderlineSpec(), defineUnderlineCommands(), defineUnderlineKeymap());
|
|
38
37
|
}
|
|
39
|
-
|
|
40
38
|
//#endregion
|
|
41
39
|
export { defineUnderline, defineUnderlineCommands, defineUnderlineKeymap, defineUnderlineSpec };
|
|
40
|
+
|
|
42
41
|
//# sourceMappingURL=prosekit-extensions-underline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-underline.js","names":[],"sources":["../src/underline/index.ts"],"sourcesContent":["import {\n defineCommands,\n defineKeymap,\n defineMarkSpec,\n toggleMark,\n union,\n type Extension,\n type PlainExtension,\n type Union,\n} from '@prosekit/core'\nimport type { Attrs } from '@prosekit/pm/model'\n\n/**\n * @internal\n */\nexport type UnderlineSpecExtension = Extension<{\n Marks: {\n underline: Attrs\n }\n}>\n\n/**\n * @internal\n */\nexport function defineUnderlineSpec(): UnderlineSpecExtension {\n return defineMarkSpec({\n name: 'underline',\n parseDOM: [\n { tag: 'u' },\n { tag: 'underline' },\n { style: 'text-decoration=underline' },\n { style: 'text-decoration-line=underline' },\n ],\n toDOM() {\n return ['u', 0]\n },\n })\n}\n\n/**\n * @internal\n */\nexport type UnderlineCommandsExtension = Extension<{\n Commands: {\n toggleUnderline: []\n }\n}>\n\n/**\n * @internal\n */\nexport function defineUnderlineCommands(): UnderlineCommandsExtension {\n return defineCommands({\n toggleUnderline: () => toggleMark({ type: 'underline' }),\n })\n}\n\n/**\n * @internal\n */\nexport function defineUnderlineKeymap(): PlainExtension {\n return defineKeymap({\n 'Mod-u': toggleMark({ type: 'underline' }),\n })\n}\n\n/**\n * @internal\n */\nexport type UnderlineExtension = Union<\n [UnderlineSpecExtension, UnderlineCommandsExtension]\n>\n\n/**\n * @public\n */\nexport function defineUnderline(): UnderlineExtension {\n return union(\n defineUnderlineSpec(),\n defineUnderlineCommands(),\n defineUnderlineKeymap(),\n )\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-underline.js","names":[],"sources":["../src/underline/index.ts"],"sourcesContent":["import {\n defineCommands,\n defineKeymap,\n defineMarkSpec,\n toggleMark,\n union,\n type Extension,\n type PlainExtension,\n type Union,\n} from '@prosekit/core'\nimport type { Attrs } from '@prosekit/pm/model'\n\n/**\n * @internal\n */\nexport type UnderlineSpecExtension = Extension<{\n Marks: {\n underline: Attrs\n }\n}>\n\n/**\n * @internal\n */\nexport function defineUnderlineSpec(): UnderlineSpecExtension {\n return defineMarkSpec({\n name: 'underline',\n parseDOM: [\n { tag: 'u' },\n { tag: 'underline' },\n { style: 'text-decoration=underline' },\n { style: 'text-decoration-line=underline' },\n ],\n toDOM() {\n return ['u', 0]\n },\n })\n}\n\n/**\n * @internal\n */\nexport type UnderlineCommandsExtension = Extension<{\n Commands: {\n toggleUnderline: []\n }\n}>\n\n/**\n * @internal\n */\nexport function defineUnderlineCommands(): UnderlineCommandsExtension {\n return defineCommands({\n toggleUnderline: () => toggleMark({ type: 'underline' }),\n })\n}\n\n/**\n * @internal\n */\nexport function defineUnderlineKeymap(): PlainExtension {\n return defineKeymap({\n 'Mod-u': toggleMark({ type: 'underline' }),\n })\n}\n\n/**\n * @internal\n */\nexport type UnderlineExtension = Union<\n [UnderlineSpecExtension, UnderlineCommandsExtension]\n>\n\n/**\n * @public\n */\nexport function defineUnderline(): UnderlineExtension {\n return union(\n defineUnderlineSpec(),\n defineUnderlineCommands(),\n defineUnderlineKeymap(),\n )\n}\n"],"mappings":";;;;;AAwBA,SAAgB,sBAA8C;AAC5D,QAAO,eAAe;EACpB,MAAM;EACN,UAAU;GACR,EAAE,KAAK,KAAK;GACZ,EAAE,KAAK,aAAa;GACpB,EAAE,OAAO,6BAA6B;GACtC,EAAE,OAAO,kCAAkC;GAC5C;EACD,QAAQ;AACN,UAAO,CAAC,KAAK,EAAE;;EAElB,CAAC;;;;;AAeJ,SAAgB,0BAAsD;AACpE,QAAO,eAAe,EACpB,uBAAuB,WAAW,EAAE,MAAM,aAAa,CAAC,EACzD,CAAC;;;;;AAMJ,SAAgB,wBAAwC;AACtD,QAAO,aAAa,EAClB,SAAS,WAAW,EAAE,MAAM,aAAa,CAAC,EAC3C,CAAC;;;;;AAaJ,SAAgB,kBAAsC;AACpD,QAAO,MACL,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,CACxB"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { definePlugin } from "@prosekit/core";
|
|
2
1
|
import { PluginKey, ProseMirrorPlugin } from "@prosekit/pm/state";
|
|
2
|
+
import { definePlugin } from "@prosekit/core";
|
|
3
3
|
import { Decoration, DecorationSet } from "@prosekit/pm/view";
|
|
4
|
-
|
|
5
4
|
//#region src/virtual-selection/index.ts
|
|
6
5
|
/**
|
|
7
6
|
* Shows a virtual selection when the editor is not focused. When the editor is
|
|
@@ -52,7 +51,7 @@ const virtualSelectionPlugin = new ProseMirrorPlugin({
|
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
53
|
});
|
|
55
|
-
|
|
56
54
|
//#endregion
|
|
57
55
|
export { defineVirtualSelection };
|
|
56
|
+
|
|
58
57
|
//# sourceMappingURL=prosekit-extensions-virtual-selection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-virtual-selection.js","names":[],"sources":["../src/virtual-selection/index.ts"],"sourcesContent":["import { definePlugin, type PlainExtension } from '@prosekit/core'\nimport { PluginKey, ProseMirrorPlugin, type EditorState, type Transaction } from '@prosekit/pm/state'\nimport { Decoration, DecorationSet } from '@prosekit/pm/view'\n\n/**\n * @internal\n */\nexport type VirtualSelectionExtension = PlainExtension\n\n/**\n * Shows a virtual selection when the editor is not focused. When the editor is\n * not focused, the selected inline content will be wrapped in a `<span>`\n * element with the class `prosekit-virtual-selection`.\n *\n * This is useful when you want to move the focus to an element outside the\n * editor, but still want to show the selection.\n *\n * @public\n */\nexport function defineVirtualSelection(): VirtualSelectionExtension {\n return definePlugin(virtualSelectionPlugin)\n}\n\n// Show the decoration when this is true.\ntype PluginState = boolean\n\nconst key = new PluginKey<PluginState>('prosekit-virtual-selection')\n\nfunction getFocusMeta(tr: Transaction): PluginState | undefined {\n return tr.getMeta(key) as PluginState | undefined\n}\n\nfunction setFocusMeta(tr: Transaction, value: PluginState) {\n return tr.setMeta(key, value)\n}\n\nfunction getFocusState(state: EditorState): PluginState | undefined {\n return key.getState(state)\n}\n\nconst virtualSelectionPlugin = new ProseMirrorPlugin<PluginState>({\n key,\n state: {\n init: () => false,\n apply: (tr, value) => {\n return getFocusMeta(tr) ?? value\n },\n },\n props: {\n handleDOMEvents: {\n focus: (view) => {\n view.dispatch(setFocusMeta(view.state.tr, false))\n },\n\n blur: (view) => {\n const { dom, root } = view\n const activeElement = root.activeElement\n\n // Don't show the decoration if the dom is blurred because the focus\n // moved outside the browser window.\n if (activeElement === dom) return\n\n view.dispatch(setFocusMeta(view.state.tr, true))\n },\n },\n decorations: (state) => {\n const { selection, doc } = state\n\n if (\n selection.empty\n || !getFocusState(state)\n // When `selection.visible` is false, it indicates that the selection is\n // rendered by the editor and it's not a native browser selection. An\n // example of this is `NodeSelection`. In this situation, since the\n // editor already shows the selection, we don't need to display a\n // virtual selection.\n || !selection.visible\n ) {\n return null\n }\n\n return DecorationSet.create(doc, [\n Decoration.inline(selection.from, selection.to, {\n class: 'prosekit-virtual-selection',\n }),\n ])\n },\n },\n})\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-virtual-selection.js","names":[],"sources":["../src/virtual-selection/index.ts"],"sourcesContent":["import { definePlugin, type PlainExtension } from '@prosekit/core'\nimport { PluginKey, ProseMirrorPlugin, type EditorState, type Transaction } from '@prosekit/pm/state'\nimport { Decoration, DecorationSet } from '@prosekit/pm/view'\n\n/**\n * @internal\n */\nexport type VirtualSelectionExtension = PlainExtension\n\n/**\n * Shows a virtual selection when the editor is not focused. When the editor is\n * not focused, the selected inline content will be wrapped in a `<span>`\n * element with the class `prosekit-virtual-selection`.\n *\n * This is useful when you want to move the focus to an element outside the\n * editor, but still want to show the selection.\n *\n * @public\n */\nexport function defineVirtualSelection(): VirtualSelectionExtension {\n return definePlugin(virtualSelectionPlugin)\n}\n\n// Show the decoration when this is true.\ntype PluginState = boolean\n\nconst key = new PluginKey<PluginState>('prosekit-virtual-selection')\n\nfunction getFocusMeta(tr: Transaction): PluginState | undefined {\n return tr.getMeta(key) as PluginState | undefined\n}\n\nfunction setFocusMeta(tr: Transaction, value: PluginState) {\n return tr.setMeta(key, value)\n}\n\nfunction getFocusState(state: EditorState): PluginState | undefined {\n return key.getState(state)\n}\n\nconst virtualSelectionPlugin = new ProseMirrorPlugin<PluginState>({\n key,\n state: {\n init: () => false,\n apply: (tr, value) => {\n return getFocusMeta(tr) ?? value\n },\n },\n props: {\n handleDOMEvents: {\n focus: (view) => {\n view.dispatch(setFocusMeta(view.state.tr, false))\n },\n\n blur: (view) => {\n const { dom, root } = view\n const activeElement = root.activeElement\n\n // Don't show the decoration if the dom is blurred because the focus\n // moved outside the browser window.\n if (activeElement === dom) return\n\n view.dispatch(setFocusMeta(view.state.tr, true))\n },\n },\n decorations: (state) => {\n const { selection, doc } = state\n\n if (\n selection.empty\n || !getFocusState(state)\n // When `selection.visible` is false, it indicates that the selection is\n // rendered by the editor and it's not a native browser selection. An\n // example of this is `NodeSelection`. In this situation, since the\n // editor already shows the selection, we don't need to display a\n // virtual selection.\n || !selection.visible\n ) {\n return null\n }\n\n return DecorationSet.create(doc, [\n Decoration.inline(selection.from, selection.to, {\n class: 'prosekit-virtual-selection',\n }),\n ])\n },\n },\n})\n"],"mappings":";;;;;;;;;;;;;;AAmBA,SAAgB,yBAAoD;AAClE,QAAO,aAAa,uBAAuB;;AAM7C,MAAM,MAAM,IAAI,UAAuB,6BAA6B;AAEpE,SAAS,aAAa,IAA0C;AAC9D,QAAO,GAAG,QAAQ,IAAI;;AAGxB,SAAS,aAAa,IAAiB,OAAoB;AACzD,QAAO,GAAG,QAAQ,KAAK,MAAM;;AAG/B,SAAS,cAAc,OAA6C;AAClE,QAAO,IAAI,SAAS,MAAM;;AAG5B,MAAM,yBAAyB,IAAI,kBAA+B;CAChE;CACA,OAAO;EACL,YAAY;EACZ,QAAQ,IAAI,UAAU;AACpB,UAAO,aAAa,GAAG,IAAI;;EAE9B;CACD,OAAO;EACL,iBAAiB;GACf,QAAQ,SAAS;AACf,SAAK,SAAS,aAAa,KAAK,MAAM,IAAI,MAAM,CAAC;;GAGnD,OAAO,SAAS;IACd,MAAM,EAAE,KAAK,SAAS;AAKtB,QAJsB,KAAK,kBAIL,IAAK;AAE3B,SAAK,SAAS,aAAa,KAAK,MAAM,IAAI,KAAK,CAAC;;GAEnD;EACD,cAAc,UAAU;GACtB,MAAM,EAAE,WAAW,QAAQ;AAE3B,OACE,UAAU,SACP,CAAC,cAAc,MAAM,IAMrB,CAAC,UAAU,QAEd,QAAO;AAGT,UAAO,cAAc,OAAO,KAAK,CAC/B,WAAW,OAAO,UAAU,MAAM,UAAU,IAAI,EAC9C,OAAO,8BACR,CAAC,CACH,CAAC;;EAEL;CACF,CAAC"}
|