@portabletext/toolbar 2.2.26 → 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.js CHANGED
@@ -61,13 +61,17 @@ function _temp$2(snapshot) {
61
61
  const disableListener = fromCallback(({
62
62
  input,
63
63
  sendBack
64
- }) => input.editor.on("*", () => {
64
+ }) => (input.editor.getSnapshot().context.readOnly ? sendBack({
65
+ type: "disable"
66
+ }) : sendBack({
67
+ type: "enable"
68
+ }), input.editor.on("*", () => {
65
69
  input.editor.getSnapshot().context.readOnly ? sendBack({
66
70
  type: "disable"
67
71
  }) : sendBack({
68
72
  type: "enable"
69
73
  });
70
- }).unsubscribe);
74
+ }).unsubscribe));
71
75
  function useMutuallyExclusiveAnnotation(props) {
72
76
  const $ = c(5), editor = useEditor();
73
77
  let t0, t1;
@@ -112,14 +116,18 @@ function _temp$1(annotation_0) {
112
116
  const activeListener$6 = fromCallback(({
113
117
  input,
114
118
  sendBack
115
- }) => input.editor.on("*", () => {
119
+ }) => (selectors.isActiveAnnotation(input.schemaType.name)(input.editor.getSnapshot()) ? sendBack({
120
+ type: "set active"
121
+ }) : sendBack({
122
+ type: "set inactive"
123
+ }), input.editor.on("*", () => {
116
124
  const snapshot = input.editor.getSnapshot();
117
125
  selectors.isActiveAnnotation(input.schemaType.name)(snapshot) ? sendBack({
118
126
  type: "set active"
119
127
  }) : sendBack({
120
128
  type: "set inactive"
121
129
  });
122
- }).unsubscribe), keyboardShortcutRemove = fromCallback(({
130
+ }).unsubscribe)), keyboardShortcutRemove = fromCallback(({
123
131
  input
124
132
  }) => {
125
133
  const shortcut = input.schemaType.shortcut;
@@ -1057,14 +1065,18 @@ function _temp(decorator) {
1057
1065
  const activeListener$3 = fromCallback(({
1058
1066
  input,
1059
1067
  sendBack
1060
- }) => input.editor.on("*", () => {
1068
+ }) => (selectors.isActiveDecorator(input.schemaType.name)(input.editor.getSnapshot()) ? sendBack({
1069
+ type: "set active"
1070
+ }) : sendBack({
1071
+ type: "set inactive"
1072
+ }), input.editor.on("*", () => {
1061
1073
  const snapshot = input.editor.getSnapshot();
1062
1074
  selectors.isActiveDecorator(input.schemaType.name)(snapshot) ? sendBack({
1063
1075
  type: "set active"
1064
1076
  }) : sendBack({
1065
1077
  type: "set inactive"
1066
1078
  });
1067
- }).unsubscribe), decoratorButtonMachine = setup({
1079
+ }).unsubscribe)), decoratorButtonMachine = setup({
1068
1080
  types: {
1069
1081
  context: {},
1070
1082
  input: {},
@@ -1637,14 +1649,18 @@ function useInlineObjectPopover(props) {
1637
1649
  const activeListener$1 = fromCallback(({
1638
1650
  input,
1639
1651
  sendBack
1640
- }) => input.editor.on("*", () => {
1652
+ }) => (selectors.isActiveListItem(input.schemaType.name)(input.editor.getSnapshot()) ? sendBack({
1653
+ type: "set active"
1654
+ }) : sendBack({
1655
+ type: "set inactive"
1656
+ }), input.editor.on("*", () => {
1641
1657
  const snapshot = input.editor.getSnapshot();
1642
1658
  selectors.isActiveListItem(input.schemaType.name)(snapshot) ? sendBack({
1643
1659
  type: "set active"
1644
1660
  }) : sendBack({
1645
1661
  type: "set inactive"
1646
1662
  });
1647
- }).unsubscribe), listButtonMachine = setup({
1663
+ }).unsubscribe)), listButtonMachine = setup({
1648
1664
  types: {
1649
1665
  context: {},
1650
1666
  input: {},
@@ -1858,13 +1874,19 @@ function useStyleKeyboardShortcuts(props) {
1858
1874
  const activeListener = fromCallback(({
1859
1875
  input,
1860
1876
  sendBack
1861
- }) => input.editor.on("*", () => {
1862
- const snapshot = input.editor.getSnapshot(), activeStyle = selectors.getActiveStyle(snapshot);
1863
- sendBack({
1877
+ }) => {
1878
+ const activeStyle = selectors.getActiveStyle(input.editor.getSnapshot());
1879
+ return sendBack({
1864
1880
  type: "set active style",
1865
1881
  style: activeStyle
1866
- });
1867
- }).unsubscribe), styleSelectorMachine = setup({
1882
+ }), input.editor.on("*", () => {
1883
+ const snapshot = input.editor.getSnapshot(), activeStyle2 = selectors.getActiveStyle(snapshot);
1884
+ sendBack({
1885
+ type: "set active style",
1886
+ style: activeStyle2
1887
+ });
1888
+ }).unsubscribe;
1889
+ }), styleSelectorMachine = setup({
1868
1890
  types: {
1869
1891
  context: {},
1870
1892
  input: {},