@fibery/prosemirror-schema 3.0.0-next.2 → 3.1.0-next.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/src/create-schema.js +2 -0
- package/lib/src/nodes/file.d.ts +32 -0
- package/lib/src/nodes/file.js +38 -0
- package/package.json +1 -1
package/lib/src/create-schema.js
CHANGED
|
@@ -20,6 +20,7 @@ const check_list_1 = require("./nodes/check-list");
|
|
|
20
20
|
const check_item_1 = require("./nodes/check-item");
|
|
21
21
|
const code_block_1 = require("./nodes/code-block");
|
|
22
22
|
const video_1 = require("./nodes/video");
|
|
23
|
+
const file_1 = require("./nodes/file");
|
|
23
24
|
const strike_1 = require("./marks/strike");
|
|
24
25
|
const underline_1 = require("./marks/underline");
|
|
25
26
|
const hint_query_1 = require("./marks/hint-query");
|
|
@@ -42,6 +43,7 @@ const createSchema = ({ sharedColorGenerator = null, headingToDOM = null, mediaT
|
|
|
42
43
|
check_item: check_item_1.check_item,
|
|
43
44
|
check_list: check_list_1.check_list,
|
|
44
45
|
video: video_1.video,
|
|
46
|
+
file: file_1.file,
|
|
45
47
|
};
|
|
46
48
|
let actualNodes = (0, prosemirror_schema_list_1.addListNodes)(base.spec.nodes, "paragraph block*", "block")
|
|
47
49
|
.append({ ...table_nodes_1.tableNodes })
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare const file: {
|
|
2
|
+
attrs: {
|
|
3
|
+
src: {};
|
|
4
|
+
title: {
|
|
5
|
+
default: null;
|
|
6
|
+
};
|
|
7
|
+
size: {
|
|
8
|
+
default: null;
|
|
9
|
+
};
|
|
10
|
+
type: {
|
|
11
|
+
default: null;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
inline: false;
|
|
15
|
+
group: string;
|
|
16
|
+
selectable: false;
|
|
17
|
+
draggable: true;
|
|
18
|
+
parseDOM: {
|
|
19
|
+
tag: string;
|
|
20
|
+
getAttrs(domNode: string | HTMLElement): {
|
|
21
|
+
src: string | null;
|
|
22
|
+
title: string | null;
|
|
23
|
+
size: string | null;
|
|
24
|
+
type: string | null;
|
|
25
|
+
};
|
|
26
|
+
}[];
|
|
27
|
+
toDOM(node: import("prosemirror-model").Node): [string, {
|
|
28
|
+
"data-file-href": any;
|
|
29
|
+
"data-size": any;
|
|
30
|
+
"data-type": any;
|
|
31
|
+
}, any];
|
|
32
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.file = void 0;
|
|
4
|
+
exports.file = {
|
|
5
|
+
attrs: {
|
|
6
|
+
src: {},
|
|
7
|
+
title: { default: null },
|
|
8
|
+
size: { default: null },
|
|
9
|
+
type: { default: null },
|
|
10
|
+
},
|
|
11
|
+
inline: false,
|
|
12
|
+
group: "block",
|
|
13
|
+
selectable: false,
|
|
14
|
+
draggable: true,
|
|
15
|
+
parseDOM: [
|
|
16
|
+
{
|
|
17
|
+
tag: "div[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
|
+
],
|
|
29
|
+
toDOM(node) {
|
|
30
|
+
const { src, title, type, size } = node.attrs;
|
|
31
|
+
const attrs = {
|
|
32
|
+
"data-file-href": src,
|
|
33
|
+
"data-size": size,
|
|
34
|
+
"data-type": type,
|
|
35
|
+
};
|
|
36
|
+
return ["div", attrs, title];
|
|
37
|
+
},
|
|
38
|
+
};
|