@atlaskit/editor-core 185.2.24 → 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 (95) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/labs/next/presets/universal.js +6 -5
  3. package/dist/cjs/plugins/extension/actions.js +6 -4
  4. package/dist/cjs/plugins/extension/commands.js +19 -16
  5. package/dist/cjs/plugins/extension/context-panel.js +4 -4
  6. package/dist/cjs/plugins/extension/extension-api.js +1 -1
  7. package/dist/cjs/plugins/extension/index.js +11 -4
  8. package/dist/cjs/plugins/extension/pm-plugins/keymap.js +2 -2
  9. package/dist/cjs/plugins/extension/pm-plugins/main.js +10 -5
  10. package/dist/cjs/plugins/extension/toolbar.js +8 -6
  11. package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +11 -6
  12. package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +5 -2
  13. package/dist/cjs/plugins/index.js +0 -7
  14. package/dist/cjs/ui/ContextPanel/index.js +9 -2
  15. package/dist/cjs/utils/action.js +1 -1
  16. package/dist/cjs/version-wrapper.js +1 -1
  17. package/dist/cjs/version.json +1 -1
  18. package/dist/es2019/labs/next/presets/universal.js +7 -6
  19. package/dist/es2019/plugins/extension/actions.js +6 -4
  20. package/dist/es2019/plugins/extension/commands.js +6 -7
  21. package/dist/es2019/plugins/extension/context-panel.js +4 -4
  22. package/dist/es2019/plugins/extension/extension-api.js +1 -1
  23. package/dist/es2019/plugins/extension/index.js +11 -4
  24. package/dist/es2019/plugins/extension/pm-plugins/keymap.js +2 -2
  25. package/dist/es2019/plugins/extension/pm-plugins/main.js +10 -5
  26. package/dist/es2019/plugins/extension/toolbar.js +8 -4
  27. package/dist/es2019/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +11 -6
  28. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +5 -2
  29. package/dist/es2019/plugins/index.js +0 -1
  30. package/dist/es2019/ui/ContextPanel/index.js +8 -1
  31. package/dist/es2019/utils/action.js +1 -1
  32. package/dist/es2019/version-wrapper.js +1 -1
  33. package/dist/es2019/version.json +1 -1
  34. package/dist/esm/labs/next/presets/universal.js +7 -6
  35. package/dist/esm/plugins/extension/actions.js +6 -4
  36. package/dist/esm/plugins/extension/commands.js +18 -15
  37. package/dist/esm/plugins/extension/context-panel.js +4 -4
  38. package/dist/esm/plugins/extension/extension-api.js +1 -1
  39. package/dist/esm/plugins/extension/index.js +11 -4
  40. package/dist/esm/plugins/extension/pm-plugins/keymap.js +2 -2
  41. package/dist/esm/plugins/extension/pm-plugins/main.js +10 -5
  42. package/dist/esm/plugins/extension/toolbar.js +8 -6
  43. package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +11 -6
  44. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +5 -2
  45. package/dist/esm/plugins/index.js +0 -1
  46. package/dist/esm/ui/ContextPanel/index.js +8 -1
  47. package/dist/esm/utils/action.js +1 -1
  48. package/dist/esm/version-wrapper.js +1 -1
  49. package/dist/esm/version.json +1 -1
  50. package/dist/types/labs/next/presets/cxhtml.d.ts +18 -2
  51. package/dist/types/labs/next/presets/default.d.ts +36 -4
  52. package/dist/types/labs/next/presets/mobile.d.ts +18 -2
  53. package/dist/types/plugins/extension/actions.d.ts +2 -1
  54. package/dist/types/plugins/extension/commands.d.ts +4 -3
  55. package/dist/types/plugins/extension/context-panel.d.ts +2 -1
  56. package/dist/types/plugins/extension/extension-api.d.ts +2 -0
  57. package/dist/types/plugins/extension/index.d.ts +4 -2
  58. package/dist/types/plugins/extension/pm-plugins/keymap.d.ts +2 -1
  59. package/dist/types/plugins/extension/pm-plugins/main.d.ts +3 -1
  60. package/dist/types/plugins/extension/toolbar.d.ts +8 -1
  61. package/dist/types/plugins/extension/types.d.ts +2 -0
  62. package/dist/types/plugins/floating-toolbar/ui/ExtensionsPlaceholder.d.ts +2 -0
  63. package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +7 -3
  64. package/dist/types/plugins/index.d.ts +0 -1
  65. package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +20 -2
  66. package/dist/types-ts4.5/labs/next/presets/default.d.ts +40 -4
  67. package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +20 -2
  68. package/dist/types-ts4.5/plugins/extension/actions.d.ts +2 -1
  69. package/dist/types-ts4.5/plugins/extension/commands.d.ts +4 -3
  70. package/dist/types-ts4.5/plugins/extension/context-panel.d.ts +2 -1
  71. package/dist/types-ts4.5/plugins/extension/extension-api.d.ts +2 -0
  72. package/dist/types-ts4.5/plugins/extension/index.d.ts +4 -2
  73. package/dist/types-ts4.5/plugins/extension/pm-plugins/keymap.d.ts +2 -1
  74. package/dist/types-ts4.5/plugins/extension/pm-plugins/main.d.ts +3 -1
  75. package/dist/types-ts4.5/plugins/extension/toolbar.d.ts +8 -1
  76. package/dist/types-ts4.5/plugins/extension/types.d.ts +2 -0
  77. package/dist/types-ts4.5/plugins/floating-toolbar/ui/ExtensionsPlaceholder.d.ts +2 -0
  78. package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +7 -3
  79. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  80. package/package.json +2 -1
  81. package/dist/cjs/plugins/context-panel/index.js +0 -66
  82. package/dist/cjs/plugins/context-panel/transforms.js +0 -13
  83. package/dist/cjs/plugins/context-panel/types.js +0 -5
  84. package/dist/es2019/plugins/context-panel/index.js +0 -45
  85. package/dist/es2019/plugins/context-panel/transforms.js +0 -4
  86. package/dist/es2019/plugins/context-panel/types.js +0 -1
  87. package/dist/esm/plugins/context-panel/index.js +0 -57
  88. package/dist/esm/plugins/context-panel/transforms.js +0 -6
  89. package/dist/esm/plugins/context-panel/types.js +0 -1
  90. package/dist/types/plugins/context-panel/index.d.ts +0 -11
  91. package/dist/types/plugins/context-panel/transforms.d.ts +0 -2
  92. package/dist/types/plugins/context-panel/types.d.ts +0 -1
  93. package/dist/types-ts4.5/plugins/context-panel/index.d.ts +0 -11
  94. package/dist/types-ts4.5/plugins/context-panel/transforms.d.ts +0 -2
  95. package/dist/types-ts4.5/plugins/context-panel/types.d.ts +0 -1
@@ -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
  const extensionPlugin = (options = {}, api) => {
8
- var _api$dependencies, _api$dependencies$fea;
8
+ var _api$dependencies, _api$dependencies$fea, _api$dependencies$con2, _api$dependencies$con3;
9
9
  const 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()) || {};
10
10
  return {
11
11
  name: 'extension',
@@ -37,15 +37,22 @@ const extensionPlugin = (options = {}, api) => {
37
37
  }
38
38
  }, {
39
39
  name: 'extensionKeymap',
40
- plugin: keymapPlugin
40
+ plugin: () => {
41
+ var _api$dependencies$con;
42
+ 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);
43
+ }
41
44
  }, {
42
45
  name: 'extensionUniqueId',
43
46
  plugin: () => createUniqueIdPlugin()
44
47
  }];
45
48
  },
46
49
  pluginsOptions: {
47
- floatingToolbar: getToolbarConfig(options.breakoutEnabled, api === null || api === void 0 ? void 0 : api.dependencies.decorations.actions.hoverDecoration),
48
- contextPanel: getContextPanel(options.allowAutoSave, featureFlags)
50
+ floatingToolbar: getToolbarConfig({
51
+ breakoutEnabled: options.breakoutEnabled,
52
+ hoverDecoration: api === null || api === void 0 ? void 0 : api.dependencies.decorations.actions.hoverDecoration,
53
+ 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
54
+ }),
55
+ 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)
49
56
  }
50
57
  };
51
58
  };
@@ -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
  const list = {};
7
7
  keymaps.bindKeymapWithCommand(keymaps.escape.common, (state, dispatch) => {
8
8
  const 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
  }
@@ -60,7 +60,8 @@ export const handleUpdate = ({
60
60
  view,
61
61
  prevState,
62
62
  domAtPos,
63
- extensionHandlers
63
+ extensionHandlers,
64
+ applyChange
64
65
  }) => {
65
66
  const {
66
67
  state,
@@ -78,7 +79,7 @@ export const handleUpdate = ({
78
79
  const selectedExtension = getSelectedExtension(state, true);
79
80
  if (!selectedExtension) {
80
81
  if (showContextPanel) {
81
- clearEditingContext(state, dispatch);
82
+ clearEditingContext(applyChange)(state, dispatch);
82
83
  }
83
84
  return;
84
85
  }
@@ -96,7 +97,7 @@ export const handleUpdate = ({
96
97
  element !== newElement;
97
98
  if (isNewNodeSelected || shouldUpdateEditButton) {
98
99
  if (showContextPanel) {
99
- clearEditingContext(state, dispatch);
100
+ clearEditingContext(applyChange)(state, dispatch);
100
101
  return;
101
102
  }
102
103
  const {
@@ -126,9 +127,11 @@ export const handleUpdate = ({
126
127
  return true;
127
128
  };
128
129
  const createPlugin = (dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, pluginInjectionApi, useLongPressSelection = false, options = {}) => {
130
+ var _pluginInjectionApi$d;
129
131
  const state = createPluginState(dispatch, {
130
132
  showEditButton: false,
131
- showContextPanel: false
133
+ showContextPanel: false,
134
+ applyChangeToContextPanel: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.contextPanel) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions.applyChange
132
135
  });
133
136
  const extensionNodeViewOptions = {
134
137
  appearance: options.appearance
@@ -143,11 +146,13 @@ const createPlugin = (dispatch, providerFactory, extensionHandlers, portalProvid
143
146
  providerFactory.subscribe('contextIdentificationProvider', contextIdentificationProviderHandler);
144
147
  return {
145
148
  update: (view, prevState) => {
149
+ var _pluginInjectionApi$d2;
146
150
  handleUpdate({
147
151
  view,
148
152
  prevState,
149
153
  domAtPos,
150
- extensionHandlers
154
+ extensionHandlers,
155
+ applyChange: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.dependencies.contextPanel) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions.applyChange
151
156
  });
152
157
  },
153
158
  destroy: () => {
@@ -95,7 +95,7 @@ const breakoutOptions = (state, formatMessage, extensionState, breakoutEnabled)
95
95
  }
96
96
  return [];
97
97
  };
98
- const editButton = (formatMessage, extensionState) => {
98
+ const editButton = (formatMessage, extensionState, applyChangeToContextPanel) => {
99
99
  if (!extensionState.showEditButton) {
100
100
  return [];
101
101
  }
@@ -110,7 +110,7 @@ const editButton = (formatMessage, extensionState) => {
110
110
  const {
111
111
  updateExtension
112
112
  } = getPluginState(state);
113
- editExtension(macroState && macroState.macroProvider, updateExtension)(state, dispatch, view);
113
+ editExtension(macroState && macroState.macroProvider, applyChangeToContextPanel, updateExtension)(state, dispatch, view);
114
114
  return true;
115
115
  },
116
116
  title: formatMessage(messages.edit),
@@ -118,14 +118,18 @@ const editButton = (formatMessage, extensionState) => {
118
118
  focusEditoronEnter: true
119
119
  }];
120
120
  };
121
- export const getToolbarConfig = (breakoutEnabled = true, hoverDecoration) => (state, intl) => {
121
+ export const getToolbarConfig = ({
122
+ breakoutEnabled = true,
123
+ hoverDecoration,
124
+ applyChangeToContextPanel
125
+ }) => (state, intl) => {
122
126
  const {
123
127
  formatMessage
124
128
  } = intl;
125
129
  const extensionState = getPluginState(state);
126
130
  if (extensionState && !extensionState.showContextPanel && extensionState.element) {
127
131
  const nodeType = [state.schema.nodes.extension, state.schema.nodes.inlineExtension, state.schema.nodes.bodiedExtension];
128
- const editButtonArray = editButton(formatMessage, extensionState);
132
+ const editButtonArray = editButton(formatMessage, extensionState, applyChangeToContextPanel);
129
133
  const breakoutButtonArray = breakoutOptions(state, formatMessage, extensionState, breakoutEnabled);
130
134
  const extensionObj = getSelectedExtension(state, true);
131
135
 
@@ -21,7 +21,8 @@ const ExtensionButton = props => {
21
21
  const {
22
22
  item,
23
23
  node,
24
- editorView
24
+ editorView,
25
+ applyChangeToContextPanel
25
26
  } = props;
26
27
  const ButtonIcon = React.useMemo(() => item.icon ? Loadable({
27
28
  loader: async () => resolveExtensionIcon(item.icon),
@@ -33,7 +34,8 @@ const ExtensionButton = props => {
33
34
  }
34
35
  const targetNodeAdf = nodeToJSON(node);
35
36
  const api = createExtensionAPI({
36
- editorView
37
+ editorView,
38
+ applyChange: applyChangeToContextPanel
37
39
  });
38
40
  item.action(targetNodeAdf, api);
39
41
  };
@@ -53,7 +55,8 @@ export const ExtensionsPlaceholder = props => {
53
55
  node,
54
56
  editorView,
55
57
  extensionProvider,
56
- separator
58
+ separator,
59
+ applyChangeToContextPanel
57
60
  } = props;
58
61
  const [extensions, setExtensions] = useState([]);
59
62
  useEffect(() => {
@@ -69,9 +72,10 @@ export const ExtensionsPlaceholder = props => {
69
72
  const nodeAdf = React.useMemo(() => nodeToJSON(node), [node]);
70
73
  const extensionItems = React.useMemo(() => {
71
74
  return getContextualToolbarItemsFromModule(extensions, nodeAdf, createExtensionAPI({
72
- editorView
75
+ editorView,
76
+ applyChange: applyChangeToContextPanel
73
77
  }));
74
- }, [extensions, nodeAdf, editorView]);
78
+ }, [extensions, nodeAdf, editorView, applyChangeToContextPanel]);
75
79
  if (!extensionItems.length) {
76
80
  return null;
77
81
  }
@@ -86,7 +90,8 @@ export const ExtensionsPlaceholder = props => {
86
90
  children.push( /*#__PURE__*/React.createElement(ExtensionButton, {
87
91
  node: node,
88
92
  item: item,
89
- editorView: editorView
93
+ editorView: editorView,
94
+ applyChangeToContextPanel: applyChangeToContextPanel
90
95
  }));
91
96
  if (index < extensionItems.length - 1) {
92
97
  children.push( /*#__PURE__*/React.createElement(Separator, null));
@@ -41,7 +41,8 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
41
41
  node,
42
42
  setDisableScroll,
43
43
  mountRef,
44
- featureFlags
44
+ featureFlags,
45
+ api
45
46
  }) => {
46
47
  const 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;
47
48
  const {
@@ -50,6 +51,7 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
50
51
  useSomewhatSemanticTextColorNames: false
51
52
  };
52
53
  return jsx(ButtonGroup, null, items.filter(item => !item.hidden).map((item, idx) => {
54
+ var _api$dependencies$con;
53
55
  switch (item.type) {
54
56
  case 'button':
55
57
  const ButtonIcon = item.icon;
@@ -205,7 +207,8 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
205
207
  node: node,
206
208
  editorView: editorView,
207
209
  extensionProvider: extensionsProvider,
208
- separator: item.separator
210
+ separator: item.separator,
211
+ 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
209
212
  });
210
213
  case 'separator':
211
214
  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';
@@ -8,7 +8,6 @@ import { N30 } from '@atlaskit/theme/colors';
8
8
  import { akEditorSwoopCubicBezier, akEditorDefaultLayoutWidth, akEditorWideLayoutWidth, akEditorBreakoutPadding, akEditorContextPanelWidth, ATLASSIAN_NAVIGATION_HEIGHT } from '@atlaskit/editor-shared-styles';
9
9
  import { ContextPanelConsumer } from '@atlaskit/editor-common/ui';
10
10
  import WithPluginState from '../WithPluginState';
11
- import { pluginKey as contextPanelPluginKey } from '../../plugins/context-panel';
12
11
  import WithEditorActions from '../WithEditorActions';
13
12
  import { getChildBreakoutModes } from '../../utils/document';
14
13
  import { WidthContext } from '@atlaskit/editor-common/ui';
@@ -167,6 +166,14 @@ const widthPluginKey = {
167
166
  return state['widthPlugin$'];
168
167
  }
169
168
  };
169
+
170
+ // @ts-ignore
171
+ const contextPanelPluginKey = {
172
+ key: 'contextPanelPluginKey$',
173
+ getState: state => {
174
+ return state['contextPanelPluginKey$'];
175
+ }
176
+ };
170
177
  function ContextPanelWithActions({
171
178
  actions,
172
179
  ...props
@@ -6,7 +6,7 @@ export async function __temporaryFixForConfigPanel(editorView) {
6
6
  const extensionPluginState = editorView.state && extensionPluginKey.getState(editorView.state);
7
7
  if (extensionPluginState && extensionPluginState.showContextPanel) {
8
8
  await new Promise(resolve => {
9
- forceAutoSave(resolve)(editorView.state, editorView.dispatch);
9
+ forceAutoSave(extensionPluginState.applyChangeToContextPanel)(resolve)(editorView.state, editorView.dispatch);
10
10
  });
11
11
  }
12
12
  }
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "185.2.24";
2
+ export const version = "185.2.25";
3
3
  export const 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.24",
3
+ "version": "185.2.25",
4
4
  "sideEffects": false
5
5
  }
@@ -2,7 +2,8 @@ import _typeof from "@babel/runtime/helpers/typeof";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  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; }
4
4
  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; }
5
- import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, datePlugin, emojiPlugin, extensionPlugin, fragmentMarkPlugin, helpDialogPlugin, imageUploadPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, listPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, mediaPlugin, mentionsPlugin, panelPlugin, placeholderTextPlugin, rulePlugin, saveOnEnterPlugin, tasksAndDecisionsPlugin, textColorPlugin, statusPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, historyPlugin, expandPlugin, isExpandInsertionEnabled, scrollIntoViewPlugin, mobileDimensionsPlugin, findReplacePlugin, contextPanelPlugin, mobileSelectionPlugin, annotationPlugin, captionPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin, copyButtonPlugin, borderPlugin } from '../../../plugins';
5
+ import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, datePlugin, emojiPlugin, extensionPlugin, fragmentMarkPlugin, helpDialogPlugin, imageUploadPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, listPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, mediaPlugin, mentionsPlugin, panelPlugin, placeholderTextPlugin, rulePlugin, saveOnEnterPlugin, tasksAndDecisionsPlugin, textColorPlugin, statusPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, historyPlugin, expandPlugin, isExpandInsertionEnabled, scrollIntoViewPlugin, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, captionPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin, copyButtonPlugin, borderPlugin } from '../../../plugins';
6
+ import { contextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
6
7
  import { gridPlugin } from '@atlaskit/editor-plugin-grid';
7
8
  import cardPlugin from '../../../plugins/card';
8
9
  import { tablesPlugin } from '@atlaskit/editor-plugin-table';
@@ -225,6 +226,11 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
225
226
  }]);
226
227
  }
227
228
  return builder;
229
+ }).maybeAdd(contextPanelPlugin, function (plugin, builder) {
230
+ if (isFullPage) {
231
+ return builder.add(contextPanelPlugin);
232
+ }
233
+ return builder;
228
234
  }).maybeAdd(extensionPlugin, function (plugin, builder) {
229
235
  if (props.allowExtension) {
230
236
  var extensionConfig = _typeof(props.allowExtension) === 'object' ? props.allowExtension : {};
@@ -300,11 +306,6 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
300
306
  return builder.add(plugin);
301
307
  }
302
308
  return builder;
303
- }).maybeAdd(contextPanelPlugin, function (plugin, builder) {
304
- if (isFullPage) {
305
- return builder.add(contextPanelPlugin);
306
- }
307
- return builder;
308
309
  }).maybeAdd(scrollIntoViewPlugin, function (plugin, builder) {
309
310
  if (props.autoScrollIntoView !== false) {
310
311
  return builder.add(scrollIntoViewPlugin);
@@ -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