@fibery/prosemirror-schema 4.22.0 → 4.23.1

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 (153) hide show
  1. package/lib/attr-constraints.d.ts +17 -0
  2. package/lib/attr-constraints.js +145 -0
  3. package/lib/block-id-utils.d.ts +10 -0
  4. package/lib/block-id-utils.js +26 -0
  5. package/lib/create-schema.d.ts +19 -0
  6. package/lib/create-schema.js +206 -0
  7. package/lib/index.d.ts +10 -10
  8. package/lib/index.js +9 -31
  9. package/lib/marks/code.d.ts +8 -0
  10. package/lib/marks/code.js +13 -0
  11. package/lib/marks/em.d.ts +9 -0
  12. package/lib/marks/em.js +22 -0
  13. package/lib/marks/hint-query.d.ts +5 -0
  14. package/lib/marks/hint-query.js +20 -0
  15. package/lib/marks/link.d.ts +10 -0
  16. package/lib/marks/link.js +43 -0
  17. package/lib/marks/linked-highlight.d.ts +13 -0
  18. package/lib/marks/linked-highlight.js +44 -0
  19. package/lib/marks/strike.d.ts +5 -0
  20. package/lib/marks/strike.js +7 -0
  21. package/lib/marks/strong.d.ts +9 -0
  22. package/lib/marks/strong.js +32 -0
  23. package/lib/marks/text-background-color.d.ts +16 -0
  24. package/lib/marks/text-background-color.js +72 -0
  25. package/lib/marks/underline.d.ts +5 -0
  26. package/lib/marks/underline.js +7 -0
  27. package/lib/nodes/callout.d.ts +31 -0
  28. package/lib/nodes/callout.js +59 -0
  29. package/lib/nodes/check-item.d.ts +14 -0
  30. package/lib/nodes/check-item.js +33 -0
  31. package/lib/nodes/check-list.d.ts +16 -0
  32. package/lib/nodes/check-list.js +24 -0
  33. package/lib/nodes/code-block.d.ts +5 -0
  34. package/lib/nodes/code-block.js +81 -0
  35. package/lib/nodes/column.d.ts +5 -0
  36. package/lib/nodes/column.js +29 -0
  37. package/lib/nodes/columns.d.ts +5 -0
  38. package/lib/nodes/columns.js +35 -0
  39. package/lib/nodes/emoji.d.ts +33 -0
  40. package/lib/nodes/emoji.js +42 -0
  41. package/lib/nodes/entity.d.ts +22 -0
  42. package/lib/nodes/entity.js +49 -0
  43. package/lib/nodes/fibery-view.d.ts +5 -0
  44. package/lib/nodes/fibery-view.js +39 -0
  45. package/lib/nodes/file.d.ts +39 -0
  46. package/lib/nodes/file.js +42 -0
  47. package/lib/nodes/heading.d.ts +7 -0
  48. package/lib/nodes/heading.js +63 -0
  49. package/lib/nodes/image-block.d.ts +5 -0
  50. package/lib/nodes/image-block.js +44 -0
  51. package/lib/nodes/important.d.ts +5 -0
  52. package/lib/nodes/important.js +15 -0
  53. package/lib/nodes/math-display.d.ts +5 -0
  54. package/lib/nodes/math-display.js +15 -0
  55. package/lib/nodes/math-inline.d.ts +5 -0
  56. package/lib/nodes/math-inline.js +15 -0
  57. package/lib/nodes/media.d.ts +7 -0
  58. package/lib/nodes/media.js +58 -0
  59. package/lib/nodes/mention.d.ts +14 -0
  60. package/lib/nodes/mention.js +37 -0
  61. package/lib/nodes/note.d.ts +5 -0
  62. package/lib/nodes/note.js +15 -0
  63. package/lib/nodes/paragraph.d.ts +5 -0
  64. package/lib/nodes/paragraph.js +33 -0
  65. package/lib/nodes/table-nodes.d.ts +5 -0
  66. package/lib/nodes/table-nodes.js +17 -0
  67. package/lib/nodes/types/inline-content.d.ts +12 -0
  68. package/lib/nodes/types/inline-content.js +0 -0
  69. package/lib/nodes/types/text.d.ts +8 -0
  70. package/lib/nodes/types/text.js +0 -0
  71. package/lib/nodes/video.d.ts +7 -0
  72. package/lib/nodes/video.js +50 -0
  73. package/lib/resizable-node-attrs.d.ts +32 -0
  74. package/lib/resizable-node-attrs.js +29 -0
  75. package/lib/transcription-node-attrs.d.ts +12 -0
  76. package/lib/transcription-node-attrs.js +10 -0
  77. package/package.json +8 -27
  78. package/lib/src/attr-constraints.d.ts +0 -14
  79. package/lib/src/attr-constraints.js +0 -185
  80. package/lib/src/block-id-utils.d.ts +0 -7
  81. package/lib/src/block-id-utils.js +0 -49
  82. package/lib/src/create-schema.d.ts +0 -18
  83. package/lib/src/create-schema.js +0 -251
  84. package/lib/src/marks/code.d.ts +0 -5
  85. package/lib/src/marks/code.js +0 -13
  86. package/lib/src/marks/em.d.ts +0 -6
  87. package/lib/src/marks/em.js +0 -19
  88. package/lib/src/marks/hint-query.d.ts +0 -2
  89. package/lib/src/marks/hint-query.js +0 -23
  90. package/lib/src/marks/link.d.ts +0 -7
  91. package/lib/src/marks/link.js +0 -39
  92. package/lib/src/marks/linked-highlight.d.ts +0 -11
  93. package/lib/src/marks/linked-highlight.js +0 -57
  94. package/lib/src/marks/strike.d.ts +0 -2
  95. package/lib/src/marks/strike.js +0 -7
  96. package/lib/src/marks/strong.d.ts +0 -6
  97. package/lib/src/marks/strong.js +0 -32
  98. package/lib/src/marks/text-background-color.d.ts +0 -13
  99. package/lib/src/marks/text-background-color.js +0 -90
  100. package/lib/src/marks/underline.d.ts +0 -2
  101. package/lib/src/marks/underline.js +0 -7
  102. package/lib/src/nodes/callout.d.ts +0 -28
  103. package/lib/src/nodes/callout.js +0 -62
  104. package/lib/src/nodes/check-item.d.ts +0 -11
  105. package/lib/src/nodes/check-item.js +0 -34
  106. package/lib/src/nodes/check-list.d.ts +0 -13
  107. package/lib/src/nodes/check-list.js +0 -31
  108. package/lib/src/nodes/code-block.d.ts +0 -2
  109. package/lib/src/nodes/code-block.js +0 -112
  110. package/lib/src/nodes/column.d.ts +0 -2
  111. package/lib/src/nodes/column.js +0 -35
  112. package/lib/src/nodes/columns.d.ts +0 -2
  113. package/lib/src/nodes/columns.js +0 -37
  114. package/lib/src/nodes/emoji.d.ts +0 -31
  115. package/lib/src/nodes/emoji.js +0 -51
  116. package/lib/src/nodes/entity.d.ts +0 -20
  117. package/lib/src/nodes/entity.js +0 -50
  118. package/lib/src/nodes/fibery-view.d.ts +0 -2
  119. package/lib/src/nodes/fibery-view.js +0 -43
  120. package/lib/src/nodes/file.d.ts +0 -36
  121. package/lib/src/nodes/file.js +0 -41
  122. package/lib/src/nodes/heading.d.ts +0 -4
  123. package/lib/src/nodes/heading.js +0 -39
  124. package/lib/src/nodes/image-block.d.ts +0 -2
  125. package/lib/src/nodes/image-block.js +0 -43
  126. package/lib/src/nodes/important.d.ts +0 -2
  127. package/lib/src/nodes/important.js +0 -11
  128. package/lib/src/nodes/math-display.d.ts +0 -2
  129. package/lib/src/nodes/math-display.js +0 -16
  130. package/lib/src/nodes/math-inline.d.ts +0 -2
  131. package/lib/src/nodes/math-inline.js +0 -16
  132. package/lib/src/nodes/media.d.ts +0 -4
  133. package/lib/src/nodes/media.js +0 -74
  134. package/lib/src/nodes/mention.d.ts +0 -11
  135. package/lib/src/nodes/mention.js +0 -38
  136. package/lib/src/nodes/note.d.ts +0 -2
  137. package/lib/src/nodes/note.js +0 -11
  138. package/lib/src/nodes/paragraph.d.ts +0 -2
  139. package/lib/src/nodes/paragraph.js +0 -27
  140. package/lib/src/nodes/table-nodes.d.ts +0 -2
  141. package/lib/src/nodes/table-nodes.js +0 -21
  142. package/lib/src/nodes/types/inline-content.d.ts +0 -10
  143. package/lib/src/nodes/types/inline-content.js +0 -2
  144. package/lib/src/nodes/types/text.d.ts +0 -5
  145. package/lib/src/nodes/types/text.js +0 -2
  146. package/lib/src/nodes/video.d.ts +0 -4
  147. package/lib/src/nodes/video.js +0 -55
  148. package/lib/src/resizable-node-attrs.d.ts +0 -29
  149. package/lib/src/resizable-node-attrs.js +0 -40
  150. package/lib/src/transcription-node-attrs.d.ts +0 -9
  151. package/lib/src/transcription-node-attrs.js +0 -10
  152. package/lib/test-helpers/index.d.ts +0 -4
  153. package/lib/test-helpers/index.js +0 -21
@@ -0,0 +1,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
+ }
47
+ };
48
+ //#endregion
49
+ export { entity };
@@ -0,0 +1,5 @@
1
+ import { NodeSpec } from "prosemirror-model";
2
+ //#region src/nodes/fibery-view.d.ts
3
+ declare const fiberyView: NodeSpec;
4
+ //#endregion
5
+ export { fiberyView };
@@ -0,0 +1,39 @@
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
+ }
37
+ };
38
+ //#endregion
39
+ export { fiberyView };
@@ -0,0 +1,39 @@
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
+ };
10
+ };
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];
37
+ };
38
+ //#endregion
39
+ export { file };
@@ -0,0 +1,42 @@
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
+ }
40
+ };
41
+ //#endregion
42
+ export { file };
@@ -0,0 +1,7 @@
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;
5
+ }) => NodeSpec;
6
+ //#endregion
7
+ export { makeHeading };
@@ -0,0 +1,63 @@
1
+ import { v4 } from "uuid";
2
+ //#region src/nodes/heading.ts
3
+ const parseGuid = (dom) => {
4
+ return dom.getAttribute("guid") || v4();
5
+ };
6
+ const makeGetAttrs = (level) => (dom) => {
7
+ const id = parseGuid(dom);
8
+ return {
9
+ level,
10
+ id,
11
+ guid: id
12
+ };
13
+ };
14
+ const makeHeading = ({ headingToDOM }) => ({
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
+ }
61
+ });
62
+ //#endregion
63
+ export { makeHeading };
@@ -0,0 +1,5 @@
1
+ import { NodeSpec } from "prosemirror-model";
2
+ //#region src/nodes/image-block.d.ts
3
+ declare const imageBlock: NodeSpec;
4
+ //#endregion
5
+ export { imageBlock };
@@ -0,0 +1,44 @@
1
+ import { createDefaultAttrs, createParseDomAttrs, createToDomAttrs } from "../resizable-node-attrs.js";
2
+ //#region src/nodes/image-block.ts
3
+ const imageBlock = {
4
+ attrs: {
5
+ src: {},
6
+ alt: { default: null },
7
+ title: { default: null },
8
+ size: { default: null },
9
+ type: { default: null },
10
+ ...createDefaultAttrs()
11
+ },
12
+ inline: false,
13
+ group: "block",
14
+ content: "inline*",
15
+ atom: true,
16
+ draggable: true,
17
+ parseDOM: [{
18
+ tag: "img[src]",
19
+ getAttrs(domNode) {
20
+ const dom = domNode;
21
+ return {
22
+ src: dom.getAttribute("src"),
23
+ title: dom.getAttribute("title"),
24
+ alt: dom.getAttribute("alt"),
25
+ ...createParseDomAttrs(dom)
26
+ };
27
+ }
28
+ }],
29
+ toDOM(node) {
30
+ const { src, alt, title } = node.attrs;
31
+ return [
32
+ "div",
33
+ {},
34
+ ["img", {
35
+ src,
36
+ alt,
37
+ title,
38
+ ...createToDomAttrs(node.attrs)
39
+ }]
40
+ ];
41
+ }
42
+ };
43
+ //#endregion
44
+ export { imageBlock };
@@ -0,0 +1,5 @@
1
+ import { NodeSpec } from "prosemirror-model";
2
+ //#region src/nodes/important.d.ts
3
+ declare const important: NodeSpec;
4
+ //#endregion
5
+ export { important };
@@ -0,0 +1,15 @@
1
+ //#region src/nodes/important.ts
2
+ const important = {
3
+ content: "inline*",
4
+ group: "block",
5
+ parseDOM: [{ tag: "div.fibery-important" }],
6
+ toDOM() {
7
+ return [
8
+ "div",
9
+ { class: "fibery-important" },
10
+ ["p", 0]
11
+ ];
12
+ }
13
+ };
14
+ //#endregion
15
+ export { important };
@@ -0,0 +1,5 @@
1
+ import { NodeSpec } from "prosemirror-model";
2
+ //#region src/nodes/math-display.d.ts
3
+ declare const math_display: NodeSpec;
4
+ //#endregion
5
+ export { math_display };
@@ -0,0 +1,15 @@
1
+ //#region src/nodes/math-display.ts
2
+ const math_display = {
3
+ group: "block math",
4
+ content: "text*",
5
+ atom: true,
6
+ code: true,
7
+ toDOM: () => [
8
+ "math-display",
9
+ { class: "math-node" },
10
+ 0
11
+ ],
12
+ parseDOM: [{ tag: "math-display" }]
13
+ };
14
+ //#endregion
15
+ export { math_display };
@@ -0,0 +1,5 @@
1
+ import { NodeSpec } from "prosemirror-model";
2
+ //#region src/nodes/math-inline.d.ts
3
+ declare const math_inline: NodeSpec;
4
+ //#endregion
5
+ export { math_inline };
@@ -0,0 +1,15 @@
1
+ //#region src/nodes/math-inline.ts
2
+ const math_inline = {
3
+ group: "inline math",
4
+ content: "text*",
5
+ inline: true,
6
+ atom: true,
7
+ toDOM: () => [
8
+ "math-inline",
9
+ { class: "math-node" },
10
+ 0
11
+ ],
12
+ parseDOM: [{ tag: "math-inline" }]
13
+ };
14
+ //#endregion
15
+ export { math_inline };
@@ -0,0 +1,7 @@
1
+ import { Node, NodeSpec } from "prosemirror-model";
2
+ //#region src/nodes/media.d.ts
3
+ declare const makeMedia: ({ mediaToDom }: {
4
+ mediaToDom: ((node: Node) => HTMLElement) | null;
5
+ }) => NodeSpec;
6
+ //#endregion
7
+ export { makeMedia };
@@ -0,0 +1,58 @@
1
+ import { createDefaultAttrs, createParseDomAttrs, createToDomAttrs } from "../resizable-node-attrs.js";
2
+ //#region src/nodes/media.ts
3
+ function toBoolean(attr) {
4
+ if (typeof attr === "boolean") return attr;
5
+ if (typeof attr === "string") {
6
+ if (attr === "false") return false;
7
+ if (attr === "true") return true;
8
+ }
9
+ return Boolean(attr);
10
+ }
11
+ function toNumberOrNull(value) {
12
+ if (!value) return null;
13
+ const parsed = parseFloat(value);
14
+ return isNaN(parsed) ? null : parsed;
15
+ }
16
+ const makeMedia = ({ mediaToDom }) => ({
17
+ inline: false,
18
+ attrs: {
19
+ url: {},
20
+ compatibleMode: { default: false },
21
+ dynamicContent: { default: true },
22
+ aspectRatio: { default: null },
23
+ ...createDefaultAttrs()
24
+ },
25
+ group: "block",
26
+ draggable: true,
27
+ parseDOM: [{
28
+ tag: "div[data-url]",
29
+ getAttrs(dom) {
30
+ const htmlElement = dom;
31
+ return {
32
+ url: htmlElement.getAttribute("data-url"),
33
+ dynamicContent: htmlElement.getAttribute("data-dynamic-content") !== "false",
34
+ aspectRatio: toNumberOrNull(htmlElement.getAttribute("data-aspect-ratio")),
35
+ compatibleMode: toBoolean(htmlElement.getAttribute("data-compatible-mode")),
36
+ ...createParseDomAttrs(htmlElement)
37
+ };
38
+ }
39
+ }],
40
+ toDOM(node) {
41
+ if (mediaToDom) return mediaToDom(node);
42
+ const { url, compatibleMode, dynamicContent, aspectRatio } = node.attrs;
43
+ return [
44
+ "div",
45
+ {
46
+ "data-url": url,
47
+ "data-compatible-mode": compatibleMode,
48
+ "data-dynamic-content": typeof dynamicContent === "boolean" ? String(dynamicContent) : "false",
49
+ "data-aspect-ratio": aspectRatio,
50
+ contenteditable: "false",
51
+ ...createToDomAttrs(node)
52
+ },
53
+ url
54
+ ];
55
+ }
56
+ });
57
+ //#endregion
58
+ export { makeMedia };
@@ -0,0 +1,14 @@
1
+ import { NodeSpec } from "prosemirror-model";
2
+ //#region src/nodes/mention.d.ts
3
+ interface MentionAttributes {
4
+ id: string;
5
+ typeId: string;
6
+ name?: string;
7
+ }
8
+ interface MentionDefinition {
9
+ type: "mention";
10
+ attrs: MentionAttributes;
11
+ }
12
+ declare const mention: NodeSpec;
13
+ //#endregion
14
+ export { MentionAttributes, MentionDefinition, mention };
@@ -0,0 +1,37 @@
1
+ //#region src/nodes/mention.ts
2
+ const mention = {
3
+ inline: true,
4
+ group: "inline",
5
+ selectable: false,
6
+ attrs: {
7
+ id: { default: "" },
8
+ name: { default: "" },
9
+ typeId: { default: "" },
10
+ meta: { default: {} }
11
+ },
12
+ parseDOM: [{
13
+ tag: "span[data-mention-id]",
14
+ getAttrs: (domNode) => {
15
+ const dom = domNode;
16
+ return {
17
+ id: dom.getAttribute("data-mention-id"),
18
+ name: dom.textContent,
19
+ typeId: dom.getAttribute("data-mention-type-id")
20
+ };
21
+ }
22
+ }],
23
+ toDOM(node) {
24
+ const { id, typeId, name } = node.attrs;
25
+ return [
26
+ "span",
27
+ {
28
+ "data-mention-id": id,
29
+ "data-mention-type-id": typeId,
30
+ contenteditable: "false"
31
+ },
32
+ name
33
+ ];
34
+ }
35
+ };
36
+ //#endregion
37
+ export { mention };
@@ -0,0 +1,5 @@
1
+ import { NodeSpec } from "prosemirror-model";
2
+ //#region src/nodes/note.d.ts
3
+ declare const note: NodeSpec;
4
+ //#endregion
5
+ export { note };
@@ -0,0 +1,15 @@
1
+ //#region src/nodes/note.ts
2
+ const note = {
3
+ content: "inline*",
4
+ group: "block",
5
+ toDOM() {
6
+ return [
7
+ "div",
8
+ { class: "fibery-note" },
9
+ ["p", 0]
10
+ ];
11
+ },
12
+ parseDOM: [{ tag: "div.fibery-note" }]
13
+ };
14
+ //#endregion
15
+ export { note };
@@ -0,0 +1,5 @@
1
+ import { NodeSpec } from "prosemirror-model";
2
+ //#region src/nodes/paragraph.d.ts
3
+ declare const paragraph: NodeSpec;
4
+ //#endregion
5
+ export { paragraph };
@@ -0,0 +1,33 @@
1
+ import { v4 } from "uuid";
2
+ //#region src/nodes/paragraph.ts
3
+ const paragraph = {
4
+ content: "inline*",
5
+ group: "block",
6
+ attrs: {
7
+ id: { default: null },
8
+ guid: { default: "" }
9
+ },
10
+ parseDOM: [{
11
+ tag: "p",
12
+ getAttrs: (dom) => {
13
+ const id = dom.getAttribute("data-guid") || v4();
14
+ return {
15
+ id,
16
+ guid: id
17
+ };
18
+ }
19
+ }],
20
+ toDOM(node) {
21
+ const id = node.attrs.id || node.attrs.guid;
22
+ return [
23
+ "p",
24
+ {
25
+ "data-id": id,
26
+ "data-guid": id
27
+ },
28
+ 0
29
+ ];
30
+ }
31
+ };
32
+ //#endregion
33
+ export { paragraph };
@@ -0,0 +1,5 @@
1
+ import { NodeSpec } from "prosemirror-model";
2
+ //#region src/nodes/table-nodes.d.ts
3
+ declare const tableNodes: Record<string, NodeSpec>;
4
+ //#endregion
5
+ export { tableNodes };
@@ -0,0 +1,17 @@
1
+ import { tableNodes as tableNodes$1 } from "prosemirror-tables";
2
+ //#region src/nodes/table-nodes.ts
3
+ const tableNodes = tableNodes$1({
4
+ tableGroup: "block",
5
+ cellContent: "block+",
6
+ cellAttributes: { background: {
7
+ default: null,
8
+ getFromDOM(dom) {
9
+ return dom.style.backgroundColor || null;
10
+ },
11
+ setDOMAttr(value, attrs) {
12
+ if (value) attrs.style = (attrs.style || "") + `background-color: ${value};`;
13
+ }
14
+ } }
15
+ });
16
+ //#endregion
17
+ export { tableNodes };
@@ -0,0 +1,12 @@
1
+ import { EntityDefinition } from "../entity.js";
2
+ import { MentionDefinition } from "../mention.js";
3
+ import { TextDefinition } from "./text.js";
4
+ //#region src/nodes/types/inline-content.d.ts
5
+ interface MarksObject<T> {
6
+ marks?: Array<T>;
7
+ }
8
+ type InlineFormattedText = TextDefinition & MarksObject<unknown>;
9
+ type InlineAtomic = MentionDefinition | EntityDefinition | unknown;
10
+ type Inline = InlineFormattedText | InlineAtomic;
11
+ //#endregion
12
+ export { Inline, InlineAtomic, InlineFormattedText };
File without changes
@@ -0,0 +1,8 @@
1
+ //#region src/nodes/types/text.d.ts
2
+ interface TextDefinition {
3
+ type: "text";
4
+ text: string;
5
+ marks?: Array<any>;
6
+ }
7
+ //#endregion
8
+ export { TextDefinition };
File without changes
@@ -0,0 +1,7 @@
1
+ import { NodeSpec } from "prosemirror-model";
2
+ //#region src/nodes/video.d.ts
3
+ declare const DEFAULT_VIDEO_WIDTH = 400;
4
+ declare const DEFAULT_VIDEO_HEIGHT = 200;
5
+ declare const video: NodeSpec;
6
+ //#endregion
7
+ export { DEFAULT_VIDEO_HEIGHT, DEFAULT_VIDEO_WIDTH, video };
@@ -0,0 +1,50 @@
1
+ import { createDefaultAttrs, createParseDomAttrs, createToDomAttrs } from "../resizable-node-attrs.js";
2
+ import { createDefaultAttrs as createDefaultAttrs$1 } from "../transcription-node-attrs.js";
3
+ //#region src/nodes/video.ts
4
+ const DEFAULT_VIDEO_WIDTH = 400;
5
+ const DEFAULT_VIDEO_HEIGHT = 200;
6
+ const video = {
7
+ inline: false,
8
+ attrs: {
9
+ src: {},
10
+ type: {},
11
+ width: { default: 400 },
12
+ height: { default: 200 },
13
+ title: { default: "" },
14
+ alignment: { default: ":alignment/block-center" },
15
+ ...createDefaultAttrs(),
16
+ ...createDefaultAttrs$1()
17
+ },
18
+ group: "block",
19
+ draggable: true,
20
+ parseDOM: [{
21
+ tag: "video",
22
+ getAttrs(domNode) {
23
+ const dom = domNode;
24
+ return {
25
+ src: dom.getAttribute("src"),
26
+ type: dom.getAttribute("type"),
27
+ width: Number(dom.getAttribute("width")) || 400,
28
+ height: Number(dom.getAttribute("height")) || 200,
29
+ title: dom.getAttribute("title"),
30
+ ...createParseDomAttrs(dom)
31
+ };
32
+ }
33
+ }],
34
+ toDOM(node) {
35
+ const { src, type, width = 400, height = 200, title } = node.attrs;
36
+ return ["video", {
37
+ src,
38
+ type,
39
+ width,
40
+ height,
41
+ title,
42
+ playsinline: "",
43
+ controls: "",
44
+ preload: "metadata",
45
+ ...createToDomAttrs(node.attrs)
46
+ }];
47
+ }
48
+ };
49
+ //#endregion
50
+ export { DEFAULT_VIDEO_HEIGHT, DEFAULT_VIDEO_WIDTH, video };