@prosekit/extensions 0.9.2 → 0.10.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/prosekit-extensions-autocomplete.d.ts +83 -11
- package/dist/prosekit-extensions-autocomplete.js +9 -0
- package/dist/prosekit-extensions-commit.js +3 -3
- package/dist/prosekit-extensions-enter-rule.d.ts +11 -5
- package/dist/prosekit-extensions-link.d.ts +2 -0
- package/dist/prosekit-extensions-link.js +24 -6
- 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 +1 -2
- 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 +11 -11
- package/dist/table-DnVliJ6E.js +0 -287
@@ -2,32 +2,104 @@ import { Extension } from "@prosekit/core";
|
|
2
2
|
import { EditorState } from "@prosekit/pm/state";
|
3
3
|
|
4
4
|
//#region src/autocomplete/autocomplete-rule.d.ts
|
5
|
-
|
5
|
+
/**
|
6
|
+
* Options for the {@link MatchHandler} callback.
|
7
|
+
*/
|
8
|
+
interface MatchHandlerOptions {
|
9
|
+
/**
|
10
|
+
* The editor state.
|
11
|
+
*/
|
6
12
|
state: EditorState;
|
13
|
+
/**
|
14
|
+
* The result of `RegExp.exec`.
|
15
|
+
*/
|
7
16
|
match: RegExpExecArray;
|
17
|
+
/**
|
18
|
+
* The start position of the matched text.
|
19
|
+
*/
|
8
20
|
from: number;
|
21
|
+
/**
|
22
|
+
* The end position of the matched text.
|
23
|
+
*/
|
9
24
|
to: number;
|
25
|
+
/**
|
26
|
+
* Call this function to ignore the match. You probably want to call this
|
27
|
+
* function when the user presses the `Escape` key.
|
28
|
+
*/
|
10
29
|
ignoreMatch: () => void;
|
30
|
+
/**
|
31
|
+
* Call this function to delete the matched text. For example, in a slash
|
32
|
+
* menu, you might want to delete the matched text first then do something
|
33
|
+
* else when the user presses the `Enter` key.
|
34
|
+
*/
|
11
35
|
deleteMatch: () => void;
|
12
|
-
}
|
36
|
+
}
|
37
|
+
/**
|
38
|
+
* A callback that is called when the rule starts to match, and also on
|
39
|
+
* subsequent updates while the rule continues to match.
|
40
|
+
*/
|
41
|
+
type MatchHandler = (options: MatchHandlerOptions) => void;
|
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
|
+
/**
|
56
|
+
* Options for creating an {@link AutocompleteRule}
|
57
|
+
*/
|
58
|
+
interface AutocompleteRuleOptions {
|
59
|
+
/**
|
60
|
+
* The regular expression to match against the text before the cursor. The
|
61
|
+
* last match before the cursor is used.
|
62
|
+
*
|
63
|
+
* For a slash menu, you might use `/\/(|\S.*)$/u`.
|
64
|
+
* For a mention, you might use `/@\w*$/`
|
65
|
+
*/
|
66
|
+
regex: RegExp;
|
67
|
+
/**
|
68
|
+
* A callback that is called when the rule starts to match, and also on
|
69
|
+
* subsequent updates while the rule continues to match.
|
70
|
+
*/
|
71
|
+
onEnter: MatchHandler;
|
72
|
+
/**
|
73
|
+
* A callback that is called when the rule stops matching.
|
74
|
+
*/
|
75
|
+
onLeave?: VoidFunction;
|
76
|
+
/**
|
77
|
+
* A predicate to determine if the rule can be applied in the current editor
|
78
|
+
* state. If not provided, it defaults to only allowing matches in empty
|
79
|
+
* selections that are not inside a code block or code mark.
|
80
|
+
*/
|
81
|
+
canMatch?: CanMatchPredicate;
|
82
|
+
}
|
83
|
+
/**
|
84
|
+
* An autocomplete rule that can be used to create an autocomplete extension.
|
85
|
+
*
|
86
|
+
* @public
|
87
|
+
*/
|
13
88
|
declare class AutocompleteRule {
|
89
|
+
/** @internal */
|
14
90
|
readonly regex: RegExp;
|
91
|
+
/** @internal */
|
15
92
|
readonly onMatch: MatchHandler;
|
93
|
+
/** @internal */
|
16
94
|
readonly onLeave?: VoidFunction;
|
95
|
+
/** @internal */
|
17
96
|
readonly canMatch: (options: {
|
18
97
|
state: EditorState;
|
19
98
|
}) => boolean;
|
20
|
-
constructor(options:
|
21
|
-
regex: RegExp;
|
22
|
-
onEnter: MatchHandler;
|
23
|
-
onLeave?: VoidFunction;
|
24
|
-
canMatch?: (options: {
|
25
|
-
state: EditorState;
|
26
|
-
}) => boolean;
|
27
|
-
});
|
99
|
+
constructor(options: AutocompleteRuleOptions);
|
28
100
|
}
|
29
101
|
//#endregion
|
30
102
|
//#region src/autocomplete/autocomplete.d.ts
|
31
103
|
declare function defineAutocomplete(rule: AutocompleteRule): Extension;
|
32
104
|
//#endregion
|
33
|
-
export { AutocompleteRule, MatchHandler, defineAutocomplete };
|
105
|
+
export { AutocompleteRule, AutocompleteRuleOptions, CanMatchOptions, CanMatchPredicate, MatchHandler, MatchHandlerOptions, defineAutocomplete };
|
@@ -130,10 +130,19 @@ const autocompleteFacet = defineFacet({
|
|
130
130
|
|
131
131
|
//#endregion
|
132
132
|
//#region src/autocomplete/autocomplete-rule.ts
|
133
|
+
/**
|
134
|
+
* An autocomplete rule that can be used to create an autocomplete extension.
|
135
|
+
*
|
136
|
+
* @public
|
137
|
+
*/
|
133
138
|
var AutocompleteRule = class {
|
139
|
+
/** @internal */
|
134
140
|
regex;
|
141
|
+
/** @internal */
|
135
142
|
onMatch;
|
143
|
+
/** @internal */
|
136
144
|
onLeave;
|
145
|
+
/** @internal */
|
137
146
|
canMatch;
|
138
147
|
constructor(options) {
|
139
148
|
this.regex = options.regex;
|
@@ -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))];
|
@@ -6,8 +6,10 @@ import { Attrs, NodeType } from "@prosekit/pm/model";
|
|
6
6
|
|
7
7
|
/**
|
8
8
|
* @public
|
9
|
+
*
|
10
|
+
* Options for {@link EnterRuleHandler}.
|
9
11
|
*/
|
10
|
-
|
12
|
+
interface EnterRuleHandlerOptions {
|
11
13
|
/**
|
12
14
|
* The current editor state.
|
13
15
|
*/
|
@@ -24,7 +26,11 @@ type EnterRuleHandler = (options: {
|
|
24
26
|
* The matched result from the regular expression.
|
25
27
|
*/
|
26
28
|
match: RegExpExecArray;
|
27
|
-
}
|
29
|
+
}
|
30
|
+
/**
|
31
|
+
* @public
|
32
|
+
*/
|
33
|
+
type EnterRuleHandler = (options: EnterRuleHandlerOptions) => Transaction | null;
|
28
34
|
/**
|
29
35
|
* Options for {@link defineEnterRule}.
|
30
36
|
*
|
@@ -51,7 +57,7 @@ type EnterRuleOptions = {
|
|
51
57
|
*
|
52
58
|
* @public
|
53
59
|
*/
|
54
|
-
|
60
|
+
interface TextBlockEnterRuleOptions {
|
55
61
|
/**
|
56
62
|
* The regular expression to match against. It should end with `$`.
|
57
63
|
*/
|
@@ -71,7 +77,7 @@ type TextBlockEnterRuleOptions = {
|
|
71
77
|
* @default true
|
72
78
|
*/
|
73
79
|
stop?: boolean;
|
74
|
-
}
|
80
|
+
}
|
75
81
|
/**
|
76
82
|
* Defines an enter rule. An enter rule applies when the text directly in front of
|
77
83
|
* the cursor matches `regex` and user presses Enter. The `regex` should end
|
@@ -102,4 +108,4 @@ declare function defineTextBlockEnterRule({
|
|
102
108
|
stop
|
103
109
|
}: TextBlockEnterRuleOptions): PlainExtension;
|
104
110
|
//#endregion
|
105
|
-
export { EnterRuleHandler, EnterRuleOptions, TextBlockEnterRuleOptions, defineEnterRule, defineTextBlockEnterRule };
|
111
|
+
export { EnterRuleHandler, EnterRuleHandlerOptions, EnterRuleOptions, TextBlockEnterRuleOptions, defineEnterRule, defineTextBlockEnterRule };
|
@@ -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");
|
@@ -26,18 +26,36 @@ function defineLinkSpec() {
|
|
26
26
|
return defineMarkSpec({
|
27
27
|
name: "link",
|
28
28
|
inclusive: false,
|
29
|
-
attrs: {
|
29
|
+
attrs: {
|
30
|
+
href: { validate: "string" },
|
31
|
+
target: {
|
32
|
+
default: null,
|
33
|
+
validate: "string|null"
|
34
|
+
},
|
35
|
+
rel: {
|
36
|
+
default: null,
|
37
|
+
validate: "string|null"
|
38
|
+
}
|
39
|
+
},
|
30
40
|
parseDOM: [{
|
31
41
|
tag: "a[href]",
|
32
42
|
getAttrs: (dom) => {
|
33
|
-
return {
|
43
|
+
return {
|
44
|
+
href: dom.getAttribute("href") || "",
|
45
|
+
target: dom.getAttribute("target") || null,
|
46
|
+
rel: dom.getAttribute("rel") || null
|
47
|
+
};
|
34
48
|
}
|
35
49
|
}],
|
36
50
|
toDOM(node) {
|
37
|
-
const { href } = node.attrs;
|
51
|
+
const { href, target, rel } = node.attrs;
|
38
52
|
return [
|
39
53
|
"a",
|
40
|
-
{
|
54
|
+
{
|
55
|
+
href,
|
56
|
+
target,
|
57
|
+
rel
|
58
|
+
},
|
41
59
|
0
|
42
60
|
];
|
43
61
|
}
|
@@ -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 { InsertTableOptions, MoveTableColumnOptions, MoveTableRowOptions, SelectTableCellOptions, SelectTableColumnOptions, SelectTableOptions, SelectTableRowOptions, TableCellSpecExtension, TableCommandsExtension, TableExtension, TableHeaderCellSpecExtension, TableRowSpecExtension, 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
|
@@ -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