@fibery/prosemirror-schema 6.0.1 → 7.0.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/create-schema.js +2 -1
- package/lib/nodes/entity.d.ts +0 -1
- package/lib/nodes/entity.js +11 -17
- package/lib/nodes/mention.d.ts +0 -1
- package/lib/nodes/mention.js +6 -12
- package/package.json +2 -1
package/lib/create-schema.js
CHANGED
|
@@ -30,6 +30,7 @@ import { note } from "./nodes/note.js";
|
|
|
30
30
|
import { paragraph } from "./nodes/paragraph.js";
|
|
31
31
|
import { tableNodes } from "./nodes/table-nodes.js";
|
|
32
32
|
import { video } from "./nodes/video.js";
|
|
33
|
+
import { isEmptyObject } from "@fibery/helpers/src/object";
|
|
33
34
|
import { Schema } from "prosemirror-model";
|
|
34
35
|
import { marks, nodes } from "prosemirror-schema-basic";
|
|
35
36
|
import { addListNodes } from "prosemirror-schema-list";
|
|
@@ -175,7 +176,7 @@ const createSchema = ({ sharedColorGenerator = null, headingToDOM = null, mediaT
|
|
|
175
176
|
const attrs = {};
|
|
176
177
|
if (state) attrs["data-check-item-state"] = state;
|
|
177
178
|
if (id) attrs["data-list-item-id"] = id;
|
|
178
|
-
return
|
|
179
|
+
return !isEmptyObject(attrs) ? [
|
|
179
180
|
"li",
|
|
180
181
|
attrs,
|
|
181
182
|
0
|
package/lib/nodes/entity.d.ts
CHANGED
package/lib/nodes/entity.js
CHANGED
|
@@ -5,7 +5,6 @@ const entity = {
|
|
|
5
5
|
selectable: false,
|
|
6
6
|
attrs: {
|
|
7
7
|
id: { default: "" },
|
|
8
|
-
text: { default: "" },
|
|
9
8
|
typeId: { default: "" },
|
|
10
9
|
meta: { default: {} }
|
|
11
10
|
},
|
|
@@ -21,28 +20,23 @@ const entity = {
|
|
|
21
20
|
meta.contextEntityPublicId = dom.getAttribute("data-context-entity-public-id") || "";
|
|
22
21
|
return {
|
|
23
22
|
id: dom.getAttribute("data-entity-id"),
|
|
24
|
-
text: dom.textContent,
|
|
25
23
|
typeId: dom.getAttribute("data-entity-type-id"),
|
|
26
24
|
meta
|
|
27
25
|
};
|
|
28
26
|
}
|
|
29
27
|
}],
|
|
30
28
|
toDOM(node) {
|
|
31
|
-
const { id, typeId,
|
|
32
|
-
return [
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
contenteditable: "false"
|
|
43
|
-
},
|
|
44
|
-
text
|
|
45
|
-
];
|
|
29
|
+
const { id, typeId, meta } = node.attrs;
|
|
30
|
+
return ["span", {
|
|
31
|
+
"data-entity-id": id,
|
|
32
|
+
"data-entity-type-id": typeId,
|
|
33
|
+
"data-comment": meta.comment,
|
|
34
|
+
"data-anchor": meta.anchor,
|
|
35
|
+
"data-field": meta.field,
|
|
36
|
+
"data-context-entity-type-id": meta.contextEntityTypeId,
|
|
37
|
+
"data-context-entity-public-id": meta.contextEntityPublicId,
|
|
38
|
+
contenteditable: "false"
|
|
39
|
+
}];
|
|
46
40
|
}
|
|
47
41
|
};
|
|
48
42
|
//#endregion
|
package/lib/nodes/mention.d.ts
CHANGED
package/lib/nodes/mention.js
CHANGED
|
@@ -5,7 +5,6 @@ const mention = {
|
|
|
5
5
|
selectable: false,
|
|
6
6
|
attrs: {
|
|
7
7
|
id: { default: "" },
|
|
8
|
-
name: { default: "" },
|
|
9
8
|
typeId: { default: "" },
|
|
10
9
|
meta: { default: {} }
|
|
11
10
|
},
|
|
@@ -15,22 +14,17 @@ const mention = {
|
|
|
15
14
|
const dom = domNode;
|
|
16
15
|
return {
|
|
17
16
|
id: dom.getAttribute("data-mention-id"),
|
|
18
|
-
name: dom.textContent,
|
|
19
17
|
typeId: dom.getAttribute("data-mention-type-id")
|
|
20
18
|
};
|
|
21
19
|
}
|
|
22
20
|
}],
|
|
23
21
|
toDOM(node) {
|
|
24
|
-
const { id, typeId
|
|
25
|
-
return [
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
contenteditable: "false"
|
|
31
|
-
},
|
|
32
|
-
name
|
|
33
|
-
];
|
|
22
|
+
const { id, typeId } = node.attrs;
|
|
23
|
+
return ["span", {
|
|
24
|
+
"data-mention-id": id,
|
|
25
|
+
"data-mention-type-id": typeId,
|
|
26
|
+
contenteditable: "false"
|
|
27
|
+
}];
|
|
34
28
|
}
|
|
35
29
|
};
|
|
36
30
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fibery/prosemirror-schema",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.1",
|
|
4
4
|
"description": "Fibery prosemirror schema",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"files": [
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
+
"@fibery/helpers": "6.0.0",
|
|
20
21
|
"prosemirror-model": "1.25.4",
|
|
21
22
|
"prosemirror-schema-basic": "1.2.2",
|
|
22
23
|
"prosemirror-schema-list": "1.5.1",
|