@atlaskit/editor-plugin-block-controls 9.0.12 → 9.0.14
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/blockControlsPlugin.js +3 -2
- package/dist/cjs/editor-commands/move-to-layout.js +3 -1
- package/dist/cjs/pm-plugins/decorations-drop-target-active.js +3 -1
- package/dist/cjs/pm-plugins/main.js +8 -6
- package/dist/cjs/ui/drop-target.js +3 -1
- package/dist/es2019/blockControlsPlugin.js +3 -2
- package/dist/es2019/editor-commands/move-to-layout.js +3 -1
- package/dist/es2019/pm-plugins/decorations-drop-target-active.js +3 -1
- package/dist/es2019/pm-plugins/main.js +5 -5
- package/dist/es2019/ui/drop-target.js +3 -1
- package/dist/esm/blockControlsPlugin.js +3 -2
- package/dist/esm/editor-commands/move-to-layout.js +3 -1
- package/dist/esm/pm-plugins/decorations-drop-target-active.js +3 -1
- package/dist/esm/pm-plugins/main.js +8 -6
- package/dist/esm/ui/drop-target.js +3 -1
- package/dist/types/blockControlsPluginType.d.ts +2 -0
- package/dist/types/pm-plugins/main.d.ts +2 -2
- package/dist/types-ts4.5/blockControlsPluginType.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +2 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 9.0.14
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`3895f6d32cc49`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3895f6d32cc49) -
|
|
8
|
+
Replace expValEquals with editorExperiment for platform_synced_block experiment to ensure
|
|
9
|
+
consistent exposure firing
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 9.0.13
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [`3d01a5983dae9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3d01a5983dae9) -
|
|
17
|
+
[ux] Make quick insert button optional (backward compatible, enabled by default)
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 9.0.12
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -30,11 +30,12 @@ var _globalStyles = require("./ui/global-styles");
|
|
|
30
30
|
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; }
|
|
31
31
|
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; }
|
|
32
32
|
var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPlugin(_ref) {
|
|
33
|
-
var _config$rightSideCont;
|
|
33
|
+
var _config$rightSideCont, _config$quickInsertBu;
|
|
34
34
|
var api = _ref.api,
|
|
35
35
|
config = _ref.config;
|
|
36
36
|
var nodeDecorationRegistry = [];
|
|
37
37
|
var rightSideControlsEnabled = (_config$rightSideCont = config === null || config === void 0 ? void 0 : config.rightSideControlsEnabled) !== null && _config$rightSideCont !== void 0 ? _config$rightSideCont : false;
|
|
38
|
+
var quickInsertButtonEnabled = (_config$quickInsertBu = config === null || config === void 0 ? void 0 : config.quickInsertButtonEnabled) !== null && _config$quickInsertBu !== void 0 ? _config$quickInsertBu : true;
|
|
38
39
|
return {
|
|
39
40
|
name: 'blockControls',
|
|
40
41
|
actions: {
|
|
@@ -56,7 +57,7 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
56
57
|
plugin: function plugin(_ref2) {
|
|
57
58
|
var getIntl = _ref2.getIntl,
|
|
58
59
|
nodeViewPortalProviderAPI = _ref2.nodeViewPortalProviderAPI;
|
|
59
|
-
return (0, _main.createPlugin)(api, getIntl, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled);
|
|
60
|
+
return (0, _main.createPlugin)(api, getIntl, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled, quickInsertButtonEnabled);
|
|
60
61
|
}
|
|
61
62
|
}];
|
|
62
63
|
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
@@ -143,7 +143,9 @@ var canMoveToLayout = function canMoveToLayout(api, from, to, tr, moveNodeAtCurs
|
|
|
143
143
|
}
|
|
144
144
|
var $to = tr.doc.resolve(to);
|
|
145
145
|
var allowedParentTypes = [doc, layoutSection];
|
|
146
|
-
if (bodiedSyncBlock && (0,
|
|
146
|
+
if (bodiedSyncBlock && (0, _experiments.editorExperiment)('platform_synced_block', true) && (0, _experiments.editorExperiment)('platform_synced_block_patch_6', true, {
|
|
147
|
+
exposure: true
|
|
148
|
+
})) {
|
|
147
149
|
allowedParentTypes.push(bodiedSyncBlock);
|
|
148
150
|
}
|
|
149
151
|
|
|
@@ -214,7 +214,9 @@ var getActiveDropTargetDecorations = exports.getActiveDropTargetDecorations = fu
|
|
|
214
214
|
}
|
|
215
215
|
var anchorEmitNodeWithPos = rootNodeWithPos;
|
|
216
216
|
if ((0, _experiments.editorExperiment)('advanced_layouts', true)) {
|
|
217
|
-
if ((0,
|
|
217
|
+
if ((0, _experiments.editorExperiment)('platform_synced_block', true) && (0, _experiments.editorExperiment)('platform_synced_block_patch_6', true, {
|
|
218
|
+
exposure: true
|
|
219
|
+
})) {
|
|
218
220
|
var schema = rootNodeWithPos.node.type.schema;
|
|
219
221
|
var layoutSection = schema.nodes.layoutSection;
|
|
220
222
|
var isLayoutSectionChildOfRoot = (0, _utils2.findChildrenByType)(rootNodeWithPos.node, layoutSection, false).length > 0;
|
|
@@ -246,9 +246,10 @@ var getDecorationAtPos = function getDecorationAtPos(state, decorations, pos, to
|
|
|
246
246
|
var _apply = exports.apply = function apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, nodeDecorationRegistry) {
|
|
247
247
|
var _api$limitedMode, _meta$multiSelectDnD, _api$editorViewMode, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _meta$isDragging3, _meta$toggleMenu, _meta$toggleMenu2, _meta$toggleMenu3, _meta$toggleMenu4, _meta$toggleMenu5, _meta$toggleMenu6, _meta$toggleMenu7, _meta$toggleMenu8, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$isShiftDown, _meta$lastDragCancell;
|
|
248
248
|
var rightSideControlsEnabled = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : false;
|
|
249
|
-
var
|
|
250
|
-
var
|
|
251
|
-
var
|
|
249
|
+
var quickInsertButtonEnabled = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : true;
|
|
250
|
+
var anchorRectCache = arguments.length > 10 ? arguments[10] : undefined;
|
|
251
|
+
var resizeObserverWidth = arguments.length > 11 ? arguments[11] : undefined;
|
|
252
|
+
var pragmaticCleanup = arguments.length > 12 ? arguments[12] : undefined;
|
|
252
253
|
var activeNode = currentState.activeNode,
|
|
253
254
|
decorations = currentState.decorations,
|
|
254
255
|
isResizerResizing = currentState.isResizerResizing,
|
|
@@ -443,7 +444,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
443
444
|
var oldHandle = (0, _decorationsDragHandle.findHandleDec)(decorations, (_activeNode5 = activeNode) === null || _activeNode5 === void 0 ? void 0 : _activeNode5.pos, (_activeNode6 = activeNode) === null || _activeNode6 === void 0 ? void 0 : _activeNode6.pos);
|
|
444
445
|
decorations = decorations.remove(oldHandle);
|
|
445
446
|
// platform_editor_controls note: enables quick insert
|
|
446
|
-
if (flags.toolbarFlagsEnabled) {
|
|
447
|
+
if (flags.toolbarFlagsEnabled && quickInsertButtonEnabled) {
|
|
447
448
|
var _activeNode7, _activeNode8;
|
|
448
449
|
var oldQuickInsertButton = (0, _decorationsQuickInsertButton.findQuickInsertInsertButtonDecoration)(decorations, (_activeNode7 = activeNode) === null || _activeNode7 === void 0 ? void 0 : _activeNode7.rootPos, (_activeNode8 = activeNode) === null || _activeNode8 === void 0 ? void 0 : _activeNode8.rootPos);
|
|
449
450
|
decorations = decorations.remove(oldQuickInsertButton);
|
|
@@ -513,7 +514,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
513
514
|
}
|
|
514
515
|
if (shouldRecreateQuickInsertButton && ((_latestActiveNode5 = latestActiveNode) === null || _latestActiveNode5 === void 0 ? void 0 : _latestActiveNode5.rootPos) !== undefined &&
|
|
515
516
|
// platform_editor_controls note: enables quick insert
|
|
516
|
-
flags.toolbarFlagsEnabled && (!rightSideControlsEnabled || !isViewMode)) {
|
|
517
|
+
flags.toolbarFlagsEnabled && quickInsertButtonEnabled && (!rightSideControlsEnabled || !isViewMode)) {
|
|
517
518
|
var _activeNode13, _activeNode14, _latestActiveNode6, _latestActiveNode7, _latestActiveNode8, _latestActiveNode9, _latestActiveNode0;
|
|
518
519
|
var _oldQuickInsertButton = (0, _decorationsQuickInsertButton.findQuickInsertInsertButtonDecoration)(decorations, (_activeNode13 = activeNode) === null || _activeNode13 === void 0 ? void 0 : _activeNode13.rootPos, (_activeNode14 = activeNode) === null || _activeNode14 === void 0 ? void 0 : _activeNode14.rootPos);
|
|
519
520
|
decorations = decorations.remove(_oldQuickInsertButton);
|
|
@@ -773,6 +774,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
773
774
|
};
|
|
774
775
|
var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, nodeViewPortalProviderAPI, nodeDecorationRegistry) {
|
|
775
776
|
var rightSideControlsEnabled = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
777
|
+
var quickInsertButtonEnabled = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true;
|
|
776
778
|
var _getIntl = getIntl(),
|
|
777
779
|
formatMessage = _getIntl.formatMessage;
|
|
778
780
|
var isAdvancedLayoutEnabled = (0, _experiments.editorExperiment)('advanced_layouts', true, {
|
|
@@ -799,7 +801,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
799
801
|
return initialState;
|
|
800
802
|
},
|
|
801
803
|
apply: function apply(tr, currentState, _, newState) {
|
|
802
|
-
return _apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled, anchorRectCache, resizeObserverWidth, pragmaticCleanup);
|
|
804
|
+
return _apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled, quickInsertButtonEnabled, anchorRectCache, resizeObserverWidth, pragmaticCleanup);
|
|
803
805
|
}
|
|
804
806
|
},
|
|
805
807
|
props: {
|
|
@@ -113,7 +113,9 @@ var HoverZone = function HoverZone(_ref) {
|
|
|
113
113
|
_useActiveAnchorTrack2 = (0, _slicedToArray2.default)(_useActiveAnchorTrack, 2),
|
|
114
114
|
_isActive = _useActiveAnchorTrack2[0],
|
|
115
115
|
setActiveAnchor = _useActiveAnchorTrack2[1];
|
|
116
|
-
var isInsideBodiedSyncBlock = parent && parent.type.name === 'bodiedSyncBlock' && (0,
|
|
116
|
+
var isInsideBodiedSyncBlock = parent && parent.type.name === 'bodiedSyncBlock' && (0, _experiments.editorExperiment)('platform_synced_block', true) && (0, _experiments.editorExperiment)('platform_synced_block_patch_6', true, {
|
|
117
|
+
exposure: true
|
|
118
|
+
});
|
|
117
119
|
(0, _react.useEffect)(function () {
|
|
118
120
|
if (ref.current) {
|
|
119
121
|
return (0, _adapter.dropTargetForElements)({
|
|
@@ -23,9 +23,10 @@ export const blockControlsPlugin = ({
|
|
|
23
23
|
api,
|
|
24
24
|
config
|
|
25
25
|
}) => {
|
|
26
|
-
var _config$rightSideCont;
|
|
26
|
+
var _config$rightSideCont, _config$quickInsertBu;
|
|
27
27
|
const nodeDecorationRegistry = [];
|
|
28
28
|
const rightSideControlsEnabled = (_config$rightSideCont = config === null || config === void 0 ? void 0 : config.rightSideControlsEnabled) !== null && _config$rightSideCont !== void 0 ? _config$rightSideCont : false;
|
|
29
|
+
const quickInsertButtonEnabled = (_config$quickInsertBu = config === null || config === void 0 ? void 0 : config.quickInsertButtonEnabled) !== null && _config$quickInsertBu !== void 0 ? _config$quickInsertBu : true;
|
|
29
30
|
return {
|
|
30
31
|
name: 'blockControls',
|
|
31
32
|
actions: {
|
|
@@ -45,7 +46,7 @@ export const blockControlsPlugin = ({
|
|
|
45
46
|
plugin: ({
|
|
46
47
|
getIntl,
|
|
47
48
|
nodeViewPortalProviderAPI
|
|
48
|
-
}) => createPlugin(api, getIntl, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled)
|
|
49
|
+
}) => createPlugin(api, getIntl, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled, quickInsertButtonEnabled)
|
|
49
50
|
}];
|
|
50
51
|
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
51
52
|
pmPlugins.push({
|
|
@@ -140,7 +140,9 @@ const canMoveToLayout = (api, from, to, tr, moveNodeAtCursorPos) => {
|
|
|
140
140
|
}
|
|
141
141
|
const $to = tr.doc.resolve(to);
|
|
142
142
|
const allowedParentTypes = [doc, layoutSection];
|
|
143
|
-
if (bodiedSyncBlock &&
|
|
143
|
+
if (bodiedSyncBlock && editorExperiment('platform_synced_block', true) && editorExperiment('platform_synced_block_patch_6', true, {
|
|
144
|
+
exposure: true
|
|
145
|
+
})) {
|
|
144
146
|
allowedParentTypes.push(bodiedSyncBlock);
|
|
145
147
|
}
|
|
146
148
|
|
|
@@ -197,7 +197,9 @@ export const getActiveDropTargetDecorations = (activeDropTargetNode, state, api,
|
|
|
197
197
|
}
|
|
198
198
|
let anchorEmitNodeWithPos = rootNodeWithPos;
|
|
199
199
|
if (editorExperiment('advanced_layouts', true)) {
|
|
200
|
-
if (
|
|
200
|
+
if (editorExperiment('platform_synced_block', true) && editorExperiment('platform_synced_block_patch_6', true, {
|
|
201
|
+
exposure: true
|
|
202
|
+
})) {
|
|
201
203
|
const schema = rootNodeWithPos.node.type.schema;
|
|
202
204
|
const {
|
|
203
205
|
layoutSection
|
|
@@ -234,7 +234,7 @@ const getDecorationAtPos = (state, decorations, pos, to) => {
|
|
|
234
234
|
const nodeDecAtActivePos = nodeDecsAtActivePos.pop();
|
|
235
235
|
return nodeDecAtActivePos;
|
|
236
236
|
};
|
|
237
|
-
export const apply = (api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled = false, anchorRectCache, resizeObserverWidth, pragmaticCleanup) => {
|
|
237
|
+
export const apply = (api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled = false, quickInsertButtonEnabled = true, anchorRectCache, resizeObserverWidth, pragmaticCleanup) => {
|
|
238
238
|
var _api$limitedMode, _api$limitedMode$shar, _api$limitedMode$shar2, _meta$multiSelectDnD, _api$editorViewMode, _api$editorViewMode$s, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _meta$isDragging3, _meta$toggleMenu, _meta$toggleMenu2, _meta$toggleMenu3, _meta$toggleMenu4, _meta$toggleMenu5, _meta$toggleMenu6, _meta$toggleMenu7, _meta$toggleMenu8, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$isShiftDown, _meta$lastDragCancell;
|
|
239
239
|
let {
|
|
240
240
|
activeNode,
|
|
@@ -433,7 +433,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
433
433
|
const oldHandle = findHandleDec(decorations, (_activeNode5 = activeNode) === null || _activeNode5 === void 0 ? void 0 : _activeNode5.pos, (_activeNode6 = activeNode) === null || _activeNode6 === void 0 ? void 0 : _activeNode6.pos);
|
|
434
434
|
decorations = decorations.remove(oldHandle);
|
|
435
435
|
// platform_editor_controls note: enables quick insert
|
|
436
|
-
if (flags.toolbarFlagsEnabled) {
|
|
436
|
+
if (flags.toolbarFlagsEnabled && quickInsertButtonEnabled) {
|
|
437
437
|
var _activeNode7, _activeNode8;
|
|
438
438
|
const oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations, (_activeNode7 = activeNode) === null || _activeNode7 === void 0 ? void 0 : _activeNode7.rootPos, (_activeNode8 = activeNode) === null || _activeNode8 === void 0 ? void 0 : _activeNode8.rootPos);
|
|
439
439
|
decorations = decorations.remove(oldQuickInsertButton);
|
|
@@ -475,7 +475,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
475
475
|
}
|
|
476
476
|
if (shouldRecreateQuickInsertButton && ((_latestActiveNode5 = latestActiveNode) === null || _latestActiveNode5 === void 0 ? void 0 : _latestActiveNode5.rootPos) !== undefined &&
|
|
477
477
|
// platform_editor_controls note: enables quick insert
|
|
478
|
-
flags.toolbarFlagsEnabled && (!rightSideControlsEnabled || !isViewMode)) {
|
|
478
|
+
flags.toolbarFlagsEnabled && quickInsertButtonEnabled && (!rightSideControlsEnabled || !isViewMode)) {
|
|
479
479
|
var _activeNode13, _activeNode14, _latestActiveNode6, _latestActiveNode7, _latestActiveNode8, _latestActiveNode9, _latestActiveNode0;
|
|
480
480
|
const oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations, (_activeNode13 = activeNode) === null || _activeNode13 === void 0 ? void 0 : _activeNode13.rootPos, (_activeNode14 = activeNode) === null || _activeNode14 === void 0 ? void 0 : _activeNode14.rootPos);
|
|
481
481
|
decorations = decorations.remove(oldQuickInsertButton);
|
|
@@ -672,7 +672,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
672
672
|
isSelectedViaDragHandle: isSelectedViaDragHandleNew
|
|
673
673
|
};
|
|
674
674
|
};
|
|
675
|
-
export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled = false) => {
|
|
675
|
+
export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled = false, quickInsertButtonEnabled = true) => {
|
|
676
676
|
const {
|
|
677
677
|
formatMessage
|
|
678
678
|
} = getIntl();
|
|
@@ -699,7 +699,7 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI, nodeDecora
|
|
|
699
699
|
init() {
|
|
700
700
|
return initialState;
|
|
701
701
|
},
|
|
702
|
-
apply: (tr, currentState, _, newState) => apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled, anchorRectCache, resizeObserverWidth, pragmaticCleanup)
|
|
702
|
+
apply: (tr, currentState, _, newState) => apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled, quickInsertButtonEnabled, anchorRectCache, resizeObserverWidth, pragmaticCleanup)
|
|
703
703
|
},
|
|
704
704
|
props: {
|
|
705
705
|
decorations: state => {
|
|
@@ -101,7 +101,9 @@ const HoverZone = ({
|
|
|
101
101
|
return node ? getNodeAnchor(node) : '';
|
|
102
102
|
}, [api, node, pos, position]);
|
|
103
103
|
const [_isActive, setActiveAnchor] = useActiveAnchorTracker(anchorName);
|
|
104
|
-
const isInsideBodiedSyncBlock = parent && parent.type.name === 'bodiedSyncBlock' &&
|
|
104
|
+
const isInsideBodiedSyncBlock = parent && parent.type.name === 'bodiedSyncBlock' && editorExperiment('platform_synced_block', true) && editorExperiment('platform_synced_block_patch_6', true, {
|
|
105
|
+
exposure: true
|
|
106
|
+
});
|
|
105
107
|
useEffect(() => {
|
|
106
108
|
if (ref.current) {
|
|
107
109
|
return dropTargetForElements({
|
|
@@ -23,11 +23,12 @@ import { createSelectionPreservationPlugin } from './pm-plugins/selection-preser
|
|
|
23
23
|
import { selectNode } from './pm-plugins/utils/getSelection';
|
|
24
24
|
import { GlobalStylesWrapper } from './ui/global-styles';
|
|
25
25
|
export var blockControlsPlugin = function blockControlsPlugin(_ref) {
|
|
26
|
-
var _config$rightSideCont;
|
|
26
|
+
var _config$rightSideCont, _config$quickInsertBu;
|
|
27
27
|
var api = _ref.api,
|
|
28
28
|
config = _ref.config;
|
|
29
29
|
var nodeDecorationRegistry = [];
|
|
30
30
|
var rightSideControlsEnabled = (_config$rightSideCont = config === null || config === void 0 ? void 0 : config.rightSideControlsEnabled) !== null && _config$rightSideCont !== void 0 ? _config$rightSideCont : false;
|
|
31
|
+
var quickInsertButtonEnabled = (_config$quickInsertBu = config === null || config === void 0 ? void 0 : config.quickInsertButtonEnabled) !== null && _config$quickInsertBu !== void 0 ? _config$quickInsertBu : true;
|
|
31
32
|
return {
|
|
32
33
|
name: 'blockControls',
|
|
33
34
|
actions: {
|
|
@@ -49,7 +50,7 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
|
|
|
49
50
|
plugin: function plugin(_ref2) {
|
|
50
51
|
var getIntl = _ref2.getIntl,
|
|
51
52
|
nodeViewPortalProviderAPI = _ref2.nodeViewPortalProviderAPI;
|
|
52
|
-
return createPlugin(api, getIntl, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled);
|
|
53
|
+
return createPlugin(api, getIntl, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled, quickInsertButtonEnabled);
|
|
53
54
|
}
|
|
54
55
|
}];
|
|
55
56
|
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
@@ -137,7 +137,9 @@ var canMoveToLayout = function canMoveToLayout(api, from, to, tr, moveNodeAtCurs
|
|
|
137
137
|
}
|
|
138
138
|
var $to = tr.doc.resolve(to);
|
|
139
139
|
var allowedParentTypes = [doc, layoutSection];
|
|
140
|
-
if (bodiedSyncBlock &&
|
|
140
|
+
if (bodiedSyncBlock && editorExperiment('platform_synced_block', true) && editorExperiment('platform_synced_block_patch_6', true, {
|
|
141
|
+
exposure: true
|
|
142
|
+
})) {
|
|
141
143
|
allowedParentTypes.push(bodiedSyncBlock);
|
|
142
144
|
}
|
|
143
145
|
|
|
@@ -209,7 +209,9 @@ export var getActiveDropTargetDecorations = function getActiveDropTargetDecorati
|
|
|
209
209
|
}
|
|
210
210
|
var anchorEmitNodeWithPos = rootNodeWithPos;
|
|
211
211
|
if (editorExperiment('advanced_layouts', true)) {
|
|
212
|
-
if (
|
|
212
|
+
if (editorExperiment('platform_synced_block', true) && editorExperiment('platform_synced_block_patch_6', true, {
|
|
213
|
+
exposure: true
|
|
214
|
+
})) {
|
|
213
215
|
var schema = rootNodeWithPos.node.type.schema;
|
|
214
216
|
var layoutSection = schema.nodes.layoutSection;
|
|
215
217
|
var isLayoutSectionChildOfRoot = findChildrenByType(rootNodeWithPos.node, layoutSection, false).length > 0;
|
|
@@ -239,9 +239,10 @@ var getDecorationAtPos = function getDecorationAtPos(state, decorations, pos, to
|
|
|
239
239
|
var _apply = function apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, nodeDecorationRegistry) {
|
|
240
240
|
var _api$limitedMode, _meta$multiSelectDnD, _api$editorViewMode, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _meta$isDragging3, _meta$toggleMenu, _meta$toggleMenu2, _meta$toggleMenu3, _meta$toggleMenu4, _meta$toggleMenu5, _meta$toggleMenu6, _meta$toggleMenu7, _meta$toggleMenu8, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$isShiftDown, _meta$lastDragCancell;
|
|
241
241
|
var rightSideControlsEnabled = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : false;
|
|
242
|
-
var
|
|
243
|
-
var
|
|
244
|
-
var
|
|
242
|
+
var quickInsertButtonEnabled = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : true;
|
|
243
|
+
var anchorRectCache = arguments.length > 10 ? arguments[10] : undefined;
|
|
244
|
+
var resizeObserverWidth = arguments.length > 11 ? arguments[11] : undefined;
|
|
245
|
+
var pragmaticCleanup = arguments.length > 12 ? arguments[12] : undefined;
|
|
245
246
|
var activeNode = currentState.activeNode,
|
|
246
247
|
decorations = currentState.decorations,
|
|
247
248
|
isResizerResizing = currentState.isResizerResizing,
|
|
@@ -436,7 +437,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
436
437
|
var oldHandle = findHandleDec(decorations, (_activeNode5 = activeNode) === null || _activeNode5 === void 0 ? void 0 : _activeNode5.pos, (_activeNode6 = activeNode) === null || _activeNode6 === void 0 ? void 0 : _activeNode6.pos);
|
|
437
438
|
decorations = decorations.remove(oldHandle);
|
|
438
439
|
// platform_editor_controls note: enables quick insert
|
|
439
|
-
if (flags.toolbarFlagsEnabled) {
|
|
440
|
+
if (flags.toolbarFlagsEnabled && quickInsertButtonEnabled) {
|
|
440
441
|
var _activeNode7, _activeNode8;
|
|
441
442
|
var oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations, (_activeNode7 = activeNode) === null || _activeNode7 === void 0 ? void 0 : _activeNode7.rootPos, (_activeNode8 = activeNode) === null || _activeNode8 === void 0 ? void 0 : _activeNode8.rootPos);
|
|
442
443
|
decorations = decorations.remove(oldQuickInsertButton);
|
|
@@ -506,7 +507,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
506
507
|
}
|
|
507
508
|
if (shouldRecreateQuickInsertButton && ((_latestActiveNode5 = latestActiveNode) === null || _latestActiveNode5 === void 0 ? void 0 : _latestActiveNode5.rootPos) !== undefined &&
|
|
508
509
|
// platform_editor_controls note: enables quick insert
|
|
509
|
-
flags.toolbarFlagsEnabled && (!rightSideControlsEnabled || !isViewMode)) {
|
|
510
|
+
flags.toolbarFlagsEnabled && quickInsertButtonEnabled && (!rightSideControlsEnabled || !isViewMode)) {
|
|
510
511
|
var _activeNode13, _activeNode14, _latestActiveNode6, _latestActiveNode7, _latestActiveNode8, _latestActiveNode9, _latestActiveNode0;
|
|
511
512
|
var _oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations, (_activeNode13 = activeNode) === null || _activeNode13 === void 0 ? void 0 : _activeNode13.rootPos, (_activeNode14 = activeNode) === null || _activeNode14 === void 0 ? void 0 : _activeNode14.rootPos);
|
|
512
513
|
decorations = decorations.remove(_oldQuickInsertButton);
|
|
@@ -767,6 +768,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
767
768
|
export { _apply as apply };
|
|
768
769
|
export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProviderAPI, nodeDecorationRegistry) {
|
|
769
770
|
var rightSideControlsEnabled = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
771
|
+
var quickInsertButtonEnabled = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true;
|
|
770
772
|
var _getIntl = getIntl(),
|
|
771
773
|
formatMessage = _getIntl.formatMessage;
|
|
772
774
|
var isAdvancedLayoutEnabled = editorExperiment('advanced_layouts', true, {
|
|
@@ -793,7 +795,7 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
793
795
|
return initialState;
|
|
794
796
|
},
|
|
795
797
|
apply: function apply(tr, currentState, _, newState) {
|
|
796
|
-
return _apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled, anchorRectCache, resizeObserverWidth, pragmaticCleanup);
|
|
798
|
+
return _apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled, quickInsertButtonEnabled, anchorRectCache, resizeObserverWidth, pragmaticCleanup);
|
|
797
799
|
}
|
|
798
800
|
},
|
|
799
801
|
props: {
|
|
@@ -105,7 +105,9 @@ var HoverZone = function HoverZone(_ref) {
|
|
|
105
105
|
_useActiveAnchorTrack2 = _slicedToArray(_useActiveAnchorTrack, 2),
|
|
106
106
|
_isActive = _useActiveAnchorTrack2[0],
|
|
107
107
|
setActiveAnchor = _useActiveAnchorTrack2[1];
|
|
108
|
-
var isInsideBodiedSyncBlock = parent && parent.type.name === 'bodiedSyncBlock' &&
|
|
108
|
+
var isInsideBodiedSyncBlock = parent && parent.type.name === 'bodiedSyncBlock' && editorExperiment('platform_synced_block', true) && editorExperiment('platform_synced_block_patch_6', true, {
|
|
109
|
+
exposure: true
|
|
110
|
+
});
|
|
109
111
|
useEffect(function () {
|
|
110
112
|
if (ref.current) {
|
|
111
113
|
return dropTargetForElements({
|
|
@@ -79,6 +79,8 @@ export interface PluginState {
|
|
|
79
79
|
}
|
|
80
80
|
export type ReleaseHiddenDecoration = () => boolean | undefined;
|
|
81
81
|
export type BlockControlsPluginConfig = {
|
|
82
|
+
/** Enable the quick insert plus button icon on the left of the drag handle */
|
|
83
|
+
quickInsertButtonEnabled?: boolean;
|
|
82
84
|
/** Enable left/right hover split: show left controls when hovering left, right controls when hovering right */
|
|
83
85
|
rightSideControlsEnabled?: boolean;
|
|
84
86
|
};
|
|
@@ -13,7 +13,7 @@ export interface FlagType {
|
|
|
13
13
|
toolbarFlagsEnabled: boolean;
|
|
14
14
|
}
|
|
15
15
|
export declare const getDecorations: (state: EditorState) => DecorationSet | undefined;
|
|
16
|
-
export declare const apply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape["formatMessage"], tr: ReadonlyTransaction, currentState: PluginState, newState: EditorState, flags: FlagType, nodeViewPortalProviderAPI: PortalProviderAPI, nodeDecorationRegistry: NodeDecorationFactory[], rightSideControlsEnabled?: boolean, anchorRectCache?: AnchorRectCache, resizeObserverWidth?: ResizeObserver, pragmaticCleanup?: (() => void) | null) => PluginState | {
|
|
16
|
+
export declare const apply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape["formatMessage"], tr: ReadonlyTransaction, currentState: PluginState, newState: EditorState, flags: FlagType, nodeViewPortalProviderAPI: PortalProviderAPI, nodeDecorationRegistry: NodeDecorationFactory[], rightSideControlsEnabled?: boolean, quickInsertButtonEnabled?: boolean, anchorRectCache?: AnchorRectCache, resizeObserverWidth?: ResizeObserver, pragmaticCleanup?: (() => void) | null) => PluginState | {
|
|
17
17
|
activeDropTargetNode: ActiveDropTargetNode | undefined;
|
|
18
18
|
activeNode: any;
|
|
19
19
|
blockMenuOptions: {
|
|
@@ -37,7 +37,7 @@ export declare const apply: (api: ExtractInjectionAPI<BlockControlsPlugin> | und
|
|
|
37
37
|
menuTriggerByNode: any;
|
|
38
38
|
multiSelectDnD: MultiSelectDnD | undefined;
|
|
39
39
|
};
|
|
40
|
-
export declare const createPlugin: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, getIntl: () => IntlShape, nodeViewPortalProviderAPI: PortalProviderAPI, nodeDecorationRegistry: NodeDecorationFactory[], rightSideControlsEnabled?: boolean) => SafePlugin<PluginState | {
|
|
40
|
+
export declare const createPlugin: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, getIntl: () => IntlShape, nodeViewPortalProviderAPI: PortalProviderAPI, nodeDecorationRegistry: NodeDecorationFactory[], rightSideControlsEnabled?: boolean, quickInsertButtonEnabled?: boolean) => SafePlugin<PluginState | {
|
|
41
41
|
activeDropTargetNode: ActiveDropTargetNode | undefined;
|
|
42
42
|
activeNode: any;
|
|
43
43
|
blockMenuOptions: {
|
|
@@ -79,6 +79,8 @@ export interface PluginState {
|
|
|
79
79
|
}
|
|
80
80
|
export type ReleaseHiddenDecoration = () => boolean | undefined;
|
|
81
81
|
export type BlockControlsPluginConfig = {
|
|
82
|
+
/** Enable the quick insert plus button icon on the left of the drag handle */
|
|
83
|
+
quickInsertButtonEnabled?: boolean;
|
|
82
84
|
/** Enable left/right hover split: show left controls when hovering left, right controls when hovering right */
|
|
83
85
|
rightSideControlsEnabled?: boolean;
|
|
84
86
|
};
|
|
@@ -13,7 +13,7 @@ export interface FlagType {
|
|
|
13
13
|
toolbarFlagsEnabled: boolean;
|
|
14
14
|
}
|
|
15
15
|
export declare const getDecorations: (state: EditorState) => DecorationSet | undefined;
|
|
16
|
-
export declare const apply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape["formatMessage"], tr: ReadonlyTransaction, currentState: PluginState, newState: EditorState, flags: FlagType, nodeViewPortalProviderAPI: PortalProviderAPI, nodeDecorationRegistry: NodeDecorationFactory[], rightSideControlsEnabled?: boolean, anchorRectCache?: AnchorRectCache, resizeObserverWidth?: ResizeObserver, pragmaticCleanup?: (() => void) | null) => PluginState | {
|
|
16
|
+
export declare const apply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape["formatMessage"], tr: ReadonlyTransaction, currentState: PluginState, newState: EditorState, flags: FlagType, nodeViewPortalProviderAPI: PortalProviderAPI, nodeDecorationRegistry: NodeDecorationFactory[], rightSideControlsEnabled?: boolean, quickInsertButtonEnabled?: boolean, anchorRectCache?: AnchorRectCache, resizeObserverWidth?: ResizeObserver, pragmaticCleanup?: (() => void) | null) => PluginState | {
|
|
17
17
|
activeDropTargetNode: ActiveDropTargetNode | undefined;
|
|
18
18
|
activeNode: any;
|
|
19
19
|
blockMenuOptions: {
|
|
@@ -37,7 +37,7 @@ export declare const apply: (api: ExtractInjectionAPI<BlockControlsPlugin> | und
|
|
|
37
37
|
menuTriggerByNode: any;
|
|
38
38
|
multiSelectDnD: MultiSelectDnD | undefined;
|
|
39
39
|
};
|
|
40
|
-
export declare const createPlugin: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, getIntl: () => IntlShape, nodeViewPortalProviderAPI: PortalProviderAPI, nodeDecorationRegistry: NodeDecorationFactory[], rightSideControlsEnabled?: boolean) => SafePlugin<PluginState | {
|
|
40
|
+
export declare const createPlugin: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, getIntl: () => IntlShape, nodeViewPortalProviderAPI: PortalProviderAPI, nodeDecorationRegistry: NodeDecorationFactory[], rightSideControlsEnabled?: boolean, quickInsertButtonEnabled?: boolean) => SafePlugin<PluginState | {
|
|
41
41
|
activeDropTargetNode: ActiveDropTargetNode | undefined;
|
|
42
42
|
activeNode: any;
|
|
43
43
|
blockMenuOptions: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.14",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
|
|
57
57
|
"@atlaskit/primitives": "^18.0.0",
|
|
58
58
|
"@atlaskit/theme": "^22.0.0",
|
|
59
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
59
|
+
"@atlaskit/tmp-editor-statsig": "^42.0.0",
|
|
60
60
|
"@atlaskit/tokens": "^11.1.0",
|
|
61
61
|
"@atlaskit/tooltip": "^21.0.0",
|
|
62
62
|
"@babel/runtime": "^7.0.0",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"uuid": "^3.1.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@atlaskit/editor-common": "^112.
|
|
70
|
+
"@atlaskit/editor-common": "^112.7.0",
|
|
71
71
|
"react": "^18.2.0",
|
|
72
72
|
"react-dom": "^18.2.0",
|
|
73
73
|
"react-intl-next": "npm:react-intl@^5.18.1"
|