@atlaskit/editor-plugin-extension 3.0.2 → 3.0.4
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 +19 -0
- package/dist/cjs/pm-plugins/main.js +1 -22
- package/dist/cjs/pm-plugins/toolbar.js +12 -2
- package/dist/cjs/ui/ConfigPanel/Fields/SelectItem.js +1 -0
- package/dist/cjs/ui/ConfigPanel/Header.js +1 -0
- package/dist/es2019/pm-plugins/main.js +1 -22
- package/dist/es2019/pm-plugins/toolbar.js +12 -2
- package/dist/es2019/ui/ConfigPanel/Fields/SelectItem.js +1 -0
- package/dist/es2019/ui/ConfigPanel/Header.js +1 -0
- package/dist/esm/pm-plugins/main.js +1 -22
- package/dist/esm/pm-plugins/toolbar.js +12 -2
- package/dist/esm/ui/ConfigPanel/Fields/SelectItem.js +1 -0
- package/dist/esm/ui/ConfigPanel/Header.js +1 -0
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-extension
|
|
2
2
|
|
|
3
|
+
## 3.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 3.0.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#101406](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/101406)
|
|
14
|
+
[`4748404f1aa3d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4748404f1aa3d) -
|
|
15
|
+
ED-26111 Add condition that properly positions the floating toolbar for extensions inside the
|
|
16
|
+
legacy content macro
|
|
17
|
+
- [#100525](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/100525)
|
|
18
|
+
[`c37f69a90637b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c37f69a90637b) -
|
|
19
|
+
ED-26114: Remove logic for legacy content macro that handled selection changes when entering and
|
|
20
|
+
exiting the extension. Now handled in the extension code in conlfuence.
|
|
21
|
+
|
|
3
22
|
## 3.0.2
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -213,27 +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
|
-
var currentSelection = event.relatedTarget;
|
|
219
|
-
var previousSelection = event.target;
|
|
220
|
-
if (!(currentSelection instanceof HTMLElement) || !(previousSelection instanceof HTMLElement)) {
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
var wasPreviousSelectionInsideExtensionEditableArea = !!previousSelection.closest('.extension-editable-area');
|
|
224
|
-
var isCurrentSelectionInsideExtensionEditableArea = !!currentSelection.closest('.extension-editable-area');
|
|
225
|
-
var maybeFromPopup = !!currentSelection.closest('[data-editor-popup="true"]');
|
|
226
|
-
|
|
227
|
-
// We want to reset the user's selection if they are entering or exiting the extension editable area.
|
|
228
|
-
// To do so, we check if there previous selection was inside or outside, and if they are now inside or outside.
|
|
229
|
-
// We want to ignore this if a blur event is originating from an editor popup.
|
|
230
|
-
if (!maybeFromPopup && wasPreviousSelectionInsideExtensionEditableArea !== isCurrentSelectionInsideExtensionEditableArea) {
|
|
231
|
-
var emptySelection = new _state.TextSelection(view.state.doc.resolve(0));
|
|
232
|
-
var tr = view.state.tr.setSelection(emptySelection);
|
|
233
|
-
view.dispatch(tr);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
},
|
|
237
216
|
/**
|
|
238
217
|
* ED-18072 - Cannot shift + arrow past bodied extension if it is not empty.
|
|
239
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.
|
|
@@ -335,7 +314,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, provid
|
|
|
335
314
|
return null;
|
|
336
315
|
},
|
|
337
316
|
handleClickOn: (0, _selection2.createSelectionClickHandler)(['extension', 'bodiedExtension', 'multiBodiedExtension'], function (target) {
|
|
338
|
-
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');
|
|
339
318
|
},
|
|
340
319
|
// It's to enable nested extensions selection
|
|
341
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 (
|
|
168
|
-
|
|
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
|
|
@@ -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,27 +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
|
-
const currentSelection = event.relatedTarget;
|
|
162
|
-
const previousSelection = event.target;
|
|
163
|
-
if (!(currentSelection instanceof HTMLElement) || !(previousSelection instanceof HTMLElement)) {
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
const wasPreviousSelectionInsideExtensionEditableArea = !!previousSelection.closest('.extension-editable-area');
|
|
167
|
-
const isCurrentSelectionInsideExtensionEditableArea = !!currentSelection.closest('.extension-editable-area');
|
|
168
|
-
const maybeFromPopup = !!currentSelection.closest('[data-editor-popup="true"]');
|
|
169
|
-
|
|
170
|
-
// We want to reset the user's selection if they are entering or exiting the extension editable area.
|
|
171
|
-
// To do so, we check if there previous selection was inside or outside, and if they are now inside or outside.
|
|
172
|
-
// We want to ignore this if a blur event is originating from an editor popup.
|
|
173
|
-
if (!maybeFromPopup && wasPreviousSelectionInsideExtensionEditableArea !== isCurrentSelectionInsideExtensionEditableArea) {
|
|
174
|
-
const emptySelection = new TextSelection(view.state.doc.resolve(0));
|
|
175
|
-
const tr = view.state.tr.setSelection(emptySelection);
|
|
176
|
-
view.dispatch(tr);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
159
|
/**
|
|
181
160
|
* ED-18072 - Cannot shift + arrow past bodied extension if it is not empty.
|
|
182
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.
|
|
@@ -289,7 +268,7 @@ export const createPlugin = (dispatch, providerFactory, extensionHandlers, porta
|
|
|
289
268
|
}
|
|
290
269
|
return null;
|
|
291
270
|
},
|
|
292
|
-
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'),
|
|
293
272
|
// It's to enable nested extensions selection
|
|
294
273
|
{
|
|
295
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 (
|
|
165
|
-
|
|
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
|
|
@@ -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,27 +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
|
-
var currentSelection = event.relatedTarget;
|
|
212
|
-
var previousSelection = event.target;
|
|
213
|
-
if (!(currentSelection instanceof HTMLElement) || !(previousSelection instanceof HTMLElement)) {
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
var wasPreviousSelectionInsideExtensionEditableArea = !!previousSelection.closest('.extension-editable-area');
|
|
217
|
-
var isCurrentSelectionInsideExtensionEditableArea = !!currentSelection.closest('.extension-editable-area');
|
|
218
|
-
var maybeFromPopup = !!currentSelection.closest('[data-editor-popup="true"]');
|
|
219
|
-
|
|
220
|
-
// We want to reset the user's selection if they are entering or exiting the extension editable area.
|
|
221
|
-
// To do so, we check if there previous selection was inside or outside, and if they are now inside or outside.
|
|
222
|
-
// We want to ignore this if a blur event is originating from an editor popup.
|
|
223
|
-
if (!maybeFromPopup && wasPreviousSelectionInsideExtensionEditableArea !== isCurrentSelectionInsideExtensionEditableArea) {
|
|
224
|
-
var emptySelection = new TextSelection(view.state.doc.resolve(0));
|
|
225
|
-
var tr = view.state.tr.setSelection(emptySelection);
|
|
226
|
-
view.dispatch(tr);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
},
|
|
230
209
|
/**
|
|
231
210
|
* ED-18072 - Cannot shift + arrow past bodied extension if it is not empty.
|
|
232
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.
|
|
@@ -328,7 +307,7 @@ export var createPlugin = function createPlugin(dispatch, providerFactory, exten
|
|
|
328
307
|
return null;
|
|
329
308
|
},
|
|
330
309
|
handleClickOn: createSelectionClickHandler(['extension', 'bodiedExtension', 'multiBodiedExtension'], function (target) {
|
|
331
|
-
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');
|
|
332
311
|
},
|
|
333
312
|
// It's to enable nested extensions selection
|
|
334
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 (
|
|
161
|
-
|
|
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
|
|
@@ -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,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-extension",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"description": "editor-plugin-extension plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@atlaskit/adf-schema": "^46.1.0",
|
|
27
|
-
"@atlaskit/adf-utils": "^19.
|
|
27
|
+
"@atlaskit/adf-utils": "^19.16.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": "^
|
|
33
|
+
"@atlaskit/editor-common": "^99.0.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",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"@atlaskit/editor-tables": "^2.8.0",
|
|
44
44
|
"@atlaskit/empty-state": "^8.1.0",
|
|
45
45
|
"@atlaskit/form": "^11.0.0",
|
|
46
|
-
"@atlaskit/heading": "4.0.
|
|
47
|
-
"@atlaskit/icon": "^23.
|
|
46
|
+
"@atlaskit/heading": "4.0.1",
|
|
47
|
+
"@atlaskit/icon": "^23.3.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,9 +56,9 @@
|
|
|
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.
|
|
59
|
+
"@atlaskit/tmp-editor-statsig": "^2.33.0",
|
|
60
60
|
"@atlaskit/toggle": "^14.0.0",
|
|
61
|
-
"@atlaskit/tokens": "^
|
|
61
|
+
"@atlaskit/tokens": "^3.0.0",
|
|
62
62
|
"@atlaskit/tooltip": "^19.0.0",
|
|
63
63
|
"@babel/runtime": "^7.0.0",
|
|
64
64
|
"@emotion/react": "^11.7.1",
|