@prosekit/extensions 0.0.0-next-20230709094459 → 0.0.0-next-20231120040948
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 +459 -0
- package/dist/list/style.css +2 -2
- package/dist/prosekit-extensions-autocomplete.d.ts +3 -0
- package/dist/prosekit-extensions-autocomplete.js +190 -0
- package/dist/prosekit-extensions-blockquote.d.ts +2 -11
- package/dist/prosekit-extensions-blockquote.js +13 -15
- package/dist/prosekit-extensions-bold.d.ts +4 -20
- package/dist/prosekit-extensions-bold.js +35 -37
- package/dist/prosekit-extensions-code-block.d.ts +5 -0
- package/dist/prosekit-extensions-code-block.js +118 -0
- package/dist/prosekit-extensions-code.d.ts +4 -16
- package/dist/prosekit-extensions-code.js +28 -12
- package/dist/prosekit-extensions-heading.d.ts +6 -15
- package/dist/prosekit-extensions-heading.js +67 -39
- package/dist/prosekit-extensions-image.d.ts +4 -0
- package/dist/prosekit-extensions-image.js +48 -0
- package/dist/prosekit-extensions-italic.d.ts +4 -20
- package/dist/prosekit-extensions-italic.js +29 -31
- package/dist/prosekit-extensions-link.d.ts +4 -0
- package/dist/prosekit-extensions-link.js +44 -0
- package/dist/prosekit-extensions-list.d.ts +6 -14
- package/dist/prosekit-extensions-list.js +54 -24
- package/dist/prosekit-extensions-mention.d.ts +3 -0
- package/dist/prosekit-extensions-mention.js +43 -0
- package/dist/prosekit-extensions-placeholder.d.ts +2 -23
- package/dist/prosekit-extensions-placeholder.js +8 -7
- package/dist/prosekit-extensions-strike.d.ts +4 -0
- package/dist/prosekit-extensions-strike.js +47 -0
- package/dist/prosekit-extensions-suggestion.d.ts +3 -37
- package/dist/prosekit-extensions-suggestion.js +7 -5
- package/dist/prosekit-extensions-underline.d.ts +4 -0
- package/dist/prosekit-extensions-underline.js +45 -0
- package/dist/prosekit-extensions.d.ts +1 -2
- package/package.json +65 -7
@@ -1,23 +1,21 @@
|
|
1
1
|
// src/blockquote/index.ts
|
2
|
-
import {
|
3
|
-
function
|
4
|
-
return
|
2
|
+
import { defineNodeSpec, union } from "@prosekit/core";
|
3
|
+
function defineBlockquoteSpec() {
|
4
|
+
return defineNodeSpec({
|
5
5
|
name: "blockquote",
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
return ["blockquote", 0];
|
13
|
-
}
|
6
|
+
content: "block+",
|
7
|
+
group: "block",
|
8
|
+
defining: true,
|
9
|
+
parseDOM: [{ tag: "blockquote" }],
|
10
|
+
toDOM() {
|
11
|
+
return ["blockquote", 0];
|
14
12
|
}
|
15
13
|
});
|
16
14
|
}
|
17
|
-
function
|
18
|
-
return
|
15
|
+
function defineBlockquote() {
|
16
|
+
return union([defineBlockquoteSpec()]);
|
19
17
|
}
|
20
18
|
export {
|
21
|
-
|
22
|
-
|
19
|
+
defineBlockquote,
|
20
|
+
defineBlockquoteSpec
|
23
21
|
};
|
@@ -1,20 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
}>;
|
6
|
-
declare function addBoldCommands(): _prosekit_core.Extension<{
|
7
|
-
COMMAND_ARGS: {
|
8
|
-
toggleBold: [];
|
9
|
-
};
|
10
|
-
}>;
|
11
|
-
declare function addBoldKeymap(): _prosekit_core.Extension<_prosekit_core.ExtensionTyping<string, string, _prosekit_core.CommandArgs>>;
|
12
|
-
/** @public */
|
13
|
-
declare function addBold(): _prosekit_core.Extension<{
|
14
|
-
MARKS: "bold";
|
15
|
-
COMMAND_ARGS: {
|
16
|
-
toggleBold: [];
|
17
|
-
};
|
18
|
-
}>;
|
19
|
-
|
20
|
-
export { addBold, addBoldCommands, addBoldKeymap, addBoldSpec };
|
1
|
+
export { defineBoldSpec } from './_tsup-dts-rollup';
|
2
|
+
export { defineBoldCommands } from './_tsup-dts-rollup';
|
3
|
+
export { defineBoldKeymap } from './_tsup-dts-rollup';
|
4
|
+
export { defineBold } from './_tsup-dts-rollup';
|
@@ -1,56 +1,54 @@
|
|
1
1
|
// src/bold/index.ts
|
2
2
|
import {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
defineCommands,
|
4
|
+
defineKeymap,
|
5
|
+
defineMarkSpec,
|
6
|
+
union,
|
7
7
|
toggleMark
|
8
8
|
} from "@prosekit/core";
|
9
|
-
function
|
10
|
-
return
|
9
|
+
function defineBoldSpec() {
|
10
|
+
return defineMarkSpec({
|
11
11
|
name: "bold",
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
return typeof value === "string" && /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null;
|
29
|
-
}
|
12
|
+
parseDOM: [
|
13
|
+
{ tag: "strong" },
|
14
|
+
// This works around a Google Docs misbehavior where
|
15
|
+
// pasted content will be inexplicably wrapped in `<b>`
|
16
|
+
// tags with a font-weight normal.
|
17
|
+
{
|
18
|
+
tag: "b",
|
19
|
+
getAttrs: (node) => {
|
20
|
+
return typeof node !== "string" && node.style.fontWeight !== "normal" && null;
|
21
|
+
}
|
22
|
+
},
|
23
|
+
{ style: "font-weight=400", clearMark: (m) => m.type.name == "strong" },
|
24
|
+
{
|
25
|
+
style: "font-weight",
|
26
|
+
getAttrs: (value) => {
|
27
|
+
return typeof value === "string" && /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null;
|
30
28
|
}
|
31
|
-
],
|
32
|
-
toDOM() {
|
33
|
-
return ["em", 0];
|
34
29
|
}
|
30
|
+
],
|
31
|
+
toDOM() {
|
32
|
+
return ["strong", 0];
|
35
33
|
}
|
36
34
|
});
|
37
35
|
}
|
38
|
-
function
|
39
|
-
return
|
36
|
+
function defineBoldCommands() {
|
37
|
+
return defineCommands({
|
40
38
|
toggleBold: () => toggleMark({ type: "bold" })
|
41
39
|
});
|
42
40
|
}
|
43
|
-
function
|
44
|
-
return
|
41
|
+
function defineBoldKeymap() {
|
42
|
+
return defineKeymap({
|
45
43
|
"Mod-b": toggleMark({ type: "bold" })
|
46
44
|
});
|
47
45
|
}
|
48
|
-
function
|
49
|
-
return
|
46
|
+
function defineBold() {
|
47
|
+
return union([defineBoldSpec(), defineBoldCommands(), defineBoldKeymap()]);
|
50
48
|
}
|
51
49
|
export {
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
50
|
+
defineBold,
|
51
|
+
defineBoldCommands,
|
52
|
+
defineBoldKeymap,
|
53
|
+
defineBoldSpec
|
56
54
|
};
|
@@ -0,0 +1,5 @@
|
|
1
|
+
export { defineCodeBlockSpec } from './_tsup-dts-rollup';
|
2
|
+
export { defineCodeBlockInputRule } from './_tsup-dts-rollup';
|
3
|
+
export { defineCodeBlockCommands } from './_tsup-dts-rollup';
|
4
|
+
export { defineCodeBlock } from './_tsup-dts-rollup';
|
5
|
+
export { CodeBlockAttrs_alias_1 as CodeBlockAttrs } from './_tsup-dts-rollup';
|
@@ -0,0 +1,118 @@
|
|
1
|
+
// src/code-block/index.ts
|
2
|
+
import {
|
3
|
+
defineCommands,
|
4
|
+
defineInputRule,
|
5
|
+
defineNodeSpec,
|
6
|
+
union,
|
7
|
+
getNodeType
|
8
|
+
} from "@prosekit/core";
|
9
|
+
import { textblockTypeInputRule } from "@prosekit/pm/inputrules";
|
10
|
+
|
11
|
+
// src/code-block/code-block-highlight.ts
|
12
|
+
import { definePlugin } from "@prosekit/core";
|
13
|
+
import { PluginKey, ProseMirrorPlugin } from "@prosekit/pm/state";
|
14
|
+
import { DecorationSet } from "@prosekit/pm/view";
|
15
|
+
import { getHighlightDecorations } from "prosemirror-highlightjs";
|
16
|
+
function defineCodeBlockHighlight(options) {
|
17
|
+
const hljs = options.hljs;
|
18
|
+
const plugin = new ProseMirrorPlugin({
|
19
|
+
key,
|
20
|
+
state: {
|
21
|
+
init(_config, state) {
|
22
|
+
const decorations = hljs ? getHighlightDecorations(
|
23
|
+
state.doc,
|
24
|
+
hljs,
|
25
|
+
blockTypes,
|
26
|
+
languageExtractor
|
27
|
+
) : [];
|
28
|
+
return DecorationSet.create(state.doc, decorations);
|
29
|
+
},
|
30
|
+
apply(tr, set) {
|
31
|
+
if (!tr.docChanged) {
|
32
|
+
return set.map(tr.mapping, tr.doc);
|
33
|
+
}
|
34
|
+
const decorations = hljs ? getHighlightDecorations(tr.doc, hljs, blockTypes, languageExtractor) : [];
|
35
|
+
return DecorationSet.create(tr.doc, decorations);
|
36
|
+
}
|
37
|
+
},
|
38
|
+
props: {
|
39
|
+
decorations(state) {
|
40
|
+
return key.getState(state);
|
41
|
+
}
|
42
|
+
}
|
43
|
+
});
|
44
|
+
return definePlugin(plugin);
|
45
|
+
}
|
46
|
+
var key = new PluginKey("prosekit-code-block-highlight");
|
47
|
+
var blockTypes = ["codeBlock"];
|
48
|
+
function languageExtractor(node) {
|
49
|
+
return node.attrs.language || "javascript";
|
50
|
+
}
|
51
|
+
|
52
|
+
// src/code-block/index.ts
|
53
|
+
function defineCodeBlockSpec() {
|
54
|
+
return defineNodeSpec({
|
55
|
+
name: "codeBlock",
|
56
|
+
content: "text*",
|
57
|
+
group: "block",
|
58
|
+
code: true,
|
59
|
+
defining: true,
|
60
|
+
marks: "",
|
61
|
+
attrs: { language: { default: "" } },
|
62
|
+
parseDOM: [
|
63
|
+
{
|
64
|
+
tag: "pre",
|
65
|
+
preserveWhitespace: "full",
|
66
|
+
getAttrs: (node) => ({
|
67
|
+
language: node.getAttribute("data-language") || ""
|
68
|
+
})
|
69
|
+
}
|
70
|
+
],
|
71
|
+
toDOM(node) {
|
72
|
+
const attrs = node.attrs;
|
73
|
+
return [
|
74
|
+
"pre",
|
75
|
+
{ "data-language": attrs.language, class: "hljs" },
|
76
|
+
["code", 0]
|
77
|
+
];
|
78
|
+
}
|
79
|
+
});
|
80
|
+
}
|
81
|
+
function defineCodeBlockInputRule() {
|
82
|
+
return defineInputRule(({ schema }) => {
|
83
|
+
const nodeType = getNodeType(schema, "codeBlock");
|
84
|
+
const getAttrs = (match) => {
|
85
|
+
return { language: match[1] || "" };
|
86
|
+
};
|
87
|
+
return textblockTypeInputRule(/^```(\S*)\s$/, nodeType, getAttrs);
|
88
|
+
});
|
89
|
+
}
|
90
|
+
function defineCodeBlockCommands() {
|
91
|
+
return defineCommands({
|
92
|
+
setCodeBlockLanguage: (language) => (state, dispatch) => {
|
93
|
+
const pos = state.selection.$from.before();
|
94
|
+
const codeBlock = state.doc.nodeAt(pos);
|
95
|
+
if (!codeBlock || codeBlock.type.name !== "codeBlock") {
|
96
|
+
return false;
|
97
|
+
}
|
98
|
+
const { tr } = state;
|
99
|
+
tr.setNodeMarkup(pos, void 0, { language });
|
100
|
+
dispatch == null ? void 0 : dispatch(tr);
|
101
|
+
return true;
|
102
|
+
}
|
103
|
+
});
|
104
|
+
}
|
105
|
+
function defineCodeBlock(options) {
|
106
|
+
return union([
|
107
|
+
defineCodeBlockSpec(),
|
108
|
+
defineCodeBlockInputRule(),
|
109
|
+
defineCodeBlockHighlight({ hljs: options == null ? void 0 : options.hljs }),
|
110
|
+
defineCodeBlockCommands()
|
111
|
+
]);
|
112
|
+
}
|
113
|
+
export {
|
114
|
+
defineCodeBlock,
|
115
|
+
defineCodeBlockCommands,
|
116
|
+
defineCodeBlockInputRule,
|
117
|
+
defineCodeBlockSpec
|
118
|
+
};
|
@@ -1,16 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
*/
|
6
|
-
declare function addCodeSpec(): _prosekit_core.Extension<{
|
7
|
-
MARKS: "code";
|
8
|
-
}>;
|
9
|
-
/**
|
10
|
-
* @public
|
11
|
-
*/
|
12
|
-
declare function addCode(): _prosekit_core.Extension<{
|
13
|
-
MARKS: "code";
|
14
|
-
}>;
|
15
|
-
|
16
|
-
export { addCode, addCodeSpec };
|
1
|
+
export { defineCodeSpec } from './_tsup-dts-rollup';
|
2
|
+
export { defineCodeCommands } from './_tsup-dts-rollup';
|
3
|
+
export { defineItalicKeymap } from './_tsup-dts-rollup';
|
4
|
+
export { defineCode } from './_tsup-dts-rollup';
|
@@ -1,20 +1,36 @@
|
|
1
1
|
// src/code/index.ts
|
2
|
-
import {
|
3
|
-
|
4
|
-
|
2
|
+
import {
|
3
|
+
defineCommands,
|
4
|
+
defineKeymap,
|
5
|
+
defineMarkSpec,
|
6
|
+
toggleMark,
|
7
|
+
union
|
8
|
+
} from "@prosekit/core";
|
9
|
+
function defineCodeSpec() {
|
10
|
+
return defineMarkSpec({
|
5
11
|
name: "code",
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
return ["code", 0];
|
10
|
-
}
|
12
|
+
parseDOM: [{ tag: "code" }],
|
13
|
+
toDOM() {
|
14
|
+
return ["code", 0];
|
11
15
|
}
|
12
16
|
});
|
13
17
|
}
|
14
|
-
function
|
15
|
-
return
|
18
|
+
function defineCodeCommands() {
|
19
|
+
return defineCommands({
|
20
|
+
toggleCode: () => toggleMark({ type: "code" })
|
21
|
+
});
|
22
|
+
}
|
23
|
+
function defineItalicKeymap() {
|
24
|
+
return defineKeymap({
|
25
|
+
"Mod-e": toggleMark({ type: "code" })
|
26
|
+
});
|
27
|
+
}
|
28
|
+
function defineCode() {
|
29
|
+
return union([defineCodeSpec(), defineCodeCommands(), defineItalicKeymap()]);
|
16
30
|
}
|
17
31
|
export {
|
18
|
-
|
19
|
-
|
32
|
+
defineCode,
|
33
|
+
defineCodeCommands,
|
34
|
+
defineCodeSpec,
|
35
|
+
defineItalicKeymap
|
20
36
|
};
|
@@ -1,15 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
}
|
6
|
-
|
7
|
-
NODES: "heading";
|
8
|
-
}>;
|
9
|
-
declare function addHeadingInputRule(): _prosekit_core.Extension<_prosekit_core.ExtensionTyping<string, string, _prosekit_core.CommandArgs>>;
|
10
|
-
/** @public */
|
11
|
-
declare function addHeading(): _prosekit_core.Extension<{
|
12
|
-
NODES: "heading";
|
13
|
-
}>;
|
14
|
-
|
15
|
-
export { HeadingAttrs, addHeading, addHeadingInputRule, addHeadingSpec };
|
1
|
+
export { defineHeadingSpec } from './_tsup-dts-rollup';
|
2
|
+
export { defineHeadingKeymap } from './_tsup-dts-rollup';
|
3
|
+
export { defineHeadingInputRule } from './_tsup-dts-rollup';
|
4
|
+
export { defineHeadingCommands } from './_tsup-dts-rollup';
|
5
|
+
export { defineHeading } from './_tsup-dts-rollup';
|
6
|
+
export { HeadingAttrs } from './_tsup-dts-rollup';
|
@@ -1,53 +1,81 @@
|
|
1
1
|
// src/heading/index.ts
|
2
2
|
import {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
defineCommands,
|
4
|
+
defineInputRule,
|
5
|
+
defineKeymap,
|
6
|
+
defineNodeSpec,
|
7
|
+
getNodeType,
|
8
|
+
insertNode,
|
9
|
+
setBlockType,
|
10
|
+
toggleNode,
|
11
|
+
union
|
7
12
|
} from "@prosekit/core";
|
8
13
|
import { textblockTypeInputRule } from "@prosekit/pm/inputrules";
|
9
|
-
function
|
10
|
-
return
|
14
|
+
function defineHeadingSpec() {
|
15
|
+
return defineNodeSpec({
|
11
16
|
name: "heading",
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
return [`h${node.attrs.level}`, 0];
|
27
|
-
}
|
17
|
+
attrs: { level: { default: 1 } },
|
18
|
+
content: "inline*",
|
19
|
+
group: "block",
|
20
|
+
defining: true,
|
21
|
+
parseDOM: [
|
22
|
+
{ tag: "h1", attrs: { level: 1 } },
|
23
|
+
{ tag: "h2", attrs: { level: 2 } },
|
24
|
+
{ tag: "h3", attrs: { level: 3 } },
|
25
|
+
{ tag: "h4", attrs: { level: 4 } },
|
26
|
+
{ tag: "h5", attrs: { level: 5 } },
|
27
|
+
{ tag: "h6", attrs: { level: 6 } }
|
28
|
+
],
|
29
|
+
toDOM(node) {
|
30
|
+
return [`h${node.attrs.level}`, 0];
|
28
31
|
}
|
29
32
|
});
|
30
33
|
}
|
31
|
-
function
|
32
|
-
return
|
34
|
+
function defineHeadingKeymap() {
|
35
|
+
return defineKeymap({
|
36
|
+
"mod-1": toggleNode({ type: "heading", attrs: { level: 1 } }),
|
37
|
+
"mod-2": toggleNode({ type: "heading", attrs: { level: 2 } }),
|
38
|
+
"mod-3": toggleNode({ type: "heading", attrs: { level: 3 } }),
|
39
|
+
"mod-4": toggleNode({ type: "heading", attrs: { level: 4 } }),
|
40
|
+
"mod-5": toggleNode({ type: "heading", attrs: { level: 5 } }),
|
41
|
+
"mod-6": toggleNode({ type: "heading", attrs: { level: 6 } })
|
42
|
+
});
|
43
|
+
}
|
44
|
+
function defineHeadingInputRule() {
|
45
|
+
return defineInputRule(({ schema }) => {
|
33
46
|
const nodeSpec = getNodeType(schema, "heading");
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
47
|
+
return textblockTypeInputRule(/^(#{1,6})\s/, nodeSpec, (match) => {
|
48
|
+
var _a, _b;
|
49
|
+
const level = (_b = (_a = match[1]) == null ? void 0 : _a.length) != null ? _b : 1;
|
50
|
+
return { level };
|
51
|
+
});
|
52
|
+
});
|
53
|
+
}
|
54
|
+
function defineHeadingCommands() {
|
55
|
+
return defineCommands({
|
56
|
+
setHeading: (attrs) => {
|
57
|
+
return setBlockType({ type: "heading", attrs });
|
58
|
+
},
|
59
|
+
insertHeading: (attrs) => {
|
60
|
+
return insertNode({ type: "heading", attrs });
|
61
|
+
},
|
62
|
+
toggleHeading: (attrs) => {
|
63
|
+
return toggleNode({ type: "heading", attrs });
|
64
|
+
}
|
44
65
|
});
|
45
66
|
}
|
46
|
-
function
|
47
|
-
return
|
67
|
+
function defineHeading() {
|
68
|
+
return union([
|
69
|
+
defineHeadingSpec(),
|
70
|
+
defineHeadingInputRule(),
|
71
|
+
defineHeadingKeymap(),
|
72
|
+
defineHeadingCommands()
|
73
|
+
]);
|
48
74
|
}
|
49
75
|
export {
|
50
|
-
|
51
|
-
|
52
|
-
|
76
|
+
defineHeading,
|
77
|
+
defineHeadingCommands,
|
78
|
+
defineHeadingInputRule,
|
79
|
+
defineHeadingKeymap,
|
80
|
+
defineHeadingSpec
|
53
81
|
};
|
@@ -0,0 +1,48 @@
|
|
1
|
+
// src/image/index.ts
|
2
|
+
import {
|
3
|
+
defineCommands,
|
4
|
+
defineNodeSpec,
|
5
|
+
insertNode,
|
6
|
+
union
|
7
|
+
} from "@prosekit/core";
|
8
|
+
function defineImageSpec() {
|
9
|
+
return defineNodeSpec({
|
10
|
+
name: "image",
|
11
|
+
attrs: {
|
12
|
+
src: { default: null }
|
13
|
+
},
|
14
|
+
group: "block",
|
15
|
+
defining: true,
|
16
|
+
parseDOM: [
|
17
|
+
{
|
18
|
+
tag: "img[src]",
|
19
|
+
getAttrs: (element) => {
|
20
|
+
if (typeof element === "string") {
|
21
|
+
return { src: null };
|
22
|
+
}
|
23
|
+
const src = element.getAttribute("src") || null;
|
24
|
+
return { src };
|
25
|
+
}
|
26
|
+
}
|
27
|
+
],
|
28
|
+
toDOM(node) {
|
29
|
+
const attrs = node.attrs;
|
30
|
+
return ["img", attrs];
|
31
|
+
}
|
32
|
+
});
|
33
|
+
}
|
34
|
+
function defineImageCommands() {
|
35
|
+
return defineCommands({
|
36
|
+
insertImage: (attrs) => {
|
37
|
+
return insertNode({ type: "image", attrs });
|
38
|
+
}
|
39
|
+
});
|
40
|
+
}
|
41
|
+
function defineImage() {
|
42
|
+
return union([defineImageSpec(), defineImageCommands()]);
|
43
|
+
}
|
44
|
+
export {
|
45
|
+
defineImage,
|
46
|
+
defineImageCommands,
|
47
|
+
defineImageSpec
|
48
|
+
};
|
@@ -1,20 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
}>;
|
6
|
-
declare function addItalicCommands(): _prosekit_core.Extension<{
|
7
|
-
COMMAND_ARGS: {
|
8
|
-
toggleItalic: [];
|
9
|
-
};
|
10
|
-
}>;
|
11
|
-
declare function addItalicKeymap(): _prosekit_core.Extension<_prosekit_core.ExtensionTyping<string, string, _prosekit_core.CommandArgs>>;
|
12
|
-
/** @public */
|
13
|
-
declare function addItalic(): _prosekit_core.Extension<{
|
14
|
-
MARKS: "italic";
|
15
|
-
COMMAND_ARGS: {
|
16
|
-
toggleItalic: [];
|
17
|
-
};
|
18
|
-
}>;
|
19
|
-
|
20
|
-
export { addItalic, addItalicCommands, addItalicKeymap, addItalicSpec };
|
1
|
+
export { defineItalicSpec } from './_tsup-dts-rollup';
|
2
|
+
export { defineItalicCommands } from './_tsup-dts-rollup';
|
3
|
+
export { defineItalicKeymap_alias_1 as defineItalicKeymap } from './_tsup-dts-rollup';
|
4
|
+
export { defineItalic } from './_tsup-dts-rollup';
|
@@ -1,50 +1,48 @@
|
|
1
1
|
// src/italic/index.ts
|
2
2
|
import {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
defineCommands,
|
4
|
+
defineKeymap,
|
5
|
+
defineMarkSpec,
|
6
|
+
union,
|
7
7
|
toggleMark
|
8
8
|
} from "@prosekit/core";
|
9
|
-
function
|
10
|
-
return
|
9
|
+
function defineItalicSpec() {
|
10
|
+
return defineMarkSpec({
|
11
11
|
name: "italic",
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
clearMark: (m) => m.type.name === "italic"
|
20
|
-
}
|
21
|
-
],
|
22
|
-
toDOM() {
|
23
|
-
return ["em", 0];
|
12
|
+
parseDOM: [
|
13
|
+
{ tag: "i" },
|
14
|
+
{ tag: "em" },
|
15
|
+
{ style: "font-style=italic" },
|
16
|
+
{
|
17
|
+
style: "font-style=normal",
|
18
|
+
clearMark: (m) => m.type.name === "italic"
|
24
19
|
}
|
20
|
+
],
|
21
|
+
toDOM() {
|
22
|
+
return ["em", 0];
|
25
23
|
}
|
26
24
|
});
|
27
25
|
}
|
28
|
-
function
|
29
|
-
return
|
26
|
+
function defineItalicCommands() {
|
27
|
+
return defineCommands({
|
30
28
|
toggleItalic: () => toggleMark({ type: "italic" })
|
31
29
|
});
|
32
30
|
}
|
33
|
-
function
|
34
|
-
return
|
31
|
+
function defineItalicKeymap() {
|
32
|
+
return defineKeymap({
|
35
33
|
"Mod-i": toggleMark({ type: "italic" })
|
36
34
|
});
|
37
35
|
}
|
38
|
-
function
|
39
|
-
return
|
40
|
-
|
41
|
-
|
42
|
-
|
36
|
+
function defineItalic() {
|
37
|
+
return union([
|
38
|
+
defineItalicSpec(),
|
39
|
+
defineItalicCommands(),
|
40
|
+
defineItalicKeymap()
|
43
41
|
]);
|
44
42
|
}
|
45
43
|
export {
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
44
|
+
defineItalic,
|
45
|
+
defineItalicCommands,
|
46
|
+
defineItalicKeymap,
|
47
|
+
defineItalicSpec
|
50
48
|
};
|