@prosekit/extensions 0.9.3 → 0.10.1
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/prosekit-extensions-autocomplete.d.ts +16 -5
- package/dist/prosekit-extensions-blockquote.d.ts +1 -1
- package/dist/prosekit-extensions-bold.d.ts +1 -1
- package/dist/prosekit-extensions-code-block.d.ts +1 -1
- package/dist/prosekit-extensions-code-block.js +20 -4
- package/dist/prosekit-extensions-code.d.ts +1 -1
- package/dist/prosekit-extensions-commit.d.ts +1 -1
- package/dist/prosekit-extensions-commit.js +3 -3
- package/dist/prosekit-extensions-drop-cursor.d.ts +1 -1
- package/dist/prosekit-extensions-file.d.ts +1 -5
- package/dist/prosekit-extensions-gap-cursor.d.ts +1 -1
- package/dist/prosekit-extensions-hard-break.d.ts +1 -1
- package/dist/prosekit-extensions-heading.d.ts +1 -1
- package/dist/prosekit-extensions-horizontal-rule.d.ts +1 -1
- package/dist/prosekit-extensions-image.d.ts +1 -1
- package/dist/prosekit-extensions-italic.d.ts +1 -1
- package/dist/prosekit-extensions-link.js +2 -2
- package/dist/prosekit-extensions-list.d.ts +1 -1
- package/dist/prosekit-extensions-loro.d.ts +1 -1
- package/dist/prosekit-extensions-mark-rule.d.ts +1 -1
- package/dist/prosekit-extensions-paragraph.d.ts +1 -1
- package/dist/prosekit-extensions-placeholder.js +1 -1
- package/dist/prosekit-extensions-table.d.ts +73 -5
- package/dist/prosekit-extensions-table.js +2 -2
- package/dist/prosekit-extensions-yjs.d.ts +2 -3
- package/dist/shiki-highlighter-chunk.js +8 -4
- package/dist/table/style.css +5 -0
- package/dist/table-dVQqzLlz.js +734 -0
- package/package.json +16 -9
- package/dist/table-DnVliJ6E.js +0 -287
|
@@ -40,6 +40,19 @@ interface MatchHandlerOptions {
|
|
|
40
40
|
*/
|
|
41
41
|
type MatchHandler = (options: MatchHandlerOptions) => void;
|
|
42
42
|
/**
|
|
43
|
+
* Options for the {@link CanMatchPredicate} callback.
|
|
44
|
+
*/
|
|
45
|
+
interface CanMatchOptions {
|
|
46
|
+
/**
|
|
47
|
+
* The editor state.
|
|
48
|
+
*/
|
|
49
|
+
state: EditorState;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A predicate to determine if the rule can be applied in the current editor state.
|
|
53
|
+
*/
|
|
54
|
+
type CanMatchPredicate = (options: CanMatchOptions) => boolean;
|
|
55
|
+
/**
|
|
43
56
|
* Options for creating an {@link AutocompleteRule}
|
|
44
57
|
*/
|
|
45
58
|
interface AutocompleteRuleOptions {
|
|
@@ -47,7 +60,7 @@ interface AutocompleteRuleOptions {
|
|
|
47
60
|
* The regular expression to match against the text before the cursor. The
|
|
48
61
|
* last match before the cursor is used.
|
|
49
62
|
*
|
|
50
|
-
* For a slash menu, you might use
|
|
63
|
+
* For a slash menu, you might use `/(?<!\S)\/(|\S.*)$/u`.
|
|
51
64
|
* For a mention, you might use `/@\w*$/`
|
|
52
65
|
*/
|
|
53
66
|
regex: RegExp;
|
|
@@ -65,9 +78,7 @@ interface AutocompleteRuleOptions {
|
|
|
65
78
|
* state. If not provided, it defaults to only allowing matches in empty
|
|
66
79
|
* selections that are not inside a code block or code mark.
|
|
67
80
|
*/
|
|
68
|
-
canMatch?:
|
|
69
|
-
state: EditorState;
|
|
70
|
-
}) => boolean;
|
|
81
|
+
canMatch?: CanMatchPredicate;
|
|
71
82
|
}
|
|
72
83
|
/**
|
|
73
84
|
* An autocomplete rule that can be used to create an autocomplete extension.
|
|
@@ -91,4 +102,4 @@ declare class AutocompleteRule {
|
|
|
91
102
|
//#region src/autocomplete/autocomplete.d.ts
|
|
92
103
|
declare function defineAutocomplete(rule: AutocompleteRule): Extension;
|
|
93
104
|
//#endregion
|
|
94
|
-
export { AutocompleteRule, AutocompleteRuleOptions, MatchHandler, MatchHandlerOptions, defineAutocomplete };
|
|
105
|
+
export { AutocompleteRule, type AutocompleteRuleOptions, type CanMatchOptions, type CanMatchPredicate, type MatchHandler, type MatchHandlerOptions, defineAutocomplete };
|
|
@@ -45,4 +45,4 @@ declare function defineBlockquoteInputRule(): PlainExtension;
|
|
|
45
45
|
*/
|
|
46
46
|
declare function defineBlockquoteKeymap(): PlainExtension;
|
|
47
47
|
//#endregion
|
|
48
|
-
export { BlockquoteCommandsExtension, BlockquoteExtension, BlockquoteSpecExtension, defineBlockquote, defineBlockquoteCommands, defineBlockquoteInputRule, defineBlockquoteKeymap, defineBlockquoteSpec };
|
|
48
|
+
export { type BlockquoteCommandsExtension, type BlockquoteExtension, type BlockquoteSpecExtension, defineBlockquote, defineBlockquoteCommands, defineBlockquoteInputRule, defineBlockquoteKeymap, defineBlockquoteSpec };
|
|
@@ -51,4 +51,4 @@ declare function defineBoldInputRule(): PlainExtension;
|
|
|
51
51
|
*/
|
|
52
52
|
declare function defineBoldKeymap(): PlainExtension;
|
|
53
53
|
//#endregion
|
|
54
|
-
export { BoldCommandsExtension, BoldExtension, BoldSpecExtension, defineBold, defineBoldCommands, defineBoldInputRule, defineBoldKeymap, defineBoldSpec };
|
|
54
|
+
export { type BoldCommandsExtension, type BoldExtension, type BoldSpecExtension, defineBold, defineBoldCommands, defineBoldInputRule, defineBoldKeymap, defineBoldSpec };
|
|
@@ -156,4 +156,4 @@ declare function defineCodeBlockShiki({
|
|
|
156
156
|
...rest
|
|
157
157
|
}?: CodeBlockShikiOptions): Extension;
|
|
158
158
|
//#endregion
|
|
159
|
-
export { CodeBlockAttrs, CodeBlockCommandsExtension, CodeBlockExtension, CodeBlockHighlightOptions, CodeBlockSpecExtension, HighlightParser, ShikiBundledLanguage, ShikiBundledLanguageInfo, ShikiBundledTheme, ShikiBundledThemeInfo, defineCodeBlock, defineCodeBlockCommands, defineCodeBlockEnterRule, defineCodeBlockHighlight, defineCodeBlockInputRule, defineCodeBlockKeymap, defineCodeBlockShiki, defineCodeBlockSpec, shikiBundledLanguagesInfo, shikiBundledThemesInfo };
|
|
159
|
+
export { type CodeBlockAttrs, type CodeBlockCommandsExtension, type CodeBlockExtension, type CodeBlockHighlightOptions, type CodeBlockSpecExtension, type HighlightParser, type ShikiBundledLanguage, type ShikiBundledLanguageInfo, type ShikiBundledTheme, type ShikiBundledThemeInfo, defineCodeBlock, defineCodeBlockCommands, defineCodeBlockEnterRule, defineCodeBlockHighlight, defineCodeBlockInputRule, defineCodeBlockKeymap, defineCodeBlockShiki, defineCodeBlockSpec, shikiBundledLanguagesInfo, shikiBundledThemesInfo };
|
|
@@ -130,18 +130,34 @@ function defineCodeBlockSpec() {
|
|
|
130
130
|
parseDOM: [{
|
|
131
131
|
tag: "pre",
|
|
132
132
|
preserveWhitespace: "full",
|
|
133
|
-
getAttrs: (node) =>
|
|
133
|
+
getAttrs: (node) => {
|
|
134
|
+
const language = extractLanguageFromElement(node) || extractLanguageFromElement(node.querySelector("code"));
|
|
135
|
+
return { language };
|
|
136
|
+
}
|
|
134
137
|
}],
|
|
135
138
|
toDOM(node) {
|
|
136
|
-
const
|
|
139
|
+
const { language } = node.attrs;
|
|
137
140
|
return [
|
|
138
141
|
"pre",
|
|
139
|
-
{ "data-language":
|
|
140
|
-
[
|
|
142
|
+
{ "data-language": language || void 0 },
|
|
143
|
+
[
|
|
144
|
+
"code",
|
|
145
|
+
{ class: language ? `language-${language}` : void 0 },
|
|
146
|
+
0
|
|
147
|
+
]
|
|
141
148
|
];
|
|
142
149
|
}
|
|
143
150
|
});
|
|
144
151
|
}
|
|
152
|
+
function extractLanguageFromElement(element) {
|
|
153
|
+
if (!element) return "";
|
|
154
|
+
const attr = element.getAttribute("data-language");
|
|
155
|
+
if (attr) return attr;
|
|
156
|
+
const className = element.className;
|
|
157
|
+
const match = className.match(/language-(\w+)/);
|
|
158
|
+
if (match) return match[1];
|
|
159
|
+
return "";
|
|
160
|
+
}
|
|
145
161
|
|
|
146
162
|
//#endregion
|
|
147
163
|
//#region src/code-block/code-block.ts
|
|
@@ -51,4 +51,4 @@ declare function defineCodeInputRule(): PlainExtension;
|
|
|
51
51
|
*/
|
|
52
52
|
declare function defineCodeKeymap(): PlainExtension;
|
|
53
53
|
//#endregion
|
|
54
|
-
export { CodeCommandsExtension, CodeExtension, CodeSpecExtension, defineCode, defineCodeCommands, defineCodeInputRule, defineCodeKeymap, defineCodeSpec };
|
|
54
|
+
export { type CodeCommandsExtension, type CodeExtension, type CodeSpecExtension, defineCode, defineCodeCommands, defineCodeInputRule, defineCodeKeymap, defineCodeSpec };
|
|
@@ -49,4 +49,4 @@ declare class CommitRecorder {
|
|
|
49
49
|
*/
|
|
50
50
|
declare function defineCommitRecorder(commitRecorder: CommitRecorder): PlainExtension;
|
|
51
51
|
//#endregion
|
|
52
|
-
export { Commit, CommitRecorder, defineCommitRecorder, defineCommitViewer };
|
|
52
|
+
export { type Commit, CommitRecorder, defineCommitRecorder, defineCommitViewer };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineDefaultState, definePlugin, jsonFromNode, union } from "@prosekit/core";
|
|
2
2
|
import { PluginKey, ProseMirrorPlugin } from "@prosekit/pm/state";
|
|
3
3
|
import { Decoration, DecorationSet } from "@prosekit/pm/view";
|
|
4
4
|
import { DOMSerializer, Fragment, Slice } from "@prosekit/pm/model";
|
|
@@ -33,13 +33,13 @@ function decorateDeletionSlice(slice) {
|
|
|
33
33
|
];
|
|
34
34
|
}
|
|
35
35
|
if (openStart > 0 && content.childCount >= 2) {
|
|
36
|
-
const nodes =
|
|
36
|
+
const nodes = content.content;
|
|
37
37
|
const head = Fragment.from(nodes.slice(0, 1));
|
|
38
38
|
const body = Fragment.from(nodes.slice(1));
|
|
39
39
|
return [...decorateDeletionSlice(new Slice(head, openStart, openStart)), ...decorateDeletionSlice(new Slice(body, 0, openEnd))];
|
|
40
40
|
}
|
|
41
41
|
if (openEnd > 0 && content.childCount >= 2) {
|
|
42
|
-
const nodes =
|
|
42
|
+
const nodes = content.content;
|
|
43
43
|
const body = Fragment.from(nodes.slice(0, -1));
|
|
44
44
|
const tail = Fragment.from(nodes.slice(-1));
|
|
45
45
|
return [...decorateDeletionSlice(new Slice(body, openStart, 0)), ...decorateDeletionSlice(new Slice(tail, openEnd, openEnd))];
|
|
@@ -32,4 +32,4 @@ type DropCursorExtension = PlainExtension;
|
|
|
32
32
|
*/
|
|
33
33
|
declare function defineDropCursor(options?: DropCursorOptions): DropCursorExtension;
|
|
34
34
|
//#endregion
|
|
35
|
-
export { DropCursorExtension, DropCursorOptions, defineDropCursor };
|
|
35
|
+
export { type DropCursorExtension, type DropCursorOptions, defineDropCursor };
|
|
@@ -58,11 +58,7 @@ declare function defineFilePasteHandler(handler: FilePasteHandler): PlainExtensi
|
|
|
58
58
|
* An interface representing the upload progress.
|
|
59
59
|
*/
|
|
60
60
|
interface UploadProgress {
|
|
61
|
-
// A number representing the amount of work already performed by the
|
|
62
|
-
// underlying process.
|
|
63
61
|
loaded: number;
|
|
64
|
-
// A number representing the total amount of work that the underlying
|
|
65
|
-
// process is in the progress of performing.
|
|
66
62
|
total: number;
|
|
67
63
|
}
|
|
68
64
|
interface UploaderOptions {
|
|
@@ -126,4 +122,4 @@ declare class UploadTask<Result> {
|
|
|
126
122
|
static delete(objectURL: string): void;
|
|
127
123
|
}
|
|
128
124
|
//#endregion
|
|
129
|
-
export { FileDropHandlerOptions, FilePasteHandlerOptions, UploadProgress, UploadTask, Uploader, UploaderOptions, defineFileDropHandler, defineFilePasteHandler };
|
|
125
|
+
export { type FileDropHandlerOptions, type FilePasteHandlerOptions, type UploadProgress, UploadTask, type Uploader, type UploaderOptions, defineFileDropHandler, defineFilePasteHandler };
|
|
@@ -50,4 +50,4 @@ declare function defineHardBreak(): HardBreakExtension;
|
|
|
50
50
|
*/
|
|
51
51
|
declare function defineHardBreakKeymap(): PlainExtension;
|
|
52
52
|
//#endregion
|
|
53
|
-
export { HardBreakCommandsExtension, HardBreakExtension, HardBreakSpecExtension, defineHardBreak, defineHardBreakCommands, defineHardBreakKeymap, defineHardBreakSpec };
|
|
53
|
+
export { type HardBreakCommandsExtension, type HardBreakExtension, type HardBreakSpecExtension, defineHardBreak, defineHardBreakCommands, defineHardBreakKeymap, defineHardBreakSpec };
|
|
@@ -60,4 +60,4 @@ declare function defineHeadingInputRule(): PlainExtension;
|
|
|
60
60
|
*/
|
|
61
61
|
declare function defineHeadingKeymap(): PlainExtension;
|
|
62
62
|
//#endregion
|
|
63
|
-
export { HeadingAttrs, HeadingCommandsExtension, HeadingExtension, HeadingSpecExtension, defineHeading, defineHeadingCommands, defineHeadingInputRule, defineHeadingKeymap, defineHeadingSpec };
|
|
63
|
+
export { type HeadingAttrs, type HeadingCommandsExtension, type HeadingExtension, type HeadingSpecExtension, defineHeading, defineHeadingCommands, defineHeadingInputRule, defineHeadingKeymap, defineHeadingSpec };
|
|
@@ -35,4 +35,4 @@ declare function defineHorizontalRule(): HorizontalRuleExtension;
|
|
|
35
35
|
*/
|
|
36
36
|
declare function defineHorizontalRuleInputRule(): PlainExtension;
|
|
37
37
|
//#endregion
|
|
38
|
-
export { HorizontalRuleCommandsExtension, HorizontalRuleExtension, HorizontalRuleSpecExtension, defineHorizontalRule, defineHorizontalRuleCommands, defineHorizontalRuleInputRule, defineHorizontalRuleSpec, insertHorizontalRule };
|
|
38
|
+
export { type HorizontalRuleCommandsExtension, type HorizontalRuleExtension, type HorizontalRuleSpecExtension, defineHorizontalRule, defineHorizontalRuleCommands, defineHorizontalRuleInputRule, defineHorizontalRuleSpec, insertHorizontalRule };
|
|
@@ -47,4 +47,4 @@ type ImageExtension = Union<[ImageSpecExtension, ImageCommandsExtension]>;
|
|
|
47
47
|
*/
|
|
48
48
|
declare function defineImage(): ImageExtension;
|
|
49
49
|
//#endregion
|
|
50
|
-
export { ImageAttrs, ImageCommandsExtension, ImageExtension, ImageSpecExtension, defineImage, defineImageCommands, defineImageSpec };
|
|
50
|
+
export { type ImageAttrs, type ImageCommandsExtension, type ImageExtension, type ImageSpecExtension, defineImage, defineImageCommands, defineImageSpec };
|
|
@@ -51,4 +51,4 @@ declare function defineItalicInputRule(): PlainExtension;
|
|
|
51
51
|
*/
|
|
52
52
|
declare function defineItalicKeymap(): PlainExtension;
|
|
53
53
|
//#endregion
|
|
54
|
-
export { ItalicCommandsExtension, ItalicExtension, ItalicSpecExtension, defineItalic, defineItalicCommands, defineItalicInputRule, defineItalicKeymap, defineItalicSpec };
|
|
54
|
+
export { type ItalicCommandsExtension, type ItalicExtension, type ItalicSpecExtension, defineItalic, defineItalicCommands, defineItalicInputRule, defineItalicKeymap, defineItalicSpec };
|
|
@@ -9,10 +9,10 @@ const TLD_RE_PATTERN = "a(?:a(?:a|rp)|b(?:arth|b(?:ott|vie)?|c|le|ogado|udhabi)|
|
|
|
9
9
|
const PUNCTUATION_CHAR_PATTERN = "\\.\\,\\;\\!\\?";
|
|
10
10
|
const STOP_CHAR_PATTERN = "[" + PUNCTUATION_CHAR_PATTERN + "]";
|
|
11
11
|
const END_CHAR_PATTERN = "[^\\s" + PUNCTUATION_CHAR_PATTERN + "]";
|
|
12
|
-
const LINK_RE_BASE_PATTERN = "((?:(?:(?:https?:)?\\/\\/)?(?:(?:[a-z0-9\\u00a1-\\uffff][a-z0-9\\u00a1-\\uffff_-]{0,62})?[a-z0-9\\u00a1-\\uffff]\\.)+(?:" + TLD_RE_PATTERN + "))(?::\\d{2,5})?(?:/(?:\\S*
|
|
12
|
+
const LINK_RE_BASE_PATTERN = "((?:(?:(?:https?:)?\\/\\/)?(?:(?:[a-z0-9\\u00a1-\\uffff][a-z0-9\\u00a1-\\uffff_-]{0,62})?[a-z0-9\\u00a1-\\uffff]\\.)+(?:" + TLD_RE_PATTERN + "))(?::\\d{2,5})?(?:/(?:\\S*[^\\s\\.\\,\\;\\!\\?])?)?(?:\\?(?:\\S*[^\\s\\.\\,\\;\\!\\?]))?(?:\\#(?:\\S*[^\\s\\.\\,\\;\\!\\?])?)?)";
|
|
13
13
|
const LINK_ENTER_PATTERN = LINK_RE_BASE_PATTERN + STOP_CHAR_PATTERN + "?$";
|
|
14
14
|
const LINK_INPUT_PATTERN = LINK_RE_BASE_PATTERN + STOP_CHAR_PATTERN + "?\\s$";
|
|
15
|
-
const LINK_MARK_PATTERN = LINK_RE_BASE_PATTERN + "(?=
|
|
15
|
+
const LINK_MARK_PATTERN = LINK_RE_BASE_PATTERN + "(?=[\\.\\,\\;\\!\\?]|\\s|$)";
|
|
16
16
|
const LINK_ENTER_RE = new RegExp(LINK_ENTER_PATTERN, "gi");
|
|
17
17
|
const LINK_INPUT_RE = new RegExp(LINK_INPUT_PATTERN, "gi");
|
|
18
18
|
const LINK_MARK_RE = new RegExp(LINK_MARK_PATTERN, "gi");
|
|
@@ -101,4 +101,4 @@ declare function defineList(): ListExtension;
|
|
|
101
101
|
*/
|
|
102
102
|
declare function defineListSerializer(): PlainExtension;
|
|
103
103
|
//#endregion
|
|
104
|
-
export { DedentListOptions, IndentListOptions, ListAttrs, ListCommandsExtension, ListDOMSerializer, ListExtension, ListSpecExtension, ToggleCollapsedOptions, UnwrapListOptions, WrapInListGetAttrs, defineList, defineListCommands, defineListInputRules, defineListKeymap, defineListPlugins, defineListSerializer, defineListSpec };
|
|
104
|
+
export { type DedentListOptions, type IndentListOptions, type ListAttrs, type ListCommandsExtension, ListDOMSerializer, type ListExtension, type ListSpecExtension, type ToggleCollapsedOptions, type UnwrapListOptions, type WrapInListGetAttrs, defineList, defineListCommands, defineListInputRules, defineListKeymap, defineListPlugins, defineListSerializer, defineListSpec };
|
|
@@ -66,4 +66,4 @@ type LoroExtension = Union<[LoroCommandsExtension, PlainExtension]>;
|
|
|
66
66
|
*/
|
|
67
67
|
declare function defineLoro(options: LoroOptions): LoroExtension;
|
|
68
68
|
//#endregion
|
|
69
|
-
export { LoroCursorOptions, LoroExtension, LoroOptions, LoroSyncPluginProps, LoroUndoPluginProps, defineLoro, defineLoroCommands, defineLoroCursorPlugin, defineLoroKeymap, defineLoroSyncPlugin, defineLoroUndoPlugin };
|
|
69
|
+
export { type LoroCursorOptions, type LoroExtension, type LoroOptions, type LoroSyncPluginProps, type LoroUndoPluginProps, defineLoro, defineLoroCommands, defineLoroCursorPlugin, defineLoroKeymap, defineLoroSyncPlugin, defineLoroUndoPlugin };
|
|
@@ -57,4 +57,4 @@ declare function defineParagraph(): ParagraphExtension;
|
|
|
57
57
|
*/
|
|
58
58
|
declare function defineParagraphKeymap(): PlainExtension;
|
|
59
59
|
//#endregion
|
|
60
|
-
export { ParagraphCommandsExtension, ParagraphExtension, ParagraphSpecExtension, defineParagraph, defineParagraphCommands, defineParagraphKeymap, defineParagraphSpec };
|
|
60
|
+
export { type ParagraphCommandsExtension, type ParagraphExtension, type ParagraphSpecExtension, defineParagraph, defineParagraphCommands, defineParagraphKeymap, defineParagraphSpec };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { findTable } from "./table-
|
|
1
|
+
import { findTable } from "./table-dVQqzLlz.js";
|
|
2
2
|
import { definePlugin, isInCodeBlock, maybeRun } from "@prosekit/core";
|
|
3
3
|
import { Plugin, PluginKey } from "@prosekit/pm/state";
|
|
4
4
|
import { Decoration, DecorationSet } from "@prosekit/pm/view";
|
|
@@ -3,6 +3,72 @@ import { Command, Selection } from "@prosekit/pm/state";
|
|
|
3
3
|
import { Attrs, ProseMirrorNode, ResolvedPos } from "@prosekit/pm/model";
|
|
4
4
|
import { CellSelection } from "prosemirror-tables";
|
|
5
5
|
|
|
6
|
+
//#region src/table/table-commands/move-table-column.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Options for {@link moveTableColumn}
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
interface MoveTableColumnOptions {
|
|
13
|
+
/**
|
|
14
|
+
* The source column index to move from.
|
|
15
|
+
*/
|
|
16
|
+
from: number;
|
|
17
|
+
/**
|
|
18
|
+
* The destination column index to move to.
|
|
19
|
+
*/
|
|
20
|
+
to: number;
|
|
21
|
+
/**
|
|
22
|
+
* Whether to select the moved column after the operation.
|
|
23
|
+
*
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
select?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Optional position to resolve table from. If not provided, uses the current selection.
|
|
29
|
+
*/
|
|
30
|
+
pos?: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Move a table column from index `origin` to index `target`.
|
|
34
|
+
*
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
declare function moveTableColumn(options: MoveTableColumnOptions): Command;
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/table/table-commands/move-table-row.d.ts
|
|
40
|
+
/**
|
|
41
|
+
* Options for {@link moveTableRow}
|
|
42
|
+
*
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
interface MoveTableRowOptions {
|
|
46
|
+
/**
|
|
47
|
+
* The source row index to move from.
|
|
48
|
+
*/
|
|
49
|
+
from: number;
|
|
50
|
+
/**
|
|
51
|
+
* The destination row index to move to.
|
|
52
|
+
*/
|
|
53
|
+
to: number;
|
|
54
|
+
/**
|
|
55
|
+
* Whether to select the moved row after the operation.
|
|
56
|
+
*
|
|
57
|
+
* @default true
|
|
58
|
+
*/
|
|
59
|
+
select?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Optional position to resolve table from. If not provided, uses the current selection.
|
|
62
|
+
*/
|
|
63
|
+
pos?: number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Move a table row from index `origin` to index `target`.
|
|
67
|
+
*
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
70
|
+
declare function moveTableRow(options: MoveTableRowOptions): Command;
|
|
71
|
+
//#endregion
|
|
6
72
|
//#region src/table/table-commands.d.ts
|
|
7
73
|
/**
|
|
8
74
|
* @public
|
|
@@ -126,6 +192,8 @@ type TableCommandsExtension = Extension<{
|
|
|
126
192
|
deleteCellSelection: [];
|
|
127
193
|
mergeTableCells: [];
|
|
128
194
|
splitTableCell: [];
|
|
195
|
+
moveTableRow: [options: MoveTableRowOptions];
|
|
196
|
+
moveTableColumn: [options: MoveTableColumnOptions];
|
|
129
197
|
};
|
|
130
198
|
}>;
|
|
131
199
|
/**
|
|
@@ -140,9 +208,9 @@ declare function defineTableCommands(): TableCommandsExtension;
|
|
|
140
208
|
* @public
|
|
141
209
|
*/
|
|
142
210
|
interface CellAttrs {
|
|
143
|
-
colspan
|
|
144
|
-
rowspan
|
|
145
|
-
colwidth
|
|
211
|
+
colspan?: number;
|
|
212
|
+
rowspan?: number;
|
|
213
|
+
colwidth?: number[] | null;
|
|
146
214
|
}
|
|
147
215
|
/**
|
|
148
216
|
* @internal
|
|
@@ -206,7 +274,7 @@ declare function defineTable(): TableExtension;
|
|
|
206
274
|
*/
|
|
207
275
|
declare function defineTablePlugins(): PlainExtension;
|
|
208
276
|
//#endregion
|
|
209
|
-
//#region src/table/table-utils.d.ts
|
|
277
|
+
//#region src/table/table-utils/query.d.ts
|
|
210
278
|
/**
|
|
211
279
|
* Checks if the given object is a `CellSelection` instance.
|
|
212
280
|
*
|
|
@@ -228,4 +296,4 @@ declare function findTable($pos: ResolvedPos): FindParentNodeResult | undefined;
|
|
|
228
296
|
*/
|
|
229
297
|
|
|
230
298
|
//#endregion
|
|
231
|
-
export { InsertTableOptions, SelectTableCellOptions, SelectTableColumnOptions, SelectTableOptions, SelectTableRowOptions, TableCellSpecExtension, TableCommandsExtension, TableExtension, TableHeaderCellSpecExtension, TableRowSpecExtension, TableSpecExtension, defineTable, defineTableCellSpec, defineTableCommands, defineTableHeaderCellSpec, defineTablePlugins, defineTableRowSpec, defineTableSpec, exitTable, findTable, insertTable, isCellSelection, selectTable, selectTableCell, selectTableColumn, selectTableRow };
|
|
299
|
+
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, defineTableHeaderCellSpec, defineTablePlugins, defineTableRowSpec, defineTableSpec, exitTable, findTable, insertTable, isCellSelection, moveTableColumn, moveTableRow, selectTable, selectTableCell, selectTableColumn, selectTableRow };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { defineTable, defineTableCellSpec, defineTableCommands, defineTableHeaderCellSpec, defineTablePlugins, defineTableRowSpec, defineTableSpec, exitTable, findTable, insertTable, isCellSelection, selectTable, selectTableCell, selectTableColumn, selectTableRow } from "./table-
|
|
1
|
+
import { defineTable, defineTableCellSpec, defineTableCommands, defineTableHeaderCellSpec, defineTablePlugins, defineTableRowSpec, defineTableSpec, exitTable, findTable, insertTable, isCellSelection, moveTableColumn, moveTableRow, selectTable, selectTableCell, selectTableColumn, selectTableRow } from "./table-dVQqzLlz.js";
|
|
2
2
|
|
|
3
|
-
export { defineTable, defineTableCellSpec, defineTableCommands, defineTableHeaderCellSpec, defineTablePlugins, defineTableRowSpec, defineTableSpec, exitTable, findTable, insertTable, isCellSelection, selectTable, selectTableCell, selectTableColumn, selectTableRow };
|
|
3
|
+
export { defineTable, defineTableCellSpec, defineTableCommands, defineTableHeaderCellSpec, defineTablePlugins, defineTableRowSpec, defineTableSpec, exitTable, findTable, insertTable, isCellSelection, moveTableColumn, moveTableRow, selectTable, selectTableCell, selectTableColumn, selectTableRow };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Extension, PlainExtension, Union } from "@prosekit/core";
|
|
2
2
|
import { yCursorPlugin, ySyncPlugin, yUndoPlugin } from "y-prosemirror";
|
|
3
3
|
import { Awareness } from "y-protocols/awareness";
|
|
4
|
-
import * as Y$1 from "yjs";
|
|
5
4
|
import * as Y from "yjs";
|
|
6
5
|
|
|
7
6
|
//#region src/yjs/yjs-commands.d.ts
|
|
@@ -32,7 +31,7 @@ declare function defineYjsCursorPlugin(options: YjsCursorOptions): PlainExtensio
|
|
|
32
31
|
*/
|
|
33
32
|
type YjsSyncPluginOptions = NonNullable<Parameters<typeof ySyncPlugin>[1]>;
|
|
34
33
|
interface YjsSyncOptions extends YjsSyncPluginOptions {
|
|
35
|
-
fragment: Y
|
|
34
|
+
fragment: Y.XmlFragment;
|
|
36
35
|
}
|
|
37
36
|
declare function defineYjsSyncPlugin(options: YjsSyncOptions): PlainExtension;
|
|
38
37
|
//#endregion
|
|
@@ -87,4 +86,4 @@ declare function defineYjs(options: YjsOptions): YjsExtension;
|
|
|
87
86
|
//#region src/yjs/yjs-keymap.d.ts
|
|
88
87
|
declare function defineYjsKeymap(): PlainExtension;
|
|
89
88
|
//#endregion
|
|
90
|
-
export { YjsCursorOptions, YjsCursorPluginOptions, YjsExtension, YjsOptions, YjsSyncOptions, YjsSyncPluginOptions, YjsUndoOptions, YjsUndoPluginOptions, defineYjs, defineYjsCommands, defineYjsCursorPlugin, defineYjsKeymap, defineYjsSyncPlugin, defineYjsUndoPlugin };
|
|
89
|
+
export { type YjsCursorOptions, type YjsCursorPluginOptions, type YjsExtension, type YjsOptions, type YjsSyncOptions, type YjsSyncPluginOptions, type YjsUndoOptions, type YjsUndoPluginOptions, defineYjs, defineYjsCommands, defineYjsCursorPlugin, defineYjsKeymap, defineYjsSyncPlugin, defineYjsUndoPlugin };
|
|
@@ -2,17 +2,21 @@ import { createHighlighter } from "shiki/bundle/full";
|
|
|
2
2
|
import { createJavaScriptRegexEngine } from "shiki/engine/javascript";
|
|
3
3
|
|
|
4
4
|
//#region src/code-block/shiki-highlighter-chunk.ts
|
|
5
|
+
let highlighterPromise;
|
|
5
6
|
let highlighter;
|
|
6
7
|
const loadedLangs = /* @__PURE__ */ new Set();
|
|
7
8
|
const loadedThemes = /* @__PURE__ */ new Set();
|
|
8
|
-
|
|
9
|
-
if (!
|
|
9
|
+
function ensureHighlighter({ ...options }) {
|
|
10
|
+
if (!highlighterPromise) {
|
|
10
11
|
if (!options.engine) {
|
|
11
12
|
const engine = createJavaScriptRegexEngine({ forgiving: true });
|
|
12
13
|
options.engine = engine;
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
+
highlighterPromise = createHighlighter(options).then((createdHighlighter) => {
|
|
16
|
+
highlighter = createdHighlighter;
|
|
17
|
+
});
|
|
15
18
|
}
|
|
19
|
+
return highlighterPromise;
|
|
16
20
|
}
|
|
17
21
|
async function loadLanguages(langs) {
|
|
18
22
|
for (const lang of langs) {
|
|
@@ -29,7 +33,7 @@ async function loadThemes(themes) {
|
|
|
29
33
|
}
|
|
30
34
|
}
|
|
31
35
|
function createOrGetHighlighter(options) {
|
|
32
|
-
if (!highlighter) return { promise:
|
|
36
|
+
if (!highlighter) return { promise: ensureHighlighter(options) };
|
|
33
37
|
const langs = options.langs.filter((lang) => !loadedLangs.has(lang));
|
|
34
38
|
if (langs.length > 0) return { promise: loadLanguages(langs) };
|
|
35
39
|
const themes = options.themes.filter((theme) => !loadedThemes.has(theme));
|
package/dist/table/style.css
CHANGED