@prosekit/extensions 0.2.3 → 0.2.4
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/_tsup-dts-rollup.d.ts +4 -14
- package/dist/prosekit-extensions-autocomplete.js +1 -4
- package/dist/prosekit-extensions-code-block.js +3 -17
- package/dist/prosekit-extensions-heading.js +2 -16
- package/dist/prosekit-extensions-link.js +2 -0
- package/dist/prosekit-extensions-placeholder.js +8 -4
- package/package.json +3 -3
- package/dist/chunk-DI46QWLX.js +0 -9
- package/dist/chunk-HQZORKGY.js +0 -6
@@ -1,8 +1,6 @@
|
|
1
1
|
import { Attrs } from '@prosekit/pm/model';
|
2
2
|
import type { BundledTheme } from 'shikiji';
|
3
|
-
import type { Command } from '@prosekit/pm/state';
|
4
3
|
import { CommandArgs } from '@prosekit/core';
|
5
|
-
import type { ContentMatch } from '@prosekit/pm/model';
|
6
4
|
import { DedentListOptions } from 'prosemirror-flat-list';
|
7
5
|
import { EditorState } from '@prosekit/pm/state';
|
8
6
|
import { Extension } from '@prosekit/core';
|
@@ -12,7 +10,6 @@ import { InputRule } from '@prosekit/pm/inputrules';
|
|
12
10
|
import { ListAttributes } from 'prosemirror-flat-list';
|
13
11
|
import { NodeRange } from 'prosemirror-model';
|
14
12
|
import { NodeType } from '@prosekit/pm/model';
|
15
|
-
import { NodeType as NodeType_2 } from 'prosemirror-model';
|
16
13
|
import { Options } from 'tsup';
|
17
14
|
import { Parser } from 'prosemirror-highlight';
|
18
15
|
import { Plugin as Plugin_2 } from '@prosekit/pm/state';
|
@@ -65,8 +62,6 @@ export declare const default_alias_1: {
|
|
65
62
|
};
|
66
63
|
};
|
67
64
|
|
68
|
-
export declare function defaultBlockAt(match: ContentMatch): NodeType_2 | null;
|
69
|
-
|
70
65
|
export declare function defaultCanMatch({ state }: {
|
71
66
|
state: EditorState;
|
72
67
|
}): boolean;
|
@@ -330,6 +325,7 @@ export declare function defineLink(): Extension< {
|
|
330
325
|
MARKS: "link";
|
331
326
|
COMMAND_ARGS: {
|
332
327
|
addLink: [attrs: LinkAttrs];
|
328
|
+
removeLink: [];
|
333
329
|
toggleLink: [attrs: LinkAttrs];
|
334
330
|
};
|
335
331
|
}>;
|
@@ -337,6 +333,7 @@ toggleLink: [attrs: LinkAttrs];
|
|
337
333
|
export declare function defineLinkCommands(): Extension< {
|
338
334
|
COMMAND_ARGS: {
|
339
335
|
addLink: [attrs: LinkAttrs];
|
336
|
+
removeLink: [];
|
340
337
|
toggleLink: [attrs: LinkAttrs];
|
341
338
|
};
|
342
339
|
}>;
|
@@ -604,6 +601,8 @@ export declare interface ImageAttrs {
|
|
604
601
|
|
605
602
|
/**
|
606
603
|
* @internal
|
604
|
+
*
|
605
|
+
* @deprecated Use the one from `@prosekit/core` instead.
|
607
606
|
*/
|
608
607
|
export declare function isInCodeBlock(selection: Selection_2): boolean | undefined;
|
609
608
|
|
@@ -631,10 +630,6 @@ export declare interface MentionAttrs {
|
|
631
630
|
value: string;
|
632
631
|
}
|
633
632
|
|
634
|
-
export declare const NO_BREAK_SPACE = "\u00A0";
|
635
|
-
|
636
|
-
export declare const OBJECT_REPLACEMENT_CHARACTER = "\uFFFC";
|
637
|
-
|
638
633
|
export declare interface PlaceholderOptions {
|
639
634
|
/**
|
640
635
|
* The placeholder text to use.
|
@@ -685,9 +680,4 @@ export declare type TextBlockEnterRuleOptions = {
|
|
685
680
|
attrs?: Attrs | null | ((match: RegExpMatchArray) => Attrs | null);
|
686
681
|
};
|
687
682
|
|
688
|
-
/**
|
689
|
-
* @internal
|
690
|
-
*/
|
691
|
-
export declare function withSkipCodeBlock(command: Command): Command;
|
692
|
-
|
693
683
|
export { }
|
@@ -1,7 +1,3 @@
|
|
1
|
-
import {
|
2
|
-
OBJECT_REPLACEMENT_CHARACTER
|
3
|
-
} from "./chunk-HQZORKGY.js";
|
4
|
-
|
5
1
|
// src/autocomplete/index.ts
|
6
2
|
import {
|
7
3
|
Facet,
|
@@ -9,6 +5,7 @@ import {
|
|
9
5
|
} from "@prosekit/core";
|
10
6
|
|
11
7
|
// src/autocomplete/plugin.ts
|
8
|
+
import { OBJECT_REPLACEMENT_CHARACTER } from "@prosekit/core";
|
12
9
|
import { Plugin } from "@prosekit/pm/state";
|
13
10
|
import { Decoration, DecorationSet } from "@prosekit/pm/view";
|
14
11
|
|
@@ -1,6 +1,3 @@
|
|
1
|
-
import {
|
2
|
-
OBJECT_REPLACEMENT_CHARACTER
|
3
|
-
} from "./chunk-HQZORKGY.js";
|
4
1
|
import {
|
5
2
|
defineTextBlockInputRule
|
6
3
|
} from "./chunk-DYFRBXUX.js";
|
@@ -42,7 +39,8 @@ import {
|
|
42
39
|
Facet,
|
43
40
|
getNodeType,
|
44
41
|
isTextSelection,
|
45
|
-
keymapFacet
|
42
|
+
keymapFacet,
|
43
|
+
OBJECT_REPLACEMENT_CHARACTER
|
46
44
|
} from "@prosekit/core";
|
47
45
|
function defineEnterRule({
|
48
46
|
regex,
|
@@ -141,20 +139,8 @@ function getAttrs(match) {
|
|
141
139
|
}
|
142
140
|
|
143
141
|
// src/code-block/code-block-keymap.ts
|
144
|
-
import { defineKeymap } from "@prosekit/core";
|
142
|
+
import { defaultBlockAt, defineKeymap } from "@prosekit/core";
|
145
143
|
import { TextSelection } from "@prosekit/pm/state";
|
146
|
-
|
147
|
-
// src/utils/default-block-at.ts
|
148
|
-
function defaultBlockAt(match) {
|
149
|
-
for (let i = 0; i < match.edgeCount; i++) {
|
150
|
-
const { type } = match.edge(i);
|
151
|
-
if (type.isTextblock && !type.hasRequiredAttrs())
|
152
|
-
return type;
|
153
|
-
}
|
154
|
-
return null;
|
155
|
-
}
|
156
|
-
|
157
|
-
// src/code-block/code-block-keymap.ts
|
158
144
|
function defineCodeBlockKeymap() {
|
159
145
|
return defineKeymap({
|
160
146
|
Enter: existCodeBlock
|
@@ -1,6 +1,3 @@
|
|
1
|
-
import {
|
2
|
-
isInCodeBlock
|
3
|
-
} from "./chunk-DI46QWLX.js";
|
4
1
|
import {
|
5
2
|
defineTextBlockInputRule
|
6
3
|
} from "./chunk-DYFRBXUX.js";
|
@@ -13,20 +10,9 @@ import {
|
|
13
10
|
insertNode,
|
14
11
|
setBlockType,
|
15
12
|
toggleNode,
|
16
|
-
union
|
13
|
+
union,
|
14
|
+
withSkipCodeBlock
|
17
15
|
} from "@prosekit/core";
|
18
|
-
|
19
|
-
// src/utils/with-skip-code-block.ts
|
20
|
-
function withSkipCodeBlock(command) {
|
21
|
-
return (state, dispatch, view) => {
|
22
|
-
if (isInCodeBlock(state.selection)) {
|
23
|
-
return false;
|
24
|
-
}
|
25
|
-
return command(state, dispatch, view);
|
26
|
-
};
|
27
|
-
}
|
28
|
-
|
29
|
-
// src/heading/index.ts
|
30
16
|
function defineHeadingSpec() {
|
31
17
|
return defineNodeSpec({
|
32
18
|
name: "heading",
|
@@ -4,6 +4,7 @@ import {
|
|
4
4
|
addMark,
|
5
5
|
defineMarkSpec,
|
6
6
|
union,
|
7
|
+
removeMark,
|
7
8
|
toggleMark
|
8
9
|
} from "@prosekit/core";
|
9
10
|
function defineLinkSpec() {
|
@@ -31,6 +32,7 @@ function defineLinkSpec() {
|
|
31
32
|
function defineLinkCommands() {
|
32
33
|
return defineCommands({
|
33
34
|
addLink: (attrs) => addMark({ type: "link", attrs }),
|
35
|
+
removeLink: () => removeMark({ type: "link" }),
|
34
36
|
toggleLink: (attrs) => toggleMark({ type: "link", attrs })
|
35
37
|
});
|
36
38
|
}
|
@@ -1,12 +1,16 @@
|
|
1
|
-
import {
|
2
|
-
isInCodeBlock
|
3
|
-
} from "./chunk-DI46QWLX.js";
|
4
|
-
|
5
1
|
// src/placeholder/index.ts
|
6
2
|
import { definePlugin } from "@prosekit/core";
|
7
3
|
import "@prosekit/pm/model";
|
8
4
|
import { Plugin, PluginKey } from "@prosekit/pm/state";
|
9
5
|
import { Decoration, DecorationSet } from "@prosekit/pm/view";
|
6
|
+
|
7
|
+
// src/utils/is-in-code-block.ts
|
8
|
+
function isInCodeBlock(selection) {
|
9
|
+
const type = selection.$from.parent.type;
|
10
|
+
return type.spec.code && type.isBlock;
|
11
|
+
}
|
12
|
+
|
13
|
+
// src/placeholder/index.ts
|
10
14
|
function definePlaceholder(options) {
|
11
15
|
return definePlugin(createPlaceholderPlugin(options));
|
12
16
|
}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@prosekit/extensions",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.2.
|
4
|
+
"version": "0.2.4",
|
5
5
|
"private": false,
|
6
6
|
"author": {
|
7
7
|
"name": "ocavue",
|
@@ -126,7 +126,7 @@
|
|
126
126
|
"dist"
|
127
127
|
],
|
128
128
|
"dependencies": {
|
129
|
-
"@prosekit/core": "^0.2.
|
129
|
+
"@prosekit/core": "^0.2.4",
|
130
130
|
"@prosekit/pm": "^0.1.1",
|
131
131
|
"prosemirror-dropcursor": "^1.8.1",
|
132
132
|
"prosemirror-flat-list": "^0.4.5",
|
@@ -142,7 +142,7 @@
|
|
142
142
|
},
|
143
143
|
"devDependencies": {
|
144
144
|
"@prosekit/dev": "*",
|
145
|
-
"shikiji": "^0.9.
|
145
|
+
"shikiji": "^0.9.18",
|
146
146
|
"tsup": "^8.0.1",
|
147
147
|
"typescript": "^5.3.3",
|
148
148
|
"vitest": "^1.1.3"
|
package/dist/chunk-DI46QWLX.js
DELETED