@tiptap/extension-paragraph 2.3.1 → 2.4.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/index.cjs CHANGED
@@ -4,6 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var core = require('@tiptap/core');
6
6
 
7
+ /**
8
+ * This extension allows you to create paragraphs.
9
+ * @see https://www.tiptap.dev/api/nodes/paragraph
10
+ */
7
11
  const Paragraph = core.Node.create({
8
12
  name: 'paragraph',
9
13
  priority: 1000,
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/paragraph.ts"],"sourcesContent":["import { mergeAttributes, Node } from '@tiptap/core'\n\nexport interface ParagraphOptions {\n HTMLAttributes: Record<string, any>,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n paragraph: {\n /**\n * Toggle a paragraph\n */\n setParagraph: () => ReturnType,\n }\n }\n}\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":";;;;;;AAiBa,MAAA,SAAS,GAAGA,SAAI,CAAC,MAAM,CAAmB;AACrD,IAAA,IAAI,EAAE,WAAW;AAEjB,IAAA,QAAQ,EAAE,IAAI;IAEd,UAAU,GAAA;QACR,OAAO;AACL,YAAA,cAAc,EAAE,EAAE;SACnB,CAAA;KACF;AAED,IAAA,KAAK,EAAE,OAAO;AAEd,IAAA,OAAO,EAAE,SAAS;IAElB,SAAS,GAAA;QACP,OAAO;YACL,EAAE,GAAG,EAAE,GAAG,EAAE;SACb,CAAA;KACF;IAED,UAAU,CAAC,EAAE,cAAc,EAAE,EAAA;AAC3B,QAAA,OAAO,CAAC,GAAG,EAAEC,oBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;KAC9E;IAED,WAAW,GAAA;QACT,OAAO;YACL,YAAY,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAI;gBACnC,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;aACnC;SACF,CAAA;KACF;IAED,oBAAoB,GAAA;QAClB,OAAO;YACL,WAAW,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE;SACvD,CAAA;KACF;AACF,CAAA;;;;;"}
1
+ {"version":3,"file":"index.cjs","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":";;;;;;AAuBA;;;AAGG;AACU,MAAA,SAAS,GAAGA,SAAI,CAAC,MAAM,CAAmB;AACrD,IAAA,IAAI,EAAE,WAAW;AAEjB,IAAA,QAAQ,EAAE,IAAI;IAEd,UAAU,GAAA;QACR,OAAO;AACL,YAAA,cAAc,EAAE,EAAE;SACnB,CAAA;KACF;AAED,IAAA,KAAK,EAAE,OAAO;AAEd,IAAA,OAAO,EAAE,SAAS;IAElB,SAAS,GAAA;QACP,OAAO;YACL,EAAE,GAAG,EAAE,GAAG,EAAE;SACb,CAAA;KACF;IAED,UAAU,CAAC,EAAE,cAAc,EAAE,EAAA;AAC3B,QAAA,OAAO,CAAC,GAAG,EAAEC,oBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;KAC9E;IAED,WAAW,GAAA;QACT,OAAO;YACL,YAAY,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAI;gBACnC,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;aACnC;SACF,CAAA;KACF;IAED,oBAAoB,GAAA;QAClB,OAAO;YACL,WAAW,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE;SACvD,CAAA;KACF;AACF,CAAA;;;;;"}
package/dist/index.js CHANGED
@@ -1,5 +1,9 @@
1
1
  import { Node, mergeAttributes } from '@tiptap/core';
2
2
 
3
+ /**
4
+ * This extension allows you to create paragraphs.
5
+ * @see https://www.tiptap.dev/api/nodes/paragraph
6
+ */
3
7
  const Paragraph = Node.create({
4
8
  name: 'paragraph',
5
9
  priority: 1000,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/paragraph.ts"],"sourcesContent":["import { mergeAttributes, Node } from '@tiptap/core'\n\nexport interface ParagraphOptions {\n HTMLAttributes: Record<string, any>,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n paragraph: {\n /**\n * Toggle a paragraph\n */\n setParagraph: () => ReturnType,\n }\n }\n}\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":[],"mappings":";;AAiBa,MAAA,SAAS,GAAG,IAAI,CAAC,MAAM,CAAmB;AACrD,IAAA,IAAI,EAAE,WAAW;AAEjB,IAAA,QAAQ,EAAE,IAAI;IAEd,UAAU,GAAA;QACR,OAAO;AACL,YAAA,cAAc,EAAE,EAAE;SACnB,CAAA;KACF;AAED,IAAA,KAAK,EAAE,OAAO;AAEd,IAAA,OAAO,EAAE,SAAS;IAElB,SAAS,GAAA;QACP,OAAO;YACL,EAAE,GAAG,EAAE,GAAG,EAAE;SACb,CAAA;KACF;IAED,UAAU,CAAC,EAAE,cAAc,EAAE,EAAA;AAC3B,QAAA,OAAO,CAAC,GAAG,EAAE,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;KAC9E;IAED,WAAW,GAAA;QACT,OAAO;YACL,YAAY,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAI;gBACnC,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;aACnC;SACF,CAAA;KACF;IAED,oBAAoB,GAAA;QAClB,OAAO;YACL,WAAW,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE;SACvD,CAAA;KACF;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"index.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":[],"mappings":";;AAuBA;;;AAGG;AACU,MAAA,SAAS,GAAG,IAAI,CAAC,MAAM,CAAmB;AACrD,IAAA,IAAI,EAAE,WAAW;AAEjB,IAAA,QAAQ,EAAE,IAAI;IAEd,UAAU,GAAA;QACR,OAAO;AACL,YAAA,cAAc,EAAE,EAAE;SACnB,CAAA;KACF;AAED,IAAA,KAAK,EAAE,OAAO;AAEd,IAAA,OAAO,EAAE,SAAS;IAElB,SAAS,GAAA;QACP,OAAO;YACL,EAAE,GAAG,EAAE,GAAG,EAAE;SACb,CAAA;KACF;IAED,UAAU,CAAC,EAAE,cAAc,EAAE,EAAA;AAC3B,QAAA,OAAO,CAAC,GAAG,EAAE,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;KAC9E;IAED,WAAW,GAAA;QACT,OAAO;YACL,YAAY,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAI;gBACnC,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;aACnC;SACF,CAAA;KACF;IAED,oBAAoB,GAAA;QAClB,OAAO;YACL,WAAW,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE;SACvD,CAAA;KACF;AACF,CAAA;;;;"}
package/dist/index.umd.js CHANGED
@@ -4,6 +4,10 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@tiptap/extension-paragraph"] = {}, global.core));
5
5
  })(this, (function (exports, core) { 'use strict';
6
6
 
7
+ /**
8
+ * This extension allows you to create paragraphs.
9
+ * @see https://www.tiptap.dev/api/nodes/paragraph
10
+ */
7
11
  const Paragraph = core.Node.create({
8
12
  name: 'paragraph',
9
13
  priority: 1000,
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.js","sources":["../src/paragraph.ts"],"sourcesContent":["import { mergeAttributes, Node } from '@tiptap/core'\n\nexport interface ParagraphOptions {\n HTMLAttributes: Record<string, any>,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n paragraph: {\n /**\n * Toggle a paragraph\n */\n setParagraph: () => ReturnType,\n }\n }\n}\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":";;;;;;AAiBa,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,CAAA;OACF;EAED,IAAA,KAAK,EAAE,OAAO;EAEd,IAAA,OAAO,EAAE,SAAS;MAElB,SAAS,GAAA;UACP,OAAO;cACL,EAAE,GAAG,EAAE,GAAG,EAAE;WACb,CAAA;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,CAAA;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,CAAA;eACnC;WACF,CAAA;OACF;MAED,oBAAoB,GAAA;UAClB,OAAO;cACL,WAAW,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE;WACvD,CAAA;OACF;EACF,CAAA;;;;;;;;;;;"}
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,CAAA;OACF;EAED,IAAA,KAAK,EAAE,OAAO;EAEd,IAAA,OAAO,EAAE,SAAS;MAElB,SAAS,GAAA;UACP,OAAO;cACL,EAAE,GAAG,EAAE,GAAG,EAAE;WACb,CAAA;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,CAAA;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,CAAA;eACnC;WACF,CAAA;OACF;MAED,oBAAoB,GAAA;UAClB,OAAO;cACL,WAAW,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE;WACvD,CAAA;OACF;EACF,CAAA;;;;;;;;;;;"}
@@ -1,5 +1,10 @@
1
1
  import { Node } from '@tiptap/core';
2
2
  export interface ParagraphOptions {
3
+ /**
4
+ * The HTML attributes for a paragraph node.
5
+ * @default {}
6
+ * @example { class: 'foo' }
7
+ */
3
8
  HTMLAttributes: Record<string, any>;
4
9
  }
5
10
  declare module '@tiptap/core' {
@@ -7,9 +12,14 @@ declare module '@tiptap/core' {
7
12
  paragraph: {
8
13
  /**
9
14
  * Toggle a paragraph
15
+ * @example editor.commands.toggleParagraph()
10
16
  */
11
17
  setParagraph: () => ReturnType;
12
18
  };
13
19
  }
14
20
  }
21
+ /**
22
+ * This extension allows you to create paragraphs.
23
+ * @see https://www.tiptap.dev/api/nodes/paragraph
24
+ */
15
25
  export declare const Paragraph: Node<ParagraphOptions, any>;
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": "2.3.1",
4
+ "version": "2.4.0",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -29,7 +29,7 @@
29
29
  "dist"
30
30
  ],
31
31
  "devDependencies": {
32
- "@tiptap/core": "^2.3.1"
32
+ "@tiptap/core": "^2.4.0"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "@tiptap/core": "^2.0.0"
package/src/paragraph.ts CHANGED
@@ -1,6 +1,11 @@
1
1
  import { mergeAttributes, Node } from '@tiptap/core'
2
2
 
3
3
  export interface ParagraphOptions {
4
+ /**
5
+ * The HTML attributes for a paragraph node.
6
+ * @default {}
7
+ * @example { class: 'foo' }
8
+ */
4
9
  HTMLAttributes: Record<string, any>,
5
10
  }
6
11
 
@@ -9,12 +14,17 @@ declare module '@tiptap/core' {
9
14
  paragraph: {
10
15
  /**
11
16
  * Toggle a paragraph
17
+ * @example editor.commands.toggleParagraph()
12
18
  */
13
19
  setParagraph: () => ReturnType,
14
20
  }
15
21
  }
16
22
  }
17
23
 
24
+ /**
25
+ * This extension allows you to create paragraphs.
26
+ * @see https://www.tiptap.dev/api/nodes/paragraph
27
+ */
18
28
  export const Paragraph = Node.create<ParagraphOptions>({
19
29
  name: 'paragraph',
20
30