@atlaskit/editor-plugin-extension 5.3.0 → 5.3.2
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 +18 -0
- package/dist/cjs/extensionPlugin.js +2 -9
- package/dist/cjs/pm-plugins/extension-api.js +1 -2
- package/dist/cjs/pm-plugins/main.js +1 -2
- package/dist/cjs/pm-plugins/toolbar.js +22 -39
- package/dist/cjs/pm-plugins/unique-id.js +10 -1
- package/dist/cjs/ui/ConfigPanel/NestedForms/RemovableField.js +1 -1
- package/dist/es2019/extensionPlugin.js +2 -9
- package/dist/es2019/pm-plugins/extension-api.js +1 -2
- package/dist/es2019/pm-plugins/main.js +2 -3
- package/dist/es2019/pm-plugins/toolbar.js +24 -43
- package/dist/es2019/pm-plugins/unique-id.js +12 -1
- package/dist/es2019/ui/ConfigPanel/NestedForms/RemovableField.js +1 -1
- package/dist/esm/extensionPlugin.js +2 -9
- package/dist/esm/pm-plugins/extension-api.js +1 -2
- package/dist/esm/pm-plugins/main.js +2 -3
- package/dist/esm/pm-plugins/toolbar.js +22 -39
- package/dist/esm/pm-plugins/unique-id.js +10 -1
- package/dist/esm/ui/ConfigPanel/NestedForms/RemovableField.js +1 -1
- package/dist/types/pm-plugins/toolbar.d.ts +3 -7
- package/dist/types-ts4.5/pm-plugins/toolbar.d.ts +3 -7
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-extension
|
|
2
2
|
|
|
3
|
+
## 5.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#148176](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/148176)
|
|
8
|
+
[`ff3d1fcb8f797`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ff3d1fcb8f797) -
|
|
9
|
+
Clean-up platform_editor_legacy_content_macro feature gate
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 5.3.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#147400](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/147400)
|
|
17
|
+
[`800ff50276ed7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/800ff50276ed7) -
|
|
18
|
+
Clean up experiment platform_editor_nested_non_bodied_macros
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 5.3.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
|
@@ -8,7 +8,6 @@ exports.extensionPlugin = void 0;
|
|
|
8
8
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
9
9
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
10
10
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
12
11
|
var _actions = require("./editor-actions/actions");
|
|
13
12
|
var _commands = require("./editor-commands/commands");
|
|
14
13
|
var _extensionApi = require("./pm-plugins/extension-api");
|
|
@@ -25,7 +24,7 @@ var _useConfigPanelPluginHook = require("./ui/useConfigPanelPluginHook");
|
|
|
25
24
|
// Remove below line when cleaning up platform_editor_ai_object_sidebar_injection feature flag
|
|
26
25
|
|
|
27
26
|
var extensionPlugin = exports.extensionPlugin = function extensionPlugin(_ref) {
|
|
28
|
-
var _api$featureFlags, _api$contextPanel, _api$analytics2, _api$analytics3, _api$contextPanel4
|
|
27
|
+
var _api$featureFlags, _api$contextPanel, _api$analytics2, _api$analytics3, _api$contextPanel4;
|
|
29
28
|
var _ref$config = _ref.config,
|
|
30
29
|
options = _ref$config === void 0 ? {} : _ref$config,
|
|
31
30
|
_api = _ref.api;
|
|
@@ -174,15 +173,9 @@ var extensionPlugin = exports.extensionPlugin = function extensionPlugin(_ref) {
|
|
|
174
173
|
forceAutoSave: _commands.forceAutoSave
|
|
175
174
|
},
|
|
176
175
|
pluginsOptions: {
|
|
177
|
-
floatingToolbar: (0,
|
|
176
|
+
floatingToolbar: (0, _toolbar.getToolbarConfig)({
|
|
178
177
|
breakoutEnabled: options.breakoutEnabled,
|
|
179
178
|
extensionApi: _api
|
|
180
|
-
}) : (0, _toolbar.getToolbarConfig)({
|
|
181
|
-
breakoutEnabled: options.breakoutEnabled,
|
|
182
|
-
hoverDecoration: _api === null || _api === void 0 || (_api$decorations = _api.decorations) === null || _api$decorations === void 0 ? void 0 : _api$decorations.actions.hoverDecoration,
|
|
183
|
-
applyChangeToContextPanel: _api === null || _api === void 0 || (_api$contextPanel5 = _api.contextPanel) === null || _api$contextPanel5 === void 0 ? void 0 : _api$contextPanel5.actions.applyChange,
|
|
184
|
-
editorAnalyticsAPI: _api === null || _api === void 0 || (_api$analytics4 = _api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions,
|
|
185
|
-
extensionApi: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') || (0, _experiments.editorExperiment)('platform_editor_offline_editing_web', true) ? _api : undefined
|
|
186
179
|
}),
|
|
187
180
|
contextPanel:
|
|
188
181
|
// if showContextPanel action is not available, or platform_editor_ai_object_sidebar_injection feature flag is off
|
|
@@ -14,7 +14,6 @@ var _editorJsonTransformer = require("@atlaskit/editor-json-transformer");
|
|
|
14
14
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
15
15
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
16
16
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
17
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
17
|
var _commands = require("../editor-commands/commands");
|
|
19
18
|
var _actions = require("./macro/actions");
|
|
20
19
|
var _pluginKey = require("./macro/plugin-key");
|
|
@@ -260,7 +259,7 @@ var createExtensionAPI = exports.createExtensionAPI = function createExtensionAP
|
|
|
260
259
|
if (typeof (opts === null || opts === void 0 ? void 0 : opts.addToHistory) === 'boolean') {
|
|
261
260
|
tr.setMeta('addToHistory', opts.addToHistory);
|
|
262
261
|
}
|
|
263
|
-
if (typeof (opts === null || opts === void 0 ? void 0 : opts.scrollIntoView) === 'boolean'
|
|
262
|
+
if (typeof (opts === null || opts === void 0 ? void 0 : opts.scrollIntoView) === 'boolean') {
|
|
264
263
|
tr.setMeta('scrollIntoView', opts.scrollIntoView);
|
|
265
264
|
}
|
|
266
265
|
dispatch(tr);
|
|
@@ -12,7 +12,6 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
|
12
12
|
var _selection2 = require("@atlaskit/editor-common/selection");
|
|
13
13
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
14
14
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
15
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
15
|
var _commands = require("../editor-commands/commands");
|
|
17
16
|
var _lazyExtension = require("../nodeviews/lazyExtension");
|
|
18
17
|
var _pluginFactory = require("./plugin-factory");
|
|
@@ -310,7 +309,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, provid
|
|
|
310
309
|
return null;
|
|
311
310
|
},
|
|
312
311
|
handleClickOn: (0, _selection2.createSelectionClickHandler)(['extension', 'bodiedExtension', 'multiBodiedExtension'], function (target) {
|
|
313
|
-
return
|
|
312
|
+
return !target.closest('.extension-non-editable-area') && (!target.closest('.extension-content') || !!target.closest('.extension-container'));
|
|
314
313
|
},
|
|
315
314
|
// It's to enable nested extensions selection
|
|
316
315
|
{
|
|
@@ -37,9 +37,6 @@ var isNestedNBM = function isNestedNBM(state, selectedExtNode) {
|
|
|
37
37
|
blockquote = _state$schema$nodes.blockquote,
|
|
38
38
|
listItem = _state$schema$nodes.listItem,
|
|
39
39
|
selection = state.selection;
|
|
40
|
-
if (!(0, _experiments.editorExperiment)('platform_editor_nested_non_bodied_macros', 'test')) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
40
|
if (!selectedExtNode) {
|
|
44
41
|
return false;
|
|
45
42
|
}
|
|
@@ -232,23 +229,17 @@ var calculateToolbarPosition = function calculateToolbarPosition(editorView, nex
|
|
|
232
229
|
// We only want to use calculated position in case of a bodiedExtension present inside an MBE node
|
|
233
230
|
var isBodiedExtensionInsideMBE = possibleMbeParent && (extensionNode === null || extensionNode === void 0 ? void 0 : extensionNode.node.type.name) === 'bodiedExtension';
|
|
234
231
|
var scrollWrapper = editorView.dom.closest('.fabric-editor-popup-scroll-parent') || document.body;
|
|
235
|
-
if (
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
// The editable extension area may have its own scroll wrapper, so we want to keep searching up the tree for the page level scroll wrapper.
|
|
232
|
+
if (!extensionNode) {
|
|
233
|
+
return nextPos;
|
|
234
|
+
}
|
|
235
|
+
var isInsideEditableExtensionArea = !!editorView.dom.closest('.extension-editable-area');
|
|
236
|
+
if (!isBodiedExtensionInsideMBE && !isInsideEditableExtensionArea) {
|
|
237
|
+
return nextPos;
|
|
238
|
+
}
|
|
239
|
+
if (isInsideEditableExtensionArea && scrollWrapper.parentElement) {
|
|
240
|
+
// The editable extension area may have its own scroll wrapper, so we want to keep searching up the tree for the page level scroll wrapper.
|
|
245
241
|
|
|
246
|
-
|
|
247
|
-
}
|
|
248
|
-
} else {
|
|
249
|
-
if (!isBodiedExtensionInsideMBE) {
|
|
250
|
-
return nextPos;
|
|
251
|
-
}
|
|
242
|
+
scrollWrapper = scrollWrapper.parentElement.closest('.fabric-editor-popup-scroll-parent') || scrollWrapper;
|
|
252
243
|
}
|
|
253
244
|
|
|
254
245
|
// Ignored via go/ees005
|
|
@@ -265,21 +256,14 @@ var calculateToolbarPosition = function calculateToolbarPosition(editorView, nex
|
|
|
265
256
|
var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(_ref) {
|
|
266
257
|
var _ref$breakoutEnabled = _ref.breakoutEnabled,
|
|
267
258
|
breakoutEnabled = _ref$breakoutEnabled === void 0 ? true : _ref$breakoutEnabled,
|
|
268
|
-
hoverDecoration = _ref.hoverDecoration,
|
|
269
|
-
applyChangeToContextPanel = _ref.applyChangeToContextPanel,
|
|
270
|
-
editorAnalyticsAPI = _ref.editorAnalyticsAPI,
|
|
271
259
|
extensionApi = _ref.extensionApi;
|
|
272
260
|
return function (state, intl) {
|
|
273
|
-
var _extensionApi$
|
|
261
|
+
var _extensionApi$decorat, _extensionApi$context, _extensionApi$analyti, _extensionApi$connect;
|
|
274
262
|
var formatMessage = intl.formatMessage;
|
|
275
263
|
var extensionState = (0, _pluginFactory.getPluginState)(state);
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
hoverDecoration = extensionApi === null || extensionApi === void 0 || (_extensionApi$decorat = extensionApi.decorations) === null || _extensionApi$decorat === void 0 ? void 0 : _extensionApi$decorat.actions.hoverDecoration;
|
|
280
|
-
applyChangeToContextPanel = extensionApi === null || extensionApi === void 0 || (_extensionApi$context = extensionApi.contextPanel) === null || _extensionApi$context === void 0 ? void 0 : _extensionApi$context.actions.applyChange;
|
|
281
|
-
editorAnalyticsAPI = extensionApi === null || extensionApi === void 0 || (_extensionApi$analyti = extensionApi.analytics) === null || _extensionApi$analyti === void 0 ? void 0 : _extensionApi$analyti.actions;
|
|
282
|
-
}
|
|
264
|
+
var hoverDecoration = extensionApi === null || extensionApi === void 0 || (_extensionApi$decorat = extensionApi.decorations) === null || _extensionApi$decorat === void 0 ? void 0 : _extensionApi$decorat.actions.hoverDecoration;
|
|
265
|
+
var applyChangeToContextPanel = extensionApi === null || extensionApi === void 0 || (_extensionApi$context = extensionApi.contextPanel) === null || _extensionApi$context === void 0 ? void 0 : _extensionApi$context.actions.applyChange;
|
|
266
|
+
var editorAnalyticsAPI = extensionApi === null || extensionApi === void 0 || (_extensionApi$analyti = extensionApi.analytics) === null || _extensionApi$analyti === void 0 ? void 0 : _extensionApi$analyti.actions;
|
|
283
267
|
if (!extensionState || extensionState.showContextPanel || !extensionState.element) {
|
|
284
268
|
return;
|
|
285
269
|
}
|
|
@@ -312,12 +296,11 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(_ref
|
|
|
312
296
|
};
|
|
313
297
|
}
|
|
314
298
|
var hoverDecorationProps = function hoverDecorationProps(nodeType, className) {
|
|
315
|
-
var _hoverDecoration, _hoverDecoration2, _hoverDecoration3, _hoverDecoration4;
|
|
316
299
|
return {
|
|
317
|
-
onMouseEnter:
|
|
318
|
-
onMouseLeave:
|
|
319
|
-
onFocus:
|
|
320
|
-
onBlur:
|
|
300
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true, className),
|
|
301
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false, className),
|
|
302
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true, className),
|
|
303
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false, className)
|
|
321
304
|
};
|
|
322
305
|
};
|
|
323
306
|
return {
|
|
@@ -358,10 +341,10 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(_ref
|
|
|
358
341
|
iconFallback: _delete.default,
|
|
359
342
|
appearance: 'danger',
|
|
360
343
|
onClick: (0, _commands.removeExtension)(editorAnalyticsAPI),
|
|
361
|
-
onMouseEnter:
|
|
362
|
-
onMouseLeave:
|
|
363
|
-
onFocus:
|
|
364
|
-
onBlur:
|
|
344
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
345
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
346
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
347
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
365
348
|
focusEditoronEnter: true,
|
|
366
349
|
title: formatMessage(_messages.default.remove),
|
|
367
350
|
tabIndex: null,
|
|
@@ -7,9 +7,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.createPlugin = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
10
|
+
var _steps = require("@atlaskit/adf-schema/steps");
|
|
10
11
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
11
12
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
12
13
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
14
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
15
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
16
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
17
|
var pluginKey = new _state.PluginKey('extensionUniqueIdPlugin');
|
|
@@ -31,7 +33,14 @@ var createPlugin = exports.createPlugin = function createPlugin() {
|
|
|
31
33
|
return;
|
|
32
34
|
}
|
|
33
35
|
var isAddingExtension = transaction.steps.some(function (step) {
|
|
34
|
-
|
|
36
|
+
var _step$attrs;
|
|
37
|
+
return (0, _utils.stepAddsOneOf)(step, extensionTypes) ||
|
|
38
|
+
// There are instances where the localId will be reset to null on publish due to extension
|
|
39
|
+
// not existing in the Storage format (eg. Legacy Content Extensions) or not having a localId
|
|
40
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
41
|
+
(0, _platformFeatureFlags.fg)('platform_editor_update_extension_local_id_on_reset') && step instanceof _steps.SetAttrsStep &&
|
|
42
|
+
// @ts-expect-error Bad ProseMirror step types
|
|
43
|
+
((_step$attrs = step.attrs) === null || _step$attrs === void 0 ? void 0 : _step$attrs.localId) === null;
|
|
35
44
|
});
|
|
36
45
|
if (isAddingExtension) {
|
|
37
46
|
// Can't simply look at changed nodes, as we could be adding an extension
|
|
@@ -54,7 +54,7 @@ var RemovableField = function RemovableField(_ref) {
|
|
|
54
54
|
,
|
|
55
55
|
className: className
|
|
56
56
|
}, children, canRemoveField &&
|
|
57
|
-
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
57
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions, @atlassian/a11y/interactive-element-not-keyboard-focusable
|
|
58
58
|
(0, _react2.jsx)("div", {
|
|
59
59
|
css: removeButtonWrapperStyles,
|
|
60
60
|
"data-testid": "remove-field-".concat(name),
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { extension, extensionFrame, inlineExtension, multiBodiedExtension } from '@atlaskit/adf-schema';
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
4
|
import { createEditSelectedExtensionAction, insertOrReplaceBodiedExtension, insertOrReplaceExtension } from './editor-actions/actions';
|
|
6
5
|
import { forceAutoSave } from './editor-commands/commands';
|
|
7
6
|
import { createExtensionAPI } from './pm-plugins/extension-api';
|
|
@@ -20,7 +19,7 @@ export const extensionPlugin = ({
|
|
|
20
19
|
config: options = {},
|
|
21
20
|
api
|
|
22
21
|
}) => {
|
|
23
|
-
var _api$featureFlags, _api$contextPanel, _api$contextPanel$act, _api$analytics2, _api$analytics3, _api$contextPanel4
|
|
22
|
+
var _api$featureFlags, _api$contextPanel, _api$contextPanel$act, _api$analytics2, _api$analytics3, _api$contextPanel4;
|
|
24
23
|
const featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
25
24
|
//Note: This is a hack to get the editor view reference in the plugin. Copied from table plugin.
|
|
26
25
|
//This is needed to get the current selection in the editor
|
|
@@ -162,15 +161,9 @@ export const extensionPlugin = ({
|
|
|
162
161
|
forceAutoSave
|
|
163
162
|
},
|
|
164
163
|
pluginsOptions: {
|
|
165
|
-
floatingToolbar:
|
|
164
|
+
floatingToolbar: getToolbarConfig({
|
|
166
165
|
breakoutEnabled: options.breakoutEnabled,
|
|
167
166
|
extensionApi: api
|
|
168
|
-
}) : getToolbarConfig({
|
|
169
|
-
breakoutEnabled: options.breakoutEnabled,
|
|
170
|
-
hoverDecoration: api === null || api === void 0 ? void 0 : (_api$decorations = api.decorations) === null || _api$decorations === void 0 ? void 0 : _api$decorations.actions.hoverDecoration,
|
|
171
|
-
applyChangeToContextPanel: api === null || api === void 0 ? void 0 : (_api$contextPanel5 = api.contextPanel) === null || _api$contextPanel5 === void 0 ? void 0 : _api$contextPanel5.actions.applyChange,
|
|
172
|
-
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions,
|
|
173
|
-
extensionApi: editorExperiment('platform_editor_controls', 'variant1') || editorExperiment('platform_editor_offline_editing_web', true) ? api : undefined
|
|
174
167
|
}),
|
|
175
168
|
contextPanel:
|
|
176
169
|
// if showContextPanel action is not available, or platform_editor_ai_object_sidebar_injection feature flag is off
|
|
@@ -5,7 +5,6 @@ import { JSONTransformer } from '@atlaskit/editor-json-transformer';
|
|
|
5
5
|
import { Fragment, Mark } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import { setTextSelection } from '@atlaskit/editor-prosemirror/utils';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { setEditingContextToContextPanel } from '../editor-commands/commands';
|
|
10
9
|
import { insertMacroFromMacroBrowser } from './macro/actions';
|
|
11
10
|
import { pluginKey as macroPluginKey } from './macro/plugin-key';
|
|
@@ -278,7 +277,7 @@ export const createExtensionAPI = options => {
|
|
|
278
277
|
if (typeof (opts === null || opts === void 0 ? void 0 : opts.addToHistory) === 'boolean') {
|
|
279
278
|
tr.setMeta('addToHistory', opts.addToHistory);
|
|
280
279
|
}
|
|
281
|
-
if (typeof (opts === null || opts === void 0 ? void 0 : opts.scrollIntoView) === 'boolean'
|
|
280
|
+
if (typeof (opts === null || opts === void 0 ? void 0 : opts.scrollIntoView) === 'boolean') {
|
|
282
281
|
tr.setMeta('scrollIntoView', opts.scrollIntoView);
|
|
283
282
|
}
|
|
284
283
|
dispatch(tr);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import {
|
|
2
|
+
import { GapCursorSelection, createSelectionClickHandler, isSelectionAtEndOfNode, isSelectionAtStartOfNode } from '@atlaskit/editor-common/selection';
|
|
3
3
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { findParentNodeOfTypeClosestToPos, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { clearEditingContext, updateState } from '../editor-commands/commands';
|
|
7
6
|
import { lazyExtensionNodeView } from '../nodeviews/lazyExtension';
|
|
8
7
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
@@ -265,7 +264,7 @@ export const createPlugin = (dispatch, providerFactory, extensionHandlers, porta
|
|
|
265
264
|
}
|
|
266
265
|
return null;
|
|
267
266
|
},
|
|
268
|
-
handleClickOn: createSelectionClickHandler(['extension', 'bodiedExtension', 'multiBodiedExtension'], target =>
|
|
267
|
+
handleClickOn: createSelectionClickHandler(['extension', 'bodiedExtension', 'multiBodiedExtension'], target => !target.closest('.extension-non-editable-area') && (!target.closest('.extension-content') || !!target.closest('.extension-container')),
|
|
269
268
|
// It's to enable nested extensions selection
|
|
270
269
|
{
|
|
271
270
|
useLongPressSelection
|
|
@@ -32,9 +32,6 @@ const isNestedNBM = (state, selectedExtNode) => {
|
|
|
32
32
|
},
|
|
33
33
|
selection
|
|
34
34
|
} = state;
|
|
35
|
-
if (!editorExperiment('platform_editor_nested_non_bodied_macros', 'test')) {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
35
|
if (!selectedExtNode) {
|
|
39
36
|
return false;
|
|
40
37
|
}
|
|
@@ -231,23 +228,17 @@ const calculateToolbarPosition = (editorView, nextPos, state, extensionNode) =>
|
|
|
231
228
|
// We only want to use calculated position in case of a bodiedExtension present inside an MBE node
|
|
232
229
|
const isBodiedExtensionInsideMBE = possibleMbeParent && (extensionNode === null || extensionNode === void 0 ? void 0 : extensionNode.node.type.name) === 'bodiedExtension';
|
|
233
230
|
let scrollWrapper = editorView.dom.closest('.fabric-editor-popup-scroll-parent') || document.body;
|
|
234
|
-
if (
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
// The editable extension area may have its own scroll wrapper, so we want to keep searching up the tree for the page level scroll wrapper.
|
|
231
|
+
if (!extensionNode) {
|
|
232
|
+
return nextPos;
|
|
233
|
+
}
|
|
234
|
+
const isInsideEditableExtensionArea = !!editorView.dom.closest('.extension-editable-area');
|
|
235
|
+
if (!isBodiedExtensionInsideMBE && !isInsideEditableExtensionArea) {
|
|
236
|
+
return nextPos;
|
|
237
|
+
}
|
|
238
|
+
if (isInsideEditableExtensionArea && scrollWrapper.parentElement) {
|
|
239
|
+
// The editable extension area may have its own scroll wrapper, so we want to keep searching up the tree for the page level scroll wrapper.
|
|
244
240
|
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
} else {
|
|
248
|
-
if (!isBodiedExtensionInsideMBE) {
|
|
249
|
-
return nextPos;
|
|
250
|
-
}
|
|
241
|
+
scrollWrapper = scrollWrapper.parentElement.closest('.fabric-editor-popup-scroll-parent') || scrollWrapper;
|
|
251
242
|
}
|
|
252
243
|
|
|
253
244
|
// Ignored via go/ees005
|
|
@@ -263,23 +254,16 @@ const calculateToolbarPosition = (editorView, nextPos, state, extensionNode) =>
|
|
|
263
254
|
};
|
|
264
255
|
export const getToolbarConfig = ({
|
|
265
256
|
breakoutEnabled = true,
|
|
266
|
-
hoverDecoration,
|
|
267
|
-
applyChangeToContextPanel,
|
|
268
|
-
editorAnalyticsAPI,
|
|
269
257
|
extensionApi
|
|
270
258
|
}) => (state, intl) => {
|
|
271
|
-
var _extensionApi$
|
|
259
|
+
var _extensionApi$decorat, _extensionApi$context, _extensionApi$analyti, _extensionApi$connect, _extensionApi$connect2, _extensionApi$connect3;
|
|
272
260
|
const {
|
|
273
261
|
formatMessage
|
|
274
262
|
} = intl;
|
|
275
263
|
const extensionState = getPluginState(state);
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
hoverDecoration = extensionApi === null || extensionApi === void 0 ? void 0 : (_extensionApi$decorat = extensionApi.decorations) === null || _extensionApi$decorat === void 0 ? void 0 : _extensionApi$decorat.actions.hoverDecoration;
|
|
280
|
-
applyChangeToContextPanel = extensionApi === null || extensionApi === void 0 ? void 0 : (_extensionApi$context = extensionApi.contextPanel) === null || _extensionApi$context === void 0 ? void 0 : _extensionApi$context.actions.applyChange;
|
|
281
|
-
editorAnalyticsAPI = extensionApi === null || extensionApi === void 0 ? void 0 : (_extensionApi$analyti = extensionApi.analytics) === null || _extensionApi$analyti === void 0 ? void 0 : _extensionApi$analyti.actions;
|
|
282
|
-
}
|
|
264
|
+
const hoverDecoration = extensionApi === null || extensionApi === void 0 ? void 0 : (_extensionApi$decorat = extensionApi.decorations) === null || _extensionApi$decorat === void 0 ? void 0 : _extensionApi$decorat.actions.hoverDecoration;
|
|
265
|
+
const applyChangeToContextPanel = extensionApi === null || extensionApi === void 0 ? void 0 : (_extensionApi$context = extensionApi.contextPanel) === null || _extensionApi$context === void 0 ? void 0 : _extensionApi$context.actions.applyChange;
|
|
266
|
+
const editorAnalyticsAPI = extensionApi === null || extensionApi === void 0 ? void 0 : (_extensionApi$analyti = extensionApi.analytics) === null || _extensionApi$analyti === void 0 ? void 0 : _extensionApi$analyti.actions;
|
|
283
267
|
if (!extensionState || extensionState.showContextPanel || !extensionState.element) {
|
|
284
268
|
return;
|
|
285
269
|
}
|
|
@@ -306,15 +290,12 @@ export const getToolbarConfig = ({
|
|
|
306
290
|
};
|
|
307
291
|
};
|
|
308
292
|
}
|
|
309
|
-
const hoverDecorationProps = (nodeType, className) => {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
onBlur: (_hoverDecoration4 = hoverDecoration) === null || _hoverDecoration4 === void 0 ? void 0 : _hoverDecoration4(nodeType, false, className)
|
|
316
|
-
};
|
|
317
|
-
};
|
|
293
|
+
const hoverDecorationProps = (nodeType, className) => ({
|
|
294
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true, className),
|
|
295
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false, className),
|
|
296
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true, className),
|
|
297
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false, className)
|
|
298
|
+
});
|
|
318
299
|
return {
|
|
319
300
|
title: 'Extension floating controls',
|
|
320
301
|
// Ignored via go/ees005
|
|
@@ -347,10 +328,10 @@ export const getToolbarConfig = ({
|
|
|
347
328
|
iconFallback: DeleteIcon,
|
|
348
329
|
appearance: 'danger',
|
|
349
330
|
onClick: removeExtension(editorAnalyticsAPI),
|
|
350
|
-
onMouseEnter:
|
|
351
|
-
onMouseLeave:
|
|
352
|
-
onFocus:
|
|
353
|
-
onBlur:
|
|
331
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
332
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
333
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
334
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
354
335
|
focusEditoronEnter: true,
|
|
355
336
|
title: formatMessage(commonMessages.remove),
|
|
356
337
|
tabIndex: null,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { uuid } from '@atlaskit/adf-schema';
|
|
2
|
+
import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
2
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
4
|
import { stepAddsOneOf } from '@atlaskit/editor-common/utils';
|
|
4
5
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
7
|
const pluginKey = new PluginKey('extensionUniqueIdPlugin');
|
|
6
8
|
const createPlugin = () => new SafePlugin({
|
|
7
9
|
appendTransaction: (transactions, _oldState, newState) => {
|
|
@@ -20,7 +22,16 @@ const createPlugin = () => new SafePlugin({
|
|
|
20
22
|
if (!transaction.docChanged) {
|
|
21
23
|
return;
|
|
22
24
|
}
|
|
23
|
-
const isAddingExtension = transaction.steps.some(step =>
|
|
25
|
+
const isAddingExtension = transaction.steps.some(step => {
|
|
26
|
+
var _step$attrs;
|
|
27
|
+
return stepAddsOneOf(step, extensionTypes) ||
|
|
28
|
+
// There are instances where the localId will be reset to null on publish due to extension
|
|
29
|
+
// not existing in the Storage format (eg. Legacy Content Extensions) or not having a localId
|
|
30
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
31
|
+
fg('platform_editor_update_extension_local_id_on_reset') && step instanceof SetAttrsStep &&
|
|
32
|
+
// @ts-expect-error Bad ProseMirror step types
|
|
33
|
+
((_step$attrs = step.attrs) === null || _step$attrs === void 0 ? void 0 : _step$attrs.localId) === null;
|
|
34
|
+
});
|
|
24
35
|
if (isAddingExtension) {
|
|
25
36
|
// Can't simply look at changed nodes, as we could be adding an extension
|
|
26
37
|
newState.doc.descendants((node, pos) => {
|
|
@@ -45,7 +45,7 @@ const RemovableField = ({
|
|
|
45
45
|
,
|
|
46
46
|
className: className
|
|
47
47
|
}, children, canRemoveField &&
|
|
48
|
-
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
48
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions, @atlassian/a11y/interactive-element-not-keyboard-focusable
|
|
49
49
|
jsx("div", {
|
|
50
50
|
css: removeButtonWrapperStyles,
|
|
51
51
|
"data-testid": `remove-field-${name}`,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { extension, extensionFrame, inlineExtension, multiBodiedExtension } from '@atlaskit/adf-schema';
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
4
|
import { createEditSelectedExtensionAction, insertOrReplaceBodiedExtension as _insertOrReplaceBodiedExtension, insertOrReplaceExtension as _insertOrReplaceExtension } from './editor-actions/actions';
|
|
6
5
|
import { forceAutoSave } from './editor-commands/commands';
|
|
7
6
|
import { createExtensionAPI } from './pm-plugins/extension-api';
|
|
@@ -17,7 +16,7 @@ import { createPlugin as createUniqueIdPlugin } from './pm-plugins/unique-id';
|
|
|
17
16
|
import { getContextPanel } from './ui/context-panel';
|
|
18
17
|
import { useConfigPanelPluginHook } from './ui/useConfigPanelPluginHook';
|
|
19
18
|
export var extensionPlugin = function extensionPlugin(_ref) {
|
|
20
|
-
var _api$featureFlags, _api$contextPanel, _api$analytics2, _api$analytics3, _api$contextPanel4
|
|
19
|
+
var _api$featureFlags, _api$contextPanel, _api$analytics2, _api$analytics3, _api$contextPanel4;
|
|
21
20
|
var _ref$config = _ref.config,
|
|
22
21
|
options = _ref$config === void 0 ? {} : _ref$config,
|
|
23
22
|
_api = _ref.api;
|
|
@@ -166,15 +165,9 @@ export var extensionPlugin = function extensionPlugin(_ref) {
|
|
|
166
165
|
forceAutoSave: forceAutoSave
|
|
167
166
|
},
|
|
168
167
|
pluginsOptions: {
|
|
169
|
-
floatingToolbar:
|
|
168
|
+
floatingToolbar: getToolbarConfig({
|
|
170
169
|
breakoutEnabled: options.breakoutEnabled,
|
|
171
170
|
extensionApi: _api
|
|
172
|
-
}) : getToolbarConfig({
|
|
173
|
-
breakoutEnabled: options.breakoutEnabled,
|
|
174
|
-
hoverDecoration: _api === null || _api === void 0 || (_api$decorations = _api.decorations) === null || _api$decorations === void 0 ? void 0 : _api$decorations.actions.hoverDecoration,
|
|
175
|
-
applyChangeToContextPanel: _api === null || _api === void 0 || (_api$contextPanel5 = _api.contextPanel) === null || _api$contextPanel5 === void 0 ? void 0 : _api$contextPanel5.actions.applyChange,
|
|
176
|
-
editorAnalyticsAPI: _api === null || _api === void 0 || (_api$analytics4 = _api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions,
|
|
177
|
-
extensionApi: editorExperiment('platform_editor_controls', 'variant1') || editorExperiment('platform_editor_offline_editing_web', true) ? _api : undefined
|
|
178
171
|
}),
|
|
179
172
|
contextPanel:
|
|
180
173
|
// if showContextPanel action is not available, or platform_editor_ai_object_sidebar_injection feature flag is off
|
|
@@ -9,7 +9,6 @@ import { JSONTransformer } from '@atlaskit/editor-json-transformer';
|
|
|
9
9
|
import { Fragment, Mark } from '@atlaskit/editor-prosemirror/model';
|
|
10
10
|
import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
11
11
|
import { setTextSelection } from '@atlaskit/editor-prosemirror/utils';
|
|
12
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
12
|
import { setEditingContextToContextPanel } from '../editor-commands/commands';
|
|
14
13
|
import { insertMacroFromMacroBrowser } from './macro/actions';
|
|
15
14
|
import { pluginKey as macroPluginKey } from './macro/plugin-key';
|
|
@@ -253,7 +252,7 @@ export var createExtensionAPI = function createExtensionAPI(options) {
|
|
|
253
252
|
if (typeof (opts === null || opts === void 0 ? void 0 : opts.addToHistory) === 'boolean') {
|
|
254
253
|
tr.setMeta('addToHistory', opts.addToHistory);
|
|
255
254
|
}
|
|
256
|
-
if (typeof (opts === null || opts === void 0 ? void 0 : opts.scrollIntoView) === 'boolean'
|
|
255
|
+
if (typeof (opts === null || opts === void 0 ? void 0 : opts.scrollIntoView) === 'boolean') {
|
|
257
256
|
tr.setMeta('scrollIntoView', opts.scrollIntoView);
|
|
258
257
|
}
|
|
259
258
|
dispatch(tr);
|
|
@@ -2,10 +2,9 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
2
2
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
|
-
import {
|
|
5
|
+
import { GapCursorSelection, createSelectionClickHandler, isSelectionAtEndOfNode, isSelectionAtStartOfNode } from '@atlaskit/editor-common/selection';
|
|
6
6
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import { findParentNodeOfTypeClosestToPos, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { clearEditingContext, updateState } from '../editor-commands/commands';
|
|
10
9
|
import { lazyExtensionNodeView } from '../nodeviews/lazyExtension';
|
|
11
10
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
@@ -303,7 +302,7 @@ export var createPlugin = function createPlugin(dispatch, providerFactory, exten
|
|
|
303
302
|
return null;
|
|
304
303
|
},
|
|
305
304
|
handleClickOn: createSelectionClickHandler(['extension', 'bodiedExtension', 'multiBodiedExtension'], function (target) {
|
|
306
|
-
return
|
|
305
|
+
return !target.closest('.extension-non-editable-area') && (!target.closest('.extension-content') || !!target.closest('.extension-container'));
|
|
307
306
|
},
|
|
308
307
|
// It's to enable nested extensions selection
|
|
309
308
|
{
|
|
@@ -31,9 +31,6 @@ var isNestedNBM = function isNestedNBM(state, selectedExtNode) {
|
|
|
31
31
|
blockquote = _state$schema$nodes.blockquote,
|
|
32
32
|
listItem = _state$schema$nodes.listItem,
|
|
33
33
|
selection = state.selection;
|
|
34
|
-
if (!editorExperiment('platform_editor_nested_non_bodied_macros', 'test')) {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
34
|
if (!selectedExtNode) {
|
|
38
35
|
return false;
|
|
39
36
|
}
|
|
@@ -226,23 +223,17 @@ var calculateToolbarPosition = function calculateToolbarPosition(editorView, nex
|
|
|
226
223
|
// We only want to use calculated position in case of a bodiedExtension present inside an MBE node
|
|
227
224
|
var isBodiedExtensionInsideMBE = possibleMbeParent && (extensionNode === null || extensionNode === void 0 ? void 0 : extensionNode.node.type.name) === 'bodiedExtension';
|
|
228
225
|
var scrollWrapper = editorView.dom.closest('.fabric-editor-popup-scroll-parent') || document.body;
|
|
229
|
-
if (
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
// The editable extension area may have its own scroll wrapper, so we want to keep searching up the tree for the page level scroll wrapper.
|
|
226
|
+
if (!extensionNode) {
|
|
227
|
+
return nextPos;
|
|
228
|
+
}
|
|
229
|
+
var isInsideEditableExtensionArea = !!editorView.dom.closest('.extension-editable-area');
|
|
230
|
+
if (!isBodiedExtensionInsideMBE && !isInsideEditableExtensionArea) {
|
|
231
|
+
return nextPos;
|
|
232
|
+
}
|
|
233
|
+
if (isInsideEditableExtensionArea && scrollWrapper.parentElement) {
|
|
234
|
+
// The editable extension area may have its own scroll wrapper, so we want to keep searching up the tree for the page level scroll wrapper.
|
|
239
235
|
|
|
240
|
-
|
|
241
|
-
}
|
|
242
|
-
} else {
|
|
243
|
-
if (!isBodiedExtensionInsideMBE) {
|
|
244
|
-
return nextPos;
|
|
245
|
-
}
|
|
236
|
+
scrollWrapper = scrollWrapper.parentElement.closest('.fabric-editor-popup-scroll-parent') || scrollWrapper;
|
|
246
237
|
}
|
|
247
238
|
|
|
248
239
|
// Ignored via go/ees005
|
|
@@ -259,21 +250,14 @@ var calculateToolbarPosition = function calculateToolbarPosition(editorView, nex
|
|
|
259
250
|
export var getToolbarConfig = function getToolbarConfig(_ref) {
|
|
260
251
|
var _ref$breakoutEnabled = _ref.breakoutEnabled,
|
|
261
252
|
breakoutEnabled = _ref$breakoutEnabled === void 0 ? true : _ref$breakoutEnabled,
|
|
262
|
-
hoverDecoration = _ref.hoverDecoration,
|
|
263
|
-
applyChangeToContextPanel = _ref.applyChangeToContextPanel,
|
|
264
|
-
editorAnalyticsAPI = _ref.editorAnalyticsAPI,
|
|
265
253
|
extensionApi = _ref.extensionApi;
|
|
266
254
|
return function (state, intl) {
|
|
267
|
-
var _extensionApi$
|
|
255
|
+
var _extensionApi$decorat, _extensionApi$context, _extensionApi$analyti, _extensionApi$connect;
|
|
268
256
|
var formatMessage = intl.formatMessage;
|
|
269
257
|
var extensionState = getPluginState(state);
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
hoverDecoration = extensionApi === null || extensionApi === void 0 || (_extensionApi$decorat = extensionApi.decorations) === null || _extensionApi$decorat === void 0 ? void 0 : _extensionApi$decorat.actions.hoverDecoration;
|
|
274
|
-
applyChangeToContextPanel = extensionApi === null || extensionApi === void 0 || (_extensionApi$context = extensionApi.contextPanel) === null || _extensionApi$context === void 0 ? void 0 : _extensionApi$context.actions.applyChange;
|
|
275
|
-
editorAnalyticsAPI = extensionApi === null || extensionApi === void 0 || (_extensionApi$analyti = extensionApi.analytics) === null || _extensionApi$analyti === void 0 ? void 0 : _extensionApi$analyti.actions;
|
|
276
|
-
}
|
|
258
|
+
var hoverDecoration = extensionApi === null || extensionApi === void 0 || (_extensionApi$decorat = extensionApi.decorations) === null || _extensionApi$decorat === void 0 ? void 0 : _extensionApi$decorat.actions.hoverDecoration;
|
|
259
|
+
var applyChangeToContextPanel = extensionApi === null || extensionApi === void 0 || (_extensionApi$context = extensionApi.contextPanel) === null || _extensionApi$context === void 0 ? void 0 : _extensionApi$context.actions.applyChange;
|
|
260
|
+
var editorAnalyticsAPI = extensionApi === null || extensionApi === void 0 || (_extensionApi$analyti = extensionApi.analytics) === null || _extensionApi$analyti === void 0 ? void 0 : _extensionApi$analyti.actions;
|
|
277
261
|
if (!extensionState || extensionState.showContextPanel || !extensionState.element) {
|
|
278
262
|
return;
|
|
279
263
|
}
|
|
@@ -306,12 +290,11 @@ export var getToolbarConfig = function getToolbarConfig(_ref) {
|
|
|
306
290
|
};
|
|
307
291
|
}
|
|
308
292
|
var hoverDecorationProps = function hoverDecorationProps(nodeType, className) {
|
|
309
|
-
var _hoverDecoration, _hoverDecoration2, _hoverDecoration3, _hoverDecoration4;
|
|
310
293
|
return {
|
|
311
|
-
onMouseEnter:
|
|
312
|
-
onMouseLeave:
|
|
313
|
-
onFocus:
|
|
314
|
-
onBlur:
|
|
294
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true, className),
|
|
295
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false, className),
|
|
296
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true, className),
|
|
297
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false, className)
|
|
315
298
|
};
|
|
316
299
|
};
|
|
317
300
|
return {
|
|
@@ -352,10 +335,10 @@ export var getToolbarConfig = function getToolbarConfig(_ref) {
|
|
|
352
335
|
iconFallback: DeleteIcon,
|
|
353
336
|
appearance: 'danger',
|
|
354
337
|
onClick: removeExtension(editorAnalyticsAPI),
|
|
355
|
-
onMouseEnter:
|
|
356
|
-
onMouseLeave:
|
|
357
|
-
onFocus:
|
|
358
|
-
onBlur:
|
|
338
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
339
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
340
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
341
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
359
342
|
focusEditoronEnter: true,
|
|
360
343
|
title: formatMessage(commonMessages.remove),
|
|
361
344
|
tabIndex: null,
|
|
@@ -2,9 +2,11 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
import { uuid } from '@atlaskit/adf-schema';
|
|
5
|
+
import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
5
6
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
6
7
|
import { stepAddsOneOf } from '@atlaskit/editor-common/utils';
|
|
7
8
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
10
|
var pluginKey = new PluginKey('extensionUniqueIdPlugin');
|
|
9
11
|
var createPlugin = function createPlugin() {
|
|
10
12
|
return new SafePlugin({
|
|
@@ -24,7 +26,14 @@ var createPlugin = function createPlugin() {
|
|
|
24
26
|
return;
|
|
25
27
|
}
|
|
26
28
|
var isAddingExtension = transaction.steps.some(function (step) {
|
|
27
|
-
|
|
29
|
+
var _step$attrs;
|
|
30
|
+
return stepAddsOneOf(step, extensionTypes) ||
|
|
31
|
+
// There are instances where the localId will be reset to null on publish due to extension
|
|
32
|
+
// not existing in the Storage format (eg. Legacy Content Extensions) or not having a localId
|
|
33
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
34
|
+
fg('platform_editor_update_extension_local_id_on_reset') && step instanceof SetAttrsStep &&
|
|
35
|
+
// @ts-expect-error Bad ProseMirror step types
|
|
36
|
+
((_step$attrs = step.attrs) === null || _step$attrs === void 0 ? void 0 : _step$attrs.localId) === null;
|
|
28
37
|
});
|
|
29
38
|
if (isAddingExtension) {
|
|
30
39
|
// Can't simply look at changed nodes, as we could be adding an extension
|
|
@@ -46,7 +46,7 @@ var RemovableField = function RemovableField(_ref) {
|
|
|
46
46
|
,
|
|
47
47
|
className: className
|
|
48
48
|
}, children, canRemoveField &&
|
|
49
|
-
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
49
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions, @atlassian/a11y/interactive-element-not-keyboard-focusable
|
|
50
50
|
jsx("div", {
|
|
51
51
|
css: removeButtonWrapperStyles,
|
|
52
52
|
"data-testid": "remove-field-".concat(name),
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
1
|
import type { FloatingToolbarHandler, PublicPluginAPI } from '@atlaskit/editor-common/types';
|
|
3
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
3
|
import { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
|
|
5
|
-
import type {
|
|
6
|
-
import type { DecorationsPlugin
|
|
4
|
+
import type { ContextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
|
|
5
|
+
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
7
6
|
interface GetToolbarConfigProps {
|
|
8
7
|
breakoutEnabled: boolean | undefined;
|
|
9
|
-
hoverDecoration?: HoverDecorationHandler | undefined;
|
|
10
|
-
applyChangeToContextPanel?: ApplyChangeHandler | undefined;
|
|
11
|
-
editorAnalyticsAPI?: EditorAnalyticsAPI | undefined;
|
|
12
8
|
extensionApi?: PublicPluginAPI<[ContextPanelPlugin, AnalyticsPlugin, DecorationsPlugin, ConnectivityPlugin]> | undefined;
|
|
13
9
|
}
|
|
14
|
-
export declare const getToolbarConfig: ({ breakoutEnabled,
|
|
10
|
+
export declare const getToolbarConfig: ({ breakoutEnabled, extensionApi }: GetToolbarConfigProps) => FloatingToolbarHandler;
|
|
15
11
|
export {};
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
1
|
import type { FloatingToolbarHandler, PublicPluginAPI } from '@atlaskit/editor-common/types';
|
|
3
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
3
|
import { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
|
|
5
|
-
import type {
|
|
6
|
-
import type { DecorationsPlugin
|
|
4
|
+
import type { ContextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
|
|
5
|
+
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
7
6
|
interface GetToolbarConfigProps {
|
|
8
7
|
breakoutEnabled: boolean | undefined;
|
|
9
|
-
hoverDecoration?: HoverDecorationHandler | undefined;
|
|
10
|
-
applyChangeToContextPanel?: ApplyChangeHandler | undefined;
|
|
11
|
-
editorAnalyticsAPI?: EditorAnalyticsAPI | undefined;
|
|
12
8
|
extensionApi?: PublicPluginAPI<[
|
|
13
9
|
ContextPanelPlugin,
|
|
14
10
|
AnalyticsPlugin,
|
|
@@ -16,5 +12,5 @@ interface GetToolbarConfigProps {
|
|
|
16
12
|
ConnectivityPlugin
|
|
17
13
|
]> | undefined;
|
|
18
14
|
}
|
|
19
|
-
export declare const getToolbarConfig: ({ breakoutEnabled,
|
|
15
|
+
export declare const getToolbarConfig: ({ breakoutEnabled, extensionApi }: GetToolbarConfigProps) => FloatingToolbarHandler;
|
|
20
16
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-extension",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.2",
|
|
4
4
|
"description": "editor-plugin-extension plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@atlaskit/button": "^23.0.0",
|
|
33
33
|
"@atlaskit/checkbox": "^17.1.0",
|
|
34
34
|
"@atlaskit/datetime-picker": "^17.0.0",
|
|
35
|
-
"@atlaskit/editor-common": "^103.
|
|
35
|
+
"@atlaskit/editor-common": "^103.21.0",
|
|
36
36
|
"@atlaskit/editor-json-transformer": "^8.24.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
38
38
|
"@atlaskit/editor-plugin-connectivity": "^2.0.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@atlaskit/heading": "^5.2.0",
|
|
50
50
|
"@atlaskit/icon": "^25.6.0",
|
|
51
51
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
52
|
-
"@atlaskit/primitives": "^14.
|
|
52
|
+
"@atlaskit/primitives": "^14.5.0",
|
|
53
53
|
"@atlaskit/radio": "^8.1.0",
|
|
54
54
|
"@atlaskit/section-message": "^8.2.0",
|
|
55
55
|
"@atlaskit/select": "^20.4.0",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@atlaskit/textarea": "^8.0.0",
|
|
60
60
|
"@atlaskit/textfield": "^8.0.0",
|
|
61
61
|
"@atlaskit/theme": "^18.0.0",
|
|
62
|
-
"@atlaskit/tmp-editor-statsig": "^4.
|
|
62
|
+
"@atlaskit/tmp-editor-statsig": "^4.15.0",
|
|
63
63
|
"@atlaskit/toggle": "^15.0.0",
|
|
64
64
|
"@atlaskit/tokens": "^4.8.0",
|
|
65
65
|
"@atlaskit/tooltip": "^20.0.0",
|
|
@@ -122,6 +122,9 @@
|
|
|
122
122
|
"platform_editor_extension_deprecation_status": {
|
|
123
123
|
"type": "boolean"
|
|
124
124
|
},
|
|
125
|
+
"platform_editor_update_extension_local_id_on_reset": {
|
|
126
|
+
"type": "boolean"
|
|
127
|
+
},
|
|
125
128
|
"platform_editor_controls_patch_2": {
|
|
126
129
|
"type": "boolean"
|
|
127
130
|
}
|