@atlaskit/editor-plugin-extension 3.0.1 → 3.0.3

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 CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/editor-plugin-extension
2
2
 
3
+ ## 3.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#101406](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/101406)
8
+ [`4748404f1aa3d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4748404f1aa3d) -
9
+ ED-26111 Add condition that properly positions the floating toolbar for extensions inside the
10
+ legacy content macro
11
+ - [#100525](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/100525)
12
+ [`c37f69a90637b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c37f69a90637b) -
13
+ ED-26114: Remove logic for legacy content macro that handled selection changes when entering and
14
+ exiting the extension. Now handled in the extension code in conlfuence.
15
+
16
+ ## 3.0.2
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies
21
+
3
22
  ## 3.0.1
4
23
 
5
24
  ### Patch Changes
@@ -213,25 +213,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, provid
213
213
  key: _pluginKey.pluginKey,
214
214
  props: {
215
215
  handleDOMEvents: {
216
- blur: function blur(view, event) {
217
- if ((0, _platformFeatureFlags.fg)('platform_editor_legacy_content_macro')) {
218
- // Ignored via go/ees005
219
- // eslint-disable-next-line @atlaskit/editor/no-as-casting
220
- var currentTarget = event.relatedTarget;
221
- // Ignored via go/ees005
222
- // eslint-disable-next-line @atlaskit/editor/no-as-casting
223
- var source = event.target;
224
- var maybeFromPopup = !!currentTarget.closest('[data-editor-popup="true"]');
225
-
226
- // If the focus is going from outside to inside an area designated as an editable area of an extension, then the extension selection is reset.
227
- // We want to ignore this if a blur event is originating from an editor popup.
228
- if (!maybeFromPopup && !!currentTarget.closest('.extension-editable-area') !== !!source.closest('.extension-editable-area')) {
229
- var emptySelection = new _state.TextSelection(view.state.doc.resolve(0));
230
- var tr = view.state.tr.setSelection(emptySelection);
231
- view.dispatch(tr);
232
- }
233
- }
234
- },
235
216
  /**
236
217
  * ED-18072 - Cannot shift + arrow past bodied extension if it is not empty.
237
218
  * This code is to handle the case where the selection starts inside or on the node and the user is trying to shift + arrow.
@@ -333,7 +314,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, provid
333
314
  return null;
334
315
  },
335
316
  handleClickOn: (0, _selection2.createSelectionClickHandler)(['extension', 'bodiedExtension', 'multiBodiedExtension'], function (target) {
336
- return (0, _platformFeatureFlags.fg)('platform_editor_legacy_content_macro') ? !target.closest('.extension-content') || !!target.closest('.extension-container') : !target.closest('.extension-content');
317
+ return (0, _platformFeatureFlags.fg)('platform_editor_legacy_content_macro') ? !target.closest('.extension-non-editable-area') && (!target.closest('.extension-content') || !!target.closest('.extension-container')) : !target.closest('.extension-content');
337
318
  },
338
319
  // It's to enable nested extensions selection
339
320
  {
@@ -164,8 +164,18 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(_ref
164
164
  var possibleMbeParent = (0, _utils2.findParentNodeOfType)(schema.nodes.extensionFrame)(selection);
165
165
  // We only want to use calculated position in case of a bodiedExtension present inside an MBE node
166
166
  var isBodiedExtensionInsideMBE = possibleMbeParent && (extensionNode === null || extensionNode === void 0 ? void 0 : extensionNode.node.type.name) === 'bodiedExtension';
167
- if (!isBodiedExtensionInsideMBE) {
168
- return nextPos;
167
+ if ((0, _platformFeatureFlags.fg)('platform_editor_legacy_content_macro')) {
168
+ if (!extensionNode) {
169
+ return nextPos;
170
+ }
171
+ var isInsideEditableExtensionArea = !!editorView.dom.closest('.extension-editable-area');
172
+ if (!isBodiedExtensionInsideMBE && !isInsideEditableExtensionArea) {
173
+ return nextPos;
174
+ }
175
+ } else {
176
+ if (!isBodiedExtensionInsideMBE) {
177
+ return nextPos;
178
+ }
169
179
  }
170
180
  var scrollWrapper = editorView.dom.closest('.fabric-editor-popup-scroll-parent') || document.body;
171
181
  // Ignored via go/ees005
@@ -24,6 +24,7 @@ var itemWrapperStyles = (0, _react.css)({
24
24
  }
25
25
  });
26
26
  var iconWrapperStyles = (0, _react.css)({
27
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
27
28
  lineHeight: 1
28
29
  });
29
30
 
@@ -52,6 +52,7 @@ var itemBodyStyles = (0, _react2.css)({
52
52
  flexDirection: 'row',
53
53
  flexWrap: 'nowrap',
54
54
  justifyContent: 'space-between',
55
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
55
56
  lineHeight: 1.4,
56
57
  margin: "0 ".concat("var(--ds-space-200, 16px)"),
57
58
  flexGrow: 3,
@@ -156,25 +156,6 @@ export const createPlugin = (dispatch, providerFactory, extensionHandlers, porta
156
156
  key: pluginKey,
157
157
  props: {
158
158
  handleDOMEvents: {
159
- blur: (view, event) => {
160
- if (fg('platform_editor_legacy_content_macro')) {
161
- // Ignored via go/ees005
162
- // eslint-disable-next-line @atlaskit/editor/no-as-casting
163
- const currentTarget = event.relatedTarget;
164
- // Ignored via go/ees005
165
- // eslint-disable-next-line @atlaskit/editor/no-as-casting
166
- const source = event.target;
167
- const maybeFromPopup = !!currentTarget.closest('[data-editor-popup="true"]');
168
-
169
- // If the focus is going from outside to inside an area designated as an editable area of an extension, then the extension selection is reset.
170
- // We want to ignore this if a blur event is originating from an editor popup.
171
- if (!maybeFromPopup && !!currentTarget.closest('.extension-editable-area') !== !!source.closest('.extension-editable-area')) {
172
- const emptySelection = new TextSelection(view.state.doc.resolve(0));
173
- const tr = view.state.tr.setSelection(emptySelection);
174
- view.dispatch(tr);
175
- }
176
- }
177
- },
178
159
  /**
179
160
  * ED-18072 - Cannot shift + arrow past bodied extension if it is not empty.
180
161
  * This code is to handle the case where the selection starts inside or on the node and the user is trying to shift + arrow.
@@ -287,7 +268,7 @@ export const createPlugin = (dispatch, providerFactory, extensionHandlers, porta
287
268
  }
288
269
  return null;
289
270
  },
290
- handleClickOn: createSelectionClickHandler(['extension', 'bodiedExtension', 'multiBodiedExtension'], target => fg('platform_editor_legacy_content_macro') ? !target.closest('.extension-content') || !!target.closest('.extension-container') : !target.closest('.extension-content'),
271
+ handleClickOn: createSelectionClickHandler(['extension', 'bodiedExtension', 'multiBodiedExtension'], target => fg('platform_editor_legacy_content_macro') ? !target.closest('.extension-non-editable-area') && (!target.closest('.extension-content') || !!target.closest('.extension-container')) : !target.closest('.extension-content'),
291
272
  // It's to enable nested extensions selection
292
273
  {
293
274
  useLongPressSelection
@@ -161,8 +161,18 @@ export const getToolbarConfig = ({
161
161
  const possibleMbeParent = findParentNodeOfType(schema.nodes.extensionFrame)(selection);
162
162
  // We only want to use calculated position in case of a bodiedExtension present inside an MBE node
163
163
  const isBodiedExtensionInsideMBE = possibleMbeParent && (extensionNode === null || extensionNode === void 0 ? void 0 : extensionNode.node.type.name) === 'bodiedExtension';
164
- if (!isBodiedExtensionInsideMBE) {
165
- return nextPos;
164
+ if (fg('platform_editor_legacy_content_macro')) {
165
+ if (!extensionNode) {
166
+ return nextPos;
167
+ }
168
+ const isInsideEditableExtensionArea = !!editorView.dom.closest('.extension-editable-area');
169
+ if (!isBodiedExtensionInsideMBE && !isInsideEditableExtensionArea) {
170
+ return nextPos;
171
+ }
172
+ } else {
173
+ if (!isBodiedExtensionInsideMBE) {
174
+ return nextPos;
175
+ }
166
176
  }
167
177
  const scrollWrapper = editorView.dom.closest('.fabric-editor-popup-scroll-parent') || document.body;
168
178
  // Ignored via go/ees005
@@ -16,6 +16,7 @@ const itemWrapperStyles = css({
16
16
  }
17
17
  });
18
18
  const iconWrapperStyles = css({
19
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
19
20
  lineHeight: 1
20
21
  });
21
22
 
@@ -44,6 +44,7 @@ const itemBodyStyles = css({
44
44
  flexDirection: 'row',
45
45
  flexWrap: 'nowrap',
46
46
  justifyContent: 'space-between',
47
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
47
48
  lineHeight: 1.4,
48
49
  margin: `0 ${"var(--ds-space-200, 16px)"}`,
49
50
  flexGrow: 3,
@@ -206,25 +206,6 @@ export var createPlugin = function createPlugin(dispatch, providerFactory, exten
206
206
  key: pluginKey,
207
207
  props: {
208
208
  handleDOMEvents: {
209
- blur: function blur(view, event) {
210
- if (fg('platform_editor_legacy_content_macro')) {
211
- // Ignored via go/ees005
212
- // eslint-disable-next-line @atlaskit/editor/no-as-casting
213
- var currentTarget = event.relatedTarget;
214
- // Ignored via go/ees005
215
- // eslint-disable-next-line @atlaskit/editor/no-as-casting
216
- var source = event.target;
217
- var maybeFromPopup = !!currentTarget.closest('[data-editor-popup="true"]');
218
-
219
- // If the focus is going from outside to inside an area designated as an editable area of an extension, then the extension selection is reset.
220
- // We want to ignore this if a blur event is originating from an editor popup.
221
- if (!maybeFromPopup && !!currentTarget.closest('.extension-editable-area') !== !!source.closest('.extension-editable-area')) {
222
- var emptySelection = new TextSelection(view.state.doc.resolve(0));
223
- var tr = view.state.tr.setSelection(emptySelection);
224
- view.dispatch(tr);
225
- }
226
- }
227
- },
228
209
  /**
229
210
  * ED-18072 - Cannot shift + arrow past bodied extension if it is not empty.
230
211
  * This code is to handle the case where the selection starts inside or on the node and the user is trying to shift + arrow.
@@ -326,7 +307,7 @@ export var createPlugin = function createPlugin(dispatch, providerFactory, exten
326
307
  return null;
327
308
  },
328
309
  handleClickOn: createSelectionClickHandler(['extension', 'bodiedExtension', 'multiBodiedExtension'], function (target) {
329
- return fg('platform_editor_legacy_content_macro') ? !target.closest('.extension-content') || !!target.closest('.extension-container') : !target.closest('.extension-content');
310
+ return fg('platform_editor_legacy_content_macro') ? !target.closest('.extension-non-editable-area') && (!target.closest('.extension-content') || !!target.closest('.extension-container')) : !target.closest('.extension-content');
330
311
  },
331
312
  // It's to enable nested extensions selection
332
313
  {
@@ -157,8 +157,18 @@ export var getToolbarConfig = function getToolbarConfig(_ref) {
157
157
  var possibleMbeParent = findParentNodeOfType(schema.nodes.extensionFrame)(selection);
158
158
  // We only want to use calculated position in case of a bodiedExtension present inside an MBE node
159
159
  var isBodiedExtensionInsideMBE = possibleMbeParent && (extensionNode === null || extensionNode === void 0 ? void 0 : extensionNode.node.type.name) === 'bodiedExtension';
160
- if (!isBodiedExtensionInsideMBE) {
161
- return nextPos;
160
+ if (fg('platform_editor_legacy_content_macro')) {
161
+ if (!extensionNode) {
162
+ return nextPos;
163
+ }
164
+ var isInsideEditableExtensionArea = !!editorView.dom.closest('.extension-editable-area');
165
+ if (!isBodiedExtensionInsideMBE && !isInsideEditableExtensionArea) {
166
+ return nextPos;
167
+ }
168
+ } else {
169
+ if (!isBodiedExtensionInsideMBE) {
170
+ return nextPos;
171
+ }
162
172
  }
163
173
  var scrollWrapper = editorView.dom.closest('.fabric-editor-popup-scroll-parent') || document.body;
164
174
  // Ignored via go/ees005
@@ -16,6 +16,7 @@ var itemWrapperStyles = css({
16
16
  }
17
17
  });
18
18
  var iconWrapperStyles = css({
19
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
19
20
  lineHeight: 1
20
21
  });
21
22
 
@@ -44,6 +44,7 @@ var itemBodyStyles = css({
44
44
  flexDirection: 'row',
45
45
  flexWrap: 'nowrap',
46
46
  justifyContent: 'space-between',
47
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
47
48
  lineHeight: 1.4,
48
49
  margin: "0 ".concat("var(--ds-space-200, 16px)"),
49
50
  flexGrow: 3,
@@ -96,7 +96,7 @@ export default function ExtensionNodePicker({
96
96
  setHasSelection(isSelected);
97
97
  }
98
98
 
99
- let iconProp: { elemBefore?: ReactNode } = {};
99
+ const iconProp: { elemBefore?: ReactNode } = {};
100
100
 
101
101
  if (item.icon) {
102
102
  const ExtensionIcon = Loadable<{ label: string }, never>({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-extension",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "description": "editor-plugin-extension plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -24,17 +24,17 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@atlaskit/adf-schema": "^46.1.0",
27
- "@atlaskit/adf-utils": "^19.14.0",
27
+ "@atlaskit/adf-utils": "^19.15.0",
28
28
  "@atlaskit/analytics-next": "^10.2.0",
29
29
  "@atlaskit/avatar": "^21.17.0",
30
30
  "@atlaskit/button": "^20.3.0",
31
31
  "@atlaskit/checkbox": "^15.2.0",
32
32
  "@atlaskit/datetime-picker": "^15.10.0",
33
- "@atlaskit/editor-common": "^97.2.0",
33
+ "@atlaskit/editor-common": "^98.2.0",
34
34
  "@atlaskit/editor-json-transformer": "^8.21.0",
35
35
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
36
36
  "@atlaskit/editor-plugin-context-identifier": "^1.3.0",
37
- "@atlaskit/editor-plugin-context-panel": "^1.3.0",
37
+ "@atlaskit/editor-plugin-context-panel": "^1.4.0",
38
38
  "@atlaskit/editor-plugin-decorations": "^1.3.0",
39
39
  "@atlaskit/editor-plugin-feature-flags": "^1.2.0",
40
40
  "@atlaskit/editor-plugin-width": "^2.0.0",
@@ -44,7 +44,7 @@
44
44
  "@atlaskit/empty-state": "^8.1.0",
45
45
  "@atlaskit/form": "^11.0.0",
46
46
  "@atlaskit/heading": "4.0.0",
47
- "@atlaskit/icon": "^23.1.0",
47
+ "@atlaskit/icon": "^23.2.0",
48
48
  "@atlaskit/platform-feature-flags": "^0.3.0",
49
49
  "@atlaskit/primitives": "^13.3.0",
50
50
  "@atlaskit/radio": "^7.0.0",
@@ -56,7 +56,7 @@
56
56
  "@atlaskit/textarea": "^5.7.0",
57
57
  "@atlaskit/textfield": "^6.7.0",
58
58
  "@atlaskit/theme": "^14.0.0",
59
- "@atlaskit/tmp-editor-statsig": "^2.29.0",
59
+ "@atlaskit/tmp-editor-statsig": "^2.33.0",
60
60
  "@atlaskit/toggle": "^14.0.0",
61
61
  "@atlaskit/tokens": "^2.5.0",
62
62
  "@atlaskit/tooltip": "^19.0.0",