@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.
@@ -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 ? `--${markType}-background-color:${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 };
@@ -10,7 +10,6 @@ type Meta = {
10
10
  export interface EntityAttributes {
11
11
  id: string;
12
12
  typeId: string;
13
- text?: string;
14
13
  meta: Meta;
15
14
  }
16
15
  export interface EntityDefinition {
@@ -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, text, meta } = node.attrs;
32
- return [
33
- "span",
34
- {
35
- "data-entity-id": id,
36
- "data-entity-type-id": typeId,
37
- "data-comment": meta.comment,
38
- "data-anchor": meta.anchor,
39
- "data-field": meta.field,
40
- "data-context-entity-type-id": meta.contextEntityTypeId,
41
- "data-context-entity-public-id": meta.contextEntityPublicId,
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
@@ -29,7 +29,7 @@ export declare const file: {
29
29
  inline: true;
30
30
  group: string;
31
31
  selectable: false;
32
- draggable: false;
32
+ draggable: true;
33
33
  leafText: (node: import("prosemirror-model").Node) => any;
34
34
  parseDOM: {
35
35
  tag: string;
package/lib/nodes/file.js CHANGED
@@ -21,7 +21,7 @@ const file = {
21
21
  inline: true,
22
22
  group: "inline",
23
23
  selectable: false,
24
- draggable: false,
24
+ draggable: true,
25
25
  leafText: (node) => node.attrs.title,
26
26
  parseDOM: [{
27
27
  tag: "span[data-file-href]",
@@ -3,7 +3,6 @@ import { NodeSpec } from "prosemirror-model";
3
3
  export interface MentionAttributes {
4
4
  id: string;
5
5
  typeId: string;
6
- name?: string;
7
6
  }
8
7
  export interface MentionDefinition {
9
8
  type: "mention";
@@ -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, name } = node.attrs;
25
- return [
26
- "span",
27
- {
28
- "data-mention-id": id,
29
- "data-mention-type-id": typeId,
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": "5.0.0",
3
+ "version": "7.0.0",
4
4
  "description": "Fibery prosemirror schema",
5
5
  "license": "UNLICENSED",
6
6
  "files": [