@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.
- package/CHANGELOG.md +7 -0
- package/dist/cjs/labs/next/presets/universal.js +6 -5
- package/dist/cjs/plugins/extension/actions.js +6 -4
- package/dist/cjs/plugins/extension/commands.js +19 -16
- package/dist/cjs/plugins/extension/context-panel.js +4 -4
- package/dist/cjs/plugins/extension/extension-api.js +1 -1
- package/dist/cjs/plugins/extension/index.js +11 -4
- package/dist/cjs/plugins/extension/pm-plugins/keymap.js +2 -2
- package/dist/cjs/plugins/extension/pm-plugins/main.js +10 -5
- package/dist/cjs/plugins/extension/toolbar.js +8 -6
- package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +11 -6
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +5 -2
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/ui/ContextPanel/index.js +9 -2
- package/dist/cjs/utils/action.js +1 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/labs/next/presets/universal.js +7 -6
- package/dist/es2019/plugins/extension/actions.js +6 -4
- package/dist/es2019/plugins/extension/commands.js +6 -7
- package/dist/es2019/plugins/extension/context-panel.js +4 -4
- package/dist/es2019/plugins/extension/extension-api.js +1 -1
- package/dist/es2019/plugins/extension/index.js +11 -4
- package/dist/es2019/plugins/extension/pm-plugins/keymap.js +2 -2
- package/dist/es2019/plugins/extension/pm-plugins/main.js +10 -5
- package/dist/es2019/plugins/extension/toolbar.js +8 -4
- package/dist/es2019/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +11 -6
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +5 -2
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/ui/ContextPanel/index.js +8 -1
- package/dist/es2019/utils/action.js +1 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/labs/next/presets/universal.js +7 -6
- package/dist/esm/plugins/extension/actions.js +6 -4
- package/dist/esm/plugins/extension/commands.js +18 -15
- package/dist/esm/plugins/extension/context-panel.js +4 -4
- package/dist/esm/plugins/extension/extension-api.js +1 -1
- package/dist/esm/plugins/extension/index.js +11 -4
- package/dist/esm/plugins/extension/pm-plugins/keymap.js +2 -2
- package/dist/esm/plugins/extension/pm-plugins/main.js +10 -5
- package/dist/esm/plugins/extension/toolbar.js +8 -6
- package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +11 -6
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +5 -2
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/ui/ContextPanel/index.js +8 -1
- package/dist/esm/utils/action.js +1 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/labs/next/presets/cxhtml.d.ts +18 -2
- package/dist/types/labs/next/presets/default.d.ts +36 -4
- package/dist/types/labs/next/presets/mobile.d.ts +18 -2
- package/dist/types/plugins/extension/actions.d.ts +2 -1
- package/dist/types/plugins/extension/commands.d.ts +4 -3
- package/dist/types/plugins/extension/context-panel.d.ts +2 -1
- package/dist/types/plugins/extension/extension-api.d.ts +2 -0
- package/dist/types/plugins/extension/index.d.ts +4 -2
- package/dist/types/plugins/extension/pm-plugins/keymap.d.ts +2 -1
- package/dist/types/plugins/extension/pm-plugins/main.d.ts +3 -1
- package/dist/types/plugins/extension/toolbar.d.ts +8 -1
- package/dist/types/plugins/extension/types.d.ts +2 -0
- package/dist/types/plugins/floating-toolbar/ui/ExtensionsPlaceholder.d.ts +2 -0
- package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +7 -3
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +20 -2
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +40 -4
- package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +20 -2
- package/dist/types-ts4.5/plugins/extension/actions.d.ts +2 -1
- package/dist/types-ts4.5/plugins/extension/commands.d.ts +4 -3
- package/dist/types-ts4.5/plugins/extension/context-panel.d.ts +2 -1
- package/dist/types-ts4.5/plugins/extension/extension-api.d.ts +2 -0
- package/dist/types-ts4.5/plugins/extension/index.d.ts +4 -2
- package/dist/types-ts4.5/plugins/extension/pm-plugins/keymap.d.ts +2 -1
- package/dist/types-ts4.5/plugins/extension/pm-plugins/main.d.ts +3 -1
- package/dist/types-ts4.5/plugins/extension/toolbar.d.ts +8 -1
- package/dist/types-ts4.5/plugins/extension/types.d.ts +2 -0
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/ExtensionsPlaceholder.d.ts +2 -0
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +7 -3
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/package.json +2 -1
- package/dist/cjs/plugins/context-panel/index.js +0 -66
- package/dist/cjs/plugins/context-panel/transforms.js +0 -13
- package/dist/cjs/plugins/context-panel/types.js +0 -5
- package/dist/es2019/plugins/context-panel/index.js +0 -45
- package/dist/es2019/plugins/context-panel/transforms.js +0 -4
- package/dist/es2019/plugins/context-panel/types.js +0 -1
- package/dist/esm/plugins/context-panel/index.js +0 -57
- package/dist/esm/plugins/context-panel/transforms.js +0 -6
- package/dist/esm/plugins/context-panel/types.js +0 -1
- package/dist/types/plugins/context-panel/index.d.ts +0 -11
- package/dist/types/plugins/context-panel/transforms.d.ts +0 -2
- package/dist/types/plugins/context-panel/types.d.ts +0 -1
- package/dist/types-ts4.5/plugins/context-panel/index.d.ts +0 -11
- package/dist/types-ts4.5/plugins/context-panel/transforms.d.ts +0 -2
- package/dist/types-ts4.5/plugins/context-panel/types.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 185.2.25
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`87366c84531`](https://bitbucket.org/atlassian/atlassian-frontend/commits/87366c84531) - Extract context panel plugin to new package @atlaskit/editor-plugin-context-panel
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
3
10
|
## 185.2.24
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -8,6 +8,7 @@ exports.default = createUniversalPreset;
|
|
|
8
8
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _plugins = require("../../../plugins");
|
|
11
|
+
var _editorPluginContextPanel = require("@atlaskit/editor-plugin-context-panel");
|
|
11
12
|
var _editorPluginGrid = require("@atlaskit/editor-plugin-grid");
|
|
12
13
|
var _card = _interopRequireDefault(require("../../../plugins/card"));
|
|
13
14
|
var _editorPluginTable = require("@atlaskit/editor-plugin-table");
|
|
@@ -232,6 +233,11 @@ function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
|
|
|
232
233
|
}]);
|
|
233
234
|
}
|
|
234
235
|
return builder;
|
|
236
|
+
}).maybeAdd(_editorPluginContextPanel.contextPanelPlugin, function (plugin, builder) {
|
|
237
|
+
if (isFullPage) {
|
|
238
|
+
return builder.add(_editorPluginContextPanel.contextPanelPlugin);
|
|
239
|
+
}
|
|
240
|
+
return builder;
|
|
235
241
|
}).maybeAdd(_plugins.extensionPlugin, function (plugin, builder) {
|
|
236
242
|
if (props.allowExtension) {
|
|
237
243
|
var extensionConfig = (0, _typeof2.default)(props.allowExtension) === 'object' ? props.allowExtension : {};
|
|
@@ -307,11 +313,6 @@ function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
|
|
|
307
313
|
return builder.add(plugin);
|
|
308
314
|
}
|
|
309
315
|
return builder;
|
|
310
|
-
}).maybeAdd(_plugins.contextPanelPlugin, function (plugin, builder) {
|
|
311
|
-
if (isFullPage) {
|
|
312
|
-
return builder.add(_plugins.contextPanelPlugin);
|
|
313
|
-
}
|
|
314
|
-
return builder;
|
|
315
316
|
}).maybeAdd(_plugins.scrollIntoViewPlugin, function (plugin, builder) {
|
|
316
317
|
if (props.autoScrollIntoView !== false) {
|
|
317
318
|
return builder.add(_plugins.scrollIntoViewPlugin);
|
|
@@ -167,11 +167,12 @@ exports.updateExtensionParams = updateExtensionParams;
|
|
|
167
167
|
var editSelectedExtension = function editSelectedExtension(editorActions) {
|
|
168
168
|
var editorView = editorActions._privateGetEditorView();
|
|
169
169
|
var _getPluginState = (0, _main.getPluginState)(editorView.state),
|
|
170
|
-
updateExtension = _getPluginState.updateExtension
|
|
171
|
-
|
|
170
|
+
updateExtension = _getPluginState.updateExtension,
|
|
171
|
+
applyChangeToContextPanel = _getPluginState.applyChangeToContextPanel;
|
|
172
|
+
return editExtension(null, applyChangeToContextPanel, updateExtension)(editorView.state, editorView.dispatch, editorView);
|
|
172
173
|
};
|
|
173
174
|
exports.editSelectedExtension = editSelectedExtension;
|
|
174
|
-
var editExtension = function editExtension(macroProvider, updateExtension) {
|
|
175
|
+
var editExtension = function editExtension(macroProvider, applyChangeToContextPanel, updateExtension) {
|
|
175
176
|
return function (state, dispatch, view) {
|
|
176
177
|
if (!view) {
|
|
177
178
|
return false;
|
|
@@ -191,7 +192,8 @@ var editExtension = function editExtension(macroProvider, updateExtension) {
|
|
|
191
192
|
if (updateMethod && view) {
|
|
192
193
|
var actions = (0, _extensionApi.createExtensionAPI)({
|
|
193
194
|
editorView: view,
|
|
194
|
-
editInLegacyMacroBrowser: editInLegacyMacroBrowser
|
|
195
|
+
editInLegacyMacroBrowser: editInLegacyMacroBrowser,
|
|
196
|
+
applyChange: applyChangeToContextPanel
|
|
195
197
|
});
|
|
196
198
|
updateExtensionParams(updateMethod, nodeWithPos, actions)(state, dispatch, view);
|
|
197
199
|
return;
|
|
@@ -10,7 +10,6 @@ exports.updateExtensionLayout = void 0;
|
|
|
10
10
|
exports.updateState = updateState;
|
|
11
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
12
|
var _prosemirrorUtils = require("prosemirror-utils");
|
|
13
|
-
var _transforms = require("../context-panel/transforms");
|
|
14
13
|
var _pluginFactory = require("./plugin-factory");
|
|
15
14
|
var _utils = require("./utils");
|
|
16
15
|
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
@@ -25,7 +24,7 @@ function updateState(state) {
|
|
|
25
24
|
data: state
|
|
26
25
|
});
|
|
27
26
|
}
|
|
28
|
-
function setEditingContextToContextPanel(processParametersBefore, processParametersAfter) {
|
|
27
|
+
function setEditingContextToContextPanel(processParametersBefore, processParametersAfter, applyChangeToContextPanel) {
|
|
29
28
|
return (0, _pluginFactory.createCommand)({
|
|
30
29
|
type: 'UPDATE_STATE',
|
|
31
30
|
data: {
|
|
@@ -33,25 +32,29 @@ function setEditingContextToContextPanel(processParametersBefore, processParamet
|
|
|
33
32
|
processParametersBefore: processParametersBefore,
|
|
34
33
|
processParametersAfter: processParametersAfter
|
|
35
34
|
}
|
|
36
|
-
},
|
|
35
|
+
}, applyChangeToContextPanel);
|
|
37
36
|
}
|
|
38
|
-
var clearEditingContext = (
|
|
39
|
-
type: 'UPDATE_STATE',
|
|
40
|
-
data: {
|
|
41
|
-
showContextPanel: false,
|
|
42
|
-
processParametersBefore: undefined,
|
|
43
|
-
processParametersAfter: undefined
|
|
44
|
-
}
|
|
45
|
-
}, _transforms.applyChange);
|
|
46
|
-
exports.clearEditingContext = clearEditingContext;
|
|
47
|
-
var forceAutoSave = function forceAutoSave(resolve, reject) {
|
|
37
|
+
var clearEditingContext = function clearEditingContext(applyChangeToContextPanel) {
|
|
48
38
|
return (0, _pluginFactory.createCommand)({
|
|
49
39
|
type: 'UPDATE_STATE',
|
|
50
40
|
data: {
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
showContextPanel: false,
|
|
42
|
+
processParametersBefore: undefined,
|
|
43
|
+
processParametersAfter: undefined
|
|
53
44
|
}
|
|
54
|
-
},
|
|
45
|
+
}, applyChangeToContextPanel);
|
|
46
|
+
};
|
|
47
|
+
exports.clearEditingContext = clearEditingContext;
|
|
48
|
+
var forceAutoSave = function forceAutoSave(applyChangeToContextPanel) {
|
|
49
|
+
return function (resolve, reject) {
|
|
50
|
+
return (0, _pluginFactory.createCommand)({
|
|
51
|
+
type: 'UPDATE_STATE',
|
|
52
|
+
data: {
|
|
53
|
+
autoSaveResolve: resolve,
|
|
54
|
+
autoSaveReject: reject
|
|
55
|
+
}
|
|
56
|
+
}, applyChangeToContextPanel);
|
|
57
|
+
};
|
|
55
58
|
};
|
|
56
59
|
exports.forceAutoSave = forceAutoSave;
|
|
57
60
|
var updateExtensionLayout = function updateExtensionLayout(layout) {
|
|
@@ -33,7 +33,7 @@ var areParametersEqual = function areParametersEqual(firstParameters, secondPara
|
|
|
33
33
|
}
|
|
34
34
|
return firstParameters === secondParameters;
|
|
35
35
|
};
|
|
36
|
-
var getContextPanel = function getContextPanel(allowAutoSave, featureFlags) {
|
|
36
|
+
var getContextPanel = function getContextPanel(allowAutoSave, featureFlags, applyChange) {
|
|
37
37
|
return function (state) {
|
|
38
38
|
var nodeWithPos = (0, _utils.getSelectedExtension)(state, true);
|
|
39
39
|
|
|
@@ -95,7 +95,7 @@ var getContextPanel = function getContextPanel(allowAutoSave, featureFlags) {
|
|
|
95
95
|
autoSaveResolve();
|
|
96
96
|
}
|
|
97
97
|
if (!allowAutoSave) {
|
|
98
|
-
(0, _commands.clearEditingContext)(editorView.state, editorView.dispatch);
|
|
98
|
+
(0, _commands.clearEditingContext)(applyChange)(editorView.state, editorView.dispatch);
|
|
99
99
|
}
|
|
100
100
|
case 5:
|
|
101
101
|
case "end":
|
|
@@ -118,7 +118,7 @@ var getContextPanel = function getContextPanel(allowAutoSave, featureFlags) {
|
|
|
118
118
|
_context2.prev = 1;
|
|
119
119
|
_context2.next = 4;
|
|
120
120
|
return new Promise(function (resolve, reject) {
|
|
121
|
-
(0, _commands.forceAutoSave)(resolve, reject)(editorView.state, editorView.dispatch);
|
|
121
|
+
(0, _commands.forceAutoSave)(applyChange)(resolve, reject)(editorView.state, editorView.dispatch);
|
|
122
122
|
});
|
|
123
123
|
case 4:
|
|
124
124
|
_context2.next = 9;
|
|
@@ -130,7 +130,7 @@ var getContextPanel = function getContextPanel(allowAutoSave, featureFlags) {
|
|
|
130
130
|
// eslint-disable-next-line no-console
|
|
131
131
|
console.error("Autosave failed with error", _context2.t0);
|
|
132
132
|
case 9:
|
|
133
|
-
(0, _commands.clearEditingContext)(editorView.state, editorView.dispatch);
|
|
133
|
+
(0, _commands.clearEditingContext)(applyChange)(editorView.state, editorView.dispatch);
|
|
134
134
|
case 10:
|
|
135
135
|
case "end":
|
|
136
136
|
return _context2.stop();
|
|
@@ -245,7 +245,7 @@ var createExtensionAPI = function createExtensionAPI(options) {
|
|
|
245
245
|
return {
|
|
246
246
|
editInContextPanel: function editInContextPanel(transformBefore, transformAfter) {
|
|
247
247
|
var editorView = options.editorView;
|
|
248
|
-
(0, _commands.setEditingContextToContextPanel)(transformBefore, transformAfter)(editorView.state, editorView.dispatch, editorView);
|
|
248
|
+
(0, _commands.setEditingContextToContextPanel)(transformBefore, transformAfter, options.applyChange)(editorView.state, editorView.dispatch, editorView);
|
|
249
249
|
},
|
|
250
250
|
_editInLegacyMacroBrowser: function _editInLegacyMacroBrowser() {
|
|
251
251
|
var editorView = options.editorView;
|
|
@@ -12,7 +12,7 @@ var _uniqueId = require("./pm-plugins/unique-id");
|
|
|
12
12
|
var _toolbar = require("./toolbar");
|
|
13
13
|
var _contextPanel = require("./context-panel");
|
|
14
14
|
var extensionPlugin = function extensionPlugin() {
|
|
15
|
-
var _api$dependencies, _api$dependencies$fea;
|
|
15
|
+
var _api$dependencies, _api$dependencies$fea, _api$dependencies$con2, _api$dependencies$con3;
|
|
16
16
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
17
17
|
var api = arguments.length > 1 ? arguments[1] : undefined;
|
|
18
18
|
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()) || {};
|
|
@@ -45,7 +45,10 @@ var extensionPlugin = function extensionPlugin() {
|
|
|
45
45
|
}
|
|
46
46
|
}, {
|
|
47
47
|
name: 'extensionKeymap',
|
|
48
|
-
plugin:
|
|
48
|
+
plugin: function plugin() {
|
|
49
|
+
var _api$dependencies$con;
|
|
50
|
+
return (0, _keymap.default)(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);
|
|
51
|
+
}
|
|
49
52
|
}, {
|
|
50
53
|
name: 'extensionUniqueId',
|
|
51
54
|
plugin: function plugin() {
|
|
@@ -54,8 +57,12 @@ var extensionPlugin = function extensionPlugin() {
|
|
|
54
57
|
}];
|
|
55
58
|
},
|
|
56
59
|
pluginsOptions: {
|
|
57
|
-
floatingToolbar: (0, _toolbar.getToolbarConfig)(
|
|
58
|
-
|
|
60
|
+
floatingToolbar: (0, _toolbar.getToolbarConfig)({
|
|
61
|
+
breakoutEnabled: options.breakoutEnabled,
|
|
62
|
+
hoverDecoration: api === null || api === void 0 ? void 0 : api.dependencies.decorations.actions.hoverDecoration,
|
|
63
|
+
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
|
|
64
|
+
}),
|
|
65
|
+
contextPanel: (0, _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)
|
|
59
66
|
}
|
|
60
67
|
};
|
|
61
68
|
};
|
|
@@ -11,14 +11,14 @@ var keymaps = _interopRequireWildcard(require("../../../keymaps"));
|
|
|
11
11
|
var _commands = require("../commands");
|
|
12
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
13
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
-
function keymapPlugin() {
|
|
14
|
+
function keymapPlugin(applyChange) {
|
|
15
15
|
var list = {};
|
|
16
16
|
keymaps.bindKeymapWithCommand(keymaps.escape.common, function (state, dispatch) {
|
|
17
17
|
var extensionState = (0, _main.getPluginState)(state);
|
|
18
18
|
if (!extensionState.showContextPanel) {
|
|
19
19
|
return false;
|
|
20
20
|
}
|
|
21
|
-
return (0, _commands.clearEditingContext)(state, dispatch);
|
|
21
|
+
return (0, _commands.clearEditingContext)(applyChange)(state, dispatch);
|
|
22
22
|
}, list);
|
|
23
23
|
return (0, _prosemirrorKeymap.keymap)(list);
|
|
24
24
|
}
|
|
@@ -165,7 +165,8 @@ var handleUpdate = function handleUpdate(_ref4) {
|
|
|
165
165
|
var view = _ref4.view,
|
|
166
166
|
prevState = _ref4.prevState,
|
|
167
167
|
domAtPos = _ref4.domAtPos,
|
|
168
|
-
extensionHandlers = _ref4.extensionHandlers
|
|
168
|
+
extensionHandlers = _ref4.extensionHandlers,
|
|
169
|
+
applyChange = _ref4.applyChange;
|
|
169
170
|
var state = view.state,
|
|
170
171
|
dispatch = view.dispatch;
|
|
171
172
|
var _getPluginState = (0, _pluginFactory.getPluginState)(state),
|
|
@@ -179,7 +180,7 @@ var handleUpdate = function handleUpdate(_ref4) {
|
|
|
179
180
|
var selectedExtension = (0, _utils2.getSelectedExtension)(state, true);
|
|
180
181
|
if (!selectedExtension) {
|
|
181
182
|
if (showContextPanel) {
|
|
182
|
-
(0, _commands.clearEditingContext)(state, dispatch);
|
|
183
|
+
(0, _commands.clearEditingContext)(applyChange)(state, dispatch);
|
|
183
184
|
}
|
|
184
185
|
return;
|
|
185
186
|
}
|
|
@@ -195,7 +196,7 @@ var handleUpdate = function handleUpdate(_ref4) {
|
|
|
195
196
|
element !== newElement;
|
|
196
197
|
if (isNewNodeSelected || shouldUpdateEditButton) {
|
|
197
198
|
if (showContextPanel) {
|
|
198
|
-
(0, _commands.clearEditingContext)(state, dispatch);
|
|
199
|
+
(0, _commands.clearEditingContext)(applyChange)(state, dispatch);
|
|
199
200
|
return;
|
|
200
201
|
}
|
|
201
202
|
var extensionType = node.attrs.extensionType;
|
|
@@ -224,11 +225,13 @@ var handleUpdate = function handleUpdate(_ref4) {
|
|
|
224
225
|
};
|
|
225
226
|
exports.handleUpdate = handleUpdate;
|
|
226
227
|
var createPlugin = function createPlugin(dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, pluginInjectionApi) {
|
|
228
|
+
var _pluginInjectionApi$d;
|
|
227
229
|
var useLongPressSelection = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
228
230
|
var options = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : {};
|
|
229
231
|
var state = (0, _pluginFactory.createPluginState)(dispatch, {
|
|
230
232
|
showEditButton: false,
|
|
231
|
-
showContextPanel: false
|
|
233
|
+
showContextPanel: false,
|
|
234
|
+
applyChangeToContextPanel: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.contextPanel) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions.applyChange
|
|
232
235
|
});
|
|
233
236
|
var extensionNodeViewOptions = {
|
|
234
237
|
appearance: options.appearance
|
|
@@ -243,11 +246,13 @@ var createPlugin = function createPlugin(dispatch, providerFactory, extensionHan
|
|
|
243
246
|
providerFactory.subscribe('contextIdentificationProvider', contextIdentificationProviderHandler);
|
|
244
247
|
return {
|
|
245
248
|
update: function update(view, prevState) {
|
|
249
|
+
var _pluginInjectionApi$d2;
|
|
246
250
|
handleUpdate({
|
|
247
251
|
view: view,
|
|
248
252
|
prevState: prevState,
|
|
249
253
|
domAtPos: domAtPos,
|
|
250
|
-
extensionHandlers: extensionHandlers
|
|
254
|
+
extensionHandlers: extensionHandlers,
|
|
255
|
+
applyChange: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.dependencies.contextPanel) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions.applyChange
|
|
251
256
|
});
|
|
252
257
|
},
|
|
253
258
|
destroy: function destroy() {
|
|
@@ -97,7 +97,7 @@ var breakoutOptions = function breakoutOptions(state, formatMessage, extensionSt
|
|
|
97
97
|
}
|
|
98
98
|
return [];
|
|
99
99
|
};
|
|
100
|
-
var editButton = function editButton(formatMessage, extensionState) {
|
|
100
|
+
var editButton = function editButton(formatMessage, extensionState, applyChangeToContextPanel) {
|
|
101
101
|
if (!extensionState.showEditButton) {
|
|
102
102
|
return [];
|
|
103
103
|
}
|
|
@@ -111,7 +111,7 @@ var editButton = function editButton(formatMessage, extensionState) {
|
|
|
111
111
|
var macroState = _pluginKey.pluginKey.getState(state);
|
|
112
112
|
var _getPluginState = (0, _main.getPluginState)(state),
|
|
113
113
|
updateExtension = _getPluginState.updateExtension;
|
|
114
|
-
(0, _actions.editExtension)(macroState && macroState.macroProvider, updateExtension)(state, dispatch, view);
|
|
114
|
+
(0, _actions.editExtension)(macroState && macroState.macroProvider, applyChangeToContextPanel, updateExtension)(state, dispatch, view);
|
|
115
115
|
return true;
|
|
116
116
|
},
|
|
117
117
|
title: formatMessage(messages.edit),
|
|
@@ -119,15 +119,17 @@ var editButton = function editButton(formatMessage, extensionState) {
|
|
|
119
119
|
focusEditoronEnter: true
|
|
120
120
|
}];
|
|
121
121
|
};
|
|
122
|
-
var getToolbarConfig = function getToolbarConfig() {
|
|
123
|
-
var breakoutEnabled =
|
|
124
|
-
|
|
122
|
+
var getToolbarConfig = function getToolbarConfig(_ref) {
|
|
123
|
+
var _ref$breakoutEnabled = _ref.breakoutEnabled,
|
|
124
|
+
breakoutEnabled = _ref$breakoutEnabled === void 0 ? true : _ref$breakoutEnabled,
|
|
125
|
+
hoverDecoration = _ref.hoverDecoration,
|
|
126
|
+
applyChangeToContextPanel = _ref.applyChangeToContextPanel;
|
|
125
127
|
return function (state, intl) {
|
|
126
128
|
var formatMessage = intl.formatMessage;
|
|
127
129
|
var extensionState = (0, _main.getPluginState)(state);
|
|
128
130
|
if (extensionState && !extensionState.showContextPanel && extensionState.element) {
|
|
129
131
|
var nodeType = [state.schema.nodes.extension, state.schema.nodes.inlineExtension, state.schema.nodes.bodiedExtension];
|
|
130
|
-
var editButtonArray = editButton(formatMessage, extensionState);
|
|
132
|
+
var editButtonArray = editButton(formatMessage, extensionState, applyChangeToContextPanel);
|
|
131
133
|
var breakoutButtonArray = breakoutOptions(state, formatMessage, extensionState, breakoutEnabled);
|
|
132
134
|
var extensionObj = (0, _utils.getSelectedExtension)(state, true);
|
|
133
135
|
|
|
@@ -55,7 +55,8 @@ var resolveExtensionIcon = /*#__PURE__*/function () {
|
|
|
55
55
|
var ExtensionButton = function ExtensionButton(props) {
|
|
56
56
|
var item = props.item,
|
|
57
57
|
node = props.node,
|
|
58
|
-
editorView = props.editorView
|
|
58
|
+
editorView = props.editorView,
|
|
59
|
+
applyChangeToContextPanel = props.applyChangeToContextPanel;
|
|
59
60
|
var ButtonIcon = _react.default.useMemo(function () {
|
|
60
61
|
return item.icon ? (0, _reactLoadable.default)({
|
|
61
62
|
loader: function () {
|
|
@@ -84,7 +85,8 @@ var ExtensionButton = function ExtensionButton(props) {
|
|
|
84
85
|
}
|
|
85
86
|
var targetNodeAdf = (0, _utils.nodeToJSON)(node);
|
|
86
87
|
var api = (0, _extensionApi.createExtensionAPI)({
|
|
87
|
-
editorView: editorView
|
|
88
|
+
editorView: editorView,
|
|
89
|
+
applyChange: applyChangeToContextPanel
|
|
88
90
|
});
|
|
89
91
|
item.action(targetNodeAdf, api);
|
|
90
92
|
};
|
|
@@ -103,7 +105,8 @@ var ExtensionsPlaceholder = function ExtensionsPlaceholder(props) {
|
|
|
103
105
|
var node = props.node,
|
|
104
106
|
editorView = props.editorView,
|
|
105
107
|
extensionProvider = props.extensionProvider,
|
|
106
|
-
separator = props.separator
|
|
108
|
+
separator = props.separator,
|
|
109
|
+
applyChangeToContextPanel = props.applyChangeToContextPanel;
|
|
107
110
|
var _useState = (0, _react.useState)([]),
|
|
108
111
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
109
112
|
extensions = _useState2[0],
|
|
@@ -141,9 +144,10 @@ var ExtensionsPlaceholder = function ExtensionsPlaceholder(props) {
|
|
|
141
144
|
}, [node]);
|
|
142
145
|
var extensionItems = _react.default.useMemo(function () {
|
|
143
146
|
return (0, _extensions.getContextualToolbarItemsFromModule)(extensions, nodeAdf, (0, _extensionApi.createExtensionAPI)({
|
|
144
|
-
editorView: editorView
|
|
147
|
+
editorView: editorView,
|
|
148
|
+
applyChange: applyChangeToContextPanel
|
|
145
149
|
}));
|
|
146
|
-
}, [extensions, nodeAdf, editorView]);
|
|
150
|
+
}, [extensions, nodeAdf, editorView, applyChangeToContextPanel]);
|
|
147
151
|
if (!extensionItems.length) {
|
|
148
152
|
return null;
|
|
149
153
|
}
|
|
@@ -158,7 +162,8 @@ var ExtensionsPlaceholder = function ExtensionsPlaceholder(props) {
|
|
|
158
162
|
children.push( /*#__PURE__*/_react.default.createElement(ExtensionButton, {
|
|
159
163
|
node: node,
|
|
160
164
|
item: item,
|
|
161
|
-
editorView: editorView
|
|
165
|
+
editorView: editorView,
|
|
166
|
+
applyChangeToContextPanel: applyChangeToContextPanel
|
|
162
167
|
}));
|
|
163
168
|
if (index < extensionItems.length - 1) {
|
|
164
169
|
children.push( /*#__PURE__*/_react.default.createElement(_Separator.default, null));
|
|
@@ -60,7 +60,8 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
60
60
|
node = _ref.node,
|
|
61
61
|
setDisableScroll = _ref.setDisableScroll,
|
|
62
62
|
mountRef = _ref.mountRef,
|
|
63
|
-
featureFlags = _ref.featureFlags
|
|
63
|
+
featureFlags = _ref.featureFlags,
|
|
64
|
+
api = _ref.api;
|
|
64
65
|
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;
|
|
65
66
|
var _ref2 = featureFlags || {
|
|
66
67
|
useSomewhatSemanticTextColorNames: false
|
|
@@ -69,6 +70,7 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
69
70
|
return (0, _react2.jsx)(_buttonGroup.default, null, items.filter(function (item) {
|
|
70
71
|
return !item.hidden;
|
|
71
72
|
}).map(function (item, idx) {
|
|
73
|
+
var _api$dependencies$con;
|
|
72
74
|
switch (item.type) {
|
|
73
75
|
case 'button':
|
|
74
76
|
var ButtonIcon = item.icon;
|
|
@@ -239,7 +241,8 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
239
241
|
node: node,
|
|
240
242
|
editorView: editorView,
|
|
241
243
|
extensionProvider: extensionsProvider,
|
|
242
|
-
separator: item.separator
|
|
244
|
+
separator: item.separator,
|
|
245
|
+
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
|
|
243
246
|
});
|
|
244
247
|
case 'separator':
|
|
245
248
|
return (0, _react2.jsx)(_Separator.default, {
|
|
@@ -107,12 +107,6 @@ Object.defineProperty(exports, "collabEditPlugin", {
|
|
|
107
107
|
return _collabEdit.default;
|
|
108
108
|
}
|
|
109
109
|
});
|
|
110
|
-
Object.defineProperty(exports, "contextPanelPlugin", {
|
|
111
|
-
enumerable: true,
|
|
112
|
-
get: function get() {
|
|
113
|
-
return _contextPanel.default;
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
110
|
Object.defineProperty(exports, "copyButtonPlugin", {
|
|
117
111
|
enumerable: true,
|
|
118
112
|
get: function get() {
|
|
@@ -454,7 +448,6 @@ var _expand = _interopRequireWildcard(require("./expand"));
|
|
|
454
448
|
var _scrollIntoView = _interopRequireDefault(require("./scroll-into-view"));
|
|
455
449
|
var _mobileDimensions = _interopRequireDefault(require("./mobile-dimensions"));
|
|
456
450
|
var _findReplace = _interopRequireDefault(require("./find-replace"));
|
|
457
|
-
var _contextPanel = _interopRequireDefault(require("./context-panel"));
|
|
458
451
|
var _selection = _interopRequireDefault(require("./selection"));
|
|
459
452
|
var _mobileSelection = _interopRequireDefault(require("./mobile-selection"));
|
|
460
453
|
var _clipboard = _interopRequireDefault(require("./clipboard"));
|
|
@@ -25,7 +25,6 @@ var _colors = require("@atlaskit/theme/colors");
|
|
|
25
25
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
26
26
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
27
27
|
var _WithPluginState = _interopRequireDefault(require("../WithPluginState"));
|
|
28
|
-
var _contextPanel = require("../../plugins/context-panel");
|
|
29
28
|
var _WithEditorActions = _interopRequireDefault(require("../WithEditorActions"));
|
|
30
29
|
var _document = require("../../utils/document");
|
|
31
30
|
var _excluded = ["actions"];
|
|
@@ -183,6 +182,14 @@ var widthPluginKey = {
|
|
|
183
182
|
return state['widthPlugin$'];
|
|
184
183
|
}
|
|
185
184
|
};
|
|
185
|
+
|
|
186
|
+
// @ts-ignore
|
|
187
|
+
var contextPanelPluginKey = {
|
|
188
|
+
key: 'contextPanelPluginKey$',
|
|
189
|
+
getState: function getState(state) {
|
|
190
|
+
return state['contextPanelPluginKey$'];
|
|
191
|
+
}
|
|
192
|
+
};
|
|
186
193
|
function ContextPanelWithActions(_ref2) {
|
|
187
194
|
var actions = _ref2.actions,
|
|
188
195
|
props = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
@@ -198,7 +205,7 @@ function ContextPanelWithActions(_ref2) {
|
|
|
198
205
|
return (0, _react2.jsx)(_WithPluginState.default, {
|
|
199
206
|
eventDispatcher: eventDispatcher,
|
|
200
207
|
plugins: {
|
|
201
|
-
contextPanel:
|
|
208
|
+
contextPanel: contextPanelPluginKey,
|
|
202
209
|
widthState: widthPluginKey
|
|
203
210
|
},
|
|
204
211
|
render: function render(_ref3) {
|
package/dist/cjs/utils/action.js
CHANGED
|
@@ -29,7 +29,7 @@ function _temporaryFixForConfigPanel() {
|
|
|
29
29
|
}
|
|
30
30
|
_context.next = 4;
|
|
31
31
|
return new Promise(function (resolve) {
|
|
32
|
-
(0, _commands.forceAutoSave)(resolve)(editorView.state, editorView.dispatch);
|
|
32
|
+
(0, _commands.forceAutoSave)(extensionPluginState.applyChangeToContextPanel)(resolve)(editorView.state, editorView.dispatch);
|
|
33
33
|
});
|
|
34
34
|
case 4:
|
|
35
35
|
case "end":
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/editor-core";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "185.2.
|
|
9
|
+
var version = "185.2.25";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
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,
|
|
1
|
+
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';
|
|
2
|
+
import { contextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
|
|
2
3
|
import { gridPlugin } from '@atlaskit/editor-plugin-grid';
|
|
3
4
|
import cardPlugin from '../../../plugins/card';
|
|
4
5
|
import { tablesPlugin } from '@atlaskit/editor-plugin-table';
|
|
@@ -227,6 +228,11 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
227
228
|
}]);
|
|
228
229
|
}
|
|
229
230
|
return builder;
|
|
231
|
+
}).maybeAdd(contextPanelPlugin, (plugin, builder) => {
|
|
232
|
+
if (isFullPage) {
|
|
233
|
+
return builder.add(contextPanelPlugin);
|
|
234
|
+
}
|
|
235
|
+
return builder;
|
|
230
236
|
}).maybeAdd(extensionPlugin, (plugin, builder) => {
|
|
231
237
|
if (props.allowExtension) {
|
|
232
238
|
const extensionConfig = typeof props.allowExtension === 'object' ? props.allowExtension : {};
|
|
@@ -306,11 +312,6 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
306
312
|
return builder.add(plugin);
|
|
307
313
|
}
|
|
308
314
|
return builder;
|
|
309
|
-
}).maybeAdd(contextPanelPlugin, (plugin, builder) => {
|
|
310
|
-
if (isFullPage) {
|
|
311
|
-
return builder.add(contextPanelPlugin);
|
|
312
|
-
}
|
|
313
|
-
return builder;
|
|
314
315
|
}).maybeAdd(scrollIntoViewPlugin, (plugin, builder) => {
|
|
315
316
|
if (props.autoScrollIntoView !== false) {
|
|
316
317
|
return builder.add(scrollIntoViewPlugin);
|
|
@@ -132,11 +132,12 @@ export const updateExtensionParams = (updateExtension, node, actions) => async (
|
|
|
132
132
|
export const editSelectedExtension = editorActions => {
|
|
133
133
|
const editorView = editorActions._privateGetEditorView();
|
|
134
134
|
const {
|
|
135
|
-
updateExtension
|
|
135
|
+
updateExtension,
|
|
136
|
+
applyChangeToContextPanel
|
|
136
137
|
} = getPluginState(editorView.state);
|
|
137
|
-
return editExtension(null, updateExtension)(editorView.state, editorView.dispatch, editorView);
|
|
138
|
+
return editExtension(null, applyChangeToContextPanel, updateExtension)(editorView.state, editorView.dispatch, editorView);
|
|
138
139
|
};
|
|
139
|
-
export const editExtension = (macroProvider, updateExtension) => (state, dispatch, view) => {
|
|
140
|
+
export const editExtension = (macroProvider, applyChangeToContextPanel, updateExtension) => (state, dispatch, view) => {
|
|
140
141
|
if (!view) {
|
|
141
142
|
return false;
|
|
142
143
|
}
|
|
@@ -156,7 +157,8 @@ export const editExtension = (macroProvider, updateExtension) => (state, dispatc
|
|
|
156
157
|
if (updateMethod && view) {
|
|
157
158
|
const actions = createExtensionAPI({
|
|
158
159
|
editorView: view,
|
|
159
|
-
editInLegacyMacroBrowser
|
|
160
|
+
editInLegacyMacroBrowser,
|
|
161
|
+
applyChange: applyChangeToContextPanel
|
|
160
162
|
});
|
|
161
163
|
updateExtensionParams(updateMethod, nodeWithPos, actions)(state, dispatch, view);
|
|
162
164
|
return;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { removeSelectedNode, removeParentNodeOfType } from 'prosemirror-utils';
|
|
2
|
-
import { applyChange } from '../context-panel/transforms';
|
|
3
2
|
import { createCommand } from './plugin-factory';
|
|
4
3
|
import { getSelectedExtension } from './utils';
|
|
5
4
|
import { removeConnectedNodes } from '@atlaskit/editor-common/utils';
|
|
@@ -11,7 +10,7 @@ export function updateState(state) {
|
|
|
11
10
|
data: state
|
|
12
11
|
});
|
|
13
12
|
}
|
|
14
|
-
export function setEditingContextToContextPanel(processParametersBefore, processParametersAfter) {
|
|
13
|
+
export function setEditingContextToContextPanel(processParametersBefore, processParametersAfter, applyChangeToContextPanel) {
|
|
15
14
|
return createCommand({
|
|
16
15
|
type: 'UPDATE_STATE',
|
|
17
16
|
data: {
|
|
@@ -19,23 +18,23 @@ export function setEditingContextToContextPanel(processParametersBefore, process
|
|
|
19
18
|
processParametersBefore,
|
|
20
19
|
processParametersAfter
|
|
21
20
|
}
|
|
22
|
-
},
|
|
21
|
+
}, applyChangeToContextPanel);
|
|
23
22
|
}
|
|
24
|
-
export const clearEditingContext = createCommand({
|
|
23
|
+
export const clearEditingContext = applyChangeToContextPanel => createCommand({
|
|
25
24
|
type: 'UPDATE_STATE',
|
|
26
25
|
data: {
|
|
27
26
|
showContextPanel: false,
|
|
28
27
|
processParametersBefore: undefined,
|
|
29
28
|
processParametersAfter: undefined
|
|
30
29
|
}
|
|
31
|
-
},
|
|
32
|
-
export const forceAutoSave = (resolve, reject) => createCommand({
|
|
30
|
+
}, applyChangeToContextPanel);
|
|
31
|
+
export const forceAutoSave = applyChangeToContextPanel => (resolve, reject) => createCommand({
|
|
33
32
|
type: 'UPDATE_STATE',
|
|
34
33
|
data: {
|
|
35
34
|
autoSaveResolve: resolve,
|
|
36
35
|
autoSaveReject: reject
|
|
37
36
|
}
|
|
38
|
-
},
|
|
37
|
+
}, applyChangeToContextPanel);
|
|
39
38
|
export const updateExtensionLayout = layout => createCommand({
|
|
40
39
|
type: 'UPDATE_STATE',
|
|
41
40
|
data: {
|
|
@@ -16,7 +16,7 @@ const areParametersEqual = (firstParameters, secondParameters) => {
|
|
|
16
16
|
}
|
|
17
17
|
return firstParameters === secondParameters;
|
|
18
18
|
};
|
|
19
|
-
export const getContextPanel = (allowAutoSave, featureFlags) => state => {
|
|
19
|
+
export const getContextPanel = (allowAutoSave, featureFlags, applyChange) => state => {
|
|
20
20
|
const nodeWithPos = getSelectedExtension(state, true);
|
|
21
21
|
|
|
22
22
|
// Adding checks to bail out early
|
|
@@ -72,14 +72,14 @@ export const getContextPanel = (allowAutoSave, featureFlags) => state => {
|
|
|
72
72
|
autoSaveResolve();
|
|
73
73
|
}
|
|
74
74
|
if (!allowAutoSave) {
|
|
75
|
-
clearEditingContext(editorView.state, editorView.dispatch);
|
|
75
|
+
clearEditingContext(applyChange)(editorView.state, editorView.dispatch);
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
onCancel: async () => {
|
|
79
79
|
if (allowAutoSave) {
|
|
80
80
|
try {
|
|
81
81
|
await new Promise((resolve, reject) => {
|
|
82
|
-
forceAutoSave(resolve, reject)(editorView.state, editorView.dispatch);
|
|
82
|
+
forceAutoSave(applyChange)(resolve, reject)(editorView.state, editorView.dispatch);
|
|
83
83
|
});
|
|
84
84
|
} catch (e) {
|
|
85
85
|
// Even if the save failed, we should proceed with closing the panel
|
|
@@ -87,7 +87,7 @@ export const getContextPanel = (allowAutoSave, featureFlags) => state => {
|
|
|
87
87
|
console.error(`Autosave failed with error`, e);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
clearEditingContext(editorView.state, editorView.dispatch);
|
|
90
|
+
clearEditingContext(applyChange)(editorView.state, editorView.dispatch);
|
|
91
91
|
},
|
|
92
92
|
featureFlags: featureFlags
|
|
93
93
|
});
|
|
@@ -260,7 +260,7 @@ export const createExtensionAPI = options => {
|
|
|
260
260
|
const {
|
|
261
261
|
editorView
|
|
262
262
|
} = options;
|
|
263
|
-
setEditingContextToContextPanel(transformBefore, transformAfter)(editorView.state, editorView.dispatch, editorView);
|
|
263
|
+
setEditingContextToContextPanel(transformBefore, transformAfter, options.applyChange)(editorView.state, editorView.dispatch, editorView);
|
|
264
264
|
},
|
|
265
265
|
_editInLegacyMacroBrowser: () => {
|
|
266
266
|
const {
|