@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.
- package/lib/attr-constraints.d.ts +17 -0
- package/lib/attr-constraints.js +145 -0
- package/lib/block-id-utils.d.ts +10 -0
- package/lib/block-id-utils.js +26 -0
- package/lib/create-schema.d.ts +19 -0
- package/lib/create-schema.js +206 -0
- package/lib/index.d.ts +10 -10
- package/lib/index.js +9 -31
- package/lib/marks/code.d.ts +8 -0
- package/lib/marks/code.js +13 -0
- package/lib/marks/em.d.ts +9 -0
- package/lib/marks/em.js +22 -0
- package/lib/marks/hint-query.d.ts +5 -0
- package/lib/marks/hint-query.js +20 -0
- package/lib/marks/link.d.ts +10 -0
- package/lib/marks/link.js +43 -0
- package/lib/marks/linked-highlight.d.ts +13 -0
- package/lib/marks/linked-highlight.js +44 -0
- package/lib/marks/strike.d.ts +5 -0
- package/lib/marks/strike.js +7 -0
- package/lib/marks/strong.d.ts +9 -0
- package/lib/marks/strong.js +32 -0
- package/lib/marks/text-background-color.d.ts +16 -0
- package/lib/marks/text-background-color.js +72 -0
- package/lib/marks/underline.d.ts +5 -0
- package/lib/marks/underline.js +7 -0
- package/lib/nodes/callout.d.ts +31 -0
- package/lib/nodes/callout.js +59 -0
- package/lib/nodes/check-item.d.ts +14 -0
- package/lib/nodes/check-item.js +33 -0
- package/lib/nodes/check-list.d.ts +16 -0
- package/lib/nodes/check-list.js +24 -0
- package/lib/nodes/code-block.d.ts +5 -0
- package/lib/nodes/code-block.js +81 -0
- package/lib/nodes/column.d.ts +5 -0
- package/lib/nodes/column.js +29 -0
- package/lib/nodes/columns.d.ts +5 -0
- package/lib/nodes/columns.js +35 -0
- package/lib/nodes/emoji.d.ts +33 -0
- package/lib/nodes/emoji.js +42 -0
- package/lib/nodes/entity.d.ts +22 -0
- package/lib/nodes/entity.js +49 -0
- package/lib/nodes/fibery-view.d.ts +5 -0
- package/lib/nodes/fibery-view.js +39 -0
- package/lib/nodes/file.d.ts +39 -0
- package/lib/nodes/file.js +42 -0
- package/lib/nodes/heading.d.ts +7 -0
- package/lib/nodes/heading.js +63 -0
- package/lib/nodes/image-block.d.ts +5 -0
- package/lib/nodes/image-block.js +44 -0
- package/lib/nodes/important.d.ts +5 -0
- package/lib/nodes/important.js +15 -0
- package/lib/nodes/math-display.d.ts +5 -0
- package/lib/nodes/math-display.js +15 -0
- package/lib/nodes/math-inline.d.ts +5 -0
- package/lib/nodes/math-inline.js +15 -0
- package/lib/nodes/media.d.ts +7 -0
- package/lib/nodes/media.js +58 -0
- package/lib/nodes/mention.d.ts +14 -0
- package/lib/nodes/mention.js +37 -0
- package/lib/nodes/note.d.ts +5 -0
- package/lib/nodes/note.js +15 -0
- package/lib/nodes/paragraph.d.ts +5 -0
- package/lib/nodes/paragraph.js +33 -0
- package/lib/nodes/table-nodes.d.ts +5 -0
- package/lib/nodes/table-nodes.js +17 -0
- package/lib/nodes/types/inline-content.d.ts +12 -0
- package/lib/nodes/types/inline-content.js +0 -0
- package/lib/nodes/types/text.d.ts +8 -0
- package/lib/nodes/types/text.js +0 -0
- package/lib/nodes/video.d.ts +7 -0
- package/lib/nodes/video.js +50 -0
- package/lib/resizable-node-attrs.d.ts +32 -0
- package/lib/resizable-node-attrs.js +29 -0
- package/lib/transcription-node-attrs.d.ts +12 -0
- package/lib/transcription-node-attrs.js +10 -0
- package/package.json +8 -27
- package/lib/src/attr-constraints.d.ts +0 -14
- package/lib/src/attr-constraints.js +0 -185
- package/lib/src/block-id-utils.d.ts +0 -7
- package/lib/src/block-id-utils.js +0 -49
- package/lib/src/create-schema.d.ts +0 -18
- package/lib/src/create-schema.js +0 -251
- package/lib/src/marks/code.d.ts +0 -5
- package/lib/src/marks/code.js +0 -13
- package/lib/src/marks/em.d.ts +0 -6
- package/lib/src/marks/em.js +0 -19
- package/lib/src/marks/hint-query.d.ts +0 -2
- package/lib/src/marks/hint-query.js +0 -23
- package/lib/src/marks/link.d.ts +0 -7
- package/lib/src/marks/link.js +0 -39
- package/lib/src/marks/linked-highlight.d.ts +0 -11
- package/lib/src/marks/linked-highlight.js +0 -57
- package/lib/src/marks/strike.d.ts +0 -2
- package/lib/src/marks/strike.js +0 -7
- package/lib/src/marks/strong.d.ts +0 -6
- package/lib/src/marks/strong.js +0 -32
- package/lib/src/marks/text-background-color.d.ts +0 -13
- package/lib/src/marks/text-background-color.js +0 -90
- package/lib/src/marks/underline.d.ts +0 -2
- package/lib/src/marks/underline.js +0 -7
- package/lib/src/nodes/callout.d.ts +0 -28
- package/lib/src/nodes/callout.js +0 -62
- package/lib/src/nodes/check-item.d.ts +0 -11
- package/lib/src/nodes/check-item.js +0 -34
- package/lib/src/nodes/check-list.d.ts +0 -13
- package/lib/src/nodes/check-list.js +0 -31
- package/lib/src/nodes/code-block.d.ts +0 -2
- package/lib/src/nodes/code-block.js +0 -112
- package/lib/src/nodes/column.d.ts +0 -2
- package/lib/src/nodes/column.js +0 -35
- package/lib/src/nodes/columns.d.ts +0 -2
- package/lib/src/nodes/columns.js +0 -37
- package/lib/src/nodes/emoji.d.ts +0 -31
- package/lib/src/nodes/emoji.js +0 -51
- package/lib/src/nodes/entity.d.ts +0 -20
- package/lib/src/nodes/entity.js +0 -50
- package/lib/src/nodes/fibery-view.d.ts +0 -2
- package/lib/src/nodes/fibery-view.js +0 -43
- package/lib/src/nodes/file.d.ts +0 -36
- package/lib/src/nodes/file.js +0 -41
- package/lib/src/nodes/heading.d.ts +0 -4
- package/lib/src/nodes/heading.js +0 -39
- package/lib/src/nodes/image-block.d.ts +0 -2
- package/lib/src/nodes/image-block.js +0 -43
- package/lib/src/nodes/important.d.ts +0 -2
- package/lib/src/nodes/important.js +0 -11
- package/lib/src/nodes/math-display.d.ts +0 -2
- package/lib/src/nodes/math-display.js +0 -16
- package/lib/src/nodes/math-inline.d.ts +0 -2
- package/lib/src/nodes/math-inline.js +0 -16
- package/lib/src/nodes/media.d.ts +0 -4
- package/lib/src/nodes/media.js +0 -74
- package/lib/src/nodes/mention.d.ts +0 -11
- package/lib/src/nodes/mention.js +0 -38
- package/lib/src/nodes/note.d.ts +0 -2
- package/lib/src/nodes/note.js +0 -11
- package/lib/src/nodes/paragraph.d.ts +0 -2
- package/lib/src/nodes/paragraph.js +0 -27
- package/lib/src/nodes/table-nodes.d.ts +0 -2
- package/lib/src/nodes/table-nodes.js +0 -21
- package/lib/src/nodes/types/inline-content.d.ts +0 -10
- package/lib/src/nodes/types/inline-content.js +0 -2
- package/lib/src/nodes/types/text.d.ts +0 -5
- package/lib/src/nodes/types/text.js +0 -2
- package/lib/src/nodes/video.d.ts +0 -4
- package/lib/src/nodes/video.js +0 -55
- package/lib/src/resizable-node-attrs.d.ts +0 -29
- package/lib/src/resizable-node-attrs.js +0 -40
- package/lib/src/transcription-node-attrs.d.ts +0 -9
- package/lib/src/transcription-node-attrs.js +0 -10
- package/lib/test-helpers/index.d.ts +0 -4
- package/lib/test-helpers/index.js +0 -21
package/lib/src/nodes/column.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.column = void 0;
|
|
4
|
-
exports.column = {
|
|
5
|
-
content: "block+",
|
|
6
|
-
selectable: true,
|
|
7
|
-
draggable: false,
|
|
8
|
-
definingAsContext: true,
|
|
9
|
-
isolating: true,
|
|
10
|
-
attrs: {
|
|
11
|
-
columnRatio: {
|
|
12
|
-
default: 1,
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
parseDOM: [
|
|
16
|
-
{
|
|
17
|
-
tag: "div.fibery-column-node",
|
|
18
|
-
getAttrs: (domNode) => {
|
|
19
|
-
const dom = domNode;
|
|
20
|
-
return {
|
|
21
|
-
columnRatio: dom.getAttribute("data-column-ratio"),
|
|
22
|
-
};
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
toDOM(node) {
|
|
27
|
-
const { columnRatio } = node.attrs;
|
|
28
|
-
const attrs = {
|
|
29
|
-
class: "fibery-column-node",
|
|
30
|
-
"data-column-ratio": columnRatio,
|
|
31
|
-
style: "min-width: 0;",
|
|
32
|
-
};
|
|
33
|
-
return ["div", attrs, 0];
|
|
34
|
-
},
|
|
35
|
-
};
|
package/lib/src/nodes/columns.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.columns = void 0;
|
|
4
|
-
const resizable_node_attrs_1 = require("../resizable-node-attrs");
|
|
5
|
-
exports.columns = {
|
|
6
|
-
content: "column+",
|
|
7
|
-
selectable: true,
|
|
8
|
-
draggable: false,
|
|
9
|
-
attrs: {
|
|
10
|
-
id: { default: "" },
|
|
11
|
-
...(0, resizable_node_attrs_1.createDefaultAttrs)(),
|
|
12
|
-
},
|
|
13
|
-
parseDOM: [
|
|
14
|
-
{
|
|
15
|
-
tag: "div.fibery-columns-node",
|
|
16
|
-
getAttrs: (domNode) => {
|
|
17
|
-
const dom = domNode;
|
|
18
|
-
return (0, resizable_node_attrs_1.createParseDomAttrs)(dom);
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
toDOM(node) {
|
|
23
|
-
let gridTemplateColumns = ``;
|
|
24
|
-
node.forEach((node, offset, index) => {
|
|
25
|
-
if (index !== 0) {
|
|
26
|
-
gridTemplateColumns += ` `;
|
|
27
|
-
}
|
|
28
|
-
gridTemplateColumns += `${node.attrs.columnRatio}fr`;
|
|
29
|
-
});
|
|
30
|
-
const attrs = {
|
|
31
|
-
class: "fibery-columns-node",
|
|
32
|
-
style: `display: grid; gap: 46px; grid-template-columns: ${gridTemplateColumns}`,
|
|
33
|
-
...(0, resizable_node_attrs_1.createToDomAttrs)(node.attrs),
|
|
34
|
-
};
|
|
35
|
-
return ["div", attrs, 0];
|
|
36
|
-
},
|
|
37
|
-
};
|
package/lib/src/nodes/emoji.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
type Emoji = {
|
|
2
|
-
name: string;
|
|
3
|
-
shortNames: string[];
|
|
4
|
-
colons: string;
|
|
5
|
-
native?: string;
|
|
6
|
-
};
|
|
7
|
-
export type EmojiOptions = {
|
|
8
|
-
getEmoji: (code: string) => Emoji | void;
|
|
9
|
-
};
|
|
10
|
-
export declare const makeEmoji: ({ getEmoji }?: EmojiOptions) => {
|
|
11
|
-
attrs: {
|
|
12
|
-
code: {};
|
|
13
|
-
};
|
|
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];
|
|
30
|
-
};
|
|
31
|
-
export {};
|
package/lib/src/nodes/emoji.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeEmoji = void 0;
|
|
4
|
-
const typeAttr = "data-emoji-node";
|
|
5
|
-
const codeAttr = "data-emoji-code";
|
|
6
|
-
const defaultOptions = {
|
|
7
|
-
getEmoji() {
|
|
8
|
-
return;
|
|
9
|
-
},
|
|
10
|
-
};
|
|
11
|
-
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
|
-
},
|
|
50
|
-
});
|
|
51
|
-
exports.makeEmoji = makeEmoji;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { NodeSpec } from "prosemirror-model";
|
|
2
|
-
type Meta = {
|
|
3
|
-
comment?: string;
|
|
4
|
-
anchor?: string;
|
|
5
|
-
field?: string;
|
|
6
|
-
contextEntityTypeId?: string;
|
|
7
|
-
contextEntityPublicId?: string;
|
|
8
|
-
};
|
|
9
|
-
export interface EntityAttributes {
|
|
10
|
-
id: string;
|
|
11
|
-
typeId: string;
|
|
12
|
-
text?: string;
|
|
13
|
-
meta: Meta;
|
|
14
|
-
}
|
|
15
|
-
export interface EntityDefinition {
|
|
16
|
-
type: "entity";
|
|
17
|
-
attrs: EntityAttributes;
|
|
18
|
-
}
|
|
19
|
-
export declare const entity: NodeSpec;
|
|
20
|
-
export {};
|
package/lib/src/nodes/entity.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
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
|
-
},
|
|
50
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
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
|
-
},
|
|
43
|
-
};
|
package/lib/src/nodes/file.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
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: {};
|
|
16
|
-
};
|
|
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];
|
|
36
|
-
};
|
package/lib/src/nodes/file.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
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
|
-
},
|
|
41
|
-
};
|
package/lib/src/nodes/heading.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeHeading = void 0;
|
|
4
|
-
const uuid_1 = require("uuid");
|
|
5
|
-
const parseGuid = (dom) => {
|
|
6
|
-
return dom.getAttribute("guid") || (0, uuid_1.v4)();
|
|
7
|
-
};
|
|
8
|
-
const makeGetAttrs = (level) => (dom) => {
|
|
9
|
-
const id = parseGuid(dom);
|
|
10
|
-
return { level, id, guid: id };
|
|
11
|
-
};
|
|
12
|
-
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
|
-
},
|
|
38
|
-
});
|
|
39
|
-
exports.makeHeading = makeHeading;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.imageBlock = void 0;
|
|
4
|
-
const resizable_node_attrs_1 = require("../resizable-node-attrs");
|
|
5
|
-
exports.imageBlock = {
|
|
6
|
-
attrs: {
|
|
7
|
-
src: {},
|
|
8
|
-
alt: { default: null },
|
|
9
|
-
title: { default: null },
|
|
10
|
-
size: { default: null },
|
|
11
|
-
type: { default: null },
|
|
12
|
-
...(0, resizable_node_attrs_1.createDefaultAttrs)(),
|
|
13
|
-
},
|
|
14
|
-
inline: false,
|
|
15
|
-
group: "block",
|
|
16
|
-
content: "inline*",
|
|
17
|
-
atom: true,
|
|
18
|
-
draggable: true,
|
|
19
|
-
parseDOM: [
|
|
20
|
-
{
|
|
21
|
-
tag: "img[src]",
|
|
22
|
-
getAttrs(domNode) {
|
|
23
|
-
const dom = domNode;
|
|
24
|
-
return {
|
|
25
|
-
src: dom.getAttribute("src"),
|
|
26
|
-
title: dom.getAttribute("title"),
|
|
27
|
-
alt: dom.getAttribute("alt"),
|
|
28
|
-
...(0, resizable_node_attrs_1.createParseDomAttrs)(dom),
|
|
29
|
-
};
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
toDOM(node) {
|
|
34
|
-
const { src, alt, title } = node.attrs;
|
|
35
|
-
const attrs = {
|
|
36
|
-
src,
|
|
37
|
-
alt,
|
|
38
|
-
title,
|
|
39
|
-
...(0, resizable_node_attrs_1.createToDomAttrs)(node.attrs),
|
|
40
|
-
};
|
|
41
|
-
return ["div", {}, ["img", attrs]];
|
|
42
|
-
},
|
|
43
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.important = void 0;
|
|
4
|
-
exports.important = {
|
|
5
|
-
content: "inline*",
|
|
6
|
-
group: "block",
|
|
7
|
-
parseDOM: [{ tag: "div.fibery-important" }],
|
|
8
|
-
toDOM() {
|
|
9
|
-
return ["div", { class: "fibery-important" }, ["p", 0]];
|
|
10
|
-
},
|
|
11
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.math_display = void 0;
|
|
4
|
-
exports.math_display = {
|
|
5
|
-
// important!
|
|
6
|
-
group: "block math",
|
|
7
|
-
content: "text*", // important!
|
|
8
|
-
atom: true, // important!
|
|
9
|
-
code: true, // important!
|
|
10
|
-
toDOM: () => ["math-display", { class: "math-node" }, 0],
|
|
11
|
-
parseDOM: [
|
|
12
|
-
{
|
|
13
|
-
tag: "math-display", // important!
|
|
14
|
-
},
|
|
15
|
-
],
|
|
16
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.math_inline = void 0;
|
|
4
|
-
exports.math_inline = {
|
|
5
|
-
// important!
|
|
6
|
-
group: "inline math",
|
|
7
|
-
content: "text*", // important!
|
|
8
|
-
inline: true, // important!
|
|
9
|
-
atom: true, // important!
|
|
10
|
-
toDOM: () => ["math-inline", { class: "math-node" }, 0],
|
|
11
|
-
parseDOM: [
|
|
12
|
-
{
|
|
13
|
-
tag: "math-inline", // important!
|
|
14
|
-
},
|
|
15
|
-
],
|
|
16
|
-
};
|
package/lib/src/nodes/media.d.ts
DELETED
package/lib/src/nodes/media.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeMedia = void 0;
|
|
4
|
-
const resizable_node_attrs_1 = require("../resizable-node-attrs");
|
|
5
|
-
function toBoolean(attr) {
|
|
6
|
-
if (typeof attr === "boolean") {
|
|
7
|
-
return attr;
|
|
8
|
-
}
|
|
9
|
-
if (typeof attr === "string") {
|
|
10
|
-
if (attr === "false") {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
if (attr === "true") {
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return Boolean(attr);
|
|
18
|
-
}
|
|
19
|
-
function toNumberOrNull(value) {
|
|
20
|
-
if (!value) {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
const parsed = parseFloat(value);
|
|
24
|
-
return isNaN(parsed) ? null : parsed;
|
|
25
|
-
}
|
|
26
|
-
const makeMedia = ({ mediaToDom }) => ({
|
|
27
|
-
inline: false,
|
|
28
|
-
attrs: {
|
|
29
|
-
url: {},
|
|
30
|
-
compatibleMode: {
|
|
31
|
-
default: false,
|
|
32
|
-
},
|
|
33
|
-
dynamicContent: {
|
|
34
|
-
default: true,
|
|
35
|
-
},
|
|
36
|
-
aspectRatio: {
|
|
37
|
-
default: null,
|
|
38
|
-
},
|
|
39
|
-
...(0, resizable_node_attrs_1.createDefaultAttrs)(),
|
|
40
|
-
},
|
|
41
|
-
group: "block",
|
|
42
|
-
draggable: true,
|
|
43
|
-
parseDOM: [
|
|
44
|
-
{
|
|
45
|
-
tag: "div[data-url]",
|
|
46
|
-
getAttrs(dom) {
|
|
47
|
-
const htmlElement = dom;
|
|
48
|
-
return {
|
|
49
|
-
url: htmlElement.getAttribute("data-url"),
|
|
50
|
-
dynamicContent: htmlElement.getAttribute("data-dynamic-content") !== "false",
|
|
51
|
-
aspectRatio: toNumberOrNull(htmlElement.getAttribute("data-aspect-ratio")),
|
|
52
|
-
compatibleMode: toBoolean(htmlElement.getAttribute("data-compatible-mode")),
|
|
53
|
-
...(0, resizable_node_attrs_1.createParseDomAttrs)(htmlElement),
|
|
54
|
-
};
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
toDOM(node) {
|
|
59
|
-
if (mediaToDom) {
|
|
60
|
-
return mediaToDom(node);
|
|
61
|
-
}
|
|
62
|
-
const { url, compatibleMode, dynamicContent, aspectRatio } = node.attrs;
|
|
63
|
-
const attrs = {
|
|
64
|
-
"data-url": url,
|
|
65
|
-
"data-compatible-mode": compatibleMode,
|
|
66
|
-
"data-dynamic-content": typeof dynamicContent === "boolean" ? String(dynamicContent) : "false",
|
|
67
|
-
"data-aspect-ratio": aspectRatio,
|
|
68
|
-
contenteditable: "false",
|
|
69
|
-
...(0, resizable_node_attrs_1.createToDomAttrs)(node),
|
|
70
|
-
};
|
|
71
|
-
return ["div", attrs, url];
|
|
72
|
-
},
|
|
73
|
-
});
|
|
74
|
-
exports.makeMedia = makeMedia;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { NodeSpec } from "prosemirror-model";
|
|
2
|
-
export interface MentionAttributes {
|
|
3
|
-
id: string;
|
|
4
|
-
typeId: string;
|
|
5
|
-
name?: string;
|
|
6
|
-
}
|
|
7
|
-
export interface MentionDefinition {
|
|
8
|
-
type: "mention";
|
|
9
|
-
attrs: MentionAttributes;
|
|
10
|
-
}
|
|
11
|
-
export declare const mention: NodeSpec;
|
package/lib/src/nodes/mention.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mention = void 0;
|
|
4
|
-
exports.mention = {
|
|
5
|
-
inline: true,
|
|
6
|
-
group: "inline",
|
|
7
|
-
selectable: false,
|
|
8
|
-
attrs: {
|
|
9
|
-
id: { default: "" },
|
|
10
|
-
name: { default: "" },
|
|
11
|
-
typeId: { default: "" },
|
|
12
|
-
meta: {
|
|
13
|
-
default: {},
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
parseDOM: [
|
|
17
|
-
{
|
|
18
|
-
tag: "span[data-mention-id]",
|
|
19
|
-
getAttrs: (domNode) => {
|
|
20
|
-
const dom = domNode;
|
|
21
|
-
return {
|
|
22
|
-
id: dom.getAttribute("data-mention-id"),
|
|
23
|
-
name: dom.textContent,
|
|
24
|
-
typeId: dom.getAttribute("data-mention-type-id"),
|
|
25
|
-
};
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
toDOM(node) {
|
|
30
|
-
const { id, typeId, name } = node.attrs;
|
|
31
|
-
const attrs = {
|
|
32
|
-
"data-mention-id": id,
|
|
33
|
-
"data-mention-type-id": typeId,
|
|
34
|
-
contenteditable: "false",
|
|
35
|
-
};
|
|
36
|
-
return ["span", attrs, name];
|
|
37
|
-
},
|
|
38
|
-
};
|
package/lib/src/nodes/note.d.ts
DELETED
package/lib/src/nodes/note.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.note = void 0;
|
|
4
|
-
exports.note = {
|
|
5
|
-
content: "inline*",
|
|
6
|
-
group: "block",
|
|
7
|
-
toDOM() {
|
|
8
|
-
return ["div", { class: "fibery-note" }, ["p", 0]];
|
|
9
|
-
},
|
|
10
|
-
parseDOM: [{ tag: "div.fibery-note" }],
|
|
11
|
-
};
|