@fibery/prosemirror-schema 5.0.0 → 7.0.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/marks/linked-highlight.js +4 -4
- package/lib/nodes/entity.d.ts +0 -1
- package/lib/nodes/entity.js +11 -17
- package/lib/nodes/file.d.ts +1 -1
- package/lib/nodes/file.js +1 -1
- package/lib/nodes/mention.d.ts +0 -1
- package/lib/nodes/mention.js +6 -12
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/marks/linked-highlight.ts
|
|
2
2
|
const hyphenatePascal = (str) => str.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/([A-Z]{2})[a-z]/, "$1-").toLowerCase();
|
|
3
|
-
const createMark = (markType, sharedColorGenerator) => {
|
|
3
|
+
const createMark = (markType, backgroundProperty, sharedColorGenerator) => {
|
|
4
4
|
const markTag = `span.${markType}`;
|
|
5
5
|
const markClassName = `${markType}`;
|
|
6
6
|
const preserveBool = (attr) => attr === "true" ? true : attr === "false" ? false : attr;
|
|
@@ -27,7 +27,7 @@ const createMark = (markType, sharedColorGenerator) => {
|
|
|
27
27
|
const color = sharedColorGenerator ? sharedColorGenerator.generate(attrs) : "#EEEEEE";
|
|
28
28
|
return [markTag, {
|
|
29
29
|
class: markClassName,
|
|
30
|
-
style: color ?
|
|
30
|
+
style: color ? `${backgroundProperty}:${color}` : ``,
|
|
31
31
|
"data-id": id,
|
|
32
32
|
...Object.fromEntries(Object.keys(meta).filter((key) => meta[key] !== false).map((key) => [`data-${hyphenatePascal(key)}`, JSON.stringify(meta[key])]))
|
|
33
33
|
}];
|
|
@@ -35,10 +35,10 @@ const createMark = (markType, sharedColorGenerator) => {
|
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
37
|
const makeLinkedHighlight = ({ sharedColorGenerator }) => {
|
|
38
|
-
return createMark("linkedhighlight", sharedColorGenerator);
|
|
38
|
+
return createMark("linkedhighlight", "--dynamic-bg-linked-highlight", sharedColorGenerator);
|
|
39
39
|
};
|
|
40
40
|
const makeLinkedHighlightEntity = ({ sharedColorGenerator }) => {
|
|
41
|
-
return createMark("linkedhighlightentity", sharedColorGenerator);
|
|
41
|
+
return createMark("linkedhighlightentity", "--dynamic-bg-linked-highlight-entity", sharedColorGenerator);
|
|
42
42
|
};
|
|
43
43
|
//#endregion
|
|
44
44
|
export { makeLinkedHighlight, makeLinkedHighlightEntity };
|
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/file.d.ts
CHANGED
package/lib/nodes/file.js
CHANGED
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
|