@pixerate/editor-react 0.208.0 → 0.209.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/dist/index.d.cts CHANGED
@@ -4,6 +4,7 @@ export { formatCommandsFor, type FormatManifest, type FormatManifestCommand, typ
4
4
  export * from "./hooks/useNavigationGuard.cjs";
5
5
  export * from "./hooks/useDismissGuard.cjs";
6
6
  export * from "./hooks/useHistory.cjs";
7
+ export * from "./hooks/useLinkFocus.cjs";
7
8
  export * from "./hooks/useHistoryDirty.cjs";
8
9
  export * from "./hooks/useHistoryShortcuts.cjs";
9
10
  export * from "./hooks/useFileImport.cjs";
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export { formatCommandsFor, type FormatManifest, type FormatManifestCommand, typ
4
4
  export * from "./hooks/useNavigationGuard.js";
5
5
  export * from "./hooks/useDismissGuard.js";
6
6
  export * from "./hooks/useHistory.js";
7
+ export * from "./hooks/useLinkFocus.js";
7
8
  export * from "./hooks/useHistoryDirty.js";
8
9
  export * from "./hooks/useHistoryShortcuts.js";
9
10
  export * from "./hooks/useFileImport.js";
package/dist/index.js CHANGED
@@ -398,8 +398,39 @@ function useHistory(managerOrOptions) {
398
398
  };
399
399
  }
400
400
 
401
+ // src/hooks/useLinkFocus.ts
402
+ import { useCallback as useCallback4, useState as useState3, useSyncExternalStore as useSyncExternalStore2 } from "react";
403
+ import { createLinkFocus } from "@pixerate/editor/tools";
404
+ function useLinkFocus(options) {
405
+ const [model] = useState3(() => options.model ?? createLinkFocus({ marks: options.marks ?? [], links: options.links ?? {}, order: options.order, labels: options.labels, dim: options.dim }));
406
+ const state = useSyncExternalStore2(model.subscribe, model.getState, model.getState);
407
+ const markProps = useCallback4(
408
+ (key) => ({ onPointerEnter: () => model.focus(key), onFocus: () => model.focus(key), "data-link-focus": key }),
409
+ [model]
410
+ );
411
+ const rootProps = {
412
+ onKeyDown: (event) => {
413
+ if (model.handleKey(event)) event.preventDefault();
414
+ },
415
+ onPointerLeave: () => {
416
+ model.clear();
417
+ },
418
+ onBlur: (event) => {
419
+ if (!event.currentTarget.contains(event.relatedTarget)) model.clear();
420
+ }
421
+ };
422
+ return {
423
+ model,
424
+ state,
425
+ markProps,
426
+ rootProps,
427
+ opacity: (index) => state.lit[index] ? 1 : model.dim,
428
+ description: model.describe(state.focus)
429
+ };
430
+ }
431
+
401
432
  // src/hooks/useHistoryDirty.ts
402
- import { useCallback as useCallback4, useEffect as useEffect3, useRef as useRef5, useState as useState3, useSyncExternalStore as useSyncExternalStore2 } from "react";
433
+ import { useCallback as useCallback5, useEffect as useEffect3, useRef as useRef5, useState as useState4, useSyncExternalStore as useSyncExternalStore3 } from "react";
403
434
  import {
404
435
  DirtyTracker,
405
436
  bindDirtyToHistory
@@ -407,7 +438,7 @@ import {
407
438
  function useHistoryDirty(options) {
408
439
  const getValueRef = useRef5(options.getValue);
409
440
  getValueRef.current = options.getValue;
410
- const [tracker] = useState3(
441
+ const [tracker] = useState4(
411
442
  () => options.tracker ?? new DirtyTracker(options.getValue(), {
412
443
  isEqual: options.isEqual,
413
444
  normalize: options.normalize
@@ -426,20 +457,20 @@ function useHistoryDirty(options) {
426
457
  if (bindingRef.current === binding) bindingRef.current = null;
427
458
  };
428
459
  }, [options.history, tracker]);
429
- const isDirty = useSyncExternalStore2(
430
- useCallback4((onChange) => tracker.subscribe(onChange), [tracker]),
460
+ const isDirty = useSyncExternalStore3(
461
+ useCallback5((onChange) => tracker.subscribe(onChange), [tracker]),
431
462
  () => tracker.dirty,
432
463
  () => tracker.dirty
433
464
  );
434
- const markClean = useCallback4(
465
+ const markClean = useCallback5(
435
466
  () => tracker.markClean(getValueRef.current()),
436
467
  [tracker]
437
468
  );
438
- const suppress = useCallback4(
469
+ const suppress = useCallback5(
439
470
  (fn) => bindingRef.current ? bindingRef.current.suppress(fn) : tracker.suppress(fn),
440
471
  [tracker]
441
472
  );
442
- const refresh = useCallback4(
473
+ const refresh = useCallback5(
443
474
  () => tracker.update(getValueRef.current()),
444
475
  [tracker]
445
476
  );
@@ -478,7 +509,7 @@ function useHistoryShortcuts(manager, options = {}) {
478
509
  }
479
510
 
480
511
  // src/hooks/useFileImport.ts
481
- import { useEffect as useEffect5, useMemo as useMemo3, useRef as useRef6, useSyncExternalStore as useSyncExternalStore3 } from "react";
512
+ import { useEffect as useEffect5, useMemo as useMemo3, useRef as useRef6, useSyncExternalStore as useSyncExternalStore4 } from "react";
482
513
  import {
483
514
  FileImportController,
484
515
  summarizeImportStructure
@@ -496,7 +527,7 @@ function useFileImport(editor, options = {}) {
496
527
  useEffect5(() => {
497
528
  controller.setOptions(options);
498
529
  });
499
- const state = useSyncExternalStore3(controller.subscribe, controller.getState, controller.getState);
530
+ const state = useSyncExternalStore4(controller.subscribe, controller.getState, controller.getState);
500
531
  const structureSummary = useMemo3(() => summarizeImportStructure(state.lastOutcomes), [state.lastOutcomes]);
501
532
  return {
502
533
  ...state,
@@ -508,7 +539,7 @@ function useFileImport(editor, options = {}) {
508
539
  }
509
540
 
510
541
  // src/hooks/useDocxExport.ts
511
- import { useEffect as useEffect6, useMemo as useMemo4, useRef as useRef7, useSyncExternalStore as useSyncExternalStore4 } from "react";
542
+ import { useEffect as useEffect6, useMemo as useMemo4, useRef as useRef7, useSyncExternalStore as useSyncExternalStore5 } from "react";
512
543
  import {
513
544
  DocxExportController
514
545
  } from "@pixerate/editor/export";
@@ -525,7 +556,7 @@ function useDocxExport(editor, options = {}) {
525
556
  useEffect6(() => {
526
557
  controller.setOptions(options);
527
558
  });
528
- const state = useSyncExternalStore4(controller.subscribe, controller.getState, controller.getState);
559
+ const state = useSyncExternalStore5(controller.subscribe, controller.getState, controller.getState);
529
560
  return {
530
561
  ...state,
531
562
  download: (fileName) => controller.download(fileName),
@@ -583,10 +614,10 @@ function useRichTextEditorDocument(editor) {
583
614
  }
584
615
 
585
616
  // src/hooks/useToolBridge.ts
586
- import { useEffect as useEffect9, useState as useState4 } from "react";
617
+ import { useEffect as useEffect9, useState as useState5 } from "react";
587
618
  import { connectToolBridge } from "@pixerate/editor/tools";
588
619
  function useToolBridge(registry, options) {
589
- const [state, setState] = useState4({ status: "off", editorId: null });
620
+ const [state, setState] = useState5({ status: "off", editorId: null });
590
621
  const key = options ? JSON.stringify([options.url, options.token, options.name, options.kind, options.reconnect]) : null;
591
622
  useEffect9(() => {
592
623
  if (!registry || !options) {
@@ -639,7 +670,7 @@ var EditorContent = ({
639
670
  };
640
671
 
641
672
  // src/components/BubbleMenu.tsx
642
- import { useEffect as useEffect11, useRef as useRef8, useState as useState5 } from "react";
673
+ import { useEffect as useEffect11, useRef as useRef8, useState as useState6 } from "react";
643
674
  import { createPortal } from "react-dom";
644
675
  import {
645
676
  BubbleMenuPlugin
@@ -654,7 +685,7 @@ var BubbleMenu = ({
654
685
  updateDelay
655
686
  }) => {
656
687
  const menuEl = useRef8(null);
657
- const [mounted, setMounted] = useState5(false);
688
+ const [mounted, setMounted] = useState6(false);
658
689
  if (!menuEl.current && typeof document !== "undefined") {
659
690
  menuEl.current = document.createElement("div");
660
691
  }
@@ -801,7 +832,7 @@ var TemplateRenderer = ({
801
832
  };
802
833
 
803
834
  // src/components/VariableForm.tsx
804
- import { useId, useMemo as useMemo8, useState as useState6 } from "react";
835
+ import { useId, useMemo as useMemo8, useState as useState7 } from "react";
805
836
  import {
806
837
  compactVariableValues,
807
838
  getVariableFormFields
@@ -817,7 +848,7 @@ var VariableForm = ({
817
848
  className = "flex flex-col gap-3 text-sm"
818
849
  }) => {
819
850
  const idPrefix = useId();
820
- const [internal, setInternal] = useState6(
851
+ const [internal, setInternal] = useState7(
821
852
  () => defaultValues ?? {}
822
853
  );
823
854
  const entered = values ?? internal;
@@ -889,10 +920,10 @@ var VariableForm = ({
889
920
  };
890
921
 
891
922
  // src/components/MergePreview.tsx
892
- import { useId as useId2, useState as useState8 } from "react";
923
+ import { useId as useId2, useState as useState9 } from "react";
893
924
 
894
925
  // src/hooks/useMergePreview.ts
895
- import { useCallback as useCallback5, useMemo as useMemo9, useState as useState7 } from "react";
926
+ import { useCallback as useCallback6, useMemo as useMemo9, useState as useState8 } from "react";
896
927
  import {
897
928
  extractVariables,
898
929
  matchFields,
@@ -903,10 +934,10 @@ import {
903
934
  } from "@pixerate/editor";
904
935
  function useMergePreview(options) {
905
936
  const { template, templates, bindings, parseOptions } = options;
906
- const [sourceText, setSourceTextState] = useState7(options.initialSource ?? "");
907
- const [overrides, setOverrides] = useState7({});
908
- const [index, setIndexState] = useState7(0);
909
- const [result, setResult] = useState7(null);
937
+ const [sourceText, setSourceTextState] = useState8(options.initialSource ?? "");
938
+ const [overrides, setOverrides] = useState8({});
939
+ const [index, setIndexState] = useState8(0);
940
+ const [result, setResult] = useState8(null);
910
941
  const source = useMemo9(
911
942
  () => parseDataSource(sourceText, parseOptions),
912
943
  [sourceText, parseOptions]
@@ -933,25 +964,25 @@ function useMergePreview(options) {
933
964
  () => record ? recordToValues(record, mapping) : {},
934
965
  [record, mapping]
935
966
  );
936
- const setSourceText = useCallback5((text) => {
967
+ const setSourceText = useCallback6((text) => {
937
968
  setSourceTextState(text);
938
969
  setIndexState(0);
939
970
  setResult(null);
940
971
  }, []);
941
- const loadFile = useCallback5(
972
+ const loadFile = useCallback6(
942
973
  async (file) => setSourceText(await file.text()),
943
974
  [setSourceText]
944
975
  );
945
- const setIndex = useCallback5(
976
+ const setIndex = useCallback6(
946
977
  (next) => setIndexState(Math.max(0, Math.min(next, count - 1))),
947
978
  [count]
948
979
  );
949
- const setFieldMapping = useCallback5((variable, field) => {
980
+ const setFieldMapping = useCallback6((variable, field) => {
950
981
  setOverrides((previous) => ({ ...previous, [variable]: field }));
951
982
  setResult(null);
952
983
  }, []);
953
- const resetMapping = useCallback5(() => setOverrides({}), []);
954
- const merge = useCallback5(() => {
984
+ const resetMapping = useCallback6(() => setOverrides({}), []);
985
+ const merge = useCallback6(() => {
955
986
  const merged = mergeRecords(template, source, {
956
987
  templates,
957
988
  bindings,
@@ -963,7 +994,7 @@ function useMergePreview(options) {
963
994
  setResult(merged);
964
995
  return merged;
965
996
  }, [template, source, templates, bindings, mapping, options.skipIf, options.separator, options.maxOutputs]);
966
- const serialize = useCallback5(
997
+ const serialize = useCallback6(
967
998
  (format) => result ? serializeMergeOutputs(result.outputs, format, options.separator) : "",
968
999
  [result, options.separator]
969
1000
  );
@@ -1027,7 +1058,7 @@ var MergePreview = ({
1027
1058
  separator,
1028
1059
  maxOutputs
1029
1060
  });
1030
- const [copied, setCopied] = useState8(false);
1061
+ const [copied, setCopied] = useState9(false);
1031
1062
  const { source, result } = merge;
1032
1063
  const copy = async () => {
1033
1064
  try {
@@ -1184,11 +1215,11 @@ var MergePreview = ({
1184
1215
  };
1185
1216
 
1186
1217
  // src/hooks/useOutline.ts
1187
- import { useMemo as useMemo10, useSyncExternalStore as useSyncExternalStore5 } from "react";
1218
+ import { useMemo as useMemo10, useSyncExternalStore as useSyncExternalStore6 } from "react";
1188
1219
  import { createOutlineStore } from "@pixerate/editor";
1189
1220
  function useOutline(editor) {
1190
1221
  const store = useMemo10(() => createOutlineStore(editor), [editor]);
1191
- return useSyncExternalStore5(store.subscribe, store.getSnapshot, store.getSnapshot);
1222
+ return useSyncExternalStore6(store.subscribe, store.getSnapshot, store.getSnapshot);
1192
1223
  }
1193
1224
 
1194
1225
  // src/components/OutlinePanel.tsx
@@ -1233,14 +1264,14 @@ var OutlinePanel = ({
1233
1264
  };
1234
1265
 
1235
1266
  // src/hooks/useParagraphStyles.ts
1236
- import { useMemo as useMemo11, useSyncExternalStore as useSyncExternalStore6 } from "react";
1267
+ import { useMemo as useMemo11, useSyncExternalStore as useSyncExternalStore7 } from "react";
1237
1268
  import {
1238
1269
  createParagraphStylesStore,
1239
1270
  getStyleRegistry
1240
1271
  } from "@pixerate/editor";
1241
1272
  function useParagraphStyles(editor) {
1242
1273
  const store = useMemo11(() => createParagraphStylesStore(editor), [editor]);
1243
- const snapshot = useSyncExternalStore6(store.subscribe, store.getSnapshot, store.getSnapshot);
1274
+ const snapshot = useSyncExternalStore7(store.subscribe, store.getSnapshot, store.getSnapshot);
1244
1275
  return useMemo11(() => {
1245
1276
  const registry = getStyleRegistry(editor);
1246
1277
  const live = () => editor && !editor.isDestroyed ? editor : null;
@@ -1264,7 +1295,7 @@ function useParagraphStyles(editor) {
1264
1295
  }
1265
1296
 
1266
1297
  // src/components/StylesGallery.tsx
1267
- import { useState as useState9 } from "react";
1298
+ import { useState as useState10 } from "react";
1268
1299
  import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
1269
1300
  var camel = (property) => property.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
1270
1301
  var keepSelection = (event) => event.preventDefault();
@@ -1280,9 +1311,9 @@ var StylesGallery = ({
1280
1311
  onChange
1281
1312
  }) => {
1282
1313
  const styles = useParagraphStyles(editor);
1283
- const [open, setOpen] = useState9(false);
1284
- const [creating, setCreating] = useState9(false);
1285
- const [name, setName] = useState9("");
1314
+ const [open, setOpen] = useState10(false);
1315
+ const [creating, setCreating] = useState10(false);
1316
+ const [name, setName] = useState10("");
1286
1317
  const list = showAllStyles ? styles.styles : styles.gallery;
1287
1318
  const current = styles.currentStyle;
1288
1319
  const expanded = variant === "gallery" || open;
@@ -1438,7 +1469,7 @@ function useEditorSlots() {
1438
1469
  }
1439
1470
 
1440
1471
  // src/review/useReview.ts
1441
- import { useCallback as useCallback6, useMemo as useMemo13, useSyncExternalStore as useSyncExternalStore7 } from "react";
1472
+ import { useCallback as useCallback7, useMemo as useMemo13, useSyncExternalStore as useSyncExternalStore8 } from "react";
1442
1473
  import {
1443
1474
  getCommentStore,
1444
1475
  getTrackChangesStore
@@ -1460,22 +1491,22 @@ function isCommentStore(value) {
1460
1491
  }
1461
1492
  function useComments(source) {
1462
1493
  const store = isCommentStore(source) ? source : getCommentStore(source);
1463
- const subscribe = useCallback6(
1494
+ const subscribe = useCallback7(
1464
1495
  (onChange) => store ? store.subscribe(() => onChange()) : noopUnsubscribe,
1465
1496
  [store]
1466
1497
  );
1467
1498
  const getSnapshot = () => store?.getSnapshot() ?? EMPTY_COMMENTS;
1468
- const snapshot = useSyncExternalStore7(subscribe, getSnapshot, getSnapshot);
1499
+ const snapshot = useSyncExternalStore8(subscribe, getSnapshot, getSnapshot);
1469
1500
  return useMemo13(() => ({ ...snapshot, store }), [snapshot, store]);
1470
1501
  }
1471
1502
  function useTrackChanges(editor) {
1472
1503
  const store = getTrackChangesStore(editor ?? null);
1473
- const subscribe = useCallback6(
1504
+ const subscribe = useCallback7(
1474
1505
  (onChange) => store ? store.subscribe(() => onChange()) : noopUnsubscribe,
1475
1506
  [store]
1476
1507
  );
1477
1508
  const getSnapshot = () => store?.getSnapshot() ?? EMPTY_TRACK_CHANGES;
1478
- const snapshot = useSyncExternalStore7(subscribe, getSnapshot, getSnapshot);
1509
+ const snapshot = useSyncExternalStore8(subscribe, getSnapshot, getSnapshot);
1479
1510
  return useMemo13(() => {
1480
1511
  const run = (fn) => () => {
1481
1512
  if (editor && !editor.isDestroyed) fn(editor);
@@ -1499,7 +1530,7 @@ function useTrackChanges(editor) {
1499
1530
  }
1500
1531
 
1501
1532
  // src/review/CommentsPanel.tsx
1502
- import { useState as useState10 } from "react";
1533
+ import { useState as useState11 } from "react";
1503
1534
  import {
1504
1535
  formatReviewTime,
1505
1536
  getCommentAuthor
@@ -1518,7 +1549,7 @@ var CommentsPanel = ({
1518
1549
  emptyMessage = "No comments yet. Select text and add a comment."
1519
1550
  }) => {
1520
1551
  const { threads, activeThreadId, store } = useComments(storeProp ?? editor);
1521
- const [showResolved, setShowResolved] = useState10(showResolvedInitial);
1552
+ const [showResolved, setShowResolved] = useState11(showResolvedInitial);
1522
1553
  const author = authorProp ?? getCommentAuthor(editor) ?? { id: "anonymous", name: "Anonymous" };
1523
1554
  const visible = threads.filter((t) => showResolved || !t.resolved);
1524
1555
  const resolvedCount = threads.filter((t) => t.resolved).length;
@@ -1562,7 +1593,7 @@ var CommentThreadCard = ({
1562
1593
  author,
1563
1594
  formatTime
1564
1595
  }) => {
1565
- const [draft, setDraft] = useState10("");
1596
+ const [draft, setDraft] = useState11("");
1566
1597
  const isDraft = thread.body === "";
1567
1598
  const quote = thread.anchor?.quote ?? thread.lastQuote ?? "";
1568
1599
  const live = editor && !editor.isDestroyed ? editor : null;
@@ -1776,15 +1807,15 @@ var CommentButton = ({
1776
1807
  );
1777
1808
 
1778
1809
  // src/review/useDocumentCompare.ts
1779
- import { useCallback as useCallback7, useMemo as useMemo14, useRef as useRef9, useState as useState11 } from "react";
1810
+ import { useCallback as useCallback8, useMemo as useMemo14, useRef as useRef9, useState as useState12 } from "react";
1780
1811
  import {
1781
1812
  applyDocumentComparison
1782
1813
  } from "@pixerate/editor";
1783
1814
  function useDocumentCompare(editor, options) {
1784
- const [summary, setSummary] = useState11(null);
1815
+ const [summary, setSummary] = useState12(null);
1785
1816
  const defaults = useRef9(options);
1786
1817
  defaults.current = options;
1787
- const compare = useCallback7(
1818
+ const compare = useCallback8(
1788
1819
  (original, revised, overrides) => {
1789
1820
  if (!editor || editor.isDestroyed) return null;
1790
1821
  const result = applyDocumentComparison(editor, original, revised, {
@@ -1796,7 +1827,7 @@ function useDocumentCompare(editor, options) {
1796
1827
  },
1797
1828
  [editor]
1798
1829
  );
1799
- const clear = useCallback7(() => setSummary(null), []);
1830
+ const clear = useCallback8(() => setSummary(null), []);
1800
1831
  return useMemo14(() => ({ summary, compare, clear }), [summary, compare, clear]);
1801
1832
  }
1802
1833
 
@@ -1848,7 +1879,7 @@ var TrackedChangesList = ({
1848
1879
  };
1849
1880
 
1850
1881
  // src/find-replace/useFindReplace.ts
1851
- import { useCallback as useCallback8, useMemo as useMemo15, useSyncExternalStore as useSyncExternalStore8 } from "react";
1882
+ import { useCallback as useCallback9, useMemo as useMemo15, useSyncExternalStore as useSyncExternalStore9 } from "react";
1852
1883
  import {
1853
1884
  EMPTY_FIND_REPLACE_SNAPSHOT,
1854
1885
  getFindReplaceStore
@@ -1857,12 +1888,12 @@ var noopUnsubscribe2 = () => {
1857
1888
  };
1858
1889
  function useFindReplace(editor) {
1859
1890
  const store = getFindReplaceStore(editor ?? null);
1860
- const subscribe = useCallback8(
1891
+ const subscribe = useCallback9(
1861
1892
  (onChange) => store ? store.subscribe(() => onChange()) : noopUnsubscribe2,
1862
1893
  [store]
1863
1894
  );
1864
1895
  const getSnapshot = () => store?.getSnapshot() ?? EMPTY_FIND_REPLACE_SNAPSHOT;
1865
- const snapshot = useSyncExternalStore8(subscribe, getSnapshot, getSnapshot);
1896
+ const snapshot = useSyncExternalStore9(subscribe, getSnapshot, getSnapshot);
1866
1897
  return useMemo15(() => {
1867
1898
  const run = (fn) => {
1868
1899
  if (editor && !editor.isDestroyed && store) fn(editor);
@@ -1887,7 +1918,7 @@ function useFindReplace(editor) {
1887
1918
  }
1888
1919
 
1889
1920
  // src/find-replace/FindReplaceBar.tsx
1890
- import { useEffect as useEffect12, useRef as useRef10, useState as useState12 } from "react";
1921
+ import { useEffect as useEffect12, useRef as useRef10, useState as useState13 } from "react";
1891
1922
  import { FIND_OPTION_TOGGLES, formatFindStatus } from "@pixerate/editor";
1892
1923
  import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
1893
1924
  var inputClass = "min-w-0 flex-1 rounded border border-input bg-background px-2 py-1 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-ring";
@@ -1903,7 +1934,7 @@ var FindReplaceBar = ({
1903
1934
  }) => {
1904
1935
  const find = useFindReplace(editor);
1905
1936
  const findInput = useRef10(null);
1906
- const [moreOpen, setMoreOpen] = useState12(false);
1937
+ const [moreOpen, setMoreOpen] = useState13(false);
1907
1938
  const visible = find.available && (alwaysOpen || find.open);
1908
1939
  useEffect12(() => {
1909
1940
  if (!visible || find.focusRequest === 0) return;
@@ -2049,7 +2080,7 @@ var FindReplaceBar = ({
2049
2080
  };
2050
2081
 
2051
2082
  // src/tables/useTableMenu.ts
2052
- import { useMemo as useMemo16, useSyncExternalStore as useSyncExternalStore9 } from "react";
2083
+ import { useMemo as useMemo16, useSyncExternalStore as useSyncExternalStore10 } from "react";
2053
2084
  import {
2054
2085
  createTableStore,
2055
2086
  getTableActionState,
@@ -2057,7 +2088,7 @@ import {
2057
2088
  } from "@pixerate/editor";
2058
2089
  function useTableMenu(editor) {
2059
2090
  const store = useMemo16(() => createTableStore(editor), [editor]);
2060
- const snapshot = useSyncExternalStore9(store.subscribe, store.getSnapshot, store.getSnapshot);
2091
+ const snapshot = useSyncExternalStore10(store.subscribe, store.getSnapshot, store.getSnapshot);
2061
2092
  return useMemo16(
2062
2093
  () => ({
2063
2094
  ...snapshot,
@@ -2114,7 +2145,7 @@ var TableToolbar = ({
2114
2145
  };
2115
2146
 
2116
2147
  // src/tables/InsertTableGrid.tsx
2117
- import { useState as useState13 } from "react";
2148
+ import { useState as useState14 } from "react";
2118
2149
  import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
2119
2150
  var keepSelection3 = (event) => event.preventDefault();
2120
2151
  var InsertTableGrid = ({
@@ -2128,7 +2159,7 @@ var InsertTableGrid = ({
2128
2159
  onInsert
2129
2160
  }) => {
2130
2161
  const table = useTableMenu(editor);
2131
- const [hover, setHover] = useState13(null);
2162
+ const [hover, setHover] = useState14(null);
2132
2163
  const status = table.actions.insertTable;
2133
2164
  const disabled = !editor || !status.enabled;
2134
2165
  const insert = (size) => {
@@ -2265,7 +2296,7 @@ function createReactChartNodeView(options = {}) {
2265
2296
  }
2266
2297
 
2267
2298
  // src/style/useStyle.ts
2268
- import { useCallback as useCallback9, useEffect as useEffect13, useMemo as useMemo17, useState as useState14 } from "react";
2299
+ import { useCallback as useCallback10, useEffect as useEffect13, useMemo as useMemo17, useState as useState15 } from "react";
2269
2300
  import { styleSwatches } from "@pixerate/editor/tools";
2270
2301
  import { richTextStyleState } from "@pixerate/editor";
2271
2302
  var message = (error) => error instanceof Error ? error.message : String(error);
@@ -2297,7 +2328,7 @@ function useResolverTask(styles, run, deliver, deps) {
2297
2328
  }, [styles, ...deps]);
2298
2329
  }
2299
2330
  function useStyle(styles, domain) {
2300
- const [result, setResult] = useState14({ style: null, error: null });
2331
+ const [result, setResult] = useState15({ style: null, error: null });
2301
2332
  useResolverTask(
2302
2333
  styles,
2303
2334
  (s) => s.resolve(domain),
@@ -2307,7 +2338,7 @@ function useStyle(styles, domain) {
2307
2338
  return result;
2308
2339
  }
2309
2340
  function useStyleFindings(styles, domain, state, scope) {
2310
- const [result, setResult] = useState14({ report: null, style: null, error: null });
2341
+ const [result, setResult] = useState15({ report: null, style: null, error: null });
2311
2342
  useResolverTask(
2312
2343
  styles,
2313
2344
  (s) => s.check(domain, state, scope !== void 0 ? { scope } : {}),
@@ -2323,14 +2354,14 @@ function useStyleFindings(styles, domain, state, scope) {
2323
2354
  return result;
2324
2355
  }
2325
2356
  function useStyleChoices(styles, scope) {
2326
- const [state, setState] = useState14({ groups: null, error: null });
2357
+ const [state, setState] = useState15({ groups: null, error: null });
2327
2358
  useResolverTask(
2328
2359
  styles,
2329
2360
  (s) => s.choices(scope !== void 0 ? { scope } : {}),
2330
2361
  ({ value, error }) => setState({ groups: value, error }),
2331
2362
  [scope]
2332
2363
  );
2333
- const choose = useCallback9(
2364
+ const choose = useCallback10(
2334
2365
  async (name, options = {}) => {
2335
2366
  if (!styles) throw new Error("There is no style resolver to choose with.");
2336
2367
  try {
@@ -2345,7 +2376,7 @@ function useStyleChoices(styles, scope) {
2345
2376
  return { ...state, choose };
2346
2377
  }
2347
2378
  function useStyleSwatches(styles, domain, scope) {
2348
- const [state, setState] = useState14({ style: null, error: null });
2379
+ const [state, setState] = useState15({ style: null, error: null });
2349
2380
  useResolverTask(
2350
2381
  styles,
2351
2382
  (s) => s.resolve(domain, scope !== void 0 ? { scope } : {}),
@@ -2358,7 +2389,7 @@ function useStyleSwatches(styles, domain, scope) {
2358
2389
  }, [state]);
2359
2390
  }
2360
2391
  function useRichTextStyleFindings(styles, editor, scope) {
2361
- const [doc, setDoc] = useState14(() => editor?.state.doc ?? null);
2392
+ const [doc, setDoc] = useState15(() => editor?.state.doc ?? null);
2362
2393
  useEffect13(() => {
2363
2394
  if (!editor) {
2364
2395
  setDoc(null);
@@ -2535,6 +2566,7 @@ export {
2535
2566
  useImageEffectsTools,
2536
2567
  useImageHistogram,
2537
2568
  useJobProgress,
2569
+ useLinkFocus,
2538
2570
  useMergePreview,
2539
2571
  useNavigationGuard,
2540
2572
  useOutline,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor-react",
3
- "version": "0.208.0",
3
+ "version": "0.209.0",
4
4
  "description": "React bindings and prompt/rich-text components for @pixerate/editor",
5
5
  "author": "Pixerate",
6
6
  "license": "MIT",
@@ -283,7 +283,7 @@
283
283
  "dependencies": {},
284
284
  "peerDependencies": {
285
285
  "@dagrejs/dagre": "^1.1.8",
286
- "@pixerate/editor": ">=0.318.0 <1.0.0-0",
286
+ "@pixerate/editor": ">=0.321.0 <1.0.0-0",
287
287
  "@tiptap/core": "^2.27.3",
288
288
  "@tiptap/extension-bubble-menu": "^2.27.3",
289
289
  "@tiptap/extension-placeholder": "^2.27.3",
@@ -334,7 +334,7 @@
334
334
  "tsup": "^9.0.0",
335
335
  "typescript": "^5.7.3",
336
336
  "vitest": "^5.1.0",
337
- "@pixerate/editor": "0.318.0"
337
+ "@pixerate/editor": "0.321.0"
338
338
  },
339
339
  "scripts": {
340
340
  "build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/finalize-declarations.mjs dist",