@atlaskit/editor-core 185.2.23 → 185.2.25

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.
Files changed (100) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/editor-next/hooks/useProviderFactory.js +54 -5
  3. package/dist/cjs/labs/next/presets/universal.js +6 -5
  4. package/dist/cjs/plugins/extension/actions.js +6 -4
  5. package/dist/cjs/plugins/extension/commands.js +19 -16
  6. package/dist/cjs/plugins/extension/context-panel.js +4 -4
  7. package/dist/cjs/plugins/extension/extension-api.js +1 -1
  8. package/dist/cjs/plugins/extension/index.js +11 -4
  9. package/dist/cjs/plugins/extension/pm-plugins/keymap.js +2 -2
  10. package/dist/cjs/plugins/extension/pm-plugins/main.js +10 -5
  11. package/dist/cjs/plugins/extension/toolbar.js +8 -6
  12. package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +11 -6
  13. package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +5 -2
  14. package/dist/cjs/plugins/index.js +0 -7
  15. package/dist/cjs/ui/ContextPanel/index.js +9 -2
  16. package/dist/cjs/utils/action.js +1 -1
  17. package/dist/cjs/version-wrapper.js +1 -1
  18. package/dist/cjs/version.json +1 -1
  19. package/dist/es2019/editor-next/hooks/useProviderFactory.js +54 -5
  20. package/dist/es2019/labs/next/presets/universal.js +7 -6
  21. package/dist/es2019/plugins/extension/actions.js +6 -4
  22. package/dist/es2019/plugins/extension/commands.js +6 -7
  23. package/dist/es2019/plugins/extension/context-panel.js +4 -4
  24. package/dist/es2019/plugins/extension/extension-api.js +1 -1
  25. package/dist/es2019/plugins/extension/index.js +11 -4
  26. package/dist/es2019/plugins/extension/pm-plugins/keymap.js +2 -2
  27. package/dist/es2019/plugins/extension/pm-plugins/main.js +10 -5
  28. package/dist/es2019/plugins/extension/toolbar.js +8 -4
  29. package/dist/es2019/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +11 -6
  30. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +5 -2
  31. package/dist/es2019/plugins/index.js +0 -1
  32. package/dist/es2019/ui/ContextPanel/index.js +8 -1
  33. package/dist/es2019/utils/action.js +1 -1
  34. package/dist/es2019/version-wrapper.js +1 -1
  35. package/dist/es2019/version.json +1 -1
  36. package/dist/esm/editor-next/hooks/useProviderFactory.js +54 -5
  37. package/dist/esm/labs/next/presets/universal.js +7 -6
  38. package/dist/esm/plugins/extension/actions.js +6 -4
  39. package/dist/esm/plugins/extension/commands.js +18 -15
  40. package/dist/esm/plugins/extension/context-panel.js +4 -4
  41. package/dist/esm/plugins/extension/extension-api.js +1 -1
  42. package/dist/esm/plugins/extension/index.js +11 -4
  43. package/dist/esm/plugins/extension/pm-plugins/keymap.js +2 -2
  44. package/dist/esm/plugins/extension/pm-plugins/main.js +10 -5
  45. package/dist/esm/plugins/extension/toolbar.js +8 -6
  46. package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +11 -6
  47. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +5 -2
  48. package/dist/esm/plugins/index.js +0 -1
  49. package/dist/esm/ui/ContextPanel/index.js +8 -1
  50. package/dist/esm/utils/action.js +1 -1
  51. package/dist/esm/version-wrapper.js +1 -1
  52. package/dist/esm/version.json +1 -1
  53. package/dist/types/editor-next/hooks/useProviderFactory.d.ts +0 -1
  54. package/dist/types/labs/next/presets/cxhtml.d.ts +18 -2
  55. package/dist/types/labs/next/presets/default.d.ts +36 -4
  56. package/dist/types/labs/next/presets/mobile.d.ts +18 -2
  57. package/dist/types/plugins/extension/actions.d.ts +2 -1
  58. package/dist/types/plugins/extension/commands.d.ts +4 -3
  59. package/dist/types/plugins/extension/context-panel.d.ts +2 -1
  60. package/dist/types/plugins/extension/extension-api.d.ts +2 -0
  61. package/dist/types/plugins/extension/index.d.ts +4 -2
  62. package/dist/types/plugins/extension/pm-plugins/keymap.d.ts +2 -1
  63. package/dist/types/plugins/extension/pm-plugins/main.d.ts +3 -1
  64. package/dist/types/plugins/extension/toolbar.d.ts +8 -1
  65. package/dist/types/plugins/extension/types.d.ts +2 -0
  66. package/dist/types/plugins/floating-toolbar/ui/ExtensionsPlaceholder.d.ts +2 -0
  67. package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +7 -3
  68. package/dist/types/plugins/index.d.ts +0 -1
  69. package/dist/types-ts4.5/editor-next/hooks/useProviderFactory.d.ts +0 -1
  70. package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +20 -2
  71. package/dist/types-ts4.5/labs/next/presets/default.d.ts +40 -4
  72. package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +20 -2
  73. package/dist/types-ts4.5/plugins/extension/actions.d.ts +2 -1
  74. package/dist/types-ts4.5/plugins/extension/commands.d.ts +4 -3
  75. package/dist/types-ts4.5/plugins/extension/context-panel.d.ts +2 -1
  76. package/dist/types-ts4.5/plugins/extension/extension-api.d.ts +2 -0
  77. package/dist/types-ts4.5/plugins/extension/index.d.ts +4 -2
  78. package/dist/types-ts4.5/plugins/extension/pm-plugins/keymap.d.ts +2 -1
  79. package/dist/types-ts4.5/plugins/extension/pm-plugins/main.d.ts +3 -1
  80. package/dist/types-ts4.5/plugins/extension/toolbar.d.ts +8 -1
  81. package/dist/types-ts4.5/plugins/extension/types.d.ts +2 -0
  82. package/dist/types-ts4.5/plugins/floating-toolbar/ui/ExtensionsPlaceholder.d.ts +2 -0
  83. package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +7 -3
  84. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  85. package/package.json +4 -3
  86. package/dist/cjs/plugins/context-panel/index.js +0 -66
  87. package/dist/cjs/plugins/context-panel/transforms.js +0 -13
  88. package/dist/cjs/plugins/context-panel/types.js +0 -5
  89. package/dist/es2019/plugins/context-panel/index.js +0 -45
  90. package/dist/es2019/plugins/context-panel/transforms.js +0 -4
  91. package/dist/es2019/plugins/context-panel/types.js +0 -1
  92. package/dist/esm/plugins/context-panel/index.js +0 -57
  93. package/dist/esm/plugins/context-panel/transforms.js +0 -6
  94. package/dist/esm/plugins/context-panel/types.js +0 -1
  95. package/dist/types/plugins/context-panel/index.d.ts +0 -11
  96. package/dist/types/plugins/context-panel/transforms.d.ts +0 -2
  97. package/dist/types/plugins/context-panel/types.d.ts +0 -1
  98. package/dist/types-ts4.5/plugins/context-panel/index.d.ts +0 -11
  99. package/dist/types-ts4.5/plugins/context-panel/transforms.d.ts +0 -2
  100. package/dist/types-ts4.5/plugins/context-panel/types.d.ts +0 -1
@@ -150,10 +150,11 @@ export var updateExtensionParams = function updateExtensionParams(updateExtensio
150
150
  export var editSelectedExtension = function editSelectedExtension(editorActions) {
151
151
  var editorView = editorActions._privateGetEditorView();
152
152
  var _getPluginState = getPluginState(editorView.state),
153
- updateExtension = _getPluginState.updateExtension;
154
- return editExtension(null, updateExtension)(editorView.state, editorView.dispatch, editorView);
153
+ updateExtension = _getPluginState.updateExtension,
154
+ applyChangeToContextPanel = _getPluginState.applyChangeToContextPanel;
155
+ return editExtension(null, applyChangeToContextPanel, updateExtension)(editorView.state, editorView.dispatch, editorView);
155
156
  };
156
- export var editExtension = function editExtension(macroProvider, updateExtension) {
157
+ export var editExtension = function editExtension(macroProvider, applyChangeToContextPanel, updateExtension) {
157
158
  return function (state, dispatch, view) {
158
159
  if (!view) {
159
160
  return false;
@@ -173,7 +174,8 @@ export var editExtension = function editExtension(macroProvider, updateExtension
173
174
  if (updateMethod && view) {
174
175
  var actions = createExtensionAPI({
175
176
  editorView: view,
176
- editInLegacyMacroBrowser: editInLegacyMacroBrowser
177
+ editInLegacyMacroBrowser: editInLegacyMacroBrowser,
178
+ applyChange: applyChangeToContextPanel
177
179
  });
178
180
  updateExtensionParams(updateMethod, nodeWithPos, actions)(state, dispatch, view);
179
181
  return;
@@ -2,7 +2,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
3
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
4
  import { removeSelectedNode, removeParentNodeOfType } from 'prosemirror-utils';
5
- import { applyChange } from '../context-panel/transforms';
6
5
  import { createCommand } from './plugin-factory';
7
6
  import { getSelectedExtension } from './utils';
8
7
  import { removeConnectedNodes } from '@atlaskit/editor-common/utils';
@@ -14,7 +13,7 @@ export function updateState(state) {
14
13
  data: state
15
14
  });
16
15
  }
17
- export function setEditingContextToContextPanel(processParametersBefore, processParametersAfter) {
16
+ export function setEditingContextToContextPanel(processParametersBefore, processParametersAfter, applyChangeToContextPanel) {
18
17
  return createCommand({
19
18
  type: 'UPDATE_STATE',
20
19
  data: {
@@ -22,24 +21,28 @@ export function setEditingContextToContextPanel(processParametersBefore, process
22
21
  processParametersBefore: processParametersBefore,
23
22
  processParametersAfter: processParametersAfter
24
23
  }
25
- }, applyChange);
24
+ }, applyChangeToContextPanel);
26
25
  }
27
- export var clearEditingContext = createCommand({
28
- type: 'UPDATE_STATE',
29
- data: {
30
- showContextPanel: false,
31
- processParametersBefore: undefined,
32
- processParametersAfter: undefined
33
- }
34
- }, applyChange);
35
- export var forceAutoSave = function forceAutoSave(resolve, reject) {
26
+ export var clearEditingContext = function clearEditingContext(applyChangeToContextPanel) {
36
27
  return createCommand({
37
28
  type: 'UPDATE_STATE',
38
29
  data: {
39
- autoSaveResolve: resolve,
40
- autoSaveReject: reject
30
+ showContextPanel: false,
31
+ processParametersBefore: undefined,
32
+ processParametersAfter: undefined
41
33
  }
42
- }, applyChange);
34
+ }, applyChangeToContextPanel);
35
+ };
36
+ export var forceAutoSave = function forceAutoSave(applyChangeToContextPanel) {
37
+ return function (resolve, reject) {
38
+ return createCommand({
39
+ type: 'UPDATE_STATE',
40
+ data: {
41
+ autoSaveResolve: resolve,
42
+ autoSaveReject: reject
43
+ }
44
+ }, applyChangeToContextPanel);
45
+ };
43
46
  };
44
47
  export var updateExtensionLayout = function updateExtensionLayout(layout) {
45
48
  return createCommand({
@@ -25,7 +25,7 @@ var areParametersEqual = function areParametersEqual(firstParameters, secondPara
25
25
  }
26
26
  return firstParameters === secondParameters;
27
27
  };
28
- export var getContextPanel = function getContextPanel(allowAutoSave, featureFlags) {
28
+ export var getContextPanel = function getContextPanel(allowAutoSave, featureFlags, applyChange) {
29
29
  return function (state) {
30
30
  var nodeWithPos = getSelectedExtension(state, true);
31
31
 
@@ -87,7 +87,7 @@ export var getContextPanel = function getContextPanel(allowAutoSave, featureFlag
87
87
  autoSaveResolve();
88
88
  }
89
89
  if (!allowAutoSave) {
90
- clearEditingContext(editorView.state, editorView.dispatch);
90
+ clearEditingContext(applyChange)(editorView.state, editorView.dispatch);
91
91
  }
92
92
  case 5:
93
93
  case "end":
@@ -110,7 +110,7 @@ export var getContextPanel = function getContextPanel(allowAutoSave, featureFlag
110
110
  _context2.prev = 1;
111
111
  _context2.next = 4;
112
112
  return new Promise(function (resolve, reject) {
113
- forceAutoSave(resolve, reject)(editorView.state, editorView.dispatch);
113
+ forceAutoSave(applyChange)(resolve, reject)(editorView.state, editorView.dispatch);
114
114
  });
115
115
  case 4:
116
116
  _context2.next = 9;
@@ -122,7 +122,7 @@ export var getContextPanel = function getContextPanel(allowAutoSave, featureFlag
122
122
  // eslint-disable-next-line no-console
123
123
  console.error("Autosave failed with error", _context2.t0);
124
124
  case 9:
125
- clearEditingContext(editorView.state, editorView.dispatch);
125
+ clearEditingContext(applyChange)(editorView.state, editorView.dispatch);
126
126
  case 10:
127
127
  case "end":
128
128
  return _context2.stop();
@@ -237,7 +237,7 @@ export var createExtensionAPI = function createExtensionAPI(options) {
237
237
  return {
238
238
  editInContextPanel: function editInContextPanel(transformBefore, transformAfter) {
239
239
  var editorView = options.editorView;
240
- setEditingContextToContextPanel(transformBefore, transformAfter)(editorView.state, editorView.dispatch, editorView);
240
+ setEditingContextToContextPanel(transformBefore, transformAfter, options.applyChange)(editorView.state, editorView.dispatch, editorView);
241
241
  },
242
242
  _editInLegacyMacroBrowser: function _editInLegacyMacroBrowser() {
243
243
  var editorView = options.editorView;
@@ -5,7 +5,7 @@ import { createPlugin as createUniqueIdPlugin } from './pm-plugins/unique-id';
5
5
  import { getToolbarConfig } from './toolbar';
6
6
  import { getContextPanel } from './context-panel';
7
7
  var extensionPlugin = function extensionPlugin() {
8
- var _api$dependencies, _api$dependencies$fea;
8
+ var _api$dependencies, _api$dependencies$fea, _api$dependencies$con2, _api$dependencies$con3;
9
9
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
10
10
  var api = arguments.length > 1 ? arguments[1] : undefined;
11
11
  var featureFlags = (api === null || api === void 0 ? void 0 : (_api$dependencies = api.dependencies) === null || _api$dependencies === void 0 ? void 0 : (_api$dependencies$fea = _api$dependencies.featureFlags) === null || _api$dependencies$fea === void 0 ? void 0 : _api$dependencies$fea.sharedState.currentState()) || {};
@@ -38,7 +38,10 @@ var extensionPlugin = function extensionPlugin() {
38
38
  }
39
39
  }, {
40
40
  name: 'extensionKeymap',
41
- plugin: keymapPlugin
41
+ plugin: function plugin() {
42
+ var _api$dependencies$con;
43
+ return keymapPlugin(api === null || api === void 0 ? void 0 : (_api$dependencies$con = api.dependencies.contextPanel) === null || _api$dependencies$con === void 0 ? void 0 : _api$dependencies$con.actions.applyChange);
44
+ }
42
45
  }, {
43
46
  name: 'extensionUniqueId',
44
47
  plugin: function plugin() {
@@ -47,8 +50,12 @@ var extensionPlugin = function extensionPlugin() {
47
50
  }];
48
51
  },
49
52
  pluginsOptions: {
50
- floatingToolbar: getToolbarConfig(options.breakoutEnabled, api === null || api === void 0 ? void 0 : api.dependencies.decorations.actions.hoverDecoration),
51
- contextPanel: getContextPanel(options.allowAutoSave, featureFlags)
53
+ floatingToolbar: getToolbarConfig({
54
+ breakoutEnabled: options.breakoutEnabled,
55
+ hoverDecoration: api === null || api === void 0 ? void 0 : api.dependencies.decorations.actions.hoverDecoration,
56
+ applyChangeToContextPanel: api === null || api === void 0 ? void 0 : (_api$dependencies$con2 = api.dependencies.contextPanel) === null || _api$dependencies$con2 === void 0 ? void 0 : _api$dependencies$con2.actions.applyChange
57
+ }),
58
+ contextPanel: getContextPanel(options.allowAutoSave, featureFlags, api === null || api === void 0 ? void 0 : (_api$dependencies$con3 = api.dependencies.contextPanel) === null || _api$dependencies$con3 === void 0 ? void 0 : _api$dependencies$con3.actions.applyChange)
52
59
  }
53
60
  };
54
61
  };
@@ -2,14 +2,14 @@ import { keymap } from 'prosemirror-keymap';
2
2
  import { getPluginState } from './main';
3
3
  import * as keymaps from '../../../keymaps';
4
4
  import { clearEditingContext } from '../commands';
5
- export default function keymapPlugin() {
5
+ export default function keymapPlugin(applyChange) {
6
6
  var list = {};
7
7
  keymaps.bindKeymapWithCommand(keymaps.escape.common, function (state, dispatch) {
8
8
  var extensionState = getPluginState(state);
9
9
  if (!extensionState.showContextPanel) {
10
10
  return false;
11
11
  }
12
- return clearEditingContext(state, dispatch);
12
+ return clearEditingContext(applyChange)(state, dispatch);
13
13
  }, list);
14
14
  return keymap(list);
15
15
  }
@@ -137,7 +137,8 @@ export var handleUpdate = function handleUpdate(_ref4) {
137
137
  var view = _ref4.view,
138
138
  prevState = _ref4.prevState,
139
139
  domAtPos = _ref4.domAtPos,
140
- extensionHandlers = _ref4.extensionHandlers;
140
+ extensionHandlers = _ref4.extensionHandlers,
141
+ applyChange = _ref4.applyChange;
141
142
  var state = view.state,
142
143
  dispatch = view.dispatch;
143
144
  var _getPluginState = getPluginState(state),
@@ -151,7 +152,7 @@ export var handleUpdate = function handleUpdate(_ref4) {
151
152
  var selectedExtension = getSelectedExtension(state, true);
152
153
  if (!selectedExtension) {
153
154
  if (showContextPanel) {
154
- clearEditingContext(state, dispatch);
155
+ clearEditingContext(applyChange)(state, dispatch);
155
156
  }
156
157
  return;
157
158
  }
@@ -167,7 +168,7 @@ export var handleUpdate = function handleUpdate(_ref4) {
167
168
  element !== newElement;
168
169
  if (isNewNodeSelected || shouldUpdateEditButton) {
169
170
  if (showContextPanel) {
170
- clearEditingContext(state, dispatch);
171
+ clearEditingContext(applyChange)(state, dispatch);
171
172
  return;
172
173
  }
173
174
  var extensionType = node.attrs.extensionType;
@@ -195,11 +196,13 @@ export var handleUpdate = function handleUpdate(_ref4) {
195
196
  return true;
196
197
  };
197
198
  var createPlugin = function createPlugin(dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, pluginInjectionApi) {
199
+ var _pluginInjectionApi$d;
198
200
  var useLongPressSelection = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
199
201
  var options = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : {};
200
202
  var state = createPluginState(dispatch, {
201
203
  showEditButton: false,
202
- showContextPanel: false
204
+ showContextPanel: false,
205
+ applyChangeToContextPanel: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.contextPanel) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions.applyChange
203
206
  });
204
207
  var extensionNodeViewOptions = {
205
208
  appearance: options.appearance
@@ -214,11 +217,13 @@ var createPlugin = function createPlugin(dispatch, providerFactory, extensionHan
214
217
  providerFactory.subscribe('contextIdentificationProvider', contextIdentificationProviderHandler);
215
218
  return {
216
219
  update: function update(view, prevState) {
220
+ var _pluginInjectionApi$d2;
217
221
  handleUpdate({
218
222
  view: view,
219
223
  prevState: prevState,
220
224
  domAtPos: domAtPos,
221
- extensionHandlers: extensionHandlers
225
+ extensionHandlers: extensionHandlers,
226
+ applyChange: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.dependencies.contextPanel) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions.applyChange
222
227
  });
223
228
  },
224
229
  destroy: function destroy() {
@@ -89,7 +89,7 @@ var breakoutOptions = function breakoutOptions(state, formatMessage, extensionSt
89
89
  }
90
90
  return [];
91
91
  };
92
- var editButton = function editButton(formatMessage, extensionState) {
92
+ var editButton = function editButton(formatMessage, extensionState, applyChangeToContextPanel) {
93
93
  if (!extensionState.showEditButton) {
94
94
  return [];
95
95
  }
@@ -103,7 +103,7 @@ var editButton = function editButton(formatMessage, extensionState) {
103
103
  var macroState = macroPluginKey.getState(state);
104
104
  var _getPluginState = getPluginState(state),
105
105
  updateExtension = _getPluginState.updateExtension;
106
- editExtension(macroState && macroState.macroProvider, updateExtension)(state, dispatch, view);
106
+ editExtension(macroState && macroState.macroProvider, applyChangeToContextPanel, updateExtension)(state, dispatch, view);
107
107
  return true;
108
108
  },
109
109
  title: formatMessage(messages.edit),
@@ -111,15 +111,17 @@ var editButton = function editButton(formatMessage, extensionState) {
111
111
  focusEditoronEnter: true
112
112
  }];
113
113
  };
114
- export var getToolbarConfig = function getToolbarConfig() {
115
- var breakoutEnabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
116
- var hoverDecoration = arguments.length > 1 ? arguments[1] : undefined;
114
+ export var getToolbarConfig = function getToolbarConfig(_ref) {
115
+ var _ref$breakoutEnabled = _ref.breakoutEnabled,
116
+ breakoutEnabled = _ref$breakoutEnabled === void 0 ? true : _ref$breakoutEnabled,
117
+ hoverDecoration = _ref.hoverDecoration,
118
+ applyChangeToContextPanel = _ref.applyChangeToContextPanel;
117
119
  return function (state, intl) {
118
120
  var formatMessage = intl.formatMessage;
119
121
  var extensionState = getPluginState(state);
120
122
  if (extensionState && !extensionState.showContextPanel && extensionState.element) {
121
123
  var nodeType = [state.schema.nodes.extension, state.schema.nodes.inlineExtension, state.schema.nodes.bodiedExtension];
122
- var editButtonArray = editButton(formatMessage, extensionState);
124
+ var editButtonArray = editButton(formatMessage, extensionState, applyChangeToContextPanel);
123
125
  var breakoutButtonArray = breakoutOptions(state, formatMessage, extensionState, breakoutEnabled);
124
126
  var extensionObj = getSelectedExtension(state, true);
125
127
 
@@ -45,7 +45,8 @@ var resolveExtensionIcon = /*#__PURE__*/function () {
45
45
  var ExtensionButton = function ExtensionButton(props) {
46
46
  var item = props.item,
47
47
  node = props.node,
48
- editorView = props.editorView;
48
+ editorView = props.editorView,
49
+ applyChangeToContextPanel = props.applyChangeToContextPanel;
49
50
  var ButtonIcon = React.useMemo(function () {
50
51
  return item.icon ? Loadable({
51
52
  loader: function () {
@@ -74,7 +75,8 @@ var ExtensionButton = function ExtensionButton(props) {
74
75
  }
75
76
  var targetNodeAdf = nodeToJSON(node);
76
77
  var api = createExtensionAPI({
77
- editorView: editorView
78
+ editorView: editorView,
79
+ applyChange: applyChangeToContextPanel
78
80
  });
79
81
  item.action(targetNodeAdf, api);
80
82
  };
@@ -93,7 +95,8 @@ export var ExtensionsPlaceholder = function ExtensionsPlaceholder(props) {
93
95
  var node = props.node,
94
96
  editorView = props.editorView,
95
97
  extensionProvider = props.extensionProvider,
96
- separator = props.separator;
98
+ separator = props.separator,
99
+ applyChangeToContextPanel = props.applyChangeToContextPanel;
97
100
  var _useState = useState([]),
98
101
  _useState2 = _slicedToArray(_useState, 2),
99
102
  extensions = _useState2[0],
@@ -131,9 +134,10 @@ export var ExtensionsPlaceholder = function ExtensionsPlaceholder(props) {
131
134
  }, [node]);
132
135
  var extensionItems = React.useMemo(function () {
133
136
  return getContextualToolbarItemsFromModule(extensions, nodeAdf, createExtensionAPI({
134
- editorView: editorView
137
+ editorView: editorView,
138
+ applyChange: applyChangeToContextPanel
135
139
  }));
136
- }, [extensions, nodeAdf, editorView]);
140
+ }, [extensions, nodeAdf, editorView, applyChangeToContextPanel]);
137
141
  if (!extensionItems.length) {
138
142
  return null;
139
143
  }
@@ -148,7 +152,8 @@ export var ExtensionsPlaceholder = function ExtensionsPlaceholder(props) {
148
152
  children.push( /*#__PURE__*/React.createElement(ExtensionButton, {
149
153
  node: node,
150
154
  item: item,
151
- editorView: editorView
155
+ editorView: editorView,
156
+ applyChangeToContextPanel: applyChangeToContextPanel
152
157
  }));
153
158
  if (index < extensionItems.length - 1) {
154
159
  children.push( /*#__PURE__*/React.createElement(Separator, null));
@@ -51,7 +51,8 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
51
51
  node = _ref.node,
52
52
  setDisableScroll = _ref.setDisableScroll,
53
53
  mountRef = _ref.mountRef,
54
- featureFlags = _ref.featureFlags;
54
+ featureFlags = _ref.featureFlags,
55
+ api = _ref.api;
55
56
  var emojiAndColourPickerMountPoint = scrollable ? popupsMountPoint || (editorView === null || editorView === void 0 ? void 0 : editorView.dom.closest('.fabric-editor-popup-scroll-parent')) || (editorView === null || editorView === void 0 ? void 0 : editorView.dom.closest('.ak-editor-content-area')) || undefined : popupsMountPoint;
56
57
  var _ref2 = featureFlags || {
57
58
  useSomewhatSemanticTextColorNames: false
@@ -60,6 +61,7 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
60
61
  return jsx(ButtonGroup, null, items.filter(function (item) {
61
62
  return !item.hidden;
62
63
  }).map(function (item, idx) {
64
+ var _api$dependencies$con;
63
65
  switch (item.type) {
64
66
  case 'button':
65
67
  var ButtonIcon = item.icon;
@@ -230,7 +232,8 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
230
232
  node: node,
231
233
  editorView: editorView,
232
234
  extensionProvider: extensionsProvider,
233
- separator: item.separator
235
+ separator: item.separator,
236
+ applyChangeToContextPanel: api === null || api === void 0 ? void 0 : (_api$dependencies$con = api.dependencies.contextPanel) === null || _api$dependencies$con === void 0 ? void 0 : _api$dependencies$con.actions.applyChange
234
237
  });
235
238
  case 'separator':
236
239
  return jsx(Separator, {
@@ -52,7 +52,6 @@ export { default as expandPlugin, isExpandInsertionEnabled } from './expand';
52
52
  export { default as scrollIntoViewPlugin } from './scroll-into-view';
53
53
  export { default as mobileDimensionsPlugin } from './mobile-dimensions';
54
54
  export { default as findReplacePlugin } from './find-replace';
55
- export { default as contextPanelPlugin } from './context-panel';
56
55
  export { default as selectionPlugin } from './selection';
57
56
  export { default as mobileSelectionPlugin } from './mobile-selection';
58
57
  export { default as clipboardPlugin } from './clipboard';
@@ -22,7 +22,6 @@ import { N30 } from '@atlaskit/theme/colors';
22
22
  import { akEditorSwoopCubicBezier, akEditorDefaultLayoutWidth, akEditorWideLayoutWidth, akEditorBreakoutPadding, akEditorContextPanelWidth, ATLASSIAN_NAVIGATION_HEIGHT } from '@atlaskit/editor-shared-styles';
23
23
  import { ContextPanelConsumer } from '@atlaskit/editor-common/ui';
24
24
  import WithPluginState from '../WithPluginState';
25
- import { pluginKey as contextPanelPluginKey } from '../../plugins/context-panel';
26
25
  import WithEditorActions from '../WithEditorActions';
27
26
  import { getChildBreakoutModes } from '../../utils/document';
28
27
  import { WidthContext } from '@atlaskit/editor-common/ui';
@@ -170,6 +169,14 @@ var widthPluginKey = {
170
169
  return state['widthPlugin$'];
171
170
  }
172
171
  };
172
+
173
+ // @ts-ignore
174
+ var contextPanelPluginKey = {
175
+ key: 'contextPanelPluginKey$',
176
+ getState: function getState(state) {
177
+ return state['contextPanelPluginKey$'];
178
+ }
179
+ };
173
180
  function ContextPanelWithActions(_ref2) {
174
181
  var actions = _ref2.actions,
175
182
  props = _objectWithoutProperties(_ref2, _excluded);
@@ -20,7 +20,7 @@ function _temporaryFixForConfigPanel() {
20
20
  }
21
21
  _context.next = 4;
22
22
  return new Promise(function (resolve) {
23
- forceAutoSave(resolve)(editorView.state, editorView.dispatch);
23
+ forceAutoSave(extensionPluginState.applyChangeToContextPanel)(resolve)(editorView.state, editorView.dispatch);
24
24
  });
25
25
  case 4:
26
26
  case "end":
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "185.2.23";
2
+ export var version = "185.2.25";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "185.2.23",
3
+ "version": "185.2.25",
4
4
  "sideEffects": false
5
5
  }
@@ -11,7 +11,6 @@ export type ProviderFactoryState = {
11
11
  /**
12
12
  *
13
13
  * This hook is used to create the provider factory object.
14
- * WARNING: Consider any changes to also make to `src/editor.tsx`
15
14
  *
16
15
  * @param props
17
16
  * @param editorActions
@@ -117,7 +117,15 @@ export declare function useCXHTMLPreset({ mentionProvider, mediaProvider, placeh
117
117
  hoverDecoration: (nodeType: import("prosemirror-model").NodeType<any> | import("prosemirror-model").NodeType<any>[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command;
118
118
  removeDecoration: import("@atlaskit/editor-common/types").Command;
119
119
  };
120
- }>];
120
+ }>, import("@atlaskit/editor-common/types").OptionalPlugin<(config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"contextPanel", {
121
+ actions: {
122
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
123
+ };
124
+ }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"contextPanel", {
125
+ actions: {
126
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
127
+ };
128
+ }>>];
121
129
  actions: {
122
130
  forceFocusSelector: import("@atlaskit/editor-plugin-floating-toolbar").ForceFocusSelector;
123
131
  };
@@ -140,7 +148,15 @@ export declare function useCXHTMLPreset({ mentionProvider, mediaProvider, placeh
140
148
  hoverDecoration: (nodeType: import("prosemirror-model").NodeType<any> | import("prosemirror-model").NodeType<any>[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command;
141
149
  removeDecoration: import("@atlaskit/editor-common/types").Command;
142
150
  };
143
- }>];
151
+ }>, import("@atlaskit/editor-common/types").OptionalPlugin<(config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"contextPanel", {
152
+ actions: {
153
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
154
+ };
155
+ }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"contextPanel", {
156
+ actions: {
157
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
158
+ };
159
+ }>>];
144
160
  actions: {
145
161
  forceFocusSelector: import("@atlaskit/editor-plugin-floating-toolbar").ForceFocusSelector;
146
162
  };
@@ -146,7 +146,15 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
146
146
  hoverDecoration: (nodeType: import("prosemirror-model").NodeType<any> | import("prosemirror-model").NodeType<any>[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command;
147
147
  removeDecoration: import("@atlaskit/editor-common/types").Command;
148
148
  };
149
- }>];
149
+ }>, import("@atlaskit/editor-common/types").OptionalPlugin<(config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"contextPanel", {
150
+ actions: {
151
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
152
+ };
153
+ }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"contextPanel", {
154
+ actions: {
155
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
156
+ };
157
+ }>>];
150
158
  actions: {
151
159
  forceFocusSelector: import("@atlaskit/editor-plugin-floating-toolbar").ForceFocusSelector;
152
160
  };
@@ -169,7 +177,15 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
169
177
  hoverDecoration: (nodeType: import("prosemirror-model").NodeType<any> | import("prosemirror-model").NodeType<any>[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command;
170
178
  removeDecoration: import("@atlaskit/editor-common/types").Command;
171
179
  };
172
- }>];
180
+ }>, import("@atlaskit/editor-common/types").OptionalPlugin<(config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"contextPanel", {
181
+ actions: {
182
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
183
+ };
184
+ }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"contextPanel", {
185
+ actions: {
186
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
187
+ };
188
+ }>>];
173
189
  actions: {
174
190
  forceFocusSelector: import("@atlaskit/editor-plugin-floating-toolbar").ForceFocusSelector;
175
191
  };
@@ -381,7 +397,15 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
381
397
  hoverDecoration: (nodeType: import("prosemirror-model").NodeType<any> | import("prosemirror-model").NodeType<any>[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command;
382
398
  removeDecoration: import("@atlaskit/editor-common/types").Command;
383
399
  };
384
- }>];
400
+ }>, import("@atlaskit/editor-common/types").OptionalPlugin<(config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"contextPanel", {
401
+ actions: {
402
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
403
+ };
404
+ }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"contextPanel", {
405
+ actions: {
406
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
407
+ };
408
+ }>>];
385
409
  actions: {
386
410
  forceFocusSelector: import("@atlaskit/editor-plugin-floating-toolbar").ForceFocusSelector;
387
411
  };
@@ -404,7 +428,15 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
404
428
  hoverDecoration: (nodeType: import("prosemirror-model").NodeType<any> | import("prosemirror-model").NodeType<any>[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command;
405
429
  removeDecoration: import("@atlaskit/editor-common/types").Command;
406
430
  };
407
- }>];
431
+ }>, import("@atlaskit/editor-common/types").OptionalPlugin<(config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"contextPanel", {
432
+ actions: {
433
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
434
+ };
435
+ }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"contextPanel", {
436
+ actions: {
437
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
438
+ };
439
+ }>>];
408
440
  actions: {
409
441
  forceFocusSelector: import("@atlaskit/editor-plugin-floating-toolbar").ForceFocusSelector;
410
442
  };
@@ -120,7 +120,15 @@ export declare function useMobilePreset({ media, placeholder, maxContentSize, cr
120
120
  hoverDecoration: (nodeType: import("prosemirror-model").NodeType<any> | import("prosemirror-model").NodeType<any>[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command;
121
121
  removeDecoration: import("@atlaskit/editor-common/types").Command;
122
122
  };
123
- }>];
123
+ }>, import("@atlaskit/editor-common/types").OptionalPlugin<(config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"contextPanel", {
124
+ actions: {
125
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
126
+ };
127
+ }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"contextPanel", {
128
+ actions: {
129
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
130
+ };
131
+ }>>];
124
132
  actions: {
125
133
  forceFocusSelector: import("@atlaskit/editor-plugin-floating-toolbar").ForceFocusSelector;
126
134
  };
@@ -143,7 +151,15 @@ export declare function useMobilePreset({ media, placeholder, maxContentSize, cr
143
151
  hoverDecoration: (nodeType: import("prosemirror-model").NodeType<any> | import("prosemirror-model").NodeType<any>[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command;
144
152
  removeDecoration: import("@atlaskit/editor-common/types").Command;
145
153
  };
146
- }>];
154
+ }>, import("@atlaskit/editor-common/types").OptionalPlugin<(config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"contextPanel", {
155
+ actions: {
156
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
157
+ };
158
+ }> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"contextPanel", {
159
+ actions: {
160
+ applyChange: (tr: import("prosemirror-state").Transaction<any>) => import("prosemirror-state").Transaction<any>;
161
+ };
162
+ }>>];
147
163
  actions: {
148
164
  forceFocusSelector: import("@atlaskit/editor-plugin-floating-toolbar").ForceFocusSelector;
149
165
  };
@@ -6,6 +6,7 @@ import { MacroProvider } from '@atlaskit/editor-common/provider-factory';
6
6
  export { transformSliceToRemoveOpenBodiedExtension } from '@atlaskit/editor-common/transforms';
7
7
  import { Command, CommandDispatch } from '../../types';
8
8
  import EditorActions from '../../actions';
9
+ import type { ApplyChangeHandler } from '@atlaskit/editor-plugin-context-panel';
9
10
  export declare const buildExtensionNode: <S extends Schema<any, any>>(type: 'inlineExtension' | 'extension' | 'bodiedExtension', schema: S, attrs: object, content?: Fragment, marks?: Mark<S>[] | undefined) => PmNode<Schema<any, any>>;
10
11
  export declare const performNodeUpdate: (type: 'inlineExtension' | 'extension' | 'bodiedExtension', newAttrs: object, content: Fragment<any>, marks: Mark[], shouldScrollIntoView: boolean) => Command;
11
12
  export declare const updateExtensionParams: (updateExtension: UpdateExtension<object>, node: {
@@ -13,4 +14,4 @@ export declare const updateExtensionParams: (updateExtension: UpdateExtension<ob
13
14
  pos: number;
14
15
  }, actions: ExtensionAPI) => (state: EditorState, dispatch?: CommandDispatch, view?: EditorView) => Promise<boolean>;
15
16
  export declare const editSelectedExtension: (editorActions: EditorActions) => boolean;
16
- export declare const editExtension: (macroProvider: MacroProvider | null, updateExtension?: Promise<UpdateExtension<object> | void>) => Command;
17
+ export declare const editExtension: (macroProvider: MacroProvider | null, applyChangeToContextPanel: ApplyChangeHandler | undefined, updateExtension?: Promise<UpdateExtension<object> | void>) => Command;
@@ -2,10 +2,11 @@ import { ExtensionLayout } from '@atlaskit/adf-schema';
2
2
  import { Node as PMNode } from 'prosemirror-model';
3
3
  import { ExtensionState } from './types';
4
4
  import { Parameters, TransformBefore, TransformAfter } from '@atlaskit/editor-common/src/extensions';
5
+ import type { ApplyChangeHandler } from '@atlaskit/editor-plugin-context-panel';
5
6
  export declare function updateState(state: Partial<ExtensionState>): import("@atlaskit/editor-common/types").Command;
6
- export declare function setEditingContextToContextPanel<T extends Parameters = Parameters>(processParametersBefore: TransformBefore<T>, processParametersAfter: TransformAfter<T>): import("@atlaskit/editor-common/types").Command;
7
- export declare const clearEditingContext: import("@atlaskit/editor-common/types").Command;
8
- export declare const forceAutoSave: (resolve: () => void, reject?: ((reason?: any) => void) | undefined) => import("@atlaskit/editor-common/types").Command;
7
+ export declare function setEditingContextToContextPanel<T extends Parameters = Parameters>(processParametersBefore: TransformBefore<T>, processParametersAfter: TransformAfter<T>, applyChangeToContextPanel: ApplyChangeHandler | undefined): import("@atlaskit/editor-common/types").Command;
8
+ export declare const clearEditingContext: (applyChangeToContextPanel: ApplyChangeHandler | undefined) => import("@atlaskit/editor-common/types").Command;
9
+ export declare const forceAutoSave: (applyChangeToContextPanel: ApplyChangeHandler | undefined) => (resolve: () => void, reject?: ((reason?: any) => void) | undefined) => import("@atlaskit/editor-common/types").Command;
9
10
  export declare const updateExtensionLayout: (layout: ExtensionLayout) => import("@atlaskit/editor-common/types").Command;
10
11
  export declare const removeExtension: () => import("@atlaskit/editor-common/types").Command;
11
12
  export declare const removeDescendantNodes: (sourceNode?: PMNode) => import("@atlaskit/editor-common/types").Command;
@@ -3,5 +3,6 @@ import { EditorState } from 'prosemirror-state';
3
3
  import { FeatureFlags } from '@atlaskit/editor-common/types';
4
4
  import type { EditorView } from 'prosemirror-view';
5
5
  import type { ContentNodeWithPos } from 'prosemirror-utils';
6
- export declare const getContextPanel: (allowAutoSave?: boolean, featureFlags?: FeatureFlags) => (state: EditorState) => JSX.Element | undefined;
6
+ import type { ApplyChangeHandler } from '@atlaskit/editor-plugin-context-panel';
7
+ export declare const getContextPanel: (allowAutoSave?: boolean, featureFlags?: FeatureFlags, applyChange?: ApplyChangeHandler) => (state: EditorState) => JSX.Element | undefined;
7
8
  export declare function onChangeAction(editorView: EditorView, updatedParameters: object | undefined, oldParameters: object | undefined, nodeWithPos: ContentNodeWithPos, onSaving?: () => void): Promise<void>;
@@ -1,6 +1,7 @@
1
1
  import { ExtensionAPI } from '@atlaskit/editor-common/extensions';
2
2
  import type { EditorView } from 'prosemirror-view';
3
3
  import { MacroProvider } from '../macro';
4
+ import type { ApplyChangeHandler } from '@atlaskit/editor-plugin-context-panel';
4
5
  interface EditInLegacyMacroBrowserArgs {
5
6
  view: EditorView;
6
7
  macroProvider?: MacroProvider;
@@ -8,6 +9,7 @@ interface EditInLegacyMacroBrowserArgs {
8
9
  export declare const getEditInLegacyMacroBrowser: ({ view, macroProvider, }: EditInLegacyMacroBrowserArgs) => () => void;
9
10
  interface CreateExtensionAPIOptions {
10
11
  editorView: EditorView;
12
+ applyChange: ApplyChangeHandler | undefined;
11
13
  editInLegacyMacroBrowser?: () => void;
12
14
  }
13
15
  export declare const createExtensionAPI: (options: CreateExtensionAPIOptions) => ExtensionAPI;