@atlaskit/editor-plugin-extension 3.2.0 → 3.4.0
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 +27 -0
- package/dist/cjs/extensionPlugin.js +6 -2
- package/dist/cjs/pm-plugins/main.js +2 -15
- package/dist/cjs/pm-plugins/toolbar.js +14 -5
- package/dist/es2019/extensionPlugin.js +6 -2
- package/dist/es2019/pm-plugins/main.js +2 -14
- package/dist/es2019/pm-plugins/toolbar.js +14 -5
- package/dist/esm/extensionPlugin.js +6 -2
- package/dist/esm/pm-plugins/main.js +2 -15
- package/dist/esm/pm-plugins/toolbar.js +14 -5
- package/dist/types/extensionPluginType.d.ts +0 -1
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/pm-plugins/toolbar.d.ts +9 -7
- package/dist/types-ts4.5/extensionPluginType.d.ts +0 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/toolbar.d.ts +13 -7
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-extension
|
|
2
2
|
|
|
3
|
+
## 3.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#111831](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/111831)
|
|
8
|
+
[`66895944dfac9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/66895944dfac9) -
|
|
9
|
+
[ED-26430] Block drag-and-drop of legacy content macro extension
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 3.3.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [#112758](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/112758)
|
|
20
|
+
[`dcef693895f59`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/dcef693895f59) -
|
|
21
|
+
ED-26472: Resolving issue with extension plugin that required the context panel plugin to be added
|
|
22
|
+
to the editor preset first. In the plugin options when calling getToolbarConfig then function for
|
|
23
|
+
applyChangeToContextPanel was sometimes undefined. Now passing in the entire extension API and
|
|
24
|
+
handling it within getToolbarConfig.
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies
|
|
29
|
+
|
|
3
30
|
## 3.2.0
|
|
4
31
|
|
|
5
32
|
### Minor Changes
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.extensionPlugin = void 0;
|
|
8
8
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
9
9
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
10
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
11
|
var _actions = require("./editor-actions/actions");
|
|
11
12
|
var _commands = require("./editor-commands/commands");
|
|
12
13
|
var _extensionApi = require("./pm-plugins/extension-api");
|
|
@@ -71,7 +72,7 @@ var extensionPlugin = exports.extensionPlugin = function extensionPlugin(_ref) {
|
|
|
71
72
|
var extensionHandlers = options.extensionHandlers || {};
|
|
72
73
|
return (0, _main.createPlugin)(dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, _api, options.useLongPressSelection, {
|
|
73
74
|
appearance: options.appearance
|
|
74
|
-
}, featureFlags, options
|
|
75
|
+
}, featureFlags, options === null || options === void 0 ? void 0 : options.__rendererExtensionOptions);
|
|
75
76
|
}
|
|
76
77
|
}, {
|
|
77
78
|
name: 'extensionKeymap',
|
|
@@ -166,7 +167,10 @@ var extensionPlugin = exports.extensionPlugin = function extensionPlugin(_ref) {
|
|
|
166
167
|
forceAutoSave: _commands.forceAutoSave
|
|
167
168
|
},
|
|
168
169
|
pluginsOptions: {
|
|
169
|
-
floatingToolbar: (0, _toolbar.getToolbarConfig)({
|
|
170
|
+
floatingToolbar: (0, _platformFeatureFlags.fg)('platform_editor_legacy_content_macro') ? (0, _toolbar.getToolbarConfig)({
|
|
171
|
+
breakoutEnabled: options.breakoutEnabled,
|
|
172
|
+
extensionApi: _api
|
|
173
|
+
}) : (0, _toolbar.getToolbarConfig)({
|
|
170
174
|
breakoutEnabled: options.breakoutEnabled,
|
|
171
175
|
hoverDecoration: _api === null || _api === void 0 || (_api$decorations = _api.decorations) === null || _api$decorations === void 0 ? void 0 : _api$decorations.actions.hoverDecoration,
|
|
172
176
|
applyChangeToContextPanel: _api === null || _api === void 0 || (_api$contextPanel4 = _api.contextPanel) === null || _api$contextPanel4 === void 0 ? void 0 : _api$contextPanel4.actions.applyChange,
|
|
@@ -172,8 +172,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, provid
|
|
|
172
172
|
var useLongPressSelection = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
173
173
|
var options = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : {};
|
|
174
174
|
var featureFlags = arguments.length > 8 ? arguments[8] : undefined;
|
|
175
|
-
var
|
|
176
|
-
var __rendererExtensionOptions = arguments.length > 10 ? arguments[10] : undefined;
|
|
175
|
+
var __rendererExtensionOptions = arguments.length > 9 ? arguments[9] : undefined;
|
|
177
176
|
var state = (0, _pluginFactory.createPluginState)(dispatch, {
|
|
178
177
|
showEditButton: false,
|
|
179
178
|
showContextPanel: false
|
|
@@ -316,19 +315,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, provid
|
|
|
316
315
|
// It's to enable nested extensions selection
|
|
317
316
|
{
|
|
318
317
|
useLongPressSelection: useLongPressSelection
|
|
319
|
-
})
|
|
320
|
-
handleDrop: function handleDrop(view, event, slice, moved) {
|
|
321
|
-
if ((0, _platformFeatureFlags.fg)('platform_editor_legacy_content_macro')) {
|
|
322
|
-
if (!allowDragAndDrop) {
|
|
323
|
-
var _slice$content$firstC;
|
|
324
|
-
// Completely disable DND for extension nodes when allowDragAndDrop is false
|
|
325
|
-
var isExtension = slice.content.childCount === 1 && ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) === view.state.schema.nodes.extension;
|
|
326
|
-
return isExtension;
|
|
327
|
-
}
|
|
328
|
-
return false;
|
|
329
|
-
}
|
|
330
|
-
return false;
|
|
331
|
-
}
|
|
318
|
+
})
|
|
332
319
|
}
|
|
333
320
|
});
|
|
334
321
|
};
|
|
@@ -109,11 +109,20 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(_ref
|
|
|
109
109
|
breakoutEnabled = _ref$breakoutEnabled === void 0 ? true : _ref$breakoutEnabled,
|
|
110
110
|
hoverDecoration = _ref.hoverDecoration,
|
|
111
111
|
applyChangeToContextPanel = _ref.applyChangeToContextPanel,
|
|
112
|
-
editorAnalyticsAPI = _ref.editorAnalyticsAPI
|
|
112
|
+
editorAnalyticsAPI = _ref.editorAnalyticsAPI,
|
|
113
|
+
extensionApi = _ref.extensionApi;
|
|
113
114
|
return function (state, intl) {
|
|
114
115
|
var formatMessage = intl.formatMessage;
|
|
115
116
|
var extensionState = (0, _pluginFactory.getPluginState)(state);
|
|
117
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_legacy_content_macro')) {
|
|
118
|
+
var _extensionApi$decorat, _extensionApi$context, _extensionApi$analyti;
|
|
119
|
+
// TODO: Change these all to const upon removal of the above FG. Remove the function params also.
|
|
120
|
+
hoverDecoration = extensionApi === null || extensionApi === void 0 || (_extensionApi$decorat = extensionApi.decorations) === null || _extensionApi$decorat === void 0 ? void 0 : _extensionApi$decorat.actions.hoverDecoration;
|
|
121
|
+
applyChangeToContextPanel = extensionApi === null || extensionApi === void 0 || (_extensionApi$context = extensionApi.contextPanel) === null || _extensionApi$context === void 0 ? void 0 : _extensionApi$context.actions.applyChange;
|
|
122
|
+
editorAnalyticsAPI = extensionApi === null || extensionApi === void 0 || (_extensionApi$analyti = extensionApi.analytics) === null || _extensionApi$analyti === void 0 ? void 0 : _extensionApi$analyti.actions;
|
|
123
|
+
}
|
|
116
124
|
if (extensionState && !extensionState.showContextPanel && extensionState.element) {
|
|
125
|
+
var _hoverDecoration, _hoverDecoration2, _hoverDecoration3, _hoverDecoration4;
|
|
117
126
|
var nodeType = [state.schema.nodes.extension, state.schema.nodes.inlineExtension, state.schema.nodes.bodiedExtension, state.schema.nodes.multiBodiedExtension];
|
|
118
127
|
var editButtonArray = editButton(formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI);
|
|
119
128
|
var breakoutButtonArray = breakoutOptions(state, formatMessage, extensionState, breakoutEnabled, editorAnalyticsAPI);
|
|
@@ -206,10 +215,10 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(_ref
|
|
|
206
215
|
iconFallback: _remove.default,
|
|
207
216
|
appearance: 'danger',
|
|
208
217
|
onClick: (0, _commands.removeExtension)(editorAnalyticsAPI),
|
|
209
|
-
onMouseEnter: hoverDecoration === null ||
|
|
210
|
-
onMouseLeave: hoverDecoration === null ||
|
|
211
|
-
onFocus: hoverDecoration === null ||
|
|
212
|
-
onBlur: hoverDecoration === null ||
|
|
218
|
+
onMouseEnter: (_hoverDecoration = hoverDecoration) === null || _hoverDecoration === void 0 ? void 0 : _hoverDecoration(nodeType, true),
|
|
219
|
+
onMouseLeave: (_hoverDecoration2 = hoverDecoration) === null || _hoverDecoration2 === void 0 ? void 0 : _hoverDecoration2(nodeType, false),
|
|
220
|
+
onFocus: (_hoverDecoration3 = hoverDecoration) === null || _hoverDecoration3 === void 0 ? void 0 : _hoverDecoration3(nodeType, true),
|
|
221
|
+
onBlur: (_hoverDecoration4 = hoverDecoration) === null || _hoverDecoration4 === void 0 ? void 0 : _hoverDecoration4(nodeType, false),
|
|
213
222
|
focusEditoronEnter: true,
|
|
214
223
|
title: formatMessage(_messages.default.remove),
|
|
215
224
|
tabIndex: null,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { extension, extensionFrame, inlineExtension, multiBodiedExtension } from '@atlaskit/adf-schema';
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { createEditSelectedExtensionAction, insertOrReplaceBodiedExtension, insertOrReplaceExtension } from './editor-actions/actions';
|
|
4
5
|
import { forceAutoSave } from './editor-commands/commands';
|
|
5
6
|
import { createExtensionAPI } from './pm-plugins/extension-api';
|
|
@@ -65,7 +66,7 @@ export const extensionPlugin = ({
|
|
|
65
66
|
const extensionHandlers = options.extensionHandlers || {};
|
|
66
67
|
return createPlugin(dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, api, options.useLongPressSelection, {
|
|
67
68
|
appearance: options.appearance
|
|
68
|
-
}, featureFlags, options
|
|
69
|
+
}, featureFlags, options === null || options === void 0 ? void 0 : options.__rendererExtensionOptions);
|
|
69
70
|
}
|
|
70
71
|
}, {
|
|
71
72
|
name: 'extensionKeymap',
|
|
@@ -155,7 +156,10 @@ export const extensionPlugin = ({
|
|
|
155
156
|
forceAutoSave
|
|
156
157
|
},
|
|
157
158
|
pluginsOptions: {
|
|
158
|
-
floatingToolbar: getToolbarConfig({
|
|
159
|
+
floatingToolbar: fg('platform_editor_legacy_content_macro') ? getToolbarConfig({
|
|
160
|
+
breakoutEnabled: options.breakoutEnabled,
|
|
161
|
+
extensionApi: api
|
|
162
|
+
}) : getToolbarConfig({
|
|
159
163
|
breakoutEnabled: options.breakoutEnabled,
|
|
160
164
|
hoverDecoration: api === null || api === void 0 ? void 0 : (_api$decorations = api.decorations) === null || _api$decorations === void 0 ? void 0 : _api$decorations.actions.hoverDecoration,
|
|
161
165
|
applyChangeToContextPanel: api === null || api === void 0 ? void 0 : (_api$contextPanel4 = api.contextPanel) === null || _api$contextPanel4 === void 0 ? void 0 : _api$contextPanel4.actions.applyChange,
|
|
@@ -115,7 +115,7 @@ export const handleUpdate = ({
|
|
|
115
115
|
}
|
|
116
116
|
return true;
|
|
117
117
|
};
|
|
118
|
-
export const createPlugin = (dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, pluginInjectionApi, useLongPressSelection = false, options = {}, featureFlags,
|
|
118
|
+
export const createPlugin = (dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, pluginInjectionApi, useLongPressSelection = false, options = {}, featureFlags, __rendererExtensionOptions) => {
|
|
119
119
|
var _featureFlags$macroIn;
|
|
120
120
|
const state = createPluginState(dispatch, {
|
|
121
121
|
showEditButton: false,
|
|
@@ -269,19 +269,7 @@ export const createPlugin = (dispatch, providerFactory, extensionHandlers, porta
|
|
|
269
269
|
// It's to enable nested extensions selection
|
|
270
270
|
{
|
|
271
271
|
useLongPressSelection
|
|
272
|
-
})
|
|
273
|
-
handleDrop(view, event, slice, moved) {
|
|
274
|
-
if (fg('platform_editor_legacy_content_macro')) {
|
|
275
|
-
if (!allowDragAndDrop) {
|
|
276
|
-
var _slice$content$firstC;
|
|
277
|
-
// Completely disable DND for extension nodes when allowDragAndDrop is false
|
|
278
|
-
const isExtension = slice.content.childCount === 1 && ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) === view.state.schema.nodes.extension;
|
|
279
|
-
return isExtension;
|
|
280
|
-
}
|
|
281
|
-
return false;
|
|
282
|
-
}
|
|
283
|
-
return false;
|
|
284
|
-
}
|
|
272
|
+
})
|
|
285
273
|
}
|
|
286
274
|
});
|
|
287
275
|
};
|
|
@@ -108,13 +108,22 @@ export const getToolbarConfig = ({
|
|
|
108
108
|
breakoutEnabled = true,
|
|
109
109
|
hoverDecoration,
|
|
110
110
|
applyChangeToContextPanel,
|
|
111
|
-
editorAnalyticsAPI
|
|
111
|
+
editorAnalyticsAPI,
|
|
112
|
+
extensionApi
|
|
112
113
|
}) => (state, intl) => {
|
|
113
114
|
const {
|
|
114
115
|
formatMessage
|
|
115
116
|
} = intl;
|
|
116
117
|
const extensionState = getPluginState(state);
|
|
118
|
+
if (fg('platform_editor_legacy_content_macro')) {
|
|
119
|
+
var _extensionApi$decorat, _extensionApi$context, _extensionApi$analyti;
|
|
120
|
+
// TODO: Change these all to const upon removal of the above FG. Remove the function params also.
|
|
121
|
+
hoverDecoration = extensionApi === null || extensionApi === void 0 ? void 0 : (_extensionApi$decorat = extensionApi.decorations) === null || _extensionApi$decorat === void 0 ? void 0 : _extensionApi$decorat.actions.hoverDecoration;
|
|
122
|
+
applyChangeToContextPanel = extensionApi === null || extensionApi === void 0 ? void 0 : (_extensionApi$context = extensionApi.contextPanel) === null || _extensionApi$context === void 0 ? void 0 : _extensionApi$context.actions.applyChange;
|
|
123
|
+
editorAnalyticsAPI = extensionApi === null || extensionApi === void 0 ? void 0 : (_extensionApi$analyti = extensionApi.analytics) === null || _extensionApi$analyti === void 0 ? void 0 : _extensionApi$analyti.actions;
|
|
124
|
+
}
|
|
117
125
|
if (extensionState && !extensionState.showContextPanel && extensionState.element) {
|
|
126
|
+
var _hoverDecoration, _hoverDecoration2, _hoverDecoration3, _hoverDecoration4;
|
|
118
127
|
const nodeType = [state.schema.nodes.extension, state.schema.nodes.inlineExtension, state.schema.nodes.bodiedExtension, state.schema.nodes.multiBodiedExtension];
|
|
119
128
|
const editButtonArray = editButton(formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI);
|
|
120
129
|
const breakoutButtonArray = breakoutOptions(state, formatMessage, extensionState, breakoutEnabled, editorAnalyticsAPI);
|
|
@@ -203,10 +212,10 @@ export const getToolbarConfig = ({
|
|
|
203
212
|
iconFallback: RemoveIcon,
|
|
204
213
|
appearance: 'danger',
|
|
205
214
|
onClick: removeExtension(editorAnalyticsAPI),
|
|
206
|
-
onMouseEnter: hoverDecoration === null ||
|
|
207
|
-
onMouseLeave: hoverDecoration === null ||
|
|
208
|
-
onFocus: hoverDecoration === null ||
|
|
209
|
-
onBlur: hoverDecoration === null ||
|
|
215
|
+
onMouseEnter: (_hoverDecoration = hoverDecoration) === null || _hoverDecoration === void 0 ? void 0 : _hoverDecoration(nodeType, true),
|
|
216
|
+
onMouseLeave: (_hoverDecoration2 = hoverDecoration) === null || _hoverDecoration2 === void 0 ? void 0 : _hoverDecoration2(nodeType, false),
|
|
217
|
+
onFocus: (_hoverDecoration3 = hoverDecoration) === null || _hoverDecoration3 === void 0 ? void 0 : _hoverDecoration3(nodeType, true),
|
|
218
|
+
onBlur: (_hoverDecoration4 = hoverDecoration) === null || _hoverDecoration4 === void 0 ? void 0 : _hoverDecoration4(nodeType, false),
|
|
210
219
|
focusEditoronEnter: true,
|
|
211
220
|
title: formatMessage(commonMessages.remove),
|
|
212
221
|
tabIndex: null,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { extension, extensionFrame, inlineExtension, multiBodiedExtension } from '@atlaskit/adf-schema';
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { createEditSelectedExtensionAction, insertOrReplaceBodiedExtension as _insertOrReplaceBodiedExtension, insertOrReplaceExtension as _insertOrReplaceExtension } from './editor-actions/actions';
|
|
4
5
|
import { forceAutoSave } from './editor-commands/commands';
|
|
5
6
|
import { createExtensionAPI } from './pm-plugins/extension-api';
|
|
@@ -64,7 +65,7 @@ export var extensionPlugin = function extensionPlugin(_ref) {
|
|
|
64
65
|
var extensionHandlers = options.extensionHandlers || {};
|
|
65
66
|
return createPlugin(dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, _api, options.useLongPressSelection, {
|
|
66
67
|
appearance: options.appearance
|
|
67
|
-
}, featureFlags, options
|
|
68
|
+
}, featureFlags, options === null || options === void 0 ? void 0 : options.__rendererExtensionOptions);
|
|
68
69
|
}
|
|
69
70
|
}, {
|
|
70
71
|
name: 'extensionKeymap',
|
|
@@ -159,7 +160,10 @@ export var extensionPlugin = function extensionPlugin(_ref) {
|
|
|
159
160
|
forceAutoSave: forceAutoSave
|
|
160
161
|
},
|
|
161
162
|
pluginsOptions: {
|
|
162
|
-
floatingToolbar: getToolbarConfig({
|
|
163
|
+
floatingToolbar: fg('platform_editor_legacy_content_macro') ? getToolbarConfig({
|
|
164
|
+
breakoutEnabled: options.breakoutEnabled,
|
|
165
|
+
extensionApi: _api
|
|
166
|
+
}) : getToolbarConfig({
|
|
163
167
|
breakoutEnabled: options.breakoutEnabled,
|
|
164
168
|
hoverDecoration: _api === null || _api === void 0 || (_api$decorations = _api.decorations) === null || _api$decorations === void 0 ? void 0 : _api$decorations.actions.hoverDecoration,
|
|
165
169
|
applyChangeToContextPanel: _api === null || _api === void 0 || (_api$contextPanel4 = _api.contextPanel) === null || _api$contextPanel4 === void 0 ? void 0 : _api$contextPanel4.actions.applyChange,
|
|
@@ -165,8 +165,7 @@ export var createPlugin = function createPlugin(dispatch, providerFactory, exten
|
|
|
165
165
|
var useLongPressSelection = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
166
166
|
var options = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : {};
|
|
167
167
|
var featureFlags = arguments.length > 8 ? arguments[8] : undefined;
|
|
168
|
-
var
|
|
169
|
-
var __rendererExtensionOptions = arguments.length > 10 ? arguments[10] : undefined;
|
|
168
|
+
var __rendererExtensionOptions = arguments.length > 9 ? arguments[9] : undefined;
|
|
170
169
|
var state = createPluginState(dispatch, {
|
|
171
170
|
showEditButton: false,
|
|
172
171
|
showContextPanel: false
|
|
@@ -309,19 +308,7 @@ export var createPlugin = function createPlugin(dispatch, providerFactory, exten
|
|
|
309
308
|
// It's to enable nested extensions selection
|
|
310
309
|
{
|
|
311
310
|
useLongPressSelection: useLongPressSelection
|
|
312
|
-
})
|
|
313
|
-
handleDrop: function handleDrop(view, event, slice, moved) {
|
|
314
|
-
if (fg('platform_editor_legacy_content_macro')) {
|
|
315
|
-
if (!allowDragAndDrop) {
|
|
316
|
-
var _slice$content$firstC;
|
|
317
|
-
// Completely disable DND for extension nodes when allowDragAndDrop is false
|
|
318
|
-
var isExtension = slice.content.childCount === 1 && ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) === view.state.schema.nodes.extension;
|
|
319
|
-
return isExtension;
|
|
320
|
-
}
|
|
321
|
-
return false;
|
|
322
|
-
}
|
|
323
|
-
return false;
|
|
324
|
-
}
|
|
311
|
+
})
|
|
325
312
|
}
|
|
326
313
|
});
|
|
327
314
|
};
|
|
@@ -102,11 +102,20 @@ export var getToolbarConfig = function getToolbarConfig(_ref) {
|
|
|
102
102
|
breakoutEnabled = _ref$breakoutEnabled === void 0 ? true : _ref$breakoutEnabled,
|
|
103
103
|
hoverDecoration = _ref.hoverDecoration,
|
|
104
104
|
applyChangeToContextPanel = _ref.applyChangeToContextPanel,
|
|
105
|
-
editorAnalyticsAPI = _ref.editorAnalyticsAPI
|
|
105
|
+
editorAnalyticsAPI = _ref.editorAnalyticsAPI,
|
|
106
|
+
extensionApi = _ref.extensionApi;
|
|
106
107
|
return function (state, intl) {
|
|
107
108
|
var formatMessage = intl.formatMessage;
|
|
108
109
|
var extensionState = getPluginState(state);
|
|
110
|
+
if (fg('platform_editor_legacy_content_macro')) {
|
|
111
|
+
var _extensionApi$decorat, _extensionApi$context, _extensionApi$analyti;
|
|
112
|
+
// TODO: Change these all to const upon removal of the above FG. Remove the function params also.
|
|
113
|
+
hoverDecoration = extensionApi === null || extensionApi === void 0 || (_extensionApi$decorat = extensionApi.decorations) === null || _extensionApi$decorat === void 0 ? void 0 : _extensionApi$decorat.actions.hoverDecoration;
|
|
114
|
+
applyChangeToContextPanel = extensionApi === null || extensionApi === void 0 || (_extensionApi$context = extensionApi.contextPanel) === null || _extensionApi$context === void 0 ? void 0 : _extensionApi$context.actions.applyChange;
|
|
115
|
+
editorAnalyticsAPI = extensionApi === null || extensionApi === void 0 || (_extensionApi$analyti = extensionApi.analytics) === null || _extensionApi$analyti === void 0 ? void 0 : _extensionApi$analyti.actions;
|
|
116
|
+
}
|
|
109
117
|
if (extensionState && !extensionState.showContextPanel && extensionState.element) {
|
|
118
|
+
var _hoverDecoration, _hoverDecoration2, _hoverDecoration3, _hoverDecoration4;
|
|
110
119
|
var nodeType = [state.schema.nodes.extension, state.schema.nodes.inlineExtension, state.schema.nodes.bodiedExtension, state.schema.nodes.multiBodiedExtension];
|
|
111
120
|
var editButtonArray = editButton(formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI);
|
|
112
121
|
var breakoutButtonArray = breakoutOptions(state, formatMessage, extensionState, breakoutEnabled, editorAnalyticsAPI);
|
|
@@ -199,10 +208,10 @@ export var getToolbarConfig = function getToolbarConfig(_ref) {
|
|
|
199
208
|
iconFallback: RemoveIcon,
|
|
200
209
|
appearance: 'danger',
|
|
201
210
|
onClick: removeExtension(editorAnalyticsAPI),
|
|
202
|
-
onMouseEnter: hoverDecoration === null ||
|
|
203
|
-
onMouseLeave: hoverDecoration === null ||
|
|
204
|
-
onFocus: hoverDecoration === null ||
|
|
205
|
-
onBlur: hoverDecoration === null ||
|
|
211
|
+
onMouseEnter: (_hoverDecoration = hoverDecoration) === null || _hoverDecoration === void 0 ? void 0 : _hoverDecoration(nodeType, true),
|
|
212
|
+
onMouseLeave: (_hoverDecoration2 = hoverDecoration) === null || _hoverDecoration2 === void 0 ? void 0 : _hoverDecoration2(nodeType, false),
|
|
213
|
+
onFocus: (_hoverDecoration3 = hoverDecoration) === null || _hoverDecoration3 === void 0 ? void 0 : _hoverDecoration3(nodeType, true),
|
|
214
|
+
onBlur: (_hoverDecoration4 = hoverDecoration) === null || _hoverDecoration4 === void 0 ? void 0 : _hoverDecoration4(nodeType, false),
|
|
206
215
|
focusEditoronEnter: true,
|
|
207
216
|
title: formatMessage(commonMessages.remove),
|
|
208
217
|
tabIndex: null,
|
|
@@ -42,7 +42,6 @@ export interface ExtensionPluginOptions extends LongPressSelectionPluginOptions
|
|
|
42
42
|
breakoutEnabled?: boolean;
|
|
43
43
|
extensionHandlers?: ExtensionHandlers;
|
|
44
44
|
appearance?: EditorAppearance;
|
|
45
|
-
allowDragAndDrop?: boolean;
|
|
46
45
|
__rendererExtensionOptions?: {
|
|
47
46
|
rendererExtensionHandlers?: ExtensionHandlers;
|
|
48
47
|
isAllowedToUseRendererView: (node: ADFEntity) => boolean;
|
|
@@ -18,4 +18,4 @@ export declare const handleUpdate: ({ view, prevState, domAtPos, extensionHandle
|
|
|
18
18
|
}) => true | undefined;
|
|
19
19
|
export declare const createPlugin: (dispatch: Dispatch, providerFactory: ProviderFactory, extensionHandlers: ExtensionHandlers, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginInjectionApi: ExtractInjectionAPI<ExtensionPlugin> | undefined, useLongPressSelection?: boolean, options?: {
|
|
20
20
|
appearance?: EditorAppearance;
|
|
21
|
-
}, featureFlags?: FeatureFlags,
|
|
21
|
+
}, featureFlags?: FeatureFlags, __rendererExtensionOptions?: ExtensionPluginOptions['__rendererExtensionOptions']) => SafePlugin<import("../extensionPluginType").ExtensionState>;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { FloatingToolbarHandler } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
2
|
+
import type { FloatingToolbarHandler, PublicPluginAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
|
+
import type { ApplyChangeHandler, ContextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
|
|
5
|
+
import type { DecorationsPlugin, HoverDecorationHandler } from '@atlaskit/editor-plugin-decorations';
|
|
5
6
|
interface GetToolbarConfigProps {
|
|
6
7
|
breakoutEnabled: boolean | undefined;
|
|
7
|
-
hoverDecoration
|
|
8
|
-
applyChangeToContextPanel
|
|
9
|
-
editorAnalyticsAPI
|
|
8
|
+
hoverDecoration?: HoverDecorationHandler | undefined;
|
|
9
|
+
applyChangeToContextPanel?: ApplyChangeHandler | undefined;
|
|
10
|
+
editorAnalyticsAPI?: EditorAnalyticsAPI | undefined;
|
|
11
|
+
extensionApi?: PublicPluginAPI<[ContextPanelPlugin, AnalyticsPlugin, DecorationsPlugin]> | undefined;
|
|
10
12
|
}
|
|
11
|
-
export declare const getToolbarConfig: ({ breakoutEnabled, hoverDecoration, applyChangeToContextPanel, editorAnalyticsAPI, }: GetToolbarConfigProps) => FloatingToolbarHandler;
|
|
13
|
+
export declare const getToolbarConfig: ({ breakoutEnabled, hoverDecoration, applyChangeToContextPanel, editorAnalyticsAPI, extensionApi, }: GetToolbarConfigProps) => FloatingToolbarHandler;
|
|
12
14
|
export {};
|
|
@@ -42,7 +42,6 @@ export interface ExtensionPluginOptions extends LongPressSelectionPluginOptions
|
|
|
42
42
|
breakoutEnabled?: boolean;
|
|
43
43
|
extensionHandlers?: ExtensionHandlers;
|
|
44
44
|
appearance?: EditorAppearance;
|
|
45
|
-
allowDragAndDrop?: boolean;
|
|
46
45
|
__rendererExtensionOptions?: {
|
|
47
46
|
rendererExtensionHandlers?: ExtensionHandlers;
|
|
48
47
|
isAllowedToUseRendererView: (node: ADFEntity) => boolean;
|
|
@@ -18,4 +18,4 @@ export declare const handleUpdate: ({ view, prevState, domAtPos, extensionHandle
|
|
|
18
18
|
}) => true | undefined;
|
|
19
19
|
export declare const createPlugin: (dispatch: Dispatch, providerFactory: ProviderFactory, extensionHandlers: ExtensionHandlers, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginInjectionApi: ExtractInjectionAPI<ExtensionPlugin> | undefined, useLongPressSelection?: boolean, options?: {
|
|
20
20
|
appearance?: EditorAppearance;
|
|
21
|
-
}, featureFlags?: FeatureFlags,
|
|
21
|
+
}, featureFlags?: FeatureFlags, __rendererExtensionOptions?: ExtensionPluginOptions['__rendererExtensionOptions']) => SafePlugin<import("../extensionPluginType").ExtensionState>;
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { FloatingToolbarHandler } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
2
|
+
import type { FloatingToolbarHandler, PublicPluginAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
|
+
import type { ApplyChangeHandler, ContextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
|
|
5
|
+
import type { DecorationsPlugin, HoverDecorationHandler } from '@atlaskit/editor-plugin-decorations';
|
|
5
6
|
interface GetToolbarConfigProps {
|
|
6
7
|
breakoutEnabled: boolean | undefined;
|
|
7
|
-
hoverDecoration
|
|
8
|
-
applyChangeToContextPanel
|
|
9
|
-
editorAnalyticsAPI
|
|
8
|
+
hoverDecoration?: HoverDecorationHandler | undefined;
|
|
9
|
+
applyChangeToContextPanel?: ApplyChangeHandler | undefined;
|
|
10
|
+
editorAnalyticsAPI?: EditorAnalyticsAPI | undefined;
|
|
11
|
+
extensionApi?: PublicPluginAPI<[
|
|
12
|
+
ContextPanelPlugin,
|
|
13
|
+
AnalyticsPlugin,
|
|
14
|
+
DecorationsPlugin
|
|
15
|
+
]> | undefined;
|
|
10
16
|
}
|
|
11
|
-
export declare const getToolbarConfig: ({ breakoutEnabled, hoverDecoration, applyChangeToContextPanel, editorAnalyticsAPI, }: GetToolbarConfigProps) => FloatingToolbarHandler;
|
|
17
|
+
export declare const getToolbarConfig: ({ breakoutEnabled, hoverDecoration, applyChangeToContextPanel, editorAnalyticsAPI, extensionApi, }: GetToolbarConfigProps) => FloatingToolbarHandler;
|
|
12
18
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-extension",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "editor-plugin-extension plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@atlaskit/button": "^20.5.0",
|
|
31
31
|
"@atlaskit/checkbox": "^15.3.0",
|
|
32
32
|
"@atlaskit/datetime-picker": "^15.12.0",
|
|
33
|
-
"@atlaskit/editor-common": "^99.
|
|
33
|
+
"@atlaskit/editor-common": "^99.12.0",
|
|
34
34
|
"@atlaskit/editor-json-transformer": "^8.23.0",
|
|
35
35
|
"@atlaskit/editor-plugin-analytics": "^1.12.0",
|
|
36
36
|
"@atlaskit/editor-plugin-context-identifier": "^1.4.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@atlaskit/empty-state": "^8.2.0",
|
|
45
45
|
"@atlaskit/form": "^11.1.0",
|
|
46
46
|
"@atlaskit/heading": "4.1.0",
|
|
47
|
-
"@atlaskit/icon": "^23.
|
|
47
|
+
"@atlaskit/icon": "^23.8.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^1.0.0",
|
|
49
49
|
"@atlaskit/primitives": "^13.5.0",
|
|
50
50
|
"@atlaskit/radio": "^7.2.0",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@atlaskit/textarea": "^6.0.0",
|
|
57
57
|
"@atlaskit/textfield": "^6.8.0",
|
|
58
58
|
"@atlaskit/theme": "^15.0.0",
|
|
59
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
59
|
+
"@atlaskit/tmp-editor-statsig": "^2.45.0",
|
|
60
60
|
"@atlaskit/toggle": "^14.1.0",
|
|
61
61
|
"@atlaskit/tokens": "^3.3.0",
|
|
62
62
|
"@atlaskit/tooltip": "^19.1.0",
|