@portabletext/editor 1.47.14 → 1.47.15

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.
@@ -5771,7 +5771,20 @@ function createInternalEditor(editorActor) {
5771
5771
  }
5772
5772
  };
5773
5773
  }
5774
- const EditorActorContext = React.createContext({}), abstractAnnotationBehaviors = [behavior_core.defineBehavior({
5774
+ const EditorActorContext = React.createContext({});
5775
+ function getGlobalScope() {
5776
+ if (typeof globalThis < "u") return globalThis;
5777
+ if (typeof window < "u") return window;
5778
+ if (typeof self < "u") return self;
5779
+ if (typeof global < "u") return global;
5780
+ throw new Error("@portabletext/editor: could not locate global scope");
5781
+ }
5782
+ const globalScope = getGlobalScope();
5783
+ function createGloballyScopedContext(key, defaultValue) {
5784
+ const symbol = Symbol.for(key);
5785
+ return typeof document > "u" ? React.createContext(defaultValue) : (globalScope[symbol] = globalScope[symbol] ?? React.createContext(defaultValue), globalScope[symbol]);
5786
+ }
5787
+ const EditorContext = createGloballyScopedContext("@portabletext/editor/context/editor", null), abstractAnnotationBehaviors = [behavior_core.defineBehavior({
5775
5788
  on: "annotation.toggle",
5776
5789
  guard: ({
5777
5790
  snapshot,
@@ -6928,7 +6941,7 @@ const editorMachine = xstate.setup({
6928
6941
  "handle behavior event": ({
6929
6942
  context,
6930
6943
  event,
6931
- self
6944
+ self: self2
6932
6945
  }) => {
6933
6946
  xstate.assertEvent(event, ["behavior event"]), performEvent({
6934
6947
  mode: "raise",
@@ -6941,11 +6954,11 @@ const editorMachine = xstate.setup({
6941
6954
  converters: [...context.converters],
6942
6955
  editor: event.editor,
6943
6956
  keyGenerator: context.keyGenerator,
6944
- readOnly: self.getSnapshot().matches({
6957
+ readOnly: self2.getSnapshot().matches({
6945
6958
  "edit mode": "read only"
6946
6959
  }),
6947
6960
  schema: context.schema,
6948
- hasTag: (tag) => self.getSnapshot().hasTag(tag),
6961
+ hasTag: (tag) => self2.getSnapshot().hasTag(tag),
6949
6962
  internalDrag: context.internalDrag
6950
6963
  }),
6951
6964
  nativeEvent: event.nativeEvent
@@ -7822,7 +7835,6 @@ function RouteEventsToChanges(props) {
7822
7835
  let t2;
7823
7836
  return $[5] !== props.editorActor ? (t2 = [props.editorActor], $[5] = props.editorActor, $[6] = t2) : t2 = $[6], React.useEffect(t1, t2), null;
7824
7837
  }
7825
- const EditorContext = React__default.default.createContext(void 0);
7826
7838
  function EditorProvider(props) {
7827
7839
  const editorActor = react.useActorRef(editorMachine, {
7828
7840
  input: editorConfigToMachineInput(props.initialConfig)