@fibery/prosemirror-schema 4.21.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.
- package/lib/index.d.ts +10 -8
- package/lib/index.js +9 -26
- package/lib/src/attr-constraints.d.ts +15 -12
- package/lib/src/attr-constraints.js +128 -168
- package/lib/src/block-id-utils.d.ts +10 -7
- package/lib/src/block-id-utils.js +16 -39
- package/lib/src/create-schema.d.ts +16 -15
- package/lib/src/create-schema.js +204 -249
- package/lib/src/marks/code.d.ts +5 -2
- package/lib/src/marks/code.js +10 -10
- package/lib/src/marks/em.d.ts +5 -2
- package/lib/src/marks/em.js +19 -16
- package/lib/src/marks/hint-query.d.ts +5 -2
- package/lib/src/marks/hint-query.js +19 -22
- package/lib/src/marks/link.d.ts +5 -2
- package/lib/src/marks/link.js +40 -36
- package/lib/src/marks/linked-highlight.d.ts +9 -7
- package/lib/src/marks/linked-highlight.js +38 -51
- package/lib/src/marks/strike.d.ts +5 -2
- package/lib/src/marks/strike.js +6 -6
- package/lib/src/marks/strong.d.ts +5 -2
- package/lib/src/marks/strong.js +29 -29
- package/lib/src/marks/text-background-color.d.ts +16 -2
- package/lib/src/marks/text-background-color.js +63 -81
- package/lib/src/marks/underline.d.ts +5 -2
- package/lib/src/marks/underline.js +6 -6
- package/lib/src/nodes/callout.d.ts +29 -28
- package/lib/src/nodes/callout.js +58 -36
- package/lib/src/nodes/check-item.d.ts +13 -10
- package/lib/src/nodes/check-item.js +32 -33
- package/lib/src/nodes/check-list.d.ts +14 -11
- package/lib/src/nodes/check-list.js +23 -30
- package/lib/src/nodes/code-block.d.ts +5 -2
- package/lib/src/nodes/code-block.js +70 -101
- package/lib/src/nodes/column.d.ts +5 -2
- package/lib/src/nodes/column.js +28 -34
- package/lib/src/nodes/columns.d.ts +5 -2
- package/lib/src/nodes/columns.js +34 -36
- package/lib/src/nodes/emoji.d.ts +28 -26
- package/lib/src/nodes/emoji.js +38 -47
- package/lib/src/nodes/entity.d.ts +18 -16
- package/lib/src/nodes/entity.js +48 -49
- package/lib/src/nodes/fibery-view.d.ts +5 -2
- package/lib/src/nodes/fibery-view.js +38 -42
- package/lib/src/nodes/file.d.ts +37 -34
- package/lib/src/nodes/file.js +41 -40
- package/lib/src/nodes/heading.d.ts +6 -3
- package/lib/src/nodes/heading.js +57 -33
- package/lib/src/nodes/image-block.d.ts +5 -2
- package/lib/src/nodes/image-block.js +43 -42
- package/lib/src/nodes/important.d.ts +5 -2
- package/lib/src/nodes/important.js +14 -10
- package/lib/src/nodes/math-display.d.ts +5 -2
- package/lib/src/nodes/math-display.js +14 -15
- package/lib/src/nodes/math-inline.d.ts +5 -2
- package/lib/src/nodes/math-inline.js +14 -15
- package/lib/src/nodes/media.d.ts +6 -3
- package/lib/src/nodes/media.js +52 -68
- package/lib/src/nodes/mention.d.ts +12 -9
- package/lib/src/nodes/mention.js +36 -37
- package/lib/src/nodes/note.d.ts +5 -2
- package/lib/src/nodes/note.js +14 -10
- package/lib/src/nodes/paragraph.d.ts +5 -2
- package/lib/src/nodes/paragraph.js +32 -26
- package/lib/src/nodes/table-nodes.d.ts +5 -2
- package/lib/src/nodes/table-nodes.js +16 -20
- package/lib/src/nodes/types/inline-content.d.ts +10 -8
- package/lib/src/nodes/types/inline-content.js +0 -2
- package/lib/src/nodes/types/text.d.ts +7 -4
- package/lib/src/nodes/types/text.js +0 -2
- package/lib/src/nodes/video.d.ts +7 -4
- package/lib/src/nodes/video.js +49 -54
- package/lib/src/resizable-node-attrs.d.ts +29 -26
- package/lib/src/resizable-node-attrs.js +23 -34
- package/lib/src/transcription-node-attrs.d.ts +10 -7
- package/lib/src/transcription-node-attrs.js +8 -8
- package/lib/test-helpers/index.d.ts +7 -4
- package/lib/test-helpers/index.js +11 -15
- package/package.json +11 -4
package/lib/src/nodes/video.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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 };
|
package/lib/src/nodes/video.js
CHANGED
|
@@ -1,55 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
playsinline: "",
|
|
49
|
-
controls: "",
|
|
50
|
-
preload: "metadata",
|
|
51
|
-
...(0, resizable_node_attrs_1.createToDomAttrs)(node.attrs),
|
|
52
|
-
},
|
|
53
|
-
];
|
|
54
|
-
},
|
|
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
|
+
}
|
|
55
48
|
};
|
|
49
|
+
//#endregion
|
|
50
|
+
export { DEFAULT_VIDEO_HEIGHT, DEFAULT_VIDEO_WIDTH, video };
|
|
@@ -1,29 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { Attrs } from "prosemirror-model";
|
|
2
|
+
//#region src/resizable-node-attrs.d.ts
|
|
3
|
+
declare const defaultHeight = 400;
|
|
4
|
+
declare const defaultWidth = 900;
|
|
5
|
+
declare function createDefaultAttrs(): {
|
|
6
|
+
nodeHeight: {
|
|
7
|
+
default: number;
|
|
8
|
+
};
|
|
9
|
+
nodeWidth: {
|
|
10
|
+
default: number;
|
|
11
|
+
};
|
|
12
|
+
nodePageWidth: {
|
|
13
|
+
default: boolean;
|
|
14
|
+
};
|
|
15
|
+
nodeFullWidth: {
|
|
16
|
+
default: boolean;
|
|
17
|
+
};
|
|
17
18
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
declare function createParseDomAttrs(dom: HTMLElement): {
|
|
20
|
+
nodeHeight: string | null;
|
|
21
|
+
nodeWidth: string | null;
|
|
22
|
+
nodePageWidth: string | null;
|
|
23
|
+
nodeFullWidth: string | null;
|
|
23
24
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
declare function createToDomAttrs({ nodeHeight, nodeWidth, nodePageWidth, nodeFullWidth }: Attrs): {
|
|
26
|
+
"data-node-height": any;
|
|
27
|
+
"data-node-width": any;
|
|
28
|
+
"data-node-page-width": any;
|
|
29
|
+
"data-node-full-width": any;
|
|
29
30
|
};
|
|
31
|
+
//#endregion
|
|
32
|
+
export { createDefaultAttrs, createParseDomAttrs, createToDomAttrs, defaultHeight, defaultWidth };
|
|
@@ -1,40 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.createDefaultAttrs = createDefaultAttrs;
|
|
5
|
-
exports.createParseDomAttrs = createParseDomAttrs;
|
|
6
|
-
exports.createToDomAttrs = createToDomAttrs;
|
|
7
|
-
exports.defaultHeight = 400;
|
|
8
|
-
exports.defaultWidth = 900;
|
|
1
|
+
//#region src/resizable-node-attrs.ts
|
|
2
|
+
const defaultHeight = 400;
|
|
3
|
+
const defaultWidth = 900;
|
|
9
4
|
function createDefaultAttrs() {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
nodePageWidth: {
|
|
18
|
-
default: true,
|
|
19
|
-
},
|
|
20
|
-
nodeFullWidth: {
|
|
21
|
-
default: false,
|
|
22
|
-
},
|
|
23
|
-
};
|
|
5
|
+
return {
|
|
6
|
+
nodeHeight: { default: 400 },
|
|
7
|
+
nodeWidth: { default: 900 },
|
|
8
|
+
nodePageWidth: { default: true },
|
|
9
|
+
nodeFullWidth: { default: false }
|
|
10
|
+
};
|
|
24
11
|
}
|
|
25
12
|
function createParseDomAttrs(dom) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
13
|
+
return {
|
|
14
|
+
nodeHeight: dom.getAttribute("data-node-height"),
|
|
15
|
+
nodeWidth: dom.getAttribute("data-node-width"),
|
|
16
|
+
nodePageWidth: dom.getAttribute("data-node-page-width"),
|
|
17
|
+
nodeFullWidth: dom.getAttribute("data-node-full-width")
|
|
18
|
+
};
|
|
32
19
|
}
|
|
33
20
|
function createToDomAttrs({ nodeHeight, nodeWidth, nodePageWidth, nodeFullWidth }) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
21
|
+
return {
|
|
22
|
+
"data-node-height": nodeHeight,
|
|
23
|
+
"data-node-width": nodeWidth,
|
|
24
|
+
"data-node-page-width": nodePageWidth,
|
|
25
|
+
"data-node-full-width": nodeFullWidth
|
|
26
|
+
};
|
|
40
27
|
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { createDefaultAttrs, createParseDomAttrs, createToDomAttrs, defaultHeight, defaultWidth };
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
//#region src/transcription-node-attrs.d.ts
|
|
2
|
+
declare function createDefaultAttrs(): {
|
|
3
|
+
transcription: {
|
|
4
|
+
default: {
|
|
5
|
+
status: string;
|
|
6
|
+
userId: string;
|
|
7
|
+
inserted: boolean;
|
|
8
8
|
};
|
|
9
|
+
};
|
|
9
10
|
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { createDefaultAttrs };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createDefaultAttrs = createDefaultAttrs;
|
|
1
|
+
//#region src/transcription-node-attrs.ts
|
|
4
2
|
function createDefaultAttrs() {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
return { transcription: { default: {
|
|
4
|
+
status: "IDLE",
|
|
5
|
+
userId: "",
|
|
6
|
+
inserted: false
|
|
7
|
+
} } };
|
|
10
8
|
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { createDefaultAttrs };
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Node as Node$1, ParseOptions, Schema } from "prosemirror-model";
|
|
2
|
+
//#region test-helpers/index.d.ts
|
|
3
|
+
declare const fromHTML: (html: string, schema: Schema, options?: ParseOptions) => Node$1;
|
|
4
|
+
declare const toDOM: (node: Node$1, schema: Schema) => Node;
|
|
5
|
+
declare const toHTML: (node: Node$1, schema: Schema) => string;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { fromHTML, toDOM, toHTML };
|
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.toHTML = exports.toDOM = exports.fromHTML = void 0;
|
|
4
|
-
const prosemirror_model_1 = require("prosemirror-model");
|
|
1
|
+
import { DOMParser, DOMSerializer, Fragment } from "prosemirror-model";
|
|
2
|
+
//#region test-helpers/index.ts
|
|
5
3
|
const fromHTML = (html, schema, options) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
const el = document.createElement("div");
|
|
5
|
+
el.innerHTML = html;
|
|
6
|
+
return DOMParser.fromSchema(schema).parse(el, options);
|
|
9
7
|
};
|
|
10
|
-
exports.fromHTML = fromHTML;
|
|
11
8
|
const toDOM = (node, schema) => {
|
|
12
|
-
|
|
13
|
-
return serializer.serializeFragment(prosemirror_model_1.Fragment.from(node));
|
|
9
|
+
return DOMSerializer.fromSchema(schema).serializeFragment(Fragment.from(node));
|
|
14
10
|
};
|
|
15
|
-
exports.toDOM = toDOM;
|
|
16
11
|
const toHTML = (node, schema) => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
const el = document.createElement("div");
|
|
13
|
+
el.appendChild(toDOM(node, schema));
|
|
14
|
+
return el.innerHTML;
|
|
20
15
|
};
|
|
21
|
-
|
|
16
|
+
//#endregion
|
|
17
|
+
export { fromHTML, toDOM, toHTML };
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fibery/prosemirror-schema",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.23.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Fibery prosemirror schema",
|
|
6
6
|
"files": [
|
|
7
7
|
"/lib"
|
|
8
8
|
],
|
|
9
|
+
"type": "module",
|
|
9
10
|
"main": "./lib/index.js",
|
|
10
11
|
"exports": {
|
|
11
12
|
".": {
|
|
@@ -29,16 +30,22 @@
|
|
|
29
30
|
"uuid": "11.1.0"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
|
-
"
|
|
33
|
-
"
|
|
33
|
+
"tsdown": "0.22.7",
|
|
34
|
+
"typescript": "rc"
|
|
34
35
|
},
|
|
35
36
|
"peerDependencies": {
|
|
36
37
|
"prosemirror-model": "1.25.4",
|
|
37
38
|
"prosemirror-schema-list": "1.5.1",
|
|
38
39
|
"prosemirror-tables": "1.8.5"
|
|
39
40
|
},
|
|
41
|
+
"size-limit": [
|
|
42
|
+
{
|
|
43
|
+
"path": "lib/**/*.js",
|
|
44
|
+
"limit": "17 kB"
|
|
45
|
+
}
|
|
46
|
+
],
|
|
40
47
|
"scripts": {
|
|
41
|
-
"build": "
|
|
48
|
+
"build": "pnpm run typecheck && tsdown",
|
|
42
49
|
"test": "../../scripts/test.sh",
|
|
43
50
|
"test:ci": "../../scripts/test.sh --ci",
|
|
44
51
|
"test:coverage": "../../scripts/test.sh --ci --coverage",
|