@atlaskit/editor-plugin-block-controls 1.10.3 → 1.10.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 +9 -0
- package/dist/cjs/pm-plugins/main.js +7 -22
- package/dist/es2019/pm-plugins/main.js +7 -22
- package/dist/esm/pm-plugins/main.js +7 -22
- package/dist/types/pm-plugins/main.d.ts +1 -14
- package/dist/types/types.d.ts +4 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -14
- package/dist/types-ts4.5/types.d.ts +4 -0
- package/package.json +2 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 1.10.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#126929](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/126929)
|
|
8
|
+
[`ba2a4b1af84db`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ba2a4b1af84db) -
|
|
9
|
+
Clean up FFs
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 1.10.3
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -85,7 +85,6 @@ var initialState = {
|
|
|
85
85
|
isDocSizeLimitEnabled: null,
|
|
86
86
|
isPMDragging: false
|
|
87
87
|
};
|
|
88
|
-
var DRAG_AND_DROP_DOC_SIZE_LIMIT = 50;
|
|
89
88
|
var createPlugin = exports.createPlugin = function createPlugin(api, getIntl) {
|
|
90
89
|
return new _safePlugin.SafePlugin({
|
|
91
90
|
key: key,
|
|
@@ -95,16 +94,6 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl) {
|
|
|
95
94
|
},
|
|
96
95
|
apply: function apply(tr, currentState, oldState, newState) {
|
|
97
96
|
var _meta$activeNode, _meta$activeNode$hand, _meta$activeNode4, _meta$isDragging, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging;
|
|
98
|
-
if (initialState.isDocSizeLimitEnabled === null) {
|
|
99
|
-
if ((0, _platformFeatureFlags.fg)('platform.editor.elements.drag-and-drop-doc-size-limit_7k4vq')) {
|
|
100
|
-
initialState.isDocSizeLimitEnabled = true;
|
|
101
|
-
} else {
|
|
102
|
-
initialState.isDocSizeLimitEnabled = false;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
if (initialState.isDocSizeLimitEnabled && newState.doc.childCount > DRAG_AND_DROP_DOC_SIZE_LIMIT) {
|
|
106
|
-
return initialState;
|
|
107
|
-
}
|
|
108
97
|
var activeNode = currentState.activeNode,
|
|
109
98
|
decorations = currentState.decorations,
|
|
110
99
|
isMenuOpen = currentState.isMenuOpen,
|
|
@@ -386,6 +375,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl) {
|
|
|
386
375
|
},
|
|
387
376
|
handleDOMEvents: {
|
|
388
377
|
drop: function drop(view, event) {
|
|
378
|
+
var _event$target;
|
|
389
379
|
// prosemirror has sends a default transaction on drop (meta where uiEvent is 'drop'),
|
|
390
380
|
// this duplicates an empty version of the node it was dropping,
|
|
391
381
|
// Adding some check here to prevent that if drop position is within activeNode
|
|
@@ -404,18 +394,13 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl) {
|
|
|
404
394
|
// Currently we can only drag one node at a time
|
|
405
395
|
// so we only need to check first child
|
|
406
396
|
var draggable = dragging === null || dragging === void 0 ? void 0 : dragging.slice.content.firstChild;
|
|
407
|
-
var
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
var _event$target;
|
|
411
|
-
var nodeElement = (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.closest('[data-drag-handler-anchor-name]');
|
|
412
|
-
if (!nodeElement) {
|
|
413
|
-
return false;
|
|
414
|
-
}
|
|
415
|
-
var domPos = (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_24304') ? Math.max(view.posAtDOM(nodeElement, 0) - 1, 0) : view.posAtDOM(nodeElement, 0) - 1;
|
|
416
|
-
var nodeTarget = state.doc.nodeAt(domPos);
|
|
417
|
-
isSameNode = !!(nodeTarget && draggable !== null && draggable !== void 0 && draggable.eq(nodeTarget));
|
|
397
|
+
var nodeElement = (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.closest('[data-drag-handler-anchor-name]');
|
|
398
|
+
if (!nodeElement) {
|
|
399
|
+
return false;
|
|
418
400
|
}
|
|
401
|
+
var domPos = (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_24304') ? Math.max(view.posAtDOM(nodeElement, 0) - 1, 0) : view.posAtDOM(nodeElement, 0) - 1;
|
|
402
|
+
var nodeTarget = state.doc.nodeAt(domPos);
|
|
403
|
+
var isSameNode = !!(nodeTarget && draggable !== null && draggable !== void 0 && draggable.eq(nodeTarget));
|
|
419
404
|
if (isSameNode) {
|
|
420
405
|
// Prevent the default drop behavior if the position is within the activeNode
|
|
421
406
|
event.preventDefault();
|
|
@@ -79,7 +79,6 @@ const initialState = {
|
|
|
79
79
|
isDocSizeLimitEnabled: null,
|
|
80
80
|
isPMDragging: false
|
|
81
81
|
};
|
|
82
|
-
const DRAG_AND_DROP_DOC_SIZE_LIMIT = 50;
|
|
83
82
|
export const createPlugin = (api, getIntl) => {
|
|
84
83
|
return new SafePlugin({
|
|
85
84
|
key,
|
|
@@ -89,16 +88,6 @@ export const createPlugin = (api, getIntl) => {
|
|
|
89
88
|
},
|
|
90
89
|
apply(tr, currentState, oldState, newState) {
|
|
91
90
|
var _meta$activeNode, _meta$activeNode$hand, _meta$activeNode4, _meta$isDragging, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging;
|
|
92
|
-
if (initialState.isDocSizeLimitEnabled === null) {
|
|
93
|
-
if (fg('platform.editor.elements.drag-and-drop-doc-size-limit_7k4vq')) {
|
|
94
|
-
initialState.isDocSizeLimitEnabled = true;
|
|
95
|
-
} else {
|
|
96
|
-
initialState.isDocSizeLimitEnabled = false;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
if (initialState.isDocSizeLimitEnabled && newState.doc.childCount > DRAG_AND_DROP_DOC_SIZE_LIMIT) {
|
|
100
|
-
return initialState;
|
|
101
|
-
}
|
|
102
91
|
let {
|
|
103
92
|
activeNode,
|
|
104
93
|
decorations,
|
|
@@ -375,6 +364,7 @@ export const createPlugin = (api, getIntl) => {
|
|
|
375
364
|
},
|
|
376
365
|
handleDOMEvents: {
|
|
377
366
|
drop(view, event) {
|
|
367
|
+
var _event$target;
|
|
378
368
|
// prosemirror has sends a default transaction on drop (meta where uiEvent is 'drop'),
|
|
379
369
|
// this duplicates an empty version of the node it was dropping,
|
|
380
370
|
// Adding some check here to prevent that if drop position is within activeNode
|
|
@@ -395,18 +385,13 @@ export const createPlugin = (api, getIntl) => {
|
|
|
395
385
|
// Currently we can only drag one node at a time
|
|
396
386
|
// so we only need to check first child
|
|
397
387
|
const draggable = dragging === null || dragging === void 0 ? void 0 : dragging.slice.content.firstChild;
|
|
398
|
-
const
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
var _event$target;
|
|
402
|
-
const nodeElement = (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.closest('[data-drag-handler-anchor-name]');
|
|
403
|
-
if (!nodeElement) {
|
|
404
|
-
return false;
|
|
405
|
-
}
|
|
406
|
-
const domPos = fg('platform_editor_element_drag_and_drop_ed_24304') ? Math.max(view.posAtDOM(nodeElement, 0) - 1, 0) : view.posAtDOM(nodeElement, 0) - 1;
|
|
407
|
-
const nodeTarget = state.doc.nodeAt(domPos);
|
|
408
|
-
isSameNode = !!(nodeTarget && draggable !== null && draggable !== void 0 && draggable.eq(nodeTarget));
|
|
388
|
+
const nodeElement = (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.closest('[data-drag-handler-anchor-name]');
|
|
389
|
+
if (!nodeElement) {
|
|
390
|
+
return false;
|
|
409
391
|
}
|
|
392
|
+
const domPos = fg('platform_editor_element_drag_and_drop_ed_24304') ? Math.max(view.posAtDOM(nodeElement, 0) - 1, 0) : view.posAtDOM(nodeElement, 0) - 1;
|
|
393
|
+
const nodeTarget = state.doc.nodeAt(domPos);
|
|
394
|
+
const isSameNode = !!(nodeTarget && draggable !== null && draggable !== void 0 && draggable.eq(nodeTarget));
|
|
410
395
|
if (isSameNode) {
|
|
411
396
|
// Prevent the default drop behavior if the position is within the activeNode
|
|
412
397
|
event.preventDefault();
|
|
@@ -78,7 +78,6 @@ var initialState = {
|
|
|
78
78
|
isDocSizeLimitEnabled: null,
|
|
79
79
|
isPMDragging: false
|
|
80
80
|
};
|
|
81
|
-
var DRAG_AND_DROP_DOC_SIZE_LIMIT = 50;
|
|
82
81
|
export var createPlugin = function createPlugin(api, getIntl) {
|
|
83
82
|
return new SafePlugin({
|
|
84
83
|
key: key,
|
|
@@ -88,16 +87,6 @@ export var createPlugin = function createPlugin(api, getIntl) {
|
|
|
88
87
|
},
|
|
89
88
|
apply: function apply(tr, currentState, oldState, newState) {
|
|
90
89
|
var _meta$activeNode, _meta$activeNode$hand, _meta$activeNode4, _meta$isDragging, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging;
|
|
91
|
-
if (initialState.isDocSizeLimitEnabled === null) {
|
|
92
|
-
if (fg('platform.editor.elements.drag-and-drop-doc-size-limit_7k4vq')) {
|
|
93
|
-
initialState.isDocSizeLimitEnabled = true;
|
|
94
|
-
} else {
|
|
95
|
-
initialState.isDocSizeLimitEnabled = false;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
if (initialState.isDocSizeLimitEnabled && newState.doc.childCount > DRAG_AND_DROP_DOC_SIZE_LIMIT) {
|
|
99
|
-
return initialState;
|
|
100
|
-
}
|
|
101
90
|
var activeNode = currentState.activeNode,
|
|
102
91
|
decorations = currentState.decorations,
|
|
103
92
|
isMenuOpen = currentState.isMenuOpen,
|
|
@@ -379,6 +368,7 @@ export var createPlugin = function createPlugin(api, getIntl) {
|
|
|
379
368
|
},
|
|
380
369
|
handleDOMEvents: {
|
|
381
370
|
drop: function drop(view, event) {
|
|
371
|
+
var _event$target;
|
|
382
372
|
// prosemirror has sends a default transaction on drop (meta where uiEvent is 'drop'),
|
|
383
373
|
// this duplicates an empty version of the node it was dropping,
|
|
384
374
|
// Adding some check here to prevent that if drop position is within activeNode
|
|
@@ -397,18 +387,13 @@ export var createPlugin = function createPlugin(api, getIntl) {
|
|
|
397
387
|
// Currently we can only drag one node at a time
|
|
398
388
|
// so we only need to check first child
|
|
399
389
|
var draggable = dragging === null || dragging === void 0 ? void 0 : dragging.slice.content.firstChild;
|
|
400
|
-
var
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
var _event$target;
|
|
404
|
-
var nodeElement = (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.closest('[data-drag-handler-anchor-name]');
|
|
405
|
-
if (!nodeElement) {
|
|
406
|
-
return false;
|
|
407
|
-
}
|
|
408
|
-
var domPos = fg('platform_editor_element_drag_and_drop_ed_24304') ? Math.max(view.posAtDOM(nodeElement, 0) - 1, 0) : view.posAtDOM(nodeElement, 0) - 1;
|
|
409
|
-
var nodeTarget = state.doc.nodeAt(domPos);
|
|
410
|
-
isSameNode = !!(nodeTarget && draggable !== null && draggable !== void 0 && draggable.eq(nodeTarget));
|
|
390
|
+
var nodeElement = (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.closest('[data-drag-handler-anchor-name]');
|
|
391
|
+
if (!nodeElement) {
|
|
392
|
+
return false;
|
|
411
393
|
}
|
|
394
|
+
var domPos = fg('platform_editor_element_drag_and_drop_ed_24304') ? Math.max(view.posAtDOM(nodeElement, 0) - 1, 0) : view.posAtDOM(nodeElement, 0) - 1;
|
|
395
|
+
var nodeTarget = state.doc.nodeAt(domPos);
|
|
396
|
+
var isSameNode = !!(nodeTarget && draggable !== null && draggable !== void 0 && draggable.eq(nodeTarget));
|
|
412
397
|
if (isSameNode) {
|
|
413
398
|
// Prevent the default drop behavior if the position is within the activeNode
|
|
414
399
|
event.preventDefault();
|
|
@@ -2,19 +2,6 @@ import { type IntlShape } from 'react-intl-next';
|
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
6
5
|
import type { BlockControlsPlugin, PluginState } from '../types';
|
|
7
6
|
export declare const key: PluginKey<PluginState>;
|
|
8
|
-
export declare const createPlugin: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, getIntl: () => IntlShape) => SafePlugin<PluginState
|
|
9
|
-
decorations: DecorationSet;
|
|
10
|
-
decorationState: import("../types").DecorationState;
|
|
11
|
-
activeNode: any;
|
|
12
|
-
isDragging: any;
|
|
13
|
-
isMenuOpen: boolean | undefined;
|
|
14
|
-
editorHeight: any;
|
|
15
|
-
editorWidthLeft: any;
|
|
16
|
-
editorWidthRight: any;
|
|
17
|
-
isResizerResizing: boolean;
|
|
18
|
-
isDocSizeLimitEnabled: boolean;
|
|
19
|
-
isPMDragging: any;
|
|
20
|
-
}>;
|
|
7
|
+
export declare const createPlugin: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, getIntl: () => IntlShape) => SafePlugin<PluginState>;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -22,6 +22,10 @@ export interface PluginState {
|
|
|
22
22
|
handleOptions?: HandleOptions;
|
|
23
23
|
} | null;
|
|
24
24
|
isResizerResizing: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* @private
|
|
27
|
+
* @deprecated Doc size limits no longer supported
|
|
28
|
+
*/
|
|
25
29
|
isDocSizeLimitEnabled: boolean | null;
|
|
26
30
|
/**
|
|
27
31
|
* is dragging the node without using drag handle, i,e, native prosemirror DnD
|
|
@@ -2,19 +2,6 @@ import { type IntlShape } from 'react-intl-next';
|
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
6
5
|
import type { BlockControlsPlugin, PluginState } from '../types';
|
|
7
6
|
export declare const key: PluginKey<PluginState>;
|
|
8
|
-
export declare const createPlugin: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, getIntl: () => IntlShape) => SafePlugin<PluginState
|
|
9
|
-
decorations: DecorationSet;
|
|
10
|
-
decorationState: import("../types").DecorationState;
|
|
11
|
-
activeNode: any;
|
|
12
|
-
isDragging: any;
|
|
13
|
-
isMenuOpen: boolean | undefined;
|
|
14
|
-
editorHeight: any;
|
|
15
|
-
editorWidthLeft: any;
|
|
16
|
-
editorWidthRight: any;
|
|
17
|
-
isResizerResizing: boolean;
|
|
18
|
-
isDocSizeLimitEnabled: boolean;
|
|
19
|
-
isPMDragging: any;
|
|
20
|
-
}>;
|
|
7
|
+
export declare const createPlugin: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, getIntl: () => IntlShape) => SafePlugin<PluginState>;
|
|
@@ -22,6 +22,10 @@ export interface PluginState {
|
|
|
22
22
|
handleOptions?: HandleOptions;
|
|
23
23
|
} | null;
|
|
24
24
|
isResizerResizing: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* @private
|
|
27
|
+
* @deprecated Doc size limits no longer supported
|
|
28
|
+
*/
|
|
25
29
|
isDocSizeLimitEnabled: boolean | null;
|
|
26
30
|
/**
|
|
27
31
|
* is dragging the node without using drag handle, i,e, native prosemirror DnD
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.4",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^40.3.0",
|
|
35
|
-
"@atlaskit/editor-common": "^87.
|
|
35
|
+
"@atlaskit/editor-common": "^87.4.0",
|
|
36
36
|
"@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^1.6.0",
|
|
38
38
|
"@atlaskit/editor-plugin-editor-disabled": "^1.2.0",
|
|
@@ -95,9 +95,6 @@
|
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
97
|
"platform-feature-flags": {
|
|
98
|
-
"platform.editor.elements.drag-and-drop-doc-size-limit_7k4vq": {
|
|
99
|
-
"type": "boolean"
|
|
100
|
-
},
|
|
101
98
|
"platform.editor.elements.drag-and-drop-remove-wrapper_fyqr2": {
|
|
102
99
|
"type": "boolean"
|
|
103
100
|
},
|
|
@@ -108,9 +105,6 @@
|
|
|
108
105
|
"type": "boolean",
|
|
109
106
|
"referenceOnly": true
|
|
110
107
|
},
|
|
111
|
-
"platform.editor.elements.drag-and-drop-ed-23892": {
|
|
112
|
-
"type": "boolean"
|
|
113
|
-
},
|
|
114
108
|
"platform_editor_elements_drag_and_drop_ed_24000": {
|
|
115
109
|
"type": "boolean"
|
|
116
110
|
},
|