@blocknote/core 0.57.0 → 0.57.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.
Files changed (3) hide show
  1. package/dist/y.js +13 -7
  2. package/dist/yjs.js +14 -11
  3. package/package.json +1 -1
package/dist/y.js CHANGED
@@ -250,12 +250,12 @@ function De(e) {
250
250
  return .2126 * a[0] + .7152 * a[1] + .0722 * a[2] <= .179;
251
251
  }
252
252
  function Oe(e) {
253
- let t = document.createElement("span");
254
- t.classList.add("bn-collaboration-cursor__base");
255
- let n = document.createElement("span");
256
- n.setAttribute("contentedEditable", "false"), n.classList.add("bn-collaboration-cursor__caret"), n.setAttribute("style", `background-color: ${e.color}; color: ${De(e.color) ? "white" : "black"}`);
257
- let r = document.createElement("span");
258
- return r.classList.add("bn-collaboration-cursor__label"), r.setAttribute("style", `background-color: ${e.color}; color: ${De(e.color) ? "white" : "black"}`), r.insertBefore(document.createTextNode(e.name), null), n.insertBefore(r, null), t.insertBefore(document.createTextNode("⁠"), null), t.insertBefore(n, null), t.insertBefore(document.createTextNode("⁠"), null), t;
253
+ let t = typeof e.color == "string" ? e.color : "#ffa500", n = De(t) ? "white" : "black", r = document.createElement("span");
254
+ r.classList.add("bn-collaboration-cursor__base");
255
+ let i = document.createElement("span");
256
+ i.setAttribute("contentedEditable", "false"), i.classList.add("bn-collaboration-cursor__caret"), i.style.backgroundColor = t, i.style.color = n;
257
+ let a = document.createElement("span");
258
+ return a.classList.add("bn-collaboration-cursor__label"), a.style.backgroundColor = t, a.style.color = n, a.insertBefore(document.createTextNode(e.name), null), i.insertBefore(a, null), r.insertBefore(document.createTextNode("⁠"), null), r.insertBefore(i, null), r.insertBefore(document.createTextNode("⁠"), null), r;
259
259
  }
260
260
  var F = p(({ options: e }) => {
261
261
  let t = /* @__PURE__ */ new Map(), n = e.provider && "awareness" in e.provider && typeof e.provider.awareness == "object" ? e.provider.awareness : void 0;
@@ -274,7 +274,13 @@ var F = p(({ options: e }) => {
274
274
  })), {
275
275
  key: "yCursor",
276
276
  prosemirrorPlugins: [n ? he(n, {
277
- selectionBuilder: ie,
277
+ selectionBuilder(e) {
278
+ let t = document.createElement("span").style;
279
+ return typeof e.color == "string" && (t.backgroundColor = e.color), ie({
280
+ ...e,
281
+ color: t.backgroundColor || "#ffa500"
282
+ });
283
+ },
278
284
  cursorBuilder(n, r) {
279
285
  let i = t.get(r);
280
286
  if (!i) {
package/dist/yjs.js CHANGED
@@ -38,13 +38,13 @@ function A(t, n) {
38
38
  let r = T(n, t.pmSchema);
39
39
  return e(r);
40
40
  }
41
- function j(e, t, n) {
41
+ function ee(e, t, n) {
42
42
  return g(k(e, t), n);
43
43
  }
44
- function ee(e, t, n = "prosemirror") {
44
+ function te(e, t, n = "prosemirror") {
45
45
  return A(e, t.getXmlFragment(n));
46
46
  }
47
- function te(e, t, n = "prosemirror") {
47
+ function j(e, t, n = "prosemirror") {
48
48
  return h(k(e, t), n);
49
49
  }
50
50
  // src/yjs/extensions/FixUpSchema.ts
@@ -72,12 +72,12 @@ function N(e) {
72
72
  return .2126 * a[0] + .7152 * a[1] + .0722 * a[2] <= .179;
73
73
  }
74
74
  function P(e) {
75
- let t = document.createElement("span");
76
- t.classList.add("bn-collaboration-cursor__base");
77
- let n = document.createElement("span");
78
- n.setAttribute("contentedEditable", "false"), n.classList.add("bn-collaboration-cursor__caret"), n.setAttribute("style", `background-color: ${e.color}; color: ${N(e.color) ? "white" : "black"}`);
79
- let r = document.createElement("span");
80
- return r.classList.add("bn-collaboration-cursor__label"), r.setAttribute("style", `background-color: ${e.color}; color: ${N(e.color) ? "white" : "black"}`), r.insertBefore(document.createTextNode(e.name), null), n.insertBefore(r, null), t.insertBefore(document.createTextNode("⁠"), null), t.insertBefore(n, null), t.insertBefore(document.createTextNode("⁠"), null), t;
75
+ let t = typeof e.color == "string" ? e.color : "#ffa500", n = N(t) ? "white" : "black", r = document.createElement("span");
76
+ r.classList.add("bn-collaboration-cursor__base");
77
+ let i = document.createElement("span");
78
+ i.setAttribute("contentedEditable", "false"), i.classList.add("bn-collaboration-cursor__caret"), i.style.backgroundColor = t, i.style.color = n;
79
+ let a = document.createElement("span");
80
+ return a.classList.add("bn-collaboration-cursor__label"), a.style.backgroundColor = t, a.style.color = n, a.insertBefore(document.createTextNode(e.name), null), i.insertBefore(a, null), r.insertBefore(document.createTextNode("⁠"), null), r.insertBefore(i, null), r.insertBefore(document.createTextNode("⁠"), null), r;
81
81
  }
82
82
  var F = o(({ options: e }) => {
83
83
  let t = /* @__PURE__ */ new Map(), n = e.provider && "awareness" in e.provider && typeof e.provider.awareness == "object" ? e.provider.awareness : void 0;
@@ -103,7 +103,10 @@ var F = o(({ options: e }) => {
103
103
  };
104
104
  },
105
105
  prosemirrorPlugins: [n ? b(n, {
106
- selectionBuilder: m,
106
+ selectionBuilder(e) {
107
+ let t = typeof e.color == "string" && /^#[0-9a-f]{6}$/i.test(e.color) ? e.color : "#ffa500";
108
+ return m({ color: t });
109
+ },
107
110
  cursorBuilder(n, r) {
108
111
  let i = t.get(r);
109
112
  if (!i) {
@@ -596,4 +599,4 @@ function $(e, t) {
596
599
  }
597
600
  };
598
601
  }
599
- export { U as CollaborationExtension, R as ForkYDocExtension, ne as RESTYjsThreadStore, z as RelativePositionMappingExtension, H as SchemaMigration, F as YCursorExtension, I as YSyncExtension, L as YUndoExtension, re as YjsThreadStore, Z as YjsThreadStoreBase, ie as YjsVersioningExtension, k as _blocksToProsemirrorNode, O as _prosemirrorJSONToBlocks, te as blocksToYDoc, j as blocksToYXmlFragment, $ as createYjsVersionView, D as findTypeInOtherYdoc, W as withCollaboration, ee as yDocToBlocks, A as yXmlFragmentToBlocks };
602
+ export { U as CollaborationExtension, R as ForkYDocExtension, ne as RESTYjsThreadStore, z as RelativePositionMappingExtension, H as SchemaMigration, F as YCursorExtension, I as YSyncExtension, L as YUndoExtension, re as YjsThreadStore, Z as YjsThreadStoreBase, ie as YjsVersioningExtension, k as _blocksToProsemirrorNode, O as _prosemirrorJSONToBlocks, j as blocksToYDoc, ee as blocksToYXmlFragment, $ as createYjsVersionView, D as findTypeInOtherYdoc, W as withCollaboration, te as yDocToBlocks, A as yXmlFragmentToBlocks };
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "directory": "packages/core"
12
12
  },
13
13
  "license": "MPL-2.0",
14
- "version": "0.57.0",
14
+ "version": "0.57.1",
15
15
  "files": [
16
16
  "dist/*.js",
17
17
  "dist/*.css",