@edifice.io/react 2.6.10-develop-pedago.20261022103835 → 2.6.10-develop-pedago.20261022131512

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.
@@ -90,7 +90,16 @@ const useTipTapEditor = (editable, content, focus, placeholder, onContentChange,
90
90
  TextAlign.configure({
91
91
  types: ["heading", "paragraph", "video", "audio", "iframe"]
92
92
  }),
93
- CustomHeading.configure({
93
+ // The published package names this node 'customHeading' (to avoid
94
+ // colliding with v3 StarterKit's now-bundled 'heading', disabled
95
+ // above). Pinned back to 'heading' to match what's already stored for
96
+ // existing content, and what edifice-tiptap-transformer's own Heading
97
+ // model does server-side - without this, loading any stored content
98
+ // with a heading throws "Unknown node type: heading" and the editor
99
+ // falls back to an empty document.
100
+ CustomHeading.extend({
101
+ name: "heading"
102
+ }).configure({
94
103
  levels: [1, 2]
95
104
  }),
96
105
  Typography,
@@ -1,3 +1,4 @@
1
+ import { ReactNode } from 'react';
1
2
  import { App, ILinkedResource } from '@edifice.io/client';
2
3
  /**
3
4
  * Definition of an internal link.
@@ -32,6 +33,11 @@ export interface InternalLinkerProps {
32
33
  applicationList?: ApplicationOption[];
33
34
  /** Whether to show the application selector */
34
35
  showApplicationSelector?: boolean;
36
+ /**
37
+ * Rendered on the search row, where the application selector sits, for
38
+ * consumers that hide that selector but still need a filter of their own.
39
+ */
40
+ searchFilter?: ReactNode;
35
41
  /** Disable application selecetor */
36
42
  disableApplicationSelector?: boolean;
37
43
  /** Optional callback to filter resources after loading. Applied in addition to search filters. */
@@ -49,5 +55,5 @@ export interface InternalLinkerProps {
49
55
  /** Label for the "load more" button. Defaults to the `bbm.linker.see.more` i18n key. */
50
56
  loadMoreLabel?: string;
51
57
  }
52
- export declare const InternalLinker: ({ appCode, defaultAppCode, defaultResourceId, onChange, onSelect, multiple, resourceList, applicationList, showApplicationSelector, disableApplicationSelector, resourceFilter, onSearch, hasMoreResources, onLoadMore, loadMoreLabel, }: InternalLinkerProps) => import("react/jsx-runtime").JSX.Element;
58
+ export declare const InternalLinker: ({ appCode, defaultAppCode, defaultResourceId, onChange, onSelect, multiple, resourceList, applicationList, showApplicationSelector, searchFilter, disableApplicationSelector, resourceFilter, onSearch, hasMoreResources, onLoadMore, loadMoreLabel, }: InternalLinkerProps) => import("react/jsx-runtime").JSX.Element;
53
59
  export default InternalLinker;
@@ -23,6 +23,7 @@ const InternalLinker = ({
23
23
  resourceList,
24
24
  applicationList,
25
25
  showApplicationSelector = !0,
26
+ searchFilter,
26
27
  disableApplicationSelector = !1,
27
28
  resourceFilter,
28
29
  onSearch,
@@ -131,6 +132,7 @@ const InternalLinker = ({
131
132
  ] }), variant: "ghost", size: "md", disabled: disableApplicationSelector }),
132
133
  /* @__PURE__ */ jsx(Dropdown.Menu, { children: options == null ? void 0 : options.map((option) => /* @__PURE__ */ jsx(Dropdown.Item, { icon: option.icon, onClick: () => handleOptionClick(option), children: option.displayName }, option.application)) })
133
134
  ] }) }),
135
+ !showApplicationSelector && searchFilter && /* @__PURE__ */ jsx("div", { className: "flex-shrink-1 px-8 py-12 border-end align-self-center", children: searchFilter }),
134
136
  /* @__PURE__ */ jsx("div", { className: "flex-grow-1 align-self-center", children: /* @__PURE__ */ jsx("form", { className: "gap-16 d-flex w-100 align-items-center px-16 py-8", onSubmit: handleSubmit, children: /* @__PURE__ */ jsx(SearchBar, { isVariant: !0, placeholder: t("search"), size: "lg", className: "w-100", disabled: !selectedApplication, onChange: handleSearchChange }) }) })
135
137
  ] }),
136
138
  /* @__PURE__ */ jsxs("div", { className: "internal-linker flex-grow-1 w-100 rounded-bottom border gap-0 overflow-auto", children: [
@@ -311,6 +311,135 @@ const found = { index: 0, offset: 0 };
311
311
  function retIndex(index, offset) {
312
312
  return found.index = index, found.offset = offset, found;
313
313
  }
314
+ function compareDeep(a, b) {
315
+ if (a === b)
316
+ return !0;
317
+ if (!(a && typeof a == "object") || !(b && typeof b == "object"))
318
+ return !1;
319
+ let array = Array.isArray(a);
320
+ if (Array.isArray(b) != array)
321
+ return !1;
322
+ if (array) {
323
+ if (a.length != b.length)
324
+ return !1;
325
+ for (let i = 0; i < a.length; i++)
326
+ if (!compareDeep(a[i], b[i]))
327
+ return !1;
328
+ } else {
329
+ for (let p in a)
330
+ if (!(p in b) || !compareDeep(a[p], b[p]))
331
+ return !1;
332
+ for (let p in b)
333
+ if (!(p in a))
334
+ return !1;
335
+ }
336
+ return !0;
337
+ }
338
+ class Mark {
339
+ /**
340
+ @internal
341
+ */
342
+ constructor(type, attrs) {
343
+ this.type = type, this.attrs = attrs;
344
+ }
345
+ /**
346
+ Given a set of marks, create a new set which contains this one as
347
+ well, in the right position. If this mark is already in the set,
348
+ the set itself is returned. If any marks that are set to be
349
+ [exclusive](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) with this mark are present,
350
+ those are replaced by this one.
351
+ */
352
+ addToSet(set) {
353
+ let copy, placed = !1;
354
+ for (let i = 0; i < set.length; i++) {
355
+ let other = set[i];
356
+ if (this.eq(other))
357
+ return set;
358
+ if (this.type.excludes(other.type))
359
+ copy || (copy = set.slice(0, i));
360
+ else {
361
+ if (other.type.excludes(this.type))
362
+ return set;
363
+ !placed && other.type.rank > this.type.rank && (copy || (copy = set.slice(0, i)), copy.push(this), placed = !0), copy && copy.push(other);
364
+ }
365
+ }
366
+ return copy || (copy = set.slice()), placed || copy.push(this), copy;
367
+ }
368
+ /**
369
+ Remove this mark from the given set, returning a new set. If this
370
+ mark is not in the set, the set itself is returned.
371
+ */
372
+ removeFromSet(set) {
373
+ for (let i = 0; i < set.length; i++)
374
+ if (this.eq(set[i]))
375
+ return set.slice(0, i).concat(set.slice(i + 1));
376
+ return set;
377
+ }
378
+ /**
379
+ Test whether this mark is in the given set of marks.
380
+ */
381
+ isInSet(set) {
382
+ for (let i = 0; i < set.length; i++)
383
+ if (this.eq(set[i]))
384
+ return !0;
385
+ return !1;
386
+ }
387
+ /**
388
+ Test whether this mark has the same type and attributes as
389
+ another mark.
390
+ */
391
+ eq(other) {
392
+ return this == other || this.type == other.type && compareDeep(this.attrs, other.attrs);
393
+ }
394
+ /**
395
+ Convert this mark to a JSON-serializeable representation.
396
+ */
397
+ toJSON() {
398
+ let obj = { type: this.type.name };
399
+ for (let _ in this.attrs) {
400
+ obj.attrs = this.attrs;
401
+ break;
402
+ }
403
+ return obj;
404
+ }
405
+ /**
406
+ Deserialize a mark from JSON.
407
+ */
408
+ static fromJSON(schema, json) {
409
+ if (!json)
410
+ throw new RangeError("Invalid input for Mark.fromJSON");
411
+ let type = schema.marks[json.type];
412
+ if (!type)
413
+ throw new RangeError(`There is no mark type ${json.type} in this schema`);
414
+ return type.create(json.attrs);
415
+ }
416
+ /**
417
+ Test whether two sets of marks are identical.
418
+ */
419
+ static sameSet(a, b) {
420
+ if (a == b)
421
+ return !0;
422
+ if (a.length != b.length)
423
+ return !1;
424
+ for (let i = 0; i < a.length; i++)
425
+ if (!a[i].eq(b[i]))
426
+ return !1;
427
+ return !0;
428
+ }
429
+ /**
430
+ Create a properly sorted mark set from null, a single mark, or an
431
+ unsorted array of marks.
432
+ */
433
+ static setFrom(marks) {
434
+ if (!marks || Array.isArray(marks) && marks.length == 0)
435
+ return Mark.none;
436
+ if (marks instanceof Mark)
437
+ return [marks];
438
+ let copy = marks.slice();
439
+ return copy.sort((a, b) => a.type.rank - b.type.rank), copy;
440
+ }
441
+ }
442
+ Mark.none = [];
314
443
  class ReplaceError extends Error {
315
444
  }
316
445
  class Slice {
@@ -414,6 +543,7 @@ function insertInto(content, dist, insert, openStart, openEnd, parent) {
414
543
  }
415
544
  export {
416
545
  Fragment,
546
+ Mark,
417
547
  ReplaceError,
418
548
  Slice
419
549
  };
@@ -1,5 +1,5 @@
1
1
  import { Slice, Fragment } from "../../../../prosemirror-model@1.25.12/node_modules/prosemirror-model/dist/index.js";
2
- import { ReplaceStep, ReplaceAroundStep } from "../../../../prosemirror-transform@1.12.2/node_modules/prosemirror-transform/dist/index.js";
2
+ import { ReplaceStep, ReplaceAroundStep } from "../../../../prosemirror-transform@1.12.3/node_modules/prosemirror-transform/dist/index.js";
3
3
  const classesById = /* @__PURE__ */ Object.create(null);
4
4
  class Selection {
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { Slice, ReplaceError, Fragment } from "../../../../prosemirror-model@1.25.12/node_modules/prosemirror-model/dist/index.js";
1
+ import { Slice, ReplaceError, Mark, Fragment } from "../../../../prosemirror-model@1.25.12/node_modules/prosemirror-model/dist/index.js";
2
2
  const lower16 = 65535, factor16 = Math.pow(2, 16);
3
3
  function makeRecover(index, offset) {
4
4
  return index + offset * factor16;
@@ -235,15 +235,28 @@ class AddMarkStep extends Step {
235
235
  super(), this.from = from, this.to = to, this.mark = mark;
236
236
  }
237
237
  apply(doc) {
238
+ if (this.from == this.to)
239
+ return new StepResult(doc, null);
238
240
  let oldSlice = doc.slice(this.from, this.to), $from = doc.resolve(this.from), parent = $from.node($from.sharedDepth(this.to)), slice = new Slice(mapFragment(oldSlice.content, (node, parent2) => !node.isAtom || !parent2.type.allowsMarkType(this.mark.type) ? node : node.mark(this.mark.addToSet(node.marks)), parent), oldSlice.openStart, oldSlice.openEnd);
239
241
  return StepResult.fromReplace(doc, this.from, this.to, slice);
240
242
  }
241
- invert() {
242
- return new RemoveMarkStep(this.from, this.to, this.mark);
243
+ invert(doc) {
244
+ let steps = [];
245
+ return doc.nodesBetween(this.from, this.to, (node, pos) => {
246
+ if (node.isInline && node.isAtom) {
247
+ let added = this.mark.addToSet(node.marks);
248
+ if (!Mark.sameSet(added, node.marks)) {
249
+ let from = Math.max(this.from, pos), to = Math.min(this.to, pos + node.nodeSize);
250
+ steps.push(new RemoveMarkStep(from, to, this.mark));
251
+ for (let mark of node.marks)
252
+ mark.isInSet(added) || steps.push(new AddMarkStep(from, to, mark));
253
+ }
254
+ }
255
+ }), steps.length == 0 ? new RemoveMarkStep(this.from, this.from, this.mark) : steps.length == 1 ? steps[0] : new MarkSetStep(steps);
243
256
  }
244
257
  map(mapping) {
245
- let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
246
- return from.deleted && to.deleted || from.pos >= to.pos ? null : new AddMarkStep(from.pos, to.pos, this.mark);
258
+ let from = mapping.map(this.from, 1), to = mapping.map(this.to, -1);
259
+ return from >= to ? null : new AddMarkStep(from, to, this.mark);
247
260
  }
248
261
  merge(other) {
249
262
  return other instanceof AddMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from ? new AddMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark) : null;
@@ -274,15 +287,20 @@ class RemoveMarkStep extends Step {
274
287
  super(), this.from = from, this.to = to, this.mark = mark;
275
288
  }
276
289
  apply(doc) {
290
+ if (this.from == this.to)
291
+ return new StepResult(doc, null);
277
292
  let oldSlice = doc.slice(this.from, this.to), slice = new Slice(mapFragment(oldSlice.content, (node) => node.mark(this.mark.removeFromSet(node.marks)), doc), oldSlice.openStart, oldSlice.openEnd);
278
293
  return StepResult.fromReplace(doc, this.from, this.to, slice);
279
294
  }
280
- invert() {
281
- return new AddMarkStep(this.from, this.to, this.mark);
295
+ invert(doc) {
296
+ let steps = [];
297
+ return doc.nodesBetween(this.from, this.to, (node, pos) => {
298
+ node.isInline && node.isAtom && this.mark.isInSet(node.marks) && steps.push(new AddMarkStep(Math.max(this.from, pos), Math.min(this.to, pos + node.nodeSize), this.mark));
299
+ }), steps.length == 0 ? new AddMarkStep(this.from, this.from, this.mark) : steps.length == 1 ? steps[0] : new MarkSetStep(steps);
282
300
  }
283
301
  map(mapping) {
284
- let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
285
- return from.deleted && to.deleted || from.pos >= to.pos ? null : new RemoveMarkStep(from.pos, to.pos, this.mark);
302
+ let from = mapping.map(this.from, 1), to = mapping.map(this.to, -1);
303
+ return from >= to ? null : new RemoveMarkStep(from, to, this.mark);
286
304
  }
287
305
  merge(other) {
288
306
  return other instanceof RemoveMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from ? new RemoveMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark) : null;
@@ -305,6 +323,40 @@ class RemoveMarkStep extends Step {
305
323
  }
306
324
  }
307
325
  Step.jsonID("removeMark", RemoveMarkStep);
326
+ class MarkSetStep extends Step {
327
+ constructor(steps) {
328
+ super(), this.steps = steps;
329
+ }
330
+ apply(doc) {
331
+ for (let step of this.steps) {
332
+ let result = step.apply(doc);
333
+ if (!result.doc)
334
+ return result;
335
+ doc = result.doc;
336
+ }
337
+ return new StepResult(doc, null);
338
+ }
339
+ invert(doc) {
340
+ return new MarkSetStep(this.steps.map((s) => s.invert(doc)));
341
+ }
342
+ map(mapping) {
343
+ let result = [];
344
+ for (let step of this.steps) {
345
+ let mapped = step.map(mapping);
346
+ mapped && result.push(mapped);
347
+ }
348
+ return result.length ? new MarkSetStep(result) : null;
349
+ }
350
+ toJSON() {
351
+ return { stepType: "markSet", steps: this.steps.map((s) => s.toJSON()) };
352
+ }
353
+ fromJSON(schema, json) {
354
+ if (!Array.isArray(json.steps) || !json.steps.every((s) => s.stepType == "addMark" || s.stepType == "removeMark"))
355
+ throw new RangeError("Invalid JSON for MarkSetStep");
356
+ return new MarkSetStep(json.steps.map((s) => Step.fromJSON(schema, s)));
357
+ }
358
+ }
359
+ Step.jsonID("markSet", MarkSetStep);
308
360
  class AddNodeMarkStep extends Step {
309
361
  /**
310
362
  Create a node mark step.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/react",
3
- "version": "2.6.10-develop-pedago.20261022103835",
3
+ "version": "2.6.10-develop-pedago.20261022131512",
4
4
  "description": "Edifice React Library",
5
5
  "keywords": [
6
6
  "react",
@@ -132,9 +132,9 @@
132
132
  "swiper": "10.1.0",
133
133
  "ua-parser-js": "1.0.36",
134
134
  "zustand": "4.5.7",
135
- "@edifice.io/bootstrap": "2.6.10-develop-pedago.20261022103835",
136
- "@edifice.io/utilities": "2.6.10-develop-pedago.20261022103835",
137
- "@edifice.io/tiptap-extensions": "2.6.10-develop-pedago.20261022103835"
135
+ "@edifice.io/tiptap-extensions": "2.6.10-develop-pedago.20261022131512",
136
+ "@edifice.io/bootstrap": "2.6.10-develop-pedago.20261022131512",
137
+ "@edifice.io/utilities": "2.6.10-develop-pedago.20261022131512"
138
138
  },
139
139
  "devDependencies": {
140
140
  "@babel/plugin-transform-react-pure-annotations": "7.27.1",
@@ -165,8 +165,8 @@
165
165
  "vite": "5.4.14",
166
166
  "vite-plugin-dts": "4.5.4",
167
167
  "vite-tsconfig-paths": "5.1.4",
168
- "@edifice.io/client": "2.6.10-develop-pedago.20261022103835",
169
- "@edifice.io/config": "2.6.10-develop-pedago.20261022103835"
168
+ "@edifice.io/client": "2.6.10-develop-pedago.20261022131512",
169
+ "@edifice.io/config": "2.6.10-develop-pedago.20261022131512"
170
170
  },
171
171
  "peerDependencies": {
172
172
  "@react-spring/web": "9.7.5",