@portabletext/toolbar 2.2.25 → 2.2.27

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.cjs CHANGED
@@ -71,13 +71,17 @@ function _temp$2(snapshot) {
71
71
  const disableListener = xstate.fromCallback(({
72
72
  input,
73
73
  sendBack
74
- }) => input.editor.on("*", () => {
74
+ }) => (input.editor.getSnapshot().context.readOnly ? sendBack({
75
+ type: "disable"
76
+ }) : sendBack({
77
+ type: "enable"
78
+ }), input.editor.on("*", () => {
75
79
  input.editor.getSnapshot().context.readOnly ? sendBack({
76
80
  type: "disable"
77
81
  }) : sendBack({
78
82
  type: "enable"
79
83
  });
80
- }).unsubscribe);
84
+ }).unsubscribe));
81
85
  function useMutuallyExclusiveAnnotation(props) {
82
86
  const $ = compilerRuntime.c(5), editor$1 = editor.useEditor();
83
87
  let t0, t1;
@@ -122,14 +126,18 @@ function _temp$1(annotation_0) {
122
126
  const activeListener$6 = xstate.fromCallback(({
123
127
  input,
124
128
  sendBack
125
- }) => input.editor.on("*", () => {
129
+ }) => (selectors__namespace.isActiveAnnotation(input.schemaType.name)(input.editor.getSnapshot()) ? sendBack({
130
+ type: "set active"
131
+ }) : sendBack({
132
+ type: "set inactive"
133
+ }), input.editor.on("*", () => {
126
134
  const snapshot = input.editor.getSnapshot();
127
135
  selectors__namespace.isActiveAnnotation(input.schemaType.name)(snapshot) ? sendBack({
128
136
  type: "set active"
129
137
  }) : sendBack({
130
138
  type: "set inactive"
131
139
  });
132
- }).unsubscribe), keyboardShortcutRemove = xstate.fromCallback(({
140
+ }).unsubscribe)), keyboardShortcutRemove = xstate.fromCallback(({
133
141
  input
134
142
  }) => {
135
143
  const shortcut = input.schemaType.shortcut;
@@ -1067,14 +1075,18 @@ function _temp(decorator) {
1067
1075
  const activeListener$3 = xstate.fromCallback(({
1068
1076
  input,
1069
1077
  sendBack
1070
- }) => input.editor.on("*", () => {
1078
+ }) => (selectors__namespace.isActiveDecorator(input.schemaType.name)(input.editor.getSnapshot()) ? sendBack({
1079
+ type: "set active"
1080
+ }) : sendBack({
1081
+ type: "set inactive"
1082
+ }), input.editor.on("*", () => {
1071
1083
  const snapshot = input.editor.getSnapshot();
1072
1084
  selectors__namespace.isActiveDecorator(input.schemaType.name)(snapshot) ? sendBack({
1073
1085
  type: "set active"
1074
1086
  }) : sendBack({
1075
1087
  type: "set inactive"
1076
1088
  });
1077
- }).unsubscribe), decoratorButtonMachine = xstate.setup({
1089
+ }).unsubscribe)), decoratorButtonMachine = xstate.setup({
1078
1090
  types: {
1079
1091
  context: {},
1080
1092
  input: {},
@@ -1647,14 +1659,18 @@ function useInlineObjectPopover(props) {
1647
1659
  const activeListener$1 = xstate.fromCallback(({
1648
1660
  input,
1649
1661
  sendBack
1650
- }) => input.editor.on("*", () => {
1662
+ }) => (selectors__namespace.isActiveListItem(input.schemaType.name)(input.editor.getSnapshot()) ? sendBack({
1663
+ type: "set active"
1664
+ }) : sendBack({
1665
+ type: "set inactive"
1666
+ }), input.editor.on("*", () => {
1651
1667
  const snapshot = input.editor.getSnapshot();
1652
1668
  selectors__namespace.isActiveListItem(input.schemaType.name)(snapshot) ? sendBack({
1653
1669
  type: "set active"
1654
1670
  }) : sendBack({
1655
1671
  type: "set inactive"
1656
1672
  });
1657
- }).unsubscribe), listButtonMachine = xstate.setup({
1673
+ }).unsubscribe)), listButtonMachine = xstate.setup({
1658
1674
  types: {
1659
1675
  context: {},
1660
1676
  input: {},
@@ -1868,13 +1884,19 @@ function useStyleKeyboardShortcuts(props) {
1868
1884
  const activeListener = xstate.fromCallback(({
1869
1885
  input,
1870
1886
  sendBack
1871
- }) => input.editor.on("*", () => {
1872
- const snapshot = input.editor.getSnapshot(), activeStyle = selectors__namespace.getActiveStyle(snapshot);
1873
- sendBack({
1887
+ }) => {
1888
+ const activeStyle = selectors__namespace.getActiveStyle(input.editor.getSnapshot());
1889
+ return sendBack({
1874
1890
  type: "set active style",
1875
1891
  style: activeStyle
1876
- });
1877
- }).unsubscribe), styleSelectorMachine = xstate.setup({
1892
+ }), input.editor.on("*", () => {
1893
+ const snapshot = input.editor.getSnapshot(), activeStyle2 = selectors__namespace.getActiveStyle(snapshot);
1894
+ sendBack({
1895
+ type: "set active style",
1896
+ style: activeStyle2
1897
+ });
1898
+ }).unsubscribe;
1899
+ }), styleSelectorMachine = xstate.setup({
1878
1900
  types: {
1879
1901
  context: {},
1880
1902
  input: {},