@fibery/prosemirror-schema 4.22.0 → 4.23.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.
Files changed (79) hide show
  1. package/lib/index.d.ts +10 -10
  2. package/lib/index.js +9 -31
  3. package/lib/src/attr-constraints.d.ts +15 -12
  4. package/lib/src/attr-constraints.js +128 -168
  5. package/lib/src/block-id-utils.d.ts +10 -7
  6. package/lib/src/block-id-utils.js +16 -39
  7. package/lib/src/create-schema.d.ts +16 -15
  8. package/lib/src/create-schema.js +204 -249
  9. package/lib/src/marks/code.d.ts +5 -2
  10. package/lib/src/marks/code.js +10 -10
  11. package/lib/src/marks/em.d.ts +5 -2
  12. package/lib/src/marks/em.js +19 -16
  13. package/lib/src/marks/hint-query.d.ts +5 -2
  14. package/lib/src/marks/hint-query.js +19 -22
  15. package/lib/src/marks/link.d.ts +5 -2
  16. package/lib/src/marks/link.js +40 -36
  17. package/lib/src/marks/linked-highlight.d.ts +9 -7
  18. package/lib/src/marks/linked-highlight.js +38 -51
  19. package/lib/src/marks/strike.d.ts +5 -2
  20. package/lib/src/marks/strike.js +6 -6
  21. package/lib/src/marks/strong.d.ts +5 -2
  22. package/lib/src/marks/strong.js +29 -29
  23. package/lib/src/marks/text-background-color.d.ts +15 -12
  24. package/lib/src/marks/text-background-color.js +63 -81
  25. package/lib/src/marks/underline.d.ts +5 -2
  26. package/lib/src/marks/underline.js +6 -6
  27. package/lib/src/nodes/callout.d.ts +29 -26
  28. package/lib/src/nodes/callout.js +55 -58
  29. package/lib/src/nodes/check-item.d.ts +13 -10
  30. package/lib/src/nodes/check-item.js +32 -33
  31. package/lib/src/nodes/check-list.d.ts +14 -11
  32. package/lib/src/nodes/check-list.js +23 -30
  33. package/lib/src/nodes/code-block.d.ts +5 -2
  34. package/lib/src/nodes/code-block.js +70 -101
  35. package/lib/src/nodes/column.d.ts +5 -2
  36. package/lib/src/nodes/column.js +28 -34
  37. package/lib/src/nodes/columns.d.ts +5 -2
  38. package/lib/src/nodes/columns.js +34 -36
  39. package/lib/src/nodes/emoji.d.ts +28 -26
  40. package/lib/src/nodes/emoji.js +38 -47
  41. package/lib/src/nodes/entity.d.ts +18 -16
  42. package/lib/src/nodes/entity.js +48 -49
  43. package/lib/src/nodes/fibery-view.d.ts +5 -2
  44. package/lib/src/nodes/fibery-view.js +38 -42
  45. package/lib/src/nodes/file.d.ts +37 -34
  46. package/lib/src/nodes/file.js +41 -40
  47. package/lib/src/nodes/heading.d.ts +6 -3
  48. package/lib/src/nodes/heading.js +57 -33
  49. package/lib/src/nodes/image-block.d.ts +5 -2
  50. package/lib/src/nodes/image-block.js +43 -42
  51. package/lib/src/nodes/important.d.ts +5 -2
  52. package/lib/src/nodes/important.js +14 -10
  53. package/lib/src/nodes/math-display.d.ts +5 -2
  54. package/lib/src/nodes/math-display.js +14 -15
  55. package/lib/src/nodes/math-inline.d.ts +5 -2
  56. package/lib/src/nodes/math-inline.js +14 -15
  57. package/lib/src/nodes/media.d.ts +6 -3
  58. package/lib/src/nodes/media.js +52 -68
  59. package/lib/src/nodes/mention.d.ts +12 -9
  60. package/lib/src/nodes/mention.js +36 -37
  61. package/lib/src/nodes/note.d.ts +5 -2
  62. package/lib/src/nodes/note.js +14 -10
  63. package/lib/src/nodes/paragraph.d.ts +5 -2
  64. package/lib/src/nodes/paragraph.js +32 -26
  65. package/lib/src/nodes/table-nodes.d.ts +5 -2
  66. package/lib/src/nodes/table-nodes.js +16 -20
  67. package/lib/src/nodes/types/inline-content.d.ts +10 -8
  68. package/lib/src/nodes/types/inline-content.js +0 -2
  69. package/lib/src/nodes/types/text.d.ts +7 -4
  70. package/lib/src/nodes/types/text.js +0 -2
  71. package/lib/src/nodes/video.d.ts +7 -4
  72. package/lib/src/nodes/video.js +49 -54
  73. package/lib/src/resizable-node-attrs.d.ts +29 -26
  74. package/lib/src/resizable-node-attrs.js +23 -34
  75. package/lib/src/transcription-node-attrs.d.ts +10 -7
  76. package/lib/src/transcription-node-attrs.js +8 -8
  77. package/lib/test-helpers/index.d.ts +7 -4
  78. package/lib/test-helpers/index.js +11 -15
  79. package/package.json +11 -4
@@ -1,31 +1,33 @@
1
+ //#region src/nodes/emoji.d.ts
1
2
  type Emoji = {
2
- name: string;
3
- shortNames: string[];
4
- colons: string;
5
- native?: string;
3
+ name: string;
4
+ shortNames: string[];
5
+ colons: string;
6
+ native?: string;
6
7
  };
7
- export type EmojiOptions = {
8
- getEmoji: (code: string) => Emoji | void;
8
+ type EmojiOptions = {
9
+ getEmoji: (code: string) => Emoji | void;
9
10
  };
10
- export declare const makeEmoji: ({ getEmoji }?: EmojiOptions) => {
11
- attrs: {
12
- code: {};
11
+ declare const makeEmoji: ({ getEmoji }?: EmojiOptions) => {
12
+ attrs: {
13
+ code: {};
14
+ };
15
+ inline: true;
16
+ atom: true;
17
+ group: string;
18
+ selectable: false;
19
+ draggable: false;
20
+ leafText: (node: import("prosemirror-model").Node) => any;
21
+ parseDOM: {
22
+ tag: string;
23
+ getAttrs(domNode: HTMLElement): {
24
+ code: string;
13
25
  };
14
- inline: true;
15
- atom: true;
16
- group: string;
17
- selectable: false;
18
- draggable: false;
19
- leafText: (node: import("prosemirror-model").Node) => any;
20
- parseDOM: {
21
- tag: string;
22
- getAttrs(domNode: HTMLElement): {
23
- code: string;
24
- };
25
- }[];
26
- toDOM(node: import("prosemirror-model").Node): [string, {
27
- "data-emoji-node": string;
28
- "data-emoji-code": any;
29
- }, any];
26
+ }[];
27
+ toDOM(node: import("prosemirror-model").Node): [string, {
28
+ "data-emoji-node": string;
29
+ "data-emoji-code": any;
30
+ }, any];
30
31
  };
31
- export {};
32
+ //#endregion
33
+ export { EmojiOptions, makeEmoji };
@@ -1,51 +1,42 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeEmoji = void 0;
1
+ //#region src/nodes/emoji.ts
4
2
  const typeAttr = "data-emoji-node";
5
3
  const codeAttr = "data-emoji-code";
6
- const defaultOptions = {
7
- getEmoji() {
8
- return;
9
- },
10
- };
4
+ const defaultOptions = { getEmoji() {} };
11
5
  const makeEmoji = ({ getEmoji } = defaultOptions) => ({
12
- attrs: {
13
- code: {},
14
- },
15
- inline: true,
16
- atom: true,
17
- group: "inline",
18
- selectable: false,
19
- draggable: false,
20
- leafText: (node) => {
21
- const { code } = node.attrs;
22
- const emoji = getEmoji(code);
23
- return emoji ? emoji.native || `:${emoji.shortNames[0]}:` : code;
24
- },
25
- parseDOM: [
26
- {
27
- tag: `span[${typeAttr}]`,
28
- getAttrs(domNode) {
29
- const dom = domNode;
30
- const code = dom.getAttribute(codeAttr);
31
- const alias = dom.textContent;
32
- // If emoji is not found by code attr, try alias, that is stored as text content
33
- // This handles the case when we have a custom emoji matching by alias, but not by id (copied from another workspace)
34
- const emoji = (code && getEmoji(code)) || (alias && getEmoji(alias)) || null;
35
- return {
36
- code: emoji ? emoji.colons : alias,
37
- };
38
- },
39
- },
40
- ],
41
- toDOM(node) {
42
- const { code } = node.attrs;
43
- const attrs = {
44
- [typeAttr]: "",
45
- [codeAttr]: code,
46
- };
47
- const emoji = getEmoji(code);
48
- return ["span", attrs, emoji ? emoji.native || `:${emoji.shortNames[0]}:` : code];
49
- },
6
+ attrs: { code: {} },
7
+ inline: true,
8
+ atom: true,
9
+ group: "inline",
10
+ selectable: false,
11
+ draggable: false,
12
+ leafText: (node) => {
13
+ const { code } = node.attrs;
14
+ const emoji = getEmoji(code);
15
+ return emoji ? emoji.native || `:${emoji.shortNames[0]}:` : code;
16
+ },
17
+ parseDOM: [{
18
+ tag: `span[${typeAttr}]`,
19
+ getAttrs(domNode) {
20
+ const dom = domNode;
21
+ const code = dom.getAttribute(codeAttr);
22
+ const alias = dom.textContent;
23
+ const emoji = code && getEmoji(code) || alias && getEmoji(alias) || null;
24
+ return { code: emoji ? emoji.colons : alias };
25
+ }
26
+ }],
27
+ toDOM(node) {
28
+ const { code } = node.attrs;
29
+ const attrs = {
30
+ [typeAttr]: "",
31
+ [codeAttr]: code
32
+ };
33
+ const emoji = getEmoji(code);
34
+ return [
35
+ "span",
36
+ attrs,
37
+ emoji ? emoji.native || `:${emoji.shortNames[0]}:` : code
38
+ ];
39
+ }
50
40
  });
51
- exports.makeEmoji = makeEmoji;
41
+ //#endregion
42
+ export { makeEmoji };
@@ -1,20 +1,22 @@
1
- import type { NodeSpec } from "prosemirror-model";
1
+ import { NodeSpec } from "prosemirror-model";
2
+ //#region src/nodes/entity.d.ts
2
3
  type Meta = {
3
- comment?: string;
4
- anchor?: string;
5
- field?: string;
6
- contextEntityTypeId?: string;
7
- contextEntityPublicId?: string;
4
+ comment?: string;
5
+ anchor?: string;
6
+ field?: string;
7
+ contextEntityTypeId?: string;
8
+ contextEntityPublicId?: string;
8
9
  };
9
- export interface EntityAttributes {
10
- id: string;
11
- typeId: string;
12
- text?: string;
13
- meta: Meta;
10
+ interface EntityAttributes {
11
+ id: string;
12
+ typeId: string;
13
+ text?: string;
14
+ meta: Meta;
14
15
  }
15
- export interface EntityDefinition {
16
- type: "entity";
17
- attrs: EntityAttributes;
16
+ interface EntityDefinition {
17
+ type: "entity";
18
+ attrs: EntityAttributes;
18
19
  }
19
- export declare const entity: NodeSpec;
20
- export {};
20
+ declare const entity: NodeSpec;
21
+ //#endregion
22
+ export { EntityAttributes, EntityDefinition, entity };
@@ -1,50 +1,49 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.entity = void 0;
4
- exports.entity = {
5
- inline: true,
6
- group: "inline",
7
- selectable: false,
8
- attrs: {
9
- id: { default: "" },
10
- text: { default: "" },
11
- typeId: { default: "" },
12
- meta: {
13
- default: {},
14
- },
15
- },
16
- parseDOM: [
17
- {
18
- tag: "span[data-entity-id]",
19
- getAttrs: (domNode) => {
20
- const dom = domNode;
21
- const meta = {};
22
- meta.comment = dom.getAttribute("data-comment") || "";
23
- meta.anchor = dom.getAttribute("data-anchor") || "";
24
- meta.field = dom.getAttribute("data-field") || "";
25
- meta.contextEntityTypeId = dom.getAttribute("data-context-entity-type-id") || "";
26
- meta.contextEntityPublicId = dom.getAttribute("data-context-entity-public-id") || "";
27
- return {
28
- id: dom.getAttribute("data-entity-id"),
29
- text: dom.textContent,
30
- typeId: dom.getAttribute("data-entity-type-id"),
31
- meta: meta,
32
- };
33
- },
34
- },
35
- ],
36
- toDOM(node) {
37
- const { id, typeId, text, meta } = node.attrs;
38
- const attrs = {
39
- "data-entity-id": id,
40
- "data-entity-type-id": typeId,
41
- "data-comment": meta.comment,
42
- "data-anchor": meta.anchor,
43
- "data-field": meta.field,
44
- "data-context-entity-type-id": meta.contextEntityTypeId,
45
- "data-context-entity-public-id": meta.contextEntityPublicId,
46
- contenteditable: "false",
47
- };
48
- return ["span", attrs, text];
49
- },
1
+ //#region src/nodes/entity.ts
2
+ const entity = {
3
+ inline: true,
4
+ group: "inline",
5
+ selectable: false,
6
+ attrs: {
7
+ id: { default: "" },
8
+ text: { default: "" },
9
+ typeId: { default: "" },
10
+ meta: { default: {} }
11
+ },
12
+ parseDOM: [{
13
+ tag: "span[data-entity-id]",
14
+ getAttrs: (domNode) => {
15
+ const dom = domNode;
16
+ const meta = {};
17
+ meta.comment = dom.getAttribute("data-comment") || "";
18
+ meta.anchor = dom.getAttribute("data-anchor") || "";
19
+ meta.field = dom.getAttribute("data-field") || "";
20
+ meta.contextEntityTypeId = dom.getAttribute("data-context-entity-type-id") || "";
21
+ meta.contextEntityPublicId = dom.getAttribute("data-context-entity-public-id") || "";
22
+ return {
23
+ id: dom.getAttribute("data-entity-id"),
24
+ text: dom.textContent,
25
+ typeId: dom.getAttribute("data-entity-type-id"),
26
+ meta
27
+ };
28
+ }
29
+ }],
30
+ toDOM(node) {
31
+ const { id, typeId, text, meta } = node.attrs;
32
+ return [
33
+ "span",
34
+ {
35
+ "data-entity-id": id,
36
+ "data-entity-type-id": typeId,
37
+ "data-comment": meta.comment,
38
+ "data-anchor": meta.anchor,
39
+ "data-field": meta.field,
40
+ "data-context-entity-type-id": meta.contextEntityTypeId,
41
+ "data-context-entity-public-id": meta.contextEntityPublicId,
42
+ contenteditable: "false"
43
+ },
44
+ text
45
+ ];
46
+ }
50
47
  };
48
+ //#endregion
49
+ export { entity };
@@ -1,2 +1,5 @@
1
- import type { NodeSpec } from "prosemirror-model";
2
- export declare const fiberyView: NodeSpec;
1
+ import { NodeSpec } from "prosemirror-model";
2
+ //#region src/nodes/fibery-view.d.ts
3
+ declare const fiberyView: NodeSpec;
4
+ //#endregion
5
+ export { fiberyView };
@@ -1,43 +1,39 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fiberyView = void 0;
4
- const resizable_node_attrs_1 = require("../resizable-node-attrs");
5
- exports.fiberyView = {
6
- inline: false,
7
- group: "block",
8
- selectable: true,
9
- atom: true,
10
- draggable: false,
11
- attrs: {
12
- // "viewId" references the embedded view entity. "id" is deprecated and
13
- // kept mirrored to "viewId" until every consumer (older clients, the
14
- // collaboration service, fibery backend) reads "viewId"; after that "id"
15
- // will become the standard block identifier like on every other block.
16
- viewId: { default: null },
17
- id: { default: "" },
18
- ...(0, resizable_node_attrs_1.createDefaultAttrs)(),
19
- },
20
- parseDOM: [
21
- {
22
- tag: "div[data-view-id]",
23
- getAttrs: (domNode) => {
24
- const dom = domNode;
25
- const viewId = dom.getAttribute("data-view-id");
26
- return {
27
- viewId,
28
- id: viewId,
29
- ...(0, resizable_node_attrs_1.createParseDomAttrs)(dom),
30
- };
31
- },
32
- },
33
- ],
34
- toDOM(node) {
35
- const viewId = node.attrs.viewId || node.attrs.id;
36
- const attrs = {
37
- "data-view-id": viewId,
38
- contenteditable: "false",
39
- ...(0, resizable_node_attrs_1.createToDomAttrs)(node.attrs),
40
- };
41
- return ["div", attrs, ""];
42
- },
1
+ import { createDefaultAttrs, createParseDomAttrs, createToDomAttrs } from "../resizable-node-attrs.js";
2
+ //#region src/nodes/fibery-view.ts
3
+ const fiberyView = {
4
+ inline: false,
5
+ group: "block",
6
+ selectable: true,
7
+ atom: true,
8
+ draggable: false,
9
+ attrs: {
10
+ viewId: { default: null },
11
+ id: { default: "" },
12
+ ...createDefaultAttrs()
13
+ },
14
+ parseDOM: [{
15
+ tag: "div[data-view-id]",
16
+ getAttrs: (domNode) => {
17
+ const dom = domNode;
18
+ const viewId = dom.getAttribute("data-view-id");
19
+ return {
20
+ viewId,
21
+ id: viewId,
22
+ ...createParseDomAttrs(dom)
23
+ };
24
+ }
25
+ }],
26
+ toDOM(node) {
27
+ return [
28
+ "div",
29
+ {
30
+ "data-view-id": node.attrs.viewId || node.attrs.id,
31
+ contenteditable: "false",
32
+ ...createToDomAttrs(node.attrs)
33
+ },
34
+ ""
35
+ ];
36
+ }
43
37
  };
38
+ //#endregion
39
+ export { fiberyView };
@@ -1,36 +1,39 @@
1
- export declare const file: {
2
- attrs: {
3
- transcription: {
4
- default: {
5
- status: string;
6
- userId: string;
7
- inserted: boolean;
8
- };
9
- };
10
- src: {};
11
- title: {
12
- default: string;
13
- };
14
- size: {};
15
- type: {};
1
+ //#region src/nodes/file.d.ts
2
+ declare const file: {
3
+ attrs: {
4
+ transcription: {
5
+ default: {
6
+ status: string;
7
+ userId: string;
8
+ inserted: boolean;
9
+ };
16
10
  };
17
- inline: true;
18
- group: string;
19
- selectable: false;
20
- draggable: false;
21
- leafText: (node: import("prosemirror-model").Node) => any;
22
- parseDOM: {
23
- tag: string;
24
- getAttrs(domNode: HTMLElement): {
25
- src: string | null;
26
- title: string;
27
- size: string | null;
28
- type: string | null;
29
- };
30
- }[];
31
- toDOM(node: import("prosemirror-model").Node): [string, {
32
- "data-file-href": any;
33
- "data-size": any;
34
- "data-type": any;
35
- }, any];
11
+ src: {};
12
+ title: {
13
+ default: string;
14
+ };
15
+ size: {};
16
+ type: {};
17
+ };
18
+ inline: true;
19
+ group: string;
20
+ selectable: false;
21
+ draggable: false;
22
+ leafText: (node: import("prosemirror-model").Node) => any;
23
+ parseDOM: {
24
+ tag: string;
25
+ getAttrs(domNode: HTMLElement): {
26
+ src: string | null;
27
+ title: string;
28
+ size: string | null;
29
+ type: string | null;
30
+ };
31
+ }[];
32
+ toDOM(node: import("prosemirror-model").Node): [string, {
33
+ "data-file-href": any;
34
+ "data-size": any;
35
+ "data-type": any;
36
+ }, any];
36
37
  };
38
+ //#endregion
39
+ export { file };
@@ -1,41 +1,42 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.file = void 0;
4
- const transcription_node_attrs_1 = require("../transcription-node-attrs");
5
- exports.file = {
6
- attrs: {
7
- src: {},
8
- title: { default: "Untitled" },
9
- size: {},
10
- type: {},
11
- ...(0, transcription_node_attrs_1.createDefaultAttrs)(),
12
- },
13
- inline: true,
14
- group: "inline",
15
- selectable: false,
16
- draggable: false,
17
- leafText: (node) => node.attrs.title,
18
- parseDOM: [
19
- {
20
- tag: "span[data-file-href]",
21
- getAttrs(domNode) {
22
- const dom = domNode;
23
- return {
24
- src: dom.getAttribute("data-file-href"),
25
- title: dom.textContent,
26
- size: dom.getAttribute("data-size"),
27
- type: dom.getAttribute("data-type"),
28
- };
29
- },
30
- },
31
- ],
32
- toDOM(node) {
33
- const { src, title, type, size } = node.attrs;
34
- const attrs = {
35
- "data-file-href": src,
36
- "data-size": size,
37
- "data-type": type,
38
- };
39
- return ["span", attrs, title];
40
- },
1
+ import { createDefaultAttrs } from "../transcription-node-attrs.js";
2
+ //#region src/nodes/file.ts
3
+ const file = {
4
+ attrs: {
5
+ src: {},
6
+ title: { default: "Untitled" },
7
+ size: {},
8
+ type: {},
9
+ ...createDefaultAttrs()
10
+ },
11
+ inline: true,
12
+ group: "inline",
13
+ selectable: false,
14
+ draggable: false,
15
+ leafText: (node) => node.attrs.title,
16
+ parseDOM: [{
17
+ tag: "span[data-file-href]",
18
+ getAttrs(domNode) {
19
+ const dom = domNode;
20
+ return {
21
+ src: dom.getAttribute("data-file-href"),
22
+ title: dom.textContent,
23
+ size: dom.getAttribute("data-size"),
24
+ type: dom.getAttribute("data-type")
25
+ };
26
+ }
27
+ }],
28
+ toDOM(node) {
29
+ const { src, title, type, size } = node.attrs;
30
+ return [
31
+ "span",
32
+ {
33
+ "data-file-href": src,
34
+ "data-size": size,
35
+ "data-type": type
36
+ },
37
+ title
38
+ ];
39
+ }
41
40
  };
41
+ //#endregion
42
+ export { file };
@@ -1,4 +1,7 @@
1
- import type { Node, NodeSpec } from "prosemirror-model";
2
- export declare const makeHeading: ({ headingToDOM }: {
3
- headingToDOM: ((node: Node) => HTMLElement) | null;
1
+ import { Node, NodeSpec } from "prosemirror-model";
2
+ //#region src/nodes/heading.d.ts
3
+ declare const makeHeading: ({ headingToDOM }: {
4
+ headingToDOM: ((node: Node) => HTMLElement) | null;
4
5
  }) => NodeSpec;
6
+ //#endregion
7
+ export { makeHeading };
@@ -1,39 +1,63 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeHeading = void 0;
4
- const uuid_1 = require("uuid");
1
+ import { v4 } from "uuid";
2
+ //#region src/nodes/heading.ts
5
3
  const parseGuid = (dom) => {
6
- return dom.getAttribute("guid") || (0, uuid_1.v4)();
4
+ return dom.getAttribute("guid") || v4();
7
5
  };
8
6
  const makeGetAttrs = (level) => (dom) => {
9
- const id = parseGuid(dom);
10
- return { level, id, guid: id };
7
+ const id = parseGuid(dom);
8
+ return {
9
+ level,
10
+ id,
11
+ guid: id
12
+ };
11
13
  };
12
14
  const makeHeading = ({ headingToDOM }) => ({
13
- content: "inline*",
14
- group: "block",
15
- attrs: {
16
- level: { default: 1 },
17
- // "id" is the unified block identifier; "guid" is deprecated and mirrors
18
- // "id" until all consumers (client editor, fibery backend) read "id".
19
- id: { default: null },
20
- guid: { default: "" },
21
- },
22
- defining: true,
23
- parseDOM: [
24
- { tag: "h1", getAttrs: makeGetAttrs(1) },
25
- { tag: "h2", getAttrs: makeGetAttrs(2) },
26
- { tag: "h3", getAttrs: makeGetAttrs(3) },
27
- { tag: "h4", getAttrs: makeGetAttrs(4) },
28
- { tag: "h5", getAttrs: makeGetAttrs(5) },
29
- { tag: "h6", getAttrs: makeGetAttrs(6) },
30
- ],
31
- toDOM(node) {
32
- if (headingToDOM) {
33
- return headingToDOM(node);
34
- }
35
- const id = node.attrs.id || node.attrs.guid;
36
- return ["h" + node.attrs.level, { "data-id": id, guid: id }, 0];
37
- },
15
+ content: "inline*",
16
+ group: "block",
17
+ attrs: {
18
+ level: { default: 1 },
19
+ id: { default: null },
20
+ guid: { default: "" }
21
+ },
22
+ defining: true,
23
+ parseDOM: [
24
+ {
25
+ tag: "h1",
26
+ getAttrs: makeGetAttrs(1)
27
+ },
28
+ {
29
+ tag: "h2",
30
+ getAttrs: makeGetAttrs(2)
31
+ },
32
+ {
33
+ tag: "h3",
34
+ getAttrs: makeGetAttrs(3)
35
+ },
36
+ {
37
+ tag: "h4",
38
+ getAttrs: makeGetAttrs(4)
39
+ },
40
+ {
41
+ tag: "h5",
42
+ getAttrs: makeGetAttrs(5)
43
+ },
44
+ {
45
+ tag: "h6",
46
+ getAttrs: makeGetAttrs(6)
47
+ }
48
+ ],
49
+ toDOM(node) {
50
+ if (headingToDOM) return headingToDOM(node);
51
+ const id = node.attrs.id || node.attrs.guid;
52
+ return [
53
+ "h" + node.attrs.level,
54
+ {
55
+ "data-id": id,
56
+ guid: id
57
+ },
58
+ 0
59
+ ];
60
+ }
38
61
  });
39
- exports.makeHeading = makeHeading;
62
+ //#endregion
63
+ export { makeHeading };
@@ -1,2 +1,5 @@
1
- import type { NodeSpec } from "prosemirror-model";
2
- export declare const imageBlock: NodeSpec;
1
+ import { NodeSpec } from "prosemirror-model";
2
+ //#region src/nodes/image-block.d.ts
3
+ declare const imageBlock: NodeSpec;
4
+ //#endregion
5
+ export { imageBlock };