@atlaskit/editor-plugin-block-controls 7.5.3 → 7.5.5
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 +17 -0
- package/dist/cjs/pm-plugins/decorations-common.js +3 -0
- package/dist/cjs/pm-plugins/decorations-drag-handle.js +5 -0
- package/dist/cjs/pm-plugins/decorations-drop-target.js +3 -1
- package/dist/cjs/pm-plugins/decorations-quick-insert-button.js +3 -0
- package/dist/cjs/pm-plugins/main.js +3 -1
- package/dist/cjs/pm-plugins/utils/validation.js +1 -1
- package/dist/es2019/pm-plugins/decorations-common.js +2 -0
- package/dist/es2019/pm-plugins/decorations-drag-handle.js +4 -0
- package/dist/es2019/pm-plugins/decorations-drop-target.js +3 -0
- package/dist/es2019/pm-plugins/decorations-quick-insert-button.js +2 -0
- package/dist/es2019/pm-plugins/main.js +3 -1
- package/dist/es2019/pm-plugins/utils/validation.js +2 -2
- package/dist/esm/pm-plugins/decorations-common.js +2 -0
- package/dist/esm/pm-plugins/decorations-drag-handle.js +4 -0
- package/dist/esm/pm-plugins/decorations-drop-target.js +3 -0
- package/dist/esm/pm-plugins/decorations-quick-insert-button.js +2 -0
- package/dist/esm/pm-plugins/main.js +3 -1
- package/dist/esm/pm-plugins/utils/validation.js +2 -2
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 7.5.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`c094becfaeeaa`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c094becfaeeaa) -
|
|
8
|
+
EDITOR-2476 Introduce new utility method to check if nested tables is supported in the schema to
|
|
9
|
+
facilitate removal of gate `platform_editor_use_nested_table_pm_nodes`
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 7.5.4
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [`13e78771cb389`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/13e78771cb389) -
|
|
17
|
+
ED-29600 gate unnecessary decoration operations in apply function
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 7.5.3
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -10,6 +10,8 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
12
12
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
13
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
14
|
+
|
|
13
15
|
var TYPE_DROP_TARGET_DEC = exports.TYPE_DROP_TARGET_DEC = 'drop-target-decoration';
|
|
14
16
|
var TYPE_HANDLE_DEC = exports.TYPE_HANDLE_DEC = 'drag-handle';
|
|
15
17
|
var TYPE_NODE_DEC = exports.TYPE_NODE_DEC = 'node-decoration';
|
|
@@ -32,6 +34,7 @@ var ObjHash = /*#__PURE__*/function () {
|
|
|
32
34
|
if (this.caching.has(node)) {
|
|
33
35
|
return this.caching.get(node);
|
|
34
36
|
}
|
|
37
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
35
38
|
var uniqueId = (0, _uuid.default)();
|
|
36
39
|
this.caching.set(node, uniqueId);
|
|
37
40
|
return uniqueId;
|
|
@@ -16,6 +16,8 @@ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
|
16
16
|
var _dragHandle = require("../ui/drag-handle");
|
|
17
17
|
var _decorationsCommon = require("./decorations-common");
|
|
18
18
|
var _marks = require("./utils/marks");
|
|
19
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
20
|
+
|
|
19
21
|
var emptyParagraphNodeDecorations = exports.emptyParagraphNodeDecorations = function emptyParagraphNodeDecorations() {
|
|
20
22
|
var anchorName = "--node-anchor-paragraph-0";
|
|
21
23
|
var style = "anchor-name: ".concat(anchorName, "; margin-top: 0px;");
|
|
@@ -46,10 +48,12 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
|
|
|
46
48
|
(0, _decorationsCommon.unmountDecorations)(nodeViewPortalProviderAPI, 'data-blocks-drag-handle-container', 'data-blocks-drag-handle-key');
|
|
47
49
|
}
|
|
48
50
|
var unbind;
|
|
51
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
49
52
|
var key = (0, _uuid.default)();
|
|
50
53
|
var widgetSpec = (0, _experiments.editorExperiment)('platform_editor_breakout_resizing', true) ? {
|
|
51
54
|
side: -1,
|
|
52
55
|
type: _decorationsCommon.TYPE_HANDLE_DEC,
|
|
56
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
53
57
|
testid: "".concat(_decorationsCommon.TYPE_HANDLE_DEC, "-").concat((0, _uuid.default)()),
|
|
54
58
|
/**
|
|
55
59
|
* sigh - `marks` influences the position that the widget is drawn (as described on the `side` property).
|
|
@@ -66,6 +70,7 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
|
|
|
66
70
|
} : {
|
|
67
71
|
side: -1,
|
|
68
72
|
type: _decorationsCommon.TYPE_HANDLE_DEC,
|
|
73
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
69
74
|
testid: "".concat(_decorationsCommon.TYPE_HANDLE_DEC, "-").concat((0, _uuid.default)()),
|
|
70
75
|
destroy: function destroy(node) {
|
|
71
76
|
unbind && unbind();
|
|
@@ -19,7 +19,7 @@ var _decorationsCommon = require("./decorations-common");
|
|
|
19
19
|
var _consts2 = require("./utils/consts");
|
|
20
20
|
var _validation = require("./utils/validation");
|
|
21
21
|
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; }
|
|
22
|
-
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; }
|
|
22
|
+
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; } // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
23
23
|
var IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn', 'listItem', 'caption'];
|
|
24
24
|
var PARENT_WITH_END_DROP_TARGET = ['tableCell', 'tableHeader', 'panel', 'layoutColumn', 'expand', 'nestedExpand', 'bodiedExtension'];
|
|
25
25
|
var DISABLE_CHILD_DROP_TARGET = ['orderedList', 'bulletList'];
|
|
@@ -83,6 +83,7 @@ var findDropTargetDecs = exports.findDropTargetDecs = function findDropTargetDec
|
|
|
83
83
|
});
|
|
84
84
|
};
|
|
85
85
|
var createDropTargetDecoration = exports.createDropTargetDecoration = function createDropTargetDecoration(pos, props, nodeViewPortalProviderAPI, side, anchorRectCache, isSameLayout) {
|
|
86
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
86
87
|
var key = (0, _uuid.default)();
|
|
87
88
|
return _view.Decoration.widget(pos, function (_, getPosUnsafe) {
|
|
88
89
|
var getPos = function getPos() {
|
|
@@ -121,6 +122,7 @@ var createDropTargetDecoration = exports.createDropTargetDecoration = function c
|
|
|
121
122
|
});
|
|
122
123
|
};
|
|
123
124
|
var createLayoutDropTargetDecoration = exports.createLayoutDropTargetDecoration = function createLayoutDropTargetDecoration(pos, props, nodeViewPortalProviderAPI, anchorRectCache) {
|
|
125
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
124
126
|
var key = (0, _uuid.default)();
|
|
125
127
|
return _view.Decoration.widget(pos, function (_, getPosUnsafe) {
|
|
126
128
|
var getPos = function getPos() {
|
|
@@ -14,6 +14,8 @@ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
|
14
14
|
var _quickInsertButton = require("../ui/quick-insert-button");
|
|
15
15
|
var _marks = require("./utils/marks");
|
|
16
16
|
var _vanillaQuickInsert = require("./vanilla-quick-insert");
|
|
17
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
18
|
+
|
|
17
19
|
var TYPE_QUICK_INSERT = 'INSERT_BUTTON';
|
|
18
20
|
var findQuickInsertInsertButtonDecoration = exports.findQuickInsertInsertButtonDecoration = function findQuickInsertInsertButtonDecoration(decorations, from, to) {
|
|
19
21
|
return decorations.find(from, to, function (spec) {
|
|
@@ -31,6 +33,7 @@ var quickInsertButtonDecoration = exports.quickInsertButtonDecoration = function
|
|
|
31
33
|
rootNodeType = _ref.rootNodeType,
|
|
32
34
|
anchorRectCache = _ref.anchorRectCache,
|
|
33
35
|
editorState = _ref.editorState;
|
|
36
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
34
37
|
var key = (0, _uuid.default)();
|
|
35
38
|
var cleanupCallbacks = [];
|
|
36
39
|
var widgetSpec = (0, _experiments.editorExperiment)('platform_editor_breakout_resizing', true) ? {
|
|
@@ -355,7 +355,9 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
355
355
|
// Re-create node decorations
|
|
356
356
|
var isDecSetEmpty = decorations === _view.DecorationSet.empty;
|
|
357
357
|
var isNodeDecsMissing = isDecSetEmpty || maybeNodeCountChanged || (0, _experiments.editorExperiment)('platform_editor_breakout_resizing', true) && hasJustFinishedResizing;
|
|
358
|
-
var shouldRedrawNodeDecs = !isResizerResizing && (isNodeDecsMissing || (meta === null || meta === void 0 ? void 0 : meta.isDragging))
|
|
358
|
+
var shouldRedrawNodeDecs = !isResizerResizing && (isNodeDecsMissing || (meta === null || meta === void 0 ? void 0 : meta.isDragging)) &&
|
|
359
|
+
// Skip expensive anchor node decoration recalculations when native anchor support is enabled
|
|
360
|
+
!((0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('editor_native_anchor_remove_decoration_in_apply'));
|
|
359
361
|
var isActiveNodeModified = false;
|
|
360
362
|
if (api && shouldRedrawNodeDecs) {
|
|
361
363
|
var oldNodeDecs = (0, _decorationsAnchor.findNodeDecs)(newState, decorations, from, to);
|
|
@@ -113,7 +113,7 @@ function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, $destNodePos,
|
|
|
113
113
|
var destParentNodeType = destParent === null || destParent === void 0 ? void 0 : destParent.type;
|
|
114
114
|
var activeNodeType = srcNode === null || srcNode === void 0 ? void 0 : srcNode.type;
|
|
115
115
|
var layoutColumnContent = srcNode.content;
|
|
116
|
-
var isNestingTablesSupported = (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes') && (0, _experiments.editorExperiment)('nested-tables-in-tables', true, {
|
|
116
|
+
var isNestingTablesSupported = (0, _nesting.isNestedTablesSupported)(schema) && (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes') && (0, _experiments.editorExperiment)('nested-tables-in-tables', true, {
|
|
117
117
|
exposure: true
|
|
118
118
|
});
|
|
119
119
|
if (activeNodeType === layoutColumn && (0, _experiments.editorExperiment)('advanced_layouts', true)) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import ReactDOM from 'react-dom';
|
|
3
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
3
4
|
import uuid from 'uuid';
|
|
4
5
|
export const TYPE_DROP_TARGET_DEC = 'drop-target-decoration';
|
|
5
6
|
export const TYPE_HANDLE_DEC = 'drag-handle';
|
|
@@ -18,6 +19,7 @@ class ObjHash {
|
|
|
18
19
|
if (this.caching.has(node)) {
|
|
19
20
|
return this.caching.get(node);
|
|
20
21
|
}
|
|
22
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
21
23
|
const uniqueId = uuid();
|
|
22
24
|
this.caching.set(node, uniqueId);
|
|
23
25
|
return uniqueId;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createElement } from 'react';
|
|
2
2
|
import { bind } from 'bind-event-listener';
|
|
3
3
|
import ReactDOM from 'react-dom';
|
|
4
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
4
5
|
import uuid from 'uuid';
|
|
5
6
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
6
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -38,10 +39,12 @@ export const dragHandleDecoration = ({
|
|
|
38
39
|
unmountDecorations(nodeViewPortalProviderAPI, 'data-blocks-drag-handle-container', 'data-blocks-drag-handle-key');
|
|
39
40
|
}
|
|
40
41
|
let unbind;
|
|
42
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
41
43
|
const key = uuid();
|
|
42
44
|
const widgetSpec = editorExperiment('platform_editor_breakout_resizing', true) ? {
|
|
43
45
|
side: -1,
|
|
44
46
|
type: TYPE_HANDLE_DEC,
|
|
47
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
45
48
|
testid: `${TYPE_HANDLE_DEC}-${uuid()}`,
|
|
46
49
|
/**
|
|
47
50
|
* sigh - `marks` influences the position that the widget is drawn (as described on the `side` property).
|
|
@@ -58,6 +61,7 @@ export const dragHandleDecoration = ({
|
|
|
58
61
|
} : {
|
|
59
62
|
side: -1,
|
|
60
63
|
type: TYPE_HANDLE_DEC,
|
|
64
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
61
65
|
testid: `${TYPE_HANDLE_DEC}-${uuid()}`,
|
|
62
66
|
destroy: node => {
|
|
63
67
|
unbind && unbind();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createElement } from 'react';
|
|
2
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
2
3
|
import uuid from 'uuid';
|
|
3
4
|
import { expandSelectionBounds } from '@atlaskit/editor-common/selection';
|
|
4
5
|
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
@@ -71,6 +72,7 @@ export const findDropTargetDecs = (decorations, from, to) => {
|
|
|
71
72
|
return decorations.find(from, to, spec => spec.type === TYPE_DROP_TARGET_DEC);
|
|
72
73
|
};
|
|
73
74
|
export const createDropTargetDecoration = (pos, props, nodeViewPortalProviderAPI, side, anchorRectCache, isSameLayout) => {
|
|
75
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
74
76
|
const key = uuid();
|
|
75
77
|
return Decoration.widget(pos, (_, getPosUnsafe) => {
|
|
76
78
|
const getPos = () => {
|
|
@@ -109,6 +111,7 @@ export const createDropTargetDecoration = (pos, props, nodeViewPortalProviderAPI
|
|
|
109
111
|
});
|
|
110
112
|
};
|
|
111
113
|
export const createLayoutDropTargetDecoration = (pos, props, nodeViewPortalProviderAPI, anchorRectCache) => {
|
|
114
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
112
115
|
const key = uuid();
|
|
113
116
|
return Decoration.widget(pos, (_, getPosUnsafe) => {
|
|
114
117
|
const getPos = () => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createElement } from 'react';
|
|
2
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
2
3
|
import uuid from 'uuid';
|
|
3
4
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
4
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -23,6 +24,7 @@ export const quickInsertButtonDecoration = ({
|
|
|
23
24
|
anchorRectCache,
|
|
24
25
|
editorState
|
|
25
26
|
}) => {
|
|
27
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
26
28
|
const key = uuid();
|
|
27
29
|
const cleanupCallbacks = [];
|
|
28
30
|
const widgetSpec = editorExperiment('platform_editor_breakout_resizing', true) ? {
|
|
@@ -354,7 +354,9 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
354
354
|
// Re-create node decorations
|
|
355
355
|
const isDecSetEmpty = decorations === DecorationSet.empty;
|
|
356
356
|
const isNodeDecsMissing = isDecSetEmpty || maybeNodeCountChanged || editorExperiment('platform_editor_breakout_resizing', true) && hasJustFinishedResizing;
|
|
357
|
-
const shouldRedrawNodeDecs = !isResizerResizing && (isNodeDecsMissing || (meta === null || meta === void 0 ? void 0 : meta.isDragging))
|
|
357
|
+
const shouldRedrawNodeDecs = !isResizerResizing && (isNodeDecsMissing || (meta === null || meta === void 0 ? void 0 : meta.isDragging)) &&
|
|
358
|
+
// Skip expensive anchor node decoration recalculations when native anchor support is enabled
|
|
359
|
+
!(expValEquals('platform_editor_native_anchor_support', 'isEnabled', true) && fg('editor_native_anchor_remove_decoration_in_apply'));
|
|
358
360
|
let isActiveNodeModified = false;
|
|
359
361
|
if (api && shouldRedrawNodeDecs) {
|
|
360
362
|
const oldNodeDecs = findNodeDecs(newState, decorations, from, to);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import memoizeOne from 'memoize-one';
|
|
2
|
-
import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
|
|
2
|
+
import { getParentOfTypeCount, isNestedTablesSupported } from '@atlaskit/editor-common/nesting';
|
|
3
3
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import { findChildrenByType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -104,7 +104,7 @@ export function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, $destNo
|
|
|
104
104
|
const destParentNodeType = destParent === null || destParent === void 0 ? void 0 : destParent.type;
|
|
105
105
|
const activeNodeType = srcNode === null || srcNode === void 0 ? void 0 : srcNode.type;
|
|
106
106
|
const layoutColumnContent = srcNode.content;
|
|
107
|
-
const isNestingTablesSupported = fg('platform_editor_use_nested_table_pm_nodes') && editorExperiment('nested-tables-in-tables', true, {
|
|
107
|
+
const isNestingTablesSupported = isNestedTablesSupported(schema) && fg('platform_editor_use_nested_table_pm_nodes') && editorExperiment('nested-tables-in-tables', true, {
|
|
108
108
|
exposure: true
|
|
109
109
|
});
|
|
110
110
|
if (activeNodeType === layoutColumn && editorExperiment('advanced_layouts', true)) {
|
|
@@ -2,6 +2,7 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
import ReactDOM from 'react-dom';
|
|
5
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
5
6
|
import uuid from 'uuid';
|
|
6
7
|
export var TYPE_DROP_TARGET_DEC = 'drop-target-decoration';
|
|
7
8
|
export var TYPE_HANDLE_DEC = 'drag-handle';
|
|
@@ -25,6 +26,7 @@ var ObjHash = /*#__PURE__*/function () {
|
|
|
25
26
|
if (this.caching.has(node)) {
|
|
26
27
|
return this.caching.get(node);
|
|
27
28
|
}
|
|
29
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
28
30
|
var uniqueId = uuid();
|
|
29
31
|
this.caching.set(node, uniqueId);
|
|
30
32
|
return uniqueId;
|
|
@@ -2,6 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import { createElement } from 'react';
|
|
3
3
|
import { bind } from 'bind-event-listener';
|
|
4
4
|
import ReactDOM from 'react-dom';
|
|
5
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
5
6
|
import uuid from 'uuid';
|
|
6
7
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
7
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -39,10 +40,12 @@ export var dragHandleDecoration = function dragHandleDecoration(_ref) {
|
|
|
39
40
|
unmountDecorations(nodeViewPortalProviderAPI, 'data-blocks-drag-handle-container', 'data-blocks-drag-handle-key');
|
|
40
41
|
}
|
|
41
42
|
var unbind;
|
|
43
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
42
44
|
var key = uuid();
|
|
43
45
|
var widgetSpec = editorExperiment('platform_editor_breakout_resizing', true) ? {
|
|
44
46
|
side: -1,
|
|
45
47
|
type: TYPE_HANDLE_DEC,
|
|
48
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
46
49
|
testid: "".concat(TYPE_HANDLE_DEC, "-").concat(uuid()),
|
|
47
50
|
/**
|
|
48
51
|
* sigh - `marks` influences the position that the widget is drawn (as described on the `side` property).
|
|
@@ -59,6 +62,7 @@ export var dragHandleDecoration = function dragHandleDecoration(_ref) {
|
|
|
59
62
|
} : {
|
|
60
63
|
side: -1,
|
|
61
64
|
type: TYPE_HANDLE_DEC,
|
|
65
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
62
66
|
testid: "".concat(TYPE_HANDLE_DEC, "-").concat(uuid()),
|
|
63
67
|
destroy: function destroy(node) {
|
|
64
68
|
unbind && unbind();
|
|
@@ -2,6 +2,7 @@ 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 { createElement } from 'react';
|
|
5
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
5
6
|
import uuid from 'uuid';
|
|
6
7
|
import { expandSelectionBounds } from '@atlaskit/editor-common/selection';
|
|
7
8
|
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
@@ -76,6 +77,7 @@ export var findDropTargetDecs = function findDropTargetDecs(decorations, from, t
|
|
|
76
77
|
});
|
|
77
78
|
};
|
|
78
79
|
export var createDropTargetDecoration = function createDropTargetDecoration(pos, props, nodeViewPortalProviderAPI, side, anchorRectCache, isSameLayout) {
|
|
80
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
79
81
|
var key = uuid();
|
|
80
82
|
return Decoration.widget(pos, function (_, getPosUnsafe) {
|
|
81
83
|
var getPos = function getPos() {
|
|
@@ -114,6 +116,7 @@ export var createDropTargetDecoration = function createDropTargetDecoration(pos,
|
|
|
114
116
|
});
|
|
115
117
|
};
|
|
116
118
|
export var createLayoutDropTargetDecoration = function createLayoutDropTargetDecoration(pos, props, nodeViewPortalProviderAPI, anchorRectCache) {
|
|
119
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
117
120
|
var key = uuid();
|
|
118
121
|
return Decoration.widget(pos, function (_, getPosUnsafe) {
|
|
119
122
|
var getPos = function getPos() {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createElement } from 'react';
|
|
2
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
2
3
|
import uuid from 'uuid';
|
|
3
4
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
4
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -24,6 +25,7 @@ export var quickInsertButtonDecoration = function quickInsertButtonDecoration(_r
|
|
|
24
25
|
rootNodeType = _ref.rootNodeType,
|
|
25
26
|
anchorRectCache = _ref.anchorRectCache,
|
|
26
27
|
editorState = _ref.editorState;
|
|
28
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
27
29
|
var key = uuid();
|
|
28
30
|
var cleanupCallbacks = [];
|
|
29
31
|
var widgetSpec = editorExperiment('platform_editor_breakout_resizing', true) ? {
|
|
@@ -348,7 +348,9 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
348
348
|
// Re-create node decorations
|
|
349
349
|
var isDecSetEmpty = decorations === DecorationSet.empty;
|
|
350
350
|
var isNodeDecsMissing = isDecSetEmpty || maybeNodeCountChanged || editorExperiment('platform_editor_breakout_resizing', true) && hasJustFinishedResizing;
|
|
351
|
-
var shouldRedrawNodeDecs = !isResizerResizing && (isNodeDecsMissing || (meta === null || meta === void 0 ? void 0 : meta.isDragging))
|
|
351
|
+
var shouldRedrawNodeDecs = !isResizerResizing && (isNodeDecsMissing || (meta === null || meta === void 0 ? void 0 : meta.isDragging)) &&
|
|
352
|
+
// Skip expensive anchor node decoration recalculations when native anchor support is enabled
|
|
353
|
+
!(expValEquals('platform_editor_native_anchor_support', 'isEnabled', true) && fg('editor_native_anchor_remove_decoration_in_apply'));
|
|
352
354
|
var isActiveNodeModified = false;
|
|
353
355
|
if (api && shouldRedrawNodeDecs) {
|
|
354
356
|
var oldNodeDecs = findNodeDecs(newState, decorations, from, to);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import memoizeOne from 'memoize-one';
|
|
2
|
-
import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
|
|
2
|
+
import { getParentOfTypeCount, isNestedTablesSupported } from '@atlaskit/editor-common/nesting';
|
|
3
3
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import { findChildrenByType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -103,7 +103,7 @@ export function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, $destNo
|
|
|
103
103
|
var destParentNodeType = destParent === null || destParent === void 0 ? void 0 : destParent.type;
|
|
104
104
|
var activeNodeType = srcNode === null || srcNode === void 0 ? void 0 : srcNode.type;
|
|
105
105
|
var layoutColumnContent = srcNode.content;
|
|
106
|
-
var isNestingTablesSupported = fg('platform_editor_use_nested_table_pm_nodes') && editorExperiment('nested-tables-in-tables', true, {
|
|
106
|
+
var isNestingTablesSupported = isNestedTablesSupported(schema) && fg('platform_editor_use_nested_table_pm_nodes') && editorExperiment('nested-tables-in-tables', true, {
|
|
107
107
|
exposure: true
|
|
108
108
|
});
|
|
109
109
|
if (activeNodeType === layoutColumn && editorExperiment('advanced_layouts', true)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "7.5.
|
|
3
|
+
"version": "7.5.5",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
|
|
54
54
|
"@atlaskit/primitives": "^16.1.0",
|
|
55
55
|
"@atlaskit/theme": "^21.0.0",
|
|
56
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
56
|
+
"@atlaskit/tmp-editor-statsig": "^13.31.0",
|
|
57
57
|
"@atlaskit/tokens": "^7.1.0",
|
|
58
58
|
"@atlaskit/tooltip": "^20.7.0",
|
|
59
59
|
"@babel/runtime": "^7.0.0",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"uuid": "^3.1.0"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"@atlaskit/editor-common": "^110.
|
|
68
|
+
"@atlaskit/editor-common": "^110.24.0",
|
|
69
69
|
"react": "^18.2.0",
|
|
70
70
|
"react-dom": "^18.2.0",
|
|
71
71
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
@@ -145,6 +145,9 @@
|
|
|
145
145
|
"platform_editor_block_menu_patch_1": {
|
|
146
146
|
"type": "boolean"
|
|
147
147
|
},
|
|
148
|
+
"editor_native_anchor_remove_decoration_in_apply": {
|
|
149
|
+
"type": "boolean"
|
|
150
|
+
},
|
|
148
151
|
"platform_editor_breakout_resizing_widget_fix": {
|
|
149
152
|
"type": "boolean"
|
|
150
153
|
},
|