@tiptap/extension-paragraph 2.11.6 → 3.0.0-beta.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/LICENSE.md +21 -0
- package/README.md +5 -1
- package/dist/index.cjs +62 -41
- package/dist/index.cjs.map +1 -1
- package/dist/{paragraph.d.ts → index.d.cts} +5 -3
- package/dist/index.d.ts +28 -4
- package/dist/index.js +37 -38
- package/dist/index.js.map +1 -1
- package/package.json +10 -8
- package/src/paragraph.ts +8 -8
- package/dist/index.d.ts.map +0 -1
- package/dist/index.umd.js +0 -49
- package/dist/index.umd.js.map +0 -1
- package/dist/paragraph.d.ts.map +0 -1
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025, Tiptap GmbH
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
# @tiptap/extension-paragraph
|
|
2
|
+
|
|
2
3
|
[](https://www.npmjs.com/package/@tiptap/extension-paragraph)
|
|
3
4
|
[](https://npmcharts.com/compare/tiptap?minimal=true)
|
|
4
5
|
[](https://www.npmjs.com/package/@tiptap/extension-paragraph)
|
|
5
6
|
[](https://github.com/sponsors/ueberdosis)
|
|
6
7
|
|
|
7
8
|
## Introduction
|
|
8
|
-
|
|
9
|
+
|
|
10
|
+
Tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a toolkit for building rich text WYSIWYG editors, which is already in use at many well-known companies such as _New York Times_, _The Guardian_ or _Atlassian_.
|
|
9
11
|
|
|
10
12
|
## Official Documentation
|
|
13
|
+
|
|
11
14
|
Documentation can be found on the [Tiptap website](https://tiptap.dev).
|
|
12
15
|
|
|
13
16
|
## License
|
|
17
|
+
|
|
14
18
|
Tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap/blob/main/LICENSE.md).
|
package/dist/index.cjs
CHANGED
|
@@ -1,45 +1,66 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
2
19
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
Paragraph: () => Paragraph,
|
|
24
|
+
default: () => index_default
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(index_exports);
|
|
6
27
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
'Mod-Alt-0': () => this.editor.commands.setParagraph(),
|
|
39
|
-
};
|
|
40
|
-
},
|
|
28
|
+
// src/paragraph.ts
|
|
29
|
+
var import_core = require("@tiptap/core");
|
|
30
|
+
var Paragraph = import_core.Node.create({
|
|
31
|
+
name: "paragraph",
|
|
32
|
+
priority: 1e3,
|
|
33
|
+
addOptions() {
|
|
34
|
+
return {
|
|
35
|
+
HTMLAttributes: {}
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
group: "block",
|
|
39
|
+
content: "inline*",
|
|
40
|
+
parseHTML() {
|
|
41
|
+
return [{ tag: "p" }];
|
|
42
|
+
},
|
|
43
|
+
renderHTML({ HTMLAttributes }) {
|
|
44
|
+
return ["p", (0, import_core.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
45
|
+
},
|
|
46
|
+
addCommands() {
|
|
47
|
+
return {
|
|
48
|
+
setParagraph: () => ({ commands }) => {
|
|
49
|
+
return commands.setNode(this.name);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
addKeyboardShortcuts() {
|
|
54
|
+
return {
|
|
55
|
+
"Mod-Alt-0": () => this.editor.commands.setParagraph()
|
|
56
|
+
};
|
|
57
|
+
}
|
|
41
58
|
});
|
|
42
59
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
60
|
+
// src/index.ts
|
|
61
|
+
var index_default = Paragraph;
|
|
62
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
+
0 && (module.exports = {
|
|
64
|
+
Paragraph
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/paragraph.ts"],"sourcesContent":["import { Paragraph } from './paragraph.js'\n\nexport * from './paragraph.js'\n\nexport default Paragraph\n","import { mergeAttributes, Node } from '@tiptap/core'\n\nexport interface ParagraphOptions {\n /**\n * The HTML attributes for a paragraph node.\n * @default {}\n * @example { class: 'foo' }\n */\n HTMLAttributes: Record<string, any>\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n paragraph: {\n /**\n * Toggle a paragraph\n * @example editor.commands.toggleParagraph()\n */\n setParagraph: () => ReturnType\n }\n }\n}\n\n/**\n * This extension allows you to create paragraphs.\n * @see https://www.tiptap.dev/api/nodes/paragraph\n */\nexport const Paragraph = Node.create<ParagraphOptions>({\n name: 'paragraph',\n\n priority: 1000,\n\n addOptions() {\n return {\n HTMLAttributes: {},\n }\n },\n\n group: 'block',\n\n content: 'inline*',\n\n parseHTML() {\n return [{ tag: 'p' }]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['p', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n addCommands() {\n return {\n setParagraph:\n () =>\n ({ commands }) => {\n return commands.setNode(this.name)\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-Alt-0': () => this.editor.commands.setParagraph(),\n }\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAAsC;AA2B/B,IAAM,YAAY,iBAAK,OAAyB;AAAA,EACrD,MAAM;AAAA,EAEN,UAAU;AAAA,EAEV,aAAa;AACX,WAAO;AAAA,MACL,gBAAgB,CAAC;AAAA,IACnB;AAAA,EACF;AAAA,EAEA,OAAO;AAAA,EAEP,SAAS;AAAA,EAET,YAAY;AACV,WAAO,CAAC,EAAE,KAAK,IAAI,CAAC;AAAA,EACtB;AAAA,EAEA,WAAW,EAAE,eAAe,GAAG;AAC7B,WAAO,CAAC,SAAK,6BAAgB,KAAK,QAAQ,gBAAgB,cAAc,GAAG,CAAC;AAAA,EAC9E;AAAA,EAEA,cAAc;AACZ,WAAO;AAAA,MACL,cACE,MACA,CAAC,EAAE,SAAS,MAAM;AAChB,eAAO,SAAS,QAAQ,KAAK,IAAI;AAAA,MACnC;AAAA,IACJ;AAAA,EACF;AAAA,EAEA,uBAAuB;AACrB,WAAO;AAAA,MACL,aAAa,MAAM,KAAK,OAAO,SAAS,aAAa;AAAA,IACvD;AAAA,EACF;AACF,CAAC;;;AD7DD,IAAO,gBAAQ;","names":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Node } from '@tiptap/core';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
interface ParagraphOptions {
|
|
3
4
|
/**
|
|
4
5
|
* The HTML attributes for a paragraph node.
|
|
5
6
|
* @default {}
|
|
@@ -22,5 +23,6 @@ declare module '@tiptap/core' {
|
|
|
22
23
|
* This extension allows you to create paragraphs.
|
|
23
24
|
* @see https://www.tiptap.dev/api/nodes/paragraph
|
|
24
25
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
declare const Paragraph: Node<ParagraphOptions, any>;
|
|
27
|
+
|
|
28
|
+
export { Paragraph, type ParagraphOptions, Paragraph as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Node } from '@tiptap/core';
|
|
2
|
+
|
|
3
|
+
interface ParagraphOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The HTML attributes for a paragraph node.
|
|
6
|
+
* @default {}
|
|
7
|
+
* @example { class: 'foo' }
|
|
8
|
+
*/
|
|
9
|
+
HTMLAttributes: Record<string, any>;
|
|
10
|
+
}
|
|
11
|
+
declare module '@tiptap/core' {
|
|
12
|
+
interface Commands<ReturnType> {
|
|
13
|
+
paragraph: {
|
|
14
|
+
/**
|
|
15
|
+
* Toggle a paragraph
|
|
16
|
+
* @example editor.commands.toggleParagraph()
|
|
17
|
+
*/
|
|
18
|
+
setParagraph: () => ReturnType;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* This extension allows you to create paragraphs.
|
|
24
|
+
* @see https://www.tiptap.dev/api/nodes/paragraph
|
|
25
|
+
*/
|
|
26
|
+
declare const Paragraph: Node<ParagraphOptions, any>;
|
|
27
|
+
|
|
28
|
+
export { Paragraph, type ParagraphOptions, Paragraph as default };
|
package/dist/index.js
CHANGED
|
@@ -1,40 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
addKeyboardShortcuts() {
|
|
33
|
-
return {
|
|
34
|
-
'Mod-Alt-0': () => this.editor.commands.setParagraph(),
|
|
35
|
-
};
|
|
36
|
-
},
|
|
1
|
+
// src/paragraph.ts
|
|
2
|
+
import { mergeAttributes, Node } from "@tiptap/core";
|
|
3
|
+
var Paragraph = Node.create({
|
|
4
|
+
name: "paragraph",
|
|
5
|
+
priority: 1e3,
|
|
6
|
+
addOptions() {
|
|
7
|
+
return {
|
|
8
|
+
HTMLAttributes: {}
|
|
9
|
+
};
|
|
10
|
+
},
|
|
11
|
+
group: "block",
|
|
12
|
+
content: "inline*",
|
|
13
|
+
parseHTML() {
|
|
14
|
+
return [{ tag: "p" }];
|
|
15
|
+
},
|
|
16
|
+
renderHTML({ HTMLAttributes }) {
|
|
17
|
+
return ["p", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
18
|
+
},
|
|
19
|
+
addCommands() {
|
|
20
|
+
return {
|
|
21
|
+
setParagraph: () => ({ commands }) => {
|
|
22
|
+
return commands.setNode(this.name);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
addKeyboardShortcuts() {
|
|
27
|
+
return {
|
|
28
|
+
"Mod-Alt-0": () => this.editor.commands.setParagraph()
|
|
29
|
+
};
|
|
30
|
+
}
|
|
37
31
|
});
|
|
38
32
|
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
// src/index.ts
|
|
34
|
+
var index_default = Paragraph;
|
|
35
|
+
export {
|
|
36
|
+
Paragraph,
|
|
37
|
+
index_default as default
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/paragraph.ts","../src/index.ts"],"sourcesContent":["import { mergeAttributes, Node } from '@tiptap/core'\n\nexport interface ParagraphOptions {\n /**\n * The HTML attributes for a paragraph node.\n * @default {}\n * @example { class: 'foo' }\n */\n HTMLAttributes: Record<string, any>\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n paragraph: {\n /**\n * Toggle a paragraph\n * @example editor.commands.toggleParagraph()\n */\n setParagraph: () => ReturnType\n }\n }\n}\n\n/**\n * This extension allows you to create paragraphs.\n * @see https://www.tiptap.dev/api/nodes/paragraph\n */\nexport const Paragraph = Node.create<ParagraphOptions>({\n name: 'paragraph',\n\n priority: 1000,\n\n addOptions() {\n return {\n HTMLAttributes: {},\n }\n },\n\n group: 'block',\n\n content: 'inline*',\n\n parseHTML() {\n return [{ tag: 'p' }]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['p', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n addCommands() {\n return {\n setParagraph:\n () =>\n ({ commands }) => {\n return commands.setNode(this.name)\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-Alt-0': () => this.editor.commands.setParagraph(),\n }\n },\n})\n","import { Paragraph } from './paragraph.js'\n\nexport * from './paragraph.js'\n\nexport default Paragraph\n"],"mappings":";AAAA,SAAS,iBAAiB,YAAY;AA2B/B,IAAM,YAAY,KAAK,OAAyB;AAAA,EACrD,MAAM;AAAA,EAEN,UAAU;AAAA,EAEV,aAAa;AACX,WAAO;AAAA,MACL,gBAAgB,CAAC;AAAA,IACnB;AAAA,EACF;AAAA,EAEA,OAAO;AAAA,EAEP,SAAS;AAAA,EAET,YAAY;AACV,WAAO,CAAC,EAAE,KAAK,IAAI,CAAC;AAAA,EACtB;AAAA,EAEA,WAAW,EAAE,eAAe,GAAG;AAC7B,WAAO,CAAC,KAAK,gBAAgB,KAAK,QAAQ,gBAAgB,cAAc,GAAG,CAAC;AAAA,EAC9E;AAAA,EAEA,cAAc;AACZ,WAAO;AAAA,MACL,cACE,MACA,CAAC,EAAE,SAAS,MAAM;AAChB,eAAO,SAAS,QAAQ,KAAK,IAAI;AAAA,MACnC;AAAA,IACJ;AAAA,EACF;AAAA,EAEA,uBAAuB;AACrB,WAAO;AAAA,MACL,aAAa,MAAM,KAAK,OAAO,SAAS,aAAa;AAAA,IACvD;AAAA,EACF;AACF,CAAC;;;AC7DD,IAAO,gBAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiptap/extension-paragraph",
|
|
3
3
|
"description": "paragraph extension for tiptap",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.0.0-beta.0",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -15,24 +15,26 @@
|
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
|
-
"types":
|
|
18
|
+
"types": {
|
|
19
|
+
"import": "./dist/index.d.ts",
|
|
20
|
+
"require": "./dist/index.d.cts"
|
|
21
|
+
},
|
|
19
22
|
"import": "./dist/index.js",
|
|
20
23
|
"require": "./dist/index.cjs"
|
|
21
24
|
}
|
|
22
25
|
},
|
|
23
26
|
"main": "dist/index.cjs",
|
|
24
27
|
"module": "dist/index.js",
|
|
25
|
-
"umd": "dist/index.umd.js",
|
|
26
28
|
"types": "dist/index.d.ts",
|
|
27
29
|
"files": [
|
|
28
30
|
"src",
|
|
29
31
|
"dist"
|
|
30
32
|
],
|
|
31
33
|
"devDependencies": {
|
|
32
|
-
"@tiptap/core": "^
|
|
34
|
+
"@tiptap/core": "^3.0.0-beta.0"
|
|
33
35
|
},
|
|
34
36
|
"peerDependencies": {
|
|
35
|
-
"@tiptap/core": "^
|
|
37
|
+
"@tiptap/core": "^3.0.0-beta.0"
|
|
36
38
|
},
|
|
37
39
|
"repository": {
|
|
38
40
|
"type": "git",
|
|
@@ -40,7 +42,7 @@
|
|
|
40
42
|
"directory": "packages/extension-paragraph"
|
|
41
43
|
},
|
|
42
44
|
"scripts": {
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
+
"build": "tsup",
|
|
46
|
+
"lint": "prettier ./src/ --check && eslint --cache --quiet --no-error-on-unmatched-pattern ./src/"
|
|
45
47
|
}
|
|
46
|
-
}
|
|
48
|
+
}
|
package/src/paragraph.ts
CHANGED
|
@@ -6,7 +6,7 @@ export interface ParagraphOptions {
|
|
|
6
6
|
* @default {}
|
|
7
7
|
* @example { class: 'foo' }
|
|
8
8
|
*/
|
|
9
|
-
HTMLAttributes: Record<string, any
|
|
9
|
+
HTMLAttributes: Record<string, any>
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
declare module '@tiptap/core' {
|
|
@@ -16,7 +16,7 @@ declare module '@tiptap/core' {
|
|
|
16
16
|
* Toggle a paragraph
|
|
17
17
|
* @example editor.commands.toggleParagraph()
|
|
18
18
|
*/
|
|
19
|
-
setParagraph: () => ReturnType
|
|
19
|
+
setParagraph: () => ReturnType
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -41,9 +41,7 @@ export const Paragraph = Node.create<ParagraphOptions>({
|
|
|
41
41
|
content: 'inline*',
|
|
42
42
|
|
|
43
43
|
parseHTML() {
|
|
44
|
-
return [
|
|
45
|
-
{ tag: 'p' },
|
|
46
|
-
]
|
|
44
|
+
return [{ tag: 'p' }]
|
|
47
45
|
},
|
|
48
46
|
|
|
49
47
|
renderHTML({ HTMLAttributes }) {
|
|
@@ -52,9 +50,11 @@ export const Paragraph = Node.create<ParagraphOptions>({
|
|
|
52
50
|
|
|
53
51
|
addCommands() {
|
|
54
52
|
return {
|
|
55
|
-
setParagraph:
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
setParagraph:
|
|
54
|
+
() =>
|
|
55
|
+
({ commands }) => {
|
|
56
|
+
return commands.setNode(this.name)
|
|
57
|
+
},
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C,cAAc,gBAAgB,CAAA;AAE9B,eAAe,SAAS,CAAA"}
|
package/dist/index.umd.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tiptap/core')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@tiptap/core'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@tiptap/extension-paragraph"] = {}, global.core));
|
|
5
|
-
})(this, (function (exports, core) { 'use strict';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* This extension allows you to create paragraphs.
|
|
9
|
-
* @see https://www.tiptap.dev/api/nodes/paragraph
|
|
10
|
-
*/
|
|
11
|
-
const Paragraph = core.Node.create({
|
|
12
|
-
name: 'paragraph',
|
|
13
|
-
priority: 1000,
|
|
14
|
-
addOptions() {
|
|
15
|
-
return {
|
|
16
|
-
HTMLAttributes: {},
|
|
17
|
-
};
|
|
18
|
-
},
|
|
19
|
-
group: 'block',
|
|
20
|
-
content: 'inline*',
|
|
21
|
-
parseHTML() {
|
|
22
|
-
return [
|
|
23
|
-
{ tag: 'p' },
|
|
24
|
-
];
|
|
25
|
-
},
|
|
26
|
-
renderHTML({ HTMLAttributes }) {
|
|
27
|
-
return ['p', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
28
|
-
},
|
|
29
|
-
addCommands() {
|
|
30
|
-
return {
|
|
31
|
-
setParagraph: () => ({ commands }) => {
|
|
32
|
-
return commands.setNode(this.name);
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
},
|
|
36
|
-
addKeyboardShortcuts() {
|
|
37
|
-
return {
|
|
38
|
-
'Mod-Alt-0': () => this.editor.commands.setParagraph(),
|
|
39
|
-
};
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
exports.Paragraph = Paragraph;
|
|
44
|
-
exports.default = Paragraph;
|
|
45
|
-
|
|
46
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
47
|
-
|
|
48
|
-
}));
|
|
49
|
-
//# sourceMappingURL=index.umd.js.map
|
package/dist/index.umd.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":["../src/paragraph.ts"],"sourcesContent":["import { mergeAttributes, Node } from '@tiptap/core'\n\nexport interface ParagraphOptions {\n /**\n * The HTML attributes for a paragraph node.\n * @default {}\n * @example { class: 'foo' }\n */\n HTMLAttributes: Record<string, any>,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n paragraph: {\n /**\n * Toggle a paragraph\n * @example editor.commands.toggleParagraph()\n */\n setParagraph: () => ReturnType,\n }\n }\n}\n\n/**\n * This extension allows you to create paragraphs.\n * @see https://www.tiptap.dev/api/nodes/paragraph\n */\nexport const Paragraph = Node.create<ParagraphOptions>({\n name: 'paragraph',\n\n priority: 1000,\n\n addOptions() {\n return {\n HTMLAttributes: {},\n }\n },\n\n group: 'block',\n\n content: 'inline*',\n\n parseHTML() {\n return [\n { tag: 'p' },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['p', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n addCommands() {\n return {\n setParagraph: () => ({ commands }) => {\n return commands.setNode(this.name)\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-Alt-0': () => this.editor.commands.setParagraph(),\n }\n },\n})\n"],"names":["Node","mergeAttributes"],"mappings":";;;;;;EAuBA;;;EAGG;AACU,QAAA,SAAS,GAAGA,SAAI,CAAC,MAAM,CAAmB;EACrD,IAAA,IAAI,EAAE,WAAW;EAEjB,IAAA,QAAQ,EAAE,IAAI;MAEd,UAAU,GAAA;UACR,OAAO;EACL,YAAA,cAAc,EAAE,EAAE;WACnB;OACF;EAED,IAAA,KAAK,EAAE,OAAO;EAEd,IAAA,OAAO,EAAE,SAAS;MAElB,SAAS,GAAA;UACP,OAAO;cACL,EAAE,GAAG,EAAE,GAAG,EAAE;WACb;OACF;MAED,UAAU,CAAC,EAAE,cAAc,EAAE,EAAA;EAC3B,QAAA,OAAO,CAAC,GAAG,EAAEC,oBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC;OAC9E;MAED,WAAW,GAAA;UACT,OAAO;cACL,YAAY,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAI;kBACnC,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;eACnC;WACF;OACF;MAED,oBAAoB,GAAA;UAClB,OAAO;cACL,WAAW,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE;WACvD;OACF;EACF,CAAA;;;;;;;;;;;"}
|
package/dist/paragraph.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paragraph.d.ts","sourceRoot":"","sources":["../src/paragraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,IAAI,EAAE,MAAM,cAAc,CAAA;AAEpD,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACrC;AAED,OAAO,QAAQ,cAAc,CAAC;IAC5B,UAAU,QAAQ,CAAC,UAAU;QAC3B,SAAS,EAAE;YACT;;;eAGG;YACH,YAAY,EAAE,MAAM,UAAU,CAAC;SAChC,CAAA;KACF;CACF;AAED;;;GAGG;AACH,eAAO,MAAM,SAAS,6BAsCpB,CAAA"}
|