@atlaskit/editor-plugin-block-controls 4.1.11 → 4.1.12
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 +11 -0
- package/dist/cjs/pm-plugins/decorations-drop-target.js +6 -2
- package/dist/cjs/pm-plugins/decorations-quick-insert-button.js +3 -1
- package/dist/cjs/pm-plugins/main.js +41 -27
- package/dist/es2019/pm-plugins/decorations-drop-target.js +6 -2
- package/dist/es2019/pm-plugins/decorations-quick-insert-button.js +3 -1
- package/dist/es2019/pm-plugins/main.js +41 -29
- package/dist/esm/pm-plugins/decorations-drop-target.js +6 -2
- package/dist/esm/pm-plugins/decorations-quick-insert-button.js +3 -1
- package/dist/esm/pm-plugins/main.js +41 -27
- package/dist/types/pm-plugins/main.d.ts +19 -2
- package/dist/types-ts4.5/pm-plugins/main.d.ts +19 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 4.1.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`20d3223b57972`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/20d3223b57972) -
|
|
8
|
+
Opted out of debounced portal provider
|
|
9
|
+
- [`e33be5daddd2b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e33be5daddd2b) -
|
|
10
|
+
ED-28892 Limited mode: adjust how we're triggering cleanup logic for block control plugin. Hook up
|
|
11
|
+
banner. Other misc setup.
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 4.1.11
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -109,7 +109,9 @@ var createDropTargetDecoration = exports.createDropTargetDecoration = function c
|
|
|
109
109
|
anchorRectCache: anchorRectCache,
|
|
110
110
|
isSameLayout: isSameLayout
|
|
111
111
|
}));
|
|
112
|
-
}, element, key
|
|
112
|
+
}, element, key, undefined,
|
|
113
|
+
// @portal-render-immediately
|
|
114
|
+
true);
|
|
113
115
|
return element;
|
|
114
116
|
}, {
|
|
115
117
|
type: _decorationsCommon.TYPE_DROP_TARGET_DEC,
|
|
@@ -140,7 +142,9 @@ var createLayoutDropTargetDecoration = exports.createLayoutDropTargetDecoration
|
|
|
140
142
|
getPos: getPos,
|
|
141
143
|
anchorRectCache: anchorRectCache
|
|
142
144
|
}));
|
|
143
|
-
}, element, key
|
|
145
|
+
}, element, key, undefined,
|
|
146
|
+
// @portal-render-immediately
|
|
147
|
+
true);
|
|
144
148
|
return element;
|
|
145
149
|
}, {
|
|
146
150
|
type: _decorationsCommon.TYPE_DROP_TARGET_DEC,
|
|
@@ -100,7 +100,9 @@ var quickInsertButtonDecoration = exports.quickInsertButtonDecoration = function
|
|
|
100
100
|
rootNodeType: rootNodeType !== null && rootNodeType !== void 0 ? rootNodeType : nodeType,
|
|
101
101
|
anchorRectCache: anchorRectCache
|
|
102
102
|
});
|
|
103
|
-
}, element, key
|
|
103
|
+
}, element, key, undefined,
|
|
104
|
+
// @portal-render-immediately
|
|
105
|
+
true);
|
|
104
106
|
return element;
|
|
105
107
|
}, widgetSpec);
|
|
106
108
|
};
|
|
@@ -76,7 +76,6 @@ var destroyFn = function destroyFn(api, editorView) {
|
|
|
76
76
|
if ((0, _performanceMeasures.isMeasuring)(EDITOR_BLOCKS_DRAG_INIT)) {
|
|
77
77
|
(0, _performanceMeasures.stopMeasure)(EDITOR_BLOCKS_DRAG_INIT, function (duration, startTime) {
|
|
78
78
|
var _api$analytics;
|
|
79
|
-
var state = editorView.state;
|
|
80
79
|
api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent({
|
|
81
80
|
action: _analytics.ACTION.BLOCKS_DRAG_INIT,
|
|
82
81
|
actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
|
|
@@ -84,7 +83,7 @@ var destroyFn = function destroyFn(api, editorView) {
|
|
|
84
83
|
attributes: {
|
|
85
84
|
duration: duration,
|
|
86
85
|
startTime: startTime,
|
|
87
|
-
nodesCount: state.doc.nodeSize
|
|
86
|
+
nodesCount: editorView === null || editorView === void 0 ? void 0 : editorView.state.doc.nodeSize
|
|
88
87
|
}
|
|
89
88
|
});
|
|
90
89
|
});
|
|
@@ -196,7 +195,7 @@ var destroyFn = function destroyFn(api, editorView) {
|
|
|
196
195
|
dragInitializationDuration: dragInitializationDuration,
|
|
197
196
|
dropProcessingDuration: duration,
|
|
198
197
|
isCancelled: isCancelled,
|
|
199
|
-
nodesCount: editorView.state.doc.nodeSize
|
|
198
|
+
nodesCount: editorView === null || editorView === void 0 ? void 0 : editorView.state.doc.nodeSize
|
|
200
199
|
}
|
|
201
200
|
});
|
|
202
201
|
});
|
|
@@ -239,8 +238,8 @@ var getDecorationAtPos = function getDecorationAtPos(state, decorations, pos, to
|
|
|
239
238
|
var nodeDecAtActivePos = nodeDecsAtActivePos.pop();
|
|
240
239
|
return nodeDecAtActivePos;
|
|
241
240
|
};
|
|
242
|
-
var _apply = exports.apply = function apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache) {
|
|
243
|
-
var _meta$multiSelectDnD, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _meta$isDragging3, _meta$toggleMenu, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$isShiftDown, _meta$lastDragCancell;
|
|
241
|
+
var _apply = exports.apply = function apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache, resizeObserverWidth, pragmaticCleanup) {
|
|
242
|
+
var _api$limitedMode, _meta$multiSelectDnD, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _meta$isDragging3, _meta$toggleMenu, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$isShiftDown, _meta$lastDragCancell;
|
|
244
243
|
var activeNode = currentState.activeNode,
|
|
245
244
|
decorations = currentState.decorations,
|
|
246
245
|
isResizerResizing = currentState.isResizerResizing,
|
|
@@ -263,6 +262,18 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
263
262
|
isAllText = _getTrMetadata.isAllText,
|
|
264
263
|
isReplacedWithSameSize = _getTrMetadata.isReplacedWithSameSize;
|
|
265
264
|
var meta = tr.getMeta(key);
|
|
265
|
+
var hasDocumentSizeBreachedThreshold = api === null || api === void 0 || (_api$limitedMode = api.limitedMode) === null || _api$limitedMode === void 0 || (_api$limitedMode = _api$limitedMode.sharedState.currentState()) === null || _api$limitedMode === void 0 || (_api$limitedMode = _api$limitedMode.limitedModePluginKey.getState(newState)) === null || _api$limitedMode === void 0 ? void 0 : _api$limitedMode.documentSizeBreachesThreshold;
|
|
266
|
+
if (hasDocumentSizeBreachedThreshold) {
|
|
267
|
+
/**
|
|
268
|
+
* INFO: This if statement is a duplicate of the logic in destroy(). When the threshold is breached and we enter limited mode, we want to trigger the cleanup logic in destroy().
|
|
269
|
+
*/
|
|
270
|
+
var editorContentArea = document.querySelector('.fabric-editor-popup-scroll-parent');
|
|
271
|
+
if (editorContentArea && resizeObserverWidth) {
|
|
272
|
+
resizeObserverWidth.unobserve(editorContentArea);
|
|
273
|
+
}
|
|
274
|
+
pragmaticCleanup === null || pragmaticCleanup === void 0 || pragmaticCleanup();
|
|
275
|
+
return currentState;
|
|
276
|
+
}
|
|
266
277
|
|
|
267
278
|
// When steps exist, remap existing decorations, activeNode and multi select positions
|
|
268
279
|
if (tr.docChanged) {
|
|
@@ -557,6 +568,8 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
557
568
|
if (!(0, _anchorUtils.isAnchorSupported)()) {
|
|
558
569
|
anchorRectCache = new _anchorUtils.AnchorRectCache();
|
|
559
570
|
}
|
|
571
|
+
var resizeObserverWidth;
|
|
572
|
+
var pragmaticCleanup = null;
|
|
560
573
|
return new _safePlugin.SafePlugin({
|
|
561
574
|
key: key,
|
|
562
575
|
state: {
|
|
@@ -564,13 +577,13 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
564
577
|
return initialState;
|
|
565
578
|
},
|
|
566
579
|
apply: function apply(tr, currentState, _, newState) {
|
|
567
|
-
return _apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache);
|
|
580
|
+
return _apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache, resizeObserverWidth, pragmaticCleanup);
|
|
568
581
|
}
|
|
569
582
|
},
|
|
570
583
|
props: {
|
|
571
584
|
decorations: function decorations(state) {
|
|
572
|
-
var _api$
|
|
573
|
-
if (api !== null && api !== void 0 && (_api$
|
|
585
|
+
var _api$limitedMode2, _api$editorDisabled, _key$getState2;
|
|
586
|
+
if (api !== null && api !== void 0 && (_api$limitedMode2 = api.limitedMode) !== null && _api$limitedMode2 !== void 0 && (_api$limitedMode2 = _api$limitedMode2.sharedState.currentState()) !== null && _api$limitedMode2 !== void 0 && _api$limitedMode2.enabled) {
|
|
574
587
|
return;
|
|
575
588
|
}
|
|
576
589
|
var isDisabled = api === null || api === void 0 || (_api$editorDisabled = api.editorDisabled) === null || _api$editorDisabled === void 0 || (_api$editorDisabled = _api$editorDisabled.sharedState.currentState()) === null || _api$editorDisabled === void 0 ? void 0 : _api$editorDisabled.editorDisabled;
|
|
@@ -629,8 +642,8 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
629
642
|
return false;
|
|
630
643
|
},
|
|
631
644
|
dragenter: function dragenter(view, event) {
|
|
632
|
-
var _api$
|
|
633
|
-
if (api !== null && api !== void 0 && (_api$
|
|
645
|
+
var _api$limitedMode3;
|
|
646
|
+
if (api !== null && api !== void 0 && (_api$limitedMode3 = api.limitedMode) !== null && _api$limitedMode3 !== void 0 && (_api$limitedMode3 = _api$limitedMode3.sharedState.currentState()) !== null && _api$limitedMode3 !== void 0 && _api$limitedMode3.enabled) {
|
|
634
647
|
return;
|
|
635
648
|
}
|
|
636
649
|
if (isHTMLElement(event.target) && (0, _expValEquals.expValEquals)('platform_editor_block_controls_perf_optimization', 'isEnabled', true)) {
|
|
@@ -663,8 +676,8 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
663
676
|
}
|
|
664
677
|
},
|
|
665
678
|
dragstart: function dragstart(view) {
|
|
666
|
-
var _api$
|
|
667
|
-
if (api !== null && api !== void 0 && (_api$
|
|
679
|
+
var _api$limitedMode4, _anchorRectCache2;
|
|
680
|
+
if (api !== null && api !== void 0 && (_api$limitedMode4 = api.limitedMode) !== null && _api$limitedMode4 !== void 0 && (_api$limitedMode4 = _api$limitedMode4.sharedState.currentState()) !== null && _api$limitedMode4 !== void 0 && _api$limitedMode4.enabled) {
|
|
668
681
|
return;
|
|
669
682
|
}
|
|
670
683
|
(0, _performanceMeasures.startMeasure)(EDITOR_BLOCKS_DRAG_INIT);
|
|
@@ -681,8 +694,8 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
681
694
|
})));
|
|
682
695
|
},
|
|
683
696
|
dragend: function dragend(view) {
|
|
684
|
-
var _api$
|
|
685
|
-
if (api !== null && api !== void 0 && (_api$
|
|
697
|
+
var _api$limitedMode5, _key$getState3;
|
|
698
|
+
if (api !== null && api !== void 0 && (_api$limitedMode5 = api.limitedMode) !== null && _api$limitedMode5 !== void 0 && (_api$limitedMode5 = _api$limitedMode5.sharedState.currentState()) !== null && _api$limitedMode5 !== void 0 && _api$limitedMode5.enabled) {
|
|
686
699
|
return;
|
|
687
700
|
}
|
|
688
701
|
var state = view.state,
|
|
@@ -702,23 +715,23 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
702
715
|
}
|
|
703
716
|
},
|
|
704
717
|
mouseover: function mouseover(view, event) {
|
|
705
|
-
var _api$
|
|
706
|
-
if (api !== null && api !== void 0 && (_api$
|
|
718
|
+
var _api$limitedMode6;
|
|
719
|
+
if (api !== null && api !== void 0 && (_api$limitedMode6 = api.limitedMode) !== null && _api$limitedMode6 !== void 0 && (_api$limitedMode6 = _api$limitedMode6.sharedState.currentState()) !== null && _api$limitedMode6 !== void 0 && _api$limitedMode6.enabled) {
|
|
707
720
|
return;
|
|
708
721
|
}
|
|
709
722
|
(0, _handleMouseOver.handleMouseOver)(view, event, api);
|
|
710
723
|
return false;
|
|
711
724
|
},
|
|
712
725
|
mousedown: function mousedown(view, event) {
|
|
713
|
-
var _api$
|
|
714
|
-
if (api !== null && api !== void 0 && (_api$
|
|
726
|
+
var _api$limitedMode7;
|
|
727
|
+
if (api !== null && api !== void 0 && (_api$limitedMode7 = api.limitedMode) !== null && _api$limitedMode7 !== void 0 && (_api$limitedMode7 = _api$limitedMode7.sharedState.currentState()) !== null && _api$limitedMode7 !== void 0 && _api$limitedMode7.enabled) {
|
|
715
728
|
return;
|
|
716
729
|
}
|
|
717
730
|
return (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _handleMouseDown.handleMouseDown)(api)(view, event) : undefined;
|
|
718
731
|
},
|
|
719
732
|
keydown: function keydown(view, event) {
|
|
720
|
-
var _api$
|
|
721
|
-
if (api !== null && api !== void 0 && (_api$
|
|
733
|
+
var _api$limitedMode8;
|
|
734
|
+
if (api !== null && api !== void 0 && (_api$limitedMode8 = api.limitedMode) !== null && _api$limitedMode8 !== void 0 && (_api$limitedMode8 = _api$limitedMode8.sharedState.currentState()) !== null && _api$limitedMode8 !== void 0 && _api$limitedMode8.enabled) {
|
|
722
735
|
return;
|
|
723
736
|
}
|
|
724
737
|
if (isMultiSelectEnabled) {
|
|
@@ -793,8 +806,8 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
793
806
|
}
|
|
794
807
|
},
|
|
795
808
|
keyup: function keyup(view, event) {
|
|
796
|
-
var _api$
|
|
797
|
-
if (api !== null && api !== void 0 && (_api$
|
|
809
|
+
var _api$limitedMode9;
|
|
810
|
+
if (api !== null && api !== void 0 && (_api$limitedMode9 = api.limitedMode) !== null && _api$limitedMode9 !== void 0 && (_api$limitedMode9 = _api$limitedMode9.sharedState.currentState()) !== null && _api$limitedMode9 !== void 0 && _api$limitedMode9.enabled) {
|
|
798
811
|
return;
|
|
799
812
|
}
|
|
800
813
|
if (!event.repeat && event.key === 'Shift') {
|
|
@@ -804,8 +817,8 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
804
817
|
}
|
|
805
818
|
},
|
|
806
819
|
blur: function blur(view, event) {
|
|
807
|
-
var _api$
|
|
808
|
-
if (api !== null && api !== void 0 && (_api$
|
|
820
|
+
var _api$limitedMode0;
|
|
821
|
+
if (api !== null && api !== void 0 && (_api$limitedMode0 = api.limitedMode) !== null && _api$limitedMode0 !== void 0 && (_api$limitedMode0 = _api$limitedMode0.sharedState.currentState()) !== null && _api$limitedMode0 !== void 0 && _api$limitedMode0.enabled) {
|
|
809
822
|
return;
|
|
810
823
|
}
|
|
811
824
|
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
@@ -835,7 +848,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
835
848
|
var editorContentArea = editorView.dom.closest('.fabric-editor-popup-scroll-parent');
|
|
836
849
|
|
|
837
850
|
// Use ResizeObserver to observe resizer (scroll-parent typically grows when resizing) and editor width changes
|
|
838
|
-
|
|
851
|
+
resizeObserverWidth = new ResizeObserver((0, _rafSchd.default)(function (entries) {
|
|
839
852
|
var pluginState = key.getState(editorView.state);
|
|
840
853
|
if (!(pluginState !== null && pluginState !== void 0 && pluginState.isDragging)) {
|
|
841
854
|
var isResizerResizing = !!dom.querySelector('.is-resizing');
|
|
@@ -864,13 +877,14 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
864
877
|
}
|
|
865
878
|
|
|
866
879
|
// Start pragmatic monitors
|
|
867
|
-
|
|
880
|
+
pragmaticCleanup = destroyFn(api, editorView);
|
|
868
881
|
return {
|
|
869
882
|
destroy: function destroy() {
|
|
883
|
+
var _pragmaticCleanup;
|
|
870
884
|
if (editorContentArea) {
|
|
871
885
|
resizeObserverWidth.unobserve(editorContentArea);
|
|
872
886
|
}
|
|
873
|
-
pragmaticCleanup();
|
|
887
|
+
(_pragmaticCleanup = pragmaticCleanup) === null || _pragmaticCleanup === void 0 || _pragmaticCleanup();
|
|
874
888
|
}
|
|
875
889
|
};
|
|
876
890
|
}
|
|
@@ -97,7 +97,9 @@ export const createDropTargetDecoration = (pos, props, nodeViewPortalProviderAPI
|
|
|
97
97
|
getPos,
|
|
98
98
|
anchorRectCache,
|
|
99
99
|
isSameLayout
|
|
100
|
-
}), element, key
|
|
100
|
+
}), element, key, undefined,
|
|
101
|
+
// @portal-render-immediately
|
|
102
|
+
true);
|
|
101
103
|
return element;
|
|
102
104
|
}, {
|
|
103
105
|
type: TYPE_DROP_TARGET_DEC,
|
|
@@ -127,7 +129,9 @@ export const createLayoutDropTargetDecoration = (pos, props, nodeViewPortalProvi
|
|
|
127
129
|
...props,
|
|
128
130
|
getPos,
|
|
129
131
|
anchorRectCache
|
|
130
|
-
}), element, key
|
|
132
|
+
}), element, key, undefined,
|
|
133
|
+
// @portal-render-immediately
|
|
134
|
+
true);
|
|
131
135
|
return element;
|
|
132
136
|
}, {
|
|
133
137
|
type: TYPE_DROP_TARGET_DEC,
|
|
@@ -90,7 +90,9 @@ export const quickInsertButtonDecoration = ({
|
|
|
90
90
|
rootAnchorName,
|
|
91
91
|
rootNodeType: rootNodeType !== null && rootNodeType !== void 0 ? rootNodeType : nodeType,
|
|
92
92
|
anchorRectCache
|
|
93
|
-
}), element, key
|
|
93
|
+
}), element, key, undefined,
|
|
94
|
+
// @portal-render-immediately
|
|
95
|
+
true);
|
|
94
96
|
return element;
|
|
95
97
|
}, widgetSpec);
|
|
96
98
|
};
|
|
@@ -66,9 +66,6 @@ const destroyFn = (api, editorView) => {
|
|
|
66
66
|
if (isMeasuring(EDITOR_BLOCKS_DRAG_INIT)) {
|
|
67
67
|
stopMeasure(EDITOR_BLOCKS_DRAG_INIT, (duration, startTime) => {
|
|
68
68
|
var _api$analytics;
|
|
69
|
-
const {
|
|
70
|
-
state
|
|
71
|
-
} = editorView;
|
|
72
69
|
api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.fireAnalyticsEvent({
|
|
73
70
|
action: ACTION.BLOCKS_DRAG_INIT,
|
|
74
71
|
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
@@ -76,7 +73,7 @@ const destroyFn = (api, editorView) => {
|
|
|
76
73
|
attributes: {
|
|
77
74
|
duration,
|
|
78
75
|
startTime,
|
|
79
|
-
nodesCount: state.doc.nodeSize
|
|
76
|
+
nodesCount: editorView === null || editorView === void 0 ? void 0 : editorView.state.doc.nodeSize
|
|
80
77
|
}
|
|
81
78
|
});
|
|
82
79
|
});
|
|
@@ -194,7 +191,7 @@ const destroyFn = (api, editorView) => {
|
|
|
194
191
|
dragInitializationDuration,
|
|
195
192
|
dropProcessingDuration: duration,
|
|
196
193
|
isCancelled,
|
|
197
|
-
nodesCount: editorView.state.doc.nodeSize
|
|
194
|
+
nodesCount: editorView === null || editorView === void 0 ? void 0 : editorView.state.doc.nodeSize
|
|
198
195
|
}
|
|
199
196
|
});
|
|
200
197
|
});
|
|
@@ -235,8 +232,8 @@ const getDecorationAtPos = (state, decorations, pos, to) => {
|
|
|
235
232
|
const nodeDecAtActivePos = nodeDecsAtActivePos.pop();
|
|
236
233
|
return nodeDecAtActivePos;
|
|
237
234
|
};
|
|
238
|
-
export const apply = (api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache) => {
|
|
239
|
-
var _meta$multiSelectDnD, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _meta$isDragging3, _meta$toggleMenu, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$isShiftDown, _meta$lastDragCancell;
|
|
235
|
+
export const apply = (api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache, resizeObserverWidth, pragmaticCleanup) => {
|
|
236
|
+
var _api$limitedMode, _api$limitedMode$shar, _api$limitedMode$shar2, _meta$multiSelectDnD, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _meta$isDragging3, _meta$toggleMenu, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$isShiftDown, _meta$lastDragCancell;
|
|
240
237
|
let {
|
|
241
238
|
activeNode,
|
|
242
239
|
decorations,
|
|
@@ -264,6 +261,18 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
264
261
|
isReplacedWithSameSize
|
|
265
262
|
} = getTrMetadata(tr);
|
|
266
263
|
const meta = tr.getMeta(key);
|
|
264
|
+
const hasDocumentSizeBreachedThreshold = api === null || api === void 0 ? void 0 : (_api$limitedMode = api.limitedMode) === null || _api$limitedMode === void 0 ? void 0 : (_api$limitedMode$shar = _api$limitedMode.sharedState.currentState()) === null || _api$limitedMode$shar === void 0 ? void 0 : (_api$limitedMode$shar2 = _api$limitedMode$shar.limitedModePluginKey.getState(newState)) === null || _api$limitedMode$shar2 === void 0 ? void 0 : _api$limitedMode$shar2.documentSizeBreachesThreshold;
|
|
265
|
+
if (hasDocumentSizeBreachedThreshold) {
|
|
266
|
+
/**
|
|
267
|
+
* INFO: This if statement is a duplicate of the logic in destroy(). When the threshold is breached and we enter limited mode, we want to trigger the cleanup logic in destroy().
|
|
268
|
+
*/
|
|
269
|
+
const editorContentArea = document.querySelector('.fabric-editor-popup-scroll-parent');
|
|
270
|
+
if (editorContentArea && resizeObserverWidth) {
|
|
271
|
+
resizeObserverWidth.unobserve(editorContentArea);
|
|
272
|
+
}
|
|
273
|
+
pragmaticCleanup === null || pragmaticCleanup === void 0 ? void 0 : pragmaticCleanup();
|
|
274
|
+
return currentState;
|
|
275
|
+
}
|
|
267
276
|
|
|
268
277
|
// When steps exist, remap existing decorations, activeNode and multi select positions
|
|
269
278
|
if (tr.docChanged) {
|
|
@@ -558,18 +567,20 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
|
558
567
|
if (!isAnchorSupported()) {
|
|
559
568
|
anchorRectCache = new AnchorRectCache();
|
|
560
569
|
}
|
|
570
|
+
let resizeObserverWidth;
|
|
571
|
+
let pragmaticCleanup = null;
|
|
561
572
|
return new SafePlugin({
|
|
562
573
|
key,
|
|
563
574
|
state: {
|
|
564
575
|
init() {
|
|
565
576
|
return initialState;
|
|
566
577
|
},
|
|
567
|
-
apply: (tr, currentState, _, newState) => apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache)
|
|
578
|
+
apply: (tr, currentState, _, newState) => apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache, resizeObserverWidth, pragmaticCleanup)
|
|
568
579
|
},
|
|
569
580
|
props: {
|
|
570
581
|
decorations: state => {
|
|
571
|
-
var _api$
|
|
572
|
-
if (api !== null && api !== void 0 && (_api$
|
|
582
|
+
var _api$limitedMode2, _api$limitedMode2$sha, _api$editorDisabled, _api$editorDisabled$s, _key$getState2;
|
|
583
|
+
if (api !== null && api !== void 0 && (_api$limitedMode2 = api.limitedMode) !== null && _api$limitedMode2 !== void 0 && (_api$limitedMode2$sha = _api$limitedMode2.sharedState.currentState()) !== null && _api$limitedMode2$sha !== void 0 && _api$limitedMode2$sha.enabled) {
|
|
573
584
|
return;
|
|
574
585
|
}
|
|
575
586
|
const isDisabled = api === null || api === void 0 ? void 0 : (_api$editorDisabled = api.editorDisabled) === null || _api$editorDisabled === void 0 ? void 0 : (_api$editorDisabled$s = _api$editorDisabled.sharedState.currentState()) === null || _api$editorDisabled$s === void 0 ? void 0 : _api$editorDisabled$s.editorDisabled;
|
|
@@ -631,8 +642,8 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
|
631
642
|
return false;
|
|
632
643
|
},
|
|
633
644
|
dragenter(view, event) {
|
|
634
|
-
var _api$
|
|
635
|
-
if (api !== null && api !== void 0 && (_api$
|
|
645
|
+
var _api$limitedMode3, _api$limitedMode3$sha;
|
|
646
|
+
if (api !== null && api !== void 0 && (_api$limitedMode3 = api.limitedMode) !== null && _api$limitedMode3 !== void 0 && (_api$limitedMode3$sha = _api$limitedMode3.sharedState.currentState()) !== null && _api$limitedMode3$sha !== void 0 && _api$limitedMode3$sha.enabled) {
|
|
636
647
|
return;
|
|
637
648
|
}
|
|
638
649
|
if (isHTMLElement(event.target) && expValEquals('platform_editor_block_controls_perf_optimization', 'isEnabled', true)) {
|
|
@@ -665,8 +676,8 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
|
665
676
|
}
|
|
666
677
|
},
|
|
667
678
|
dragstart(view) {
|
|
668
|
-
var _api$
|
|
669
|
-
if (api !== null && api !== void 0 && (_api$
|
|
679
|
+
var _api$limitedMode4, _api$limitedMode4$sha, _anchorRectCache2;
|
|
680
|
+
if (api !== null && api !== void 0 && (_api$limitedMode4 = api.limitedMode) !== null && _api$limitedMode4 !== void 0 && (_api$limitedMode4$sha = _api$limitedMode4.sharedState.currentState()) !== null && _api$limitedMode4$sha !== void 0 && _api$limitedMode4$sha.enabled) {
|
|
670
681
|
return;
|
|
671
682
|
}
|
|
672
683
|
startMeasure(EDITOR_BLOCKS_DRAG_INIT);
|
|
@@ -684,8 +695,8 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
|
684
695
|
}));
|
|
685
696
|
},
|
|
686
697
|
dragend(view) {
|
|
687
|
-
var _api$
|
|
688
|
-
if (api !== null && api !== void 0 && (_api$
|
|
698
|
+
var _api$limitedMode5, _api$limitedMode5$sha, _key$getState3;
|
|
699
|
+
if (api !== null && api !== void 0 && (_api$limitedMode5 = api.limitedMode) !== null && _api$limitedMode5 !== void 0 && (_api$limitedMode5$sha = _api$limitedMode5.sharedState.currentState()) !== null && _api$limitedMode5$sha !== void 0 && _api$limitedMode5$sha.enabled) {
|
|
689
700
|
return;
|
|
690
701
|
}
|
|
691
702
|
const {
|
|
@@ -708,23 +719,23 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
|
708
719
|
}
|
|
709
720
|
},
|
|
710
721
|
mouseover: (view, event) => {
|
|
711
|
-
var _api$
|
|
712
|
-
if (api !== null && api !== void 0 && (_api$
|
|
722
|
+
var _api$limitedMode6, _api$limitedMode6$sha;
|
|
723
|
+
if (api !== null && api !== void 0 && (_api$limitedMode6 = api.limitedMode) !== null && _api$limitedMode6 !== void 0 && (_api$limitedMode6$sha = _api$limitedMode6.sharedState.currentState()) !== null && _api$limitedMode6$sha !== void 0 && _api$limitedMode6$sha.enabled) {
|
|
713
724
|
return;
|
|
714
725
|
}
|
|
715
726
|
handleMouseOver(view, event, api);
|
|
716
727
|
return false;
|
|
717
728
|
},
|
|
718
729
|
mousedown: (view, event) => {
|
|
719
|
-
var _api$
|
|
720
|
-
if (api !== null && api !== void 0 && (_api$
|
|
730
|
+
var _api$limitedMode7, _api$limitedMode7$sha;
|
|
731
|
+
if (api !== null && api !== void 0 && (_api$limitedMode7 = api.limitedMode) !== null && _api$limitedMode7 !== void 0 && (_api$limitedMode7$sha = _api$limitedMode7.sharedState.currentState()) !== null && _api$limitedMode7$sha !== void 0 && _api$limitedMode7$sha.enabled) {
|
|
721
732
|
return;
|
|
722
733
|
}
|
|
723
734
|
return editorExperiment('platform_editor_controls', 'variant1') ? handleMouseDown(api)(view, event) : undefined;
|
|
724
735
|
},
|
|
725
736
|
keydown(view, event) {
|
|
726
|
-
var _api$
|
|
727
|
-
if (api !== null && api !== void 0 && (_api$
|
|
737
|
+
var _api$limitedMode8, _api$limitedMode8$sha;
|
|
738
|
+
if (api !== null && api !== void 0 && (_api$limitedMode8 = api.limitedMode) !== null && _api$limitedMode8 !== void 0 && (_api$limitedMode8$sha = _api$limitedMode8.sharedState.currentState()) !== null && _api$limitedMode8$sha !== void 0 && _api$limitedMode8$sha.enabled) {
|
|
728
739
|
return;
|
|
729
740
|
}
|
|
730
741
|
if (isMultiSelectEnabled) {
|
|
@@ -802,8 +813,8 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
|
802
813
|
}
|
|
803
814
|
},
|
|
804
815
|
keyup(view, event) {
|
|
805
|
-
var _api$
|
|
806
|
-
if (api !== null && api !== void 0 && (_api$
|
|
816
|
+
var _api$limitedMode9, _api$limitedMode9$sha;
|
|
817
|
+
if (api !== null && api !== void 0 && (_api$limitedMode9 = api.limitedMode) !== null && _api$limitedMode9 !== void 0 && (_api$limitedMode9$sha = _api$limitedMode9.sharedState.currentState()) !== null && _api$limitedMode9$sha !== void 0 && _api$limitedMode9$sha.enabled) {
|
|
807
818
|
return;
|
|
808
819
|
}
|
|
809
820
|
if (!event.repeat && event.key === 'Shift') {
|
|
@@ -814,8 +825,8 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
|
814
825
|
}
|
|
815
826
|
},
|
|
816
827
|
blur(view, event) {
|
|
817
|
-
var _api$
|
|
818
|
-
if (api !== null && api !== void 0 && (_api$
|
|
828
|
+
var _api$limitedMode0, _api$limitedMode0$sha;
|
|
829
|
+
if (api !== null && api !== void 0 && (_api$limitedMode0 = api.limitedMode) !== null && _api$limitedMode0 !== void 0 && (_api$limitedMode0$sha = _api$limitedMode0.sharedState.currentState()) !== null && _api$limitedMode0$sha !== void 0 && _api$limitedMode0$sha.enabled) {
|
|
819
830
|
return;
|
|
820
831
|
}
|
|
821
832
|
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
@@ -847,7 +858,7 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
|
847
858
|
const editorContentArea = editorView.dom.closest('.fabric-editor-popup-scroll-parent');
|
|
848
859
|
|
|
849
860
|
// Use ResizeObserver to observe resizer (scroll-parent typically grows when resizing) and editor width changes
|
|
850
|
-
|
|
861
|
+
resizeObserverWidth = new ResizeObserver(rafSchedule(entries => {
|
|
851
862
|
const pluginState = key.getState(editorView.state);
|
|
852
863
|
if (!(pluginState !== null && pluginState !== void 0 && pluginState.isDragging)) {
|
|
853
864
|
const isResizerResizing = !!dom.querySelector('.is-resizing');
|
|
@@ -877,13 +888,14 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
|
877
888
|
}
|
|
878
889
|
|
|
879
890
|
// Start pragmatic monitors
|
|
880
|
-
|
|
891
|
+
pragmaticCleanup = destroyFn(api, editorView);
|
|
881
892
|
return {
|
|
882
893
|
destroy() {
|
|
894
|
+
var _pragmaticCleanup;
|
|
883
895
|
if (editorContentArea) {
|
|
884
896
|
resizeObserverWidth.unobserve(editorContentArea);
|
|
885
897
|
}
|
|
886
|
-
pragmaticCleanup();
|
|
898
|
+
(_pragmaticCleanup = pragmaticCleanup) === null || _pragmaticCleanup === void 0 ? void 0 : _pragmaticCleanup();
|
|
887
899
|
}
|
|
888
900
|
};
|
|
889
901
|
}
|
|
@@ -102,7 +102,9 @@ export var createDropTargetDecoration = function createDropTargetDecoration(pos,
|
|
|
102
102
|
anchorRectCache: anchorRectCache,
|
|
103
103
|
isSameLayout: isSameLayout
|
|
104
104
|
}));
|
|
105
|
-
}, element, key
|
|
105
|
+
}, element, key, undefined,
|
|
106
|
+
// @portal-render-immediately
|
|
107
|
+
true);
|
|
106
108
|
return element;
|
|
107
109
|
}, {
|
|
108
110
|
type: TYPE_DROP_TARGET_DEC,
|
|
@@ -133,7 +135,9 @@ export var createLayoutDropTargetDecoration = function createLayoutDropTargetDec
|
|
|
133
135
|
getPos: getPos,
|
|
134
136
|
anchorRectCache: anchorRectCache
|
|
135
137
|
}));
|
|
136
|
-
}, element, key
|
|
138
|
+
}, element, key, undefined,
|
|
139
|
+
// @portal-render-immediately
|
|
140
|
+
true);
|
|
137
141
|
return element;
|
|
138
142
|
}, {
|
|
139
143
|
type: TYPE_DROP_TARGET_DEC,
|
|
@@ -93,7 +93,9 @@ export var quickInsertButtonDecoration = function quickInsertButtonDecoration(_r
|
|
|
93
93
|
rootNodeType: rootNodeType !== null && rootNodeType !== void 0 ? rootNodeType : nodeType,
|
|
94
94
|
anchorRectCache: anchorRectCache
|
|
95
95
|
});
|
|
96
|
-
}, element, key
|
|
96
|
+
}, element, key, undefined,
|
|
97
|
+
// @portal-render-immediately
|
|
98
|
+
true);
|
|
97
99
|
return element;
|
|
98
100
|
}, widgetSpec);
|
|
99
101
|
};
|
|
@@ -69,7 +69,6 @@ var destroyFn = function destroyFn(api, editorView) {
|
|
|
69
69
|
if (isMeasuring(EDITOR_BLOCKS_DRAG_INIT)) {
|
|
70
70
|
stopMeasure(EDITOR_BLOCKS_DRAG_INIT, function (duration, startTime) {
|
|
71
71
|
var _api$analytics;
|
|
72
|
-
var state = editorView.state;
|
|
73
72
|
api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent({
|
|
74
73
|
action: ACTION.BLOCKS_DRAG_INIT,
|
|
75
74
|
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
@@ -77,7 +76,7 @@ var destroyFn = function destroyFn(api, editorView) {
|
|
|
77
76
|
attributes: {
|
|
78
77
|
duration: duration,
|
|
79
78
|
startTime: startTime,
|
|
80
|
-
nodesCount: state.doc.nodeSize
|
|
79
|
+
nodesCount: editorView === null || editorView === void 0 ? void 0 : editorView.state.doc.nodeSize
|
|
81
80
|
}
|
|
82
81
|
});
|
|
83
82
|
});
|
|
@@ -189,7 +188,7 @@ var destroyFn = function destroyFn(api, editorView) {
|
|
|
189
188
|
dragInitializationDuration: dragInitializationDuration,
|
|
190
189
|
dropProcessingDuration: duration,
|
|
191
190
|
isCancelled: isCancelled,
|
|
192
|
-
nodesCount: editorView.state.doc.nodeSize
|
|
191
|
+
nodesCount: editorView === null || editorView === void 0 ? void 0 : editorView.state.doc.nodeSize
|
|
193
192
|
}
|
|
194
193
|
});
|
|
195
194
|
});
|
|
@@ -232,8 +231,8 @@ var getDecorationAtPos = function getDecorationAtPos(state, decorations, pos, to
|
|
|
232
231
|
var nodeDecAtActivePos = nodeDecsAtActivePos.pop();
|
|
233
232
|
return nodeDecAtActivePos;
|
|
234
233
|
};
|
|
235
|
-
var _apply = function apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache) {
|
|
236
|
-
var _meta$multiSelectDnD, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _meta$isDragging3, _meta$toggleMenu, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$isShiftDown, _meta$lastDragCancell;
|
|
234
|
+
var _apply = function apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache, resizeObserverWidth, pragmaticCleanup) {
|
|
235
|
+
var _api$limitedMode, _meta$multiSelectDnD, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _meta$isDragging3, _meta$toggleMenu, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$isShiftDown, _meta$lastDragCancell;
|
|
237
236
|
var activeNode = currentState.activeNode,
|
|
238
237
|
decorations = currentState.decorations,
|
|
239
238
|
isResizerResizing = currentState.isResizerResizing,
|
|
@@ -256,6 +255,18 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
256
255
|
isAllText = _getTrMetadata.isAllText,
|
|
257
256
|
isReplacedWithSameSize = _getTrMetadata.isReplacedWithSameSize;
|
|
258
257
|
var meta = tr.getMeta(key);
|
|
258
|
+
var hasDocumentSizeBreachedThreshold = api === null || api === void 0 || (_api$limitedMode = api.limitedMode) === null || _api$limitedMode === void 0 || (_api$limitedMode = _api$limitedMode.sharedState.currentState()) === null || _api$limitedMode === void 0 || (_api$limitedMode = _api$limitedMode.limitedModePluginKey.getState(newState)) === null || _api$limitedMode === void 0 ? void 0 : _api$limitedMode.documentSizeBreachesThreshold;
|
|
259
|
+
if (hasDocumentSizeBreachedThreshold) {
|
|
260
|
+
/**
|
|
261
|
+
* INFO: This if statement is a duplicate of the logic in destroy(). When the threshold is breached and we enter limited mode, we want to trigger the cleanup logic in destroy().
|
|
262
|
+
*/
|
|
263
|
+
var editorContentArea = document.querySelector('.fabric-editor-popup-scroll-parent');
|
|
264
|
+
if (editorContentArea && resizeObserverWidth) {
|
|
265
|
+
resizeObserverWidth.unobserve(editorContentArea);
|
|
266
|
+
}
|
|
267
|
+
pragmaticCleanup === null || pragmaticCleanup === void 0 || pragmaticCleanup();
|
|
268
|
+
return currentState;
|
|
269
|
+
}
|
|
259
270
|
|
|
260
271
|
// When steps exist, remap existing decorations, activeNode and multi select positions
|
|
261
272
|
if (tr.docChanged) {
|
|
@@ -551,6 +562,8 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
551
562
|
if (!isAnchorSupported()) {
|
|
552
563
|
anchorRectCache = new AnchorRectCache();
|
|
553
564
|
}
|
|
565
|
+
var resizeObserverWidth;
|
|
566
|
+
var pragmaticCleanup = null;
|
|
554
567
|
return new SafePlugin({
|
|
555
568
|
key: key,
|
|
556
569
|
state: {
|
|
@@ -558,13 +571,13 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
558
571
|
return initialState;
|
|
559
572
|
},
|
|
560
573
|
apply: function apply(tr, currentState, _, newState) {
|
|
561
|
-
return _apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache);
|
|
574
|
+
return _apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache, resizeObserverWidth, pragmaticCleanup);
|
|
562
575
|
}
|
|
563
576
|
},
|
|
564
577
|
props: {
|
|
565
578
|
decorations: function decorations(state) {
|
|
566
|
-
var _api$
|
|
567
|
-
if (api !== null && api !== void 0 && (_api$
|
|
579
|
+
var _api$limitedMode2, _api$editorDisabled, _key$getState2;
|
|
580
|
+
if (api !== null && api !== void 0 && (_api$limitedMode2 = api.limitedMode) !== null && _api$limitedMode2 !== void 0 && (_api$limitedMode2 = _api$limitedMode2.sharedState.currentState()) !== null && _api$limitedMode2 !== void 0 && _api$limitedMode2.enabled) {
|
|
568
581
|
return;
|
|
569
582
|
}
|
|
570
583
|
var isDisabled = api === null || api === void 0 || (_api$editorDisabled = api.editorDisabled) === null || _api$editorDisabled === void 0 || (_api$editorDisabled = _api$editorDisabled.sharedState.currentState()) === null || _api$editorDisabled === void 0 ? void 0 : _api$editorDisabled.editorDisabled;
|
|
@@ -623,8 +636,8 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
623
636
|
return false;
|
|
624
637
|
},
|
|
625
638
|
dragenter: function dragenter(view, event) {
|
|
626
|
-
var _api$
|
|
627
|
-
if (api !== null && api !== void 0 && (_api$
|
|
639
|
+
var _api$limitedMode3;
|
|
640
|
+
if (api !== null && api !== void 0 && (_api$limitedMode3 = api.limitedMode) !== null && _api$limitedMode3 !== void 0 && (_api$limitedMode3 = _api$limitedMode3.sharedState.currentState()) !== null && _api$limitedMode3 !== void 0 && _api$limitedMode3.enabled) {
|
|
628
641
|
return;
|
|
629
642
|
}
|
|
630
643
|
if (isHTMLElement(event.target) && expValEquals('platform_editor_block_controls_perf_optimization', 'isEnabled', true)) {
|
|
@@ -657,8 +670,8 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
657
670
|
}
|
|
658
671
|
},
|
|
659
672
|
dragstart: function dragstart(view) {
|
|
660
|
-
var _api$
|
|
661
|
-
if (api !== null && api !== void 0 && (_api$
|
|
673
|
+
var _api$limitedMode4, _anchorRectCache2;
|
|
674
|
+
if (api !== null && api !== void 0 && (_api$limitedMode4 = api.limitedMode) !== null && _api$limitedMode4 !== void 0 && (_api$limitedMode4 = _api$limitedMode4.sharedState.currentState()) !== null && _api$limitedMode4 !== void 0 && _api$limitedMode4.enabled) {
|
|
662
675
|
return;
|
|
663
676
|
}
|
|
664
677
|
startMeasure(EDITOR_BLOCKS_DRAG_INIT);
|
|
@@ -675,8 +688,8 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
675
688
|
})));
|
|
676
689
|
},
|
|
677
690
|
dragend: function dragend(view) {
|
|
678
|
-
var _api$
|
|
679
|
-
if (api !== null && api !== void 0 && (_api$
|
|
691
|
+
var _api$limitedMode5, _key$getState3;
|
|
692
|
+
if (api !== null && api !== void 0 && (_api$limitedMode5 = api.limitedMode) !== null && _api$limitedMode5 !== void 0 && (_api$limitedMode5 = _api$limitedMode5.sharedState.currentState()) !== null && _api$limitedMode5 !== void 0 && _api$limitedMode5.enabled) {
|
|
680
693
|
return;
|
|
681
694
|
}
|
|
682
695
|
var state = view.state,
|
|
@@ -696,23 +709,23 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
696
709
|
}
|
|
697
710
|
},
|
|
698
711
|
mouseover: function mouseover(view, event) {
|
|
699
|
-
var _api$
|
|
700
|
-
if (api !== null && api !== void 0 && (_api$
|
|
712
|
+
var _api$limitedMode6;
|
|
713
|
+
if (api !== null && api !== void 0 && (_api$limitedMode6 = api.limitedMode) !== null && _api$limitedMode6 !== void 0 && (_api$limitedMode6 = _api$limitedMode6.sharedState.currentState()) !== null && _api$limitedMode6 !== void 0 && _api$limitedMode6.enabled) {
|
|
701
714
|
return;
|
|
702
715
|
}
|
|
703
716
|
handleMouseOver(view, event, api);
|
|
704
717
|
return false;
|
|
705
718
|
},
|
|
706
719
|
mousedown: function mousedown(view, event) {
|
|
707
|
-
var _api$
|
|
708
|
-
if (api !== null && api !== void 0 && (_api$
|
|
720
|
+
var _api$limitedMode7;
|
|
721
|
+
if (api !== null && api !== void 0 && (_api$limitedMode7 = api.limitedMode) !== null && _api$limitedMode7 !== void 0 && (_api$limitedMode7 = _api$limitedMode7.sharedState.currentState()) !== null && _api$limitedMode7 !== void 0 && _api$limitedMode7.enabled) {
|
|
709
722
|
return;
|
|
710
723
|
}
|
|
711
724
|
return editorExperiment('platform_editor_controls', 'variant1') ? handleMouseDown(api)(view, event) : undefined;
|
|
712
725
|
},
|
|
713
726
|
keydown: function keydown(view, event) {
|
|
714
|
-
var _api$
|
|
715
|
-
if (api !== null && api !== void 0 && (_api$
|
|
727
|
+
var _api$limitedMode8;
|
|
728
|
+
if (api !== null && api !== void 0 && (_api$limitedMode8 = api.limitedMode) !== null && _api$limitedMode8 !== void 0 && (_api$limitedMode8 = _api$limitedMode8.sharedState.currentState()) !== null && _api$limitedMode8 !== void 0 && _api$limitedMode8.enabled) {
|
|
716
729
|
return;
|
|
717
730
|
}
|
|
718
731
|
if (isMultiSelectEnabled) {
|
|
@@ -787,8 +800,8 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
787
800
|
}
|
|
788
801
|
},
|
|
789
802
|
keyup: function keyup(view, event) {
|
|
790
|
-
var _api$
|
|
791
|
-
if (api !== null && api !== void 0 && (_api$
|
|
803
|
+
var _api$limitedMode9;
|
|
804
|
+
if (api !== null && api !== void 0 && (_api$limitedMode9 = api.limitedMode) !== null && _api$limitedMode9 !== void 0 && (_api$limitedMode9 = _api$limitedMode9.sharedState.currentState()) !== null && _api$limitedMode9 !== void 0 && _api$limitedMode9.enabled) {
|
|
792
805
|
return;
|
|
793
806
|
}
|
|
794
807
|
if (!event.repeat && event.key === 'Shift') {
|
|
@@ -798,8 +811,8 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
798
811
|
}
|
|
799
812
|
},
|
|
800
813
|
blur: function blur(view, event) {
|
|
801
|
-
var _api$
|
|
802
|
-
if (api !== null && api !== void 0 && (_api$
|
|
814
|
+
var _api$limitedMode0;
|
|
815
|
+
if (api !== null && api !== void 0 && (_api$limitedMode0 = api.limitedMode) !== null && _api$limitedMode0 !== void 0 && (_api$limitedMode0 = _api$limitedMode0.sharedState.currentState()) !== null && _api$limitedMode0 !== void 0 && _api$limitedMode0.enabled) {
|
|
803
816
|
return;
|
|
804
817
|
}
|
|
805
818
|
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
@@ -829,7 +842,7 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
829
842
|
var editorContentArea = editorView.dom.closest('.fabric-editor-popup-scroll-parent');
|
|
830
843
|
|
|
831
844
|
// Use ResizeObserver to observe resizer (scroll-parent typically grows when resizing) and editor width changes
|
|
832
|
-
|
|
845
|
+
resizeObserverWidth = new ResizeObserver(rafSchedule(function (entries) {
|
|
833
846
|
var pluginState = key.getState(editorView.state);
|
|
834
847
|
if (!(pluginState !== null && pluginState !== void 0 && pluginState.isDragging)) {
|
|
835
848
|
var isResizerResizing = !!dom.querySelector('.is-resizing');
|
|
@@ -858,13 +871,14 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
858
871
|
}
|
|
859
872
|
|
|
860
873
|
// Start pragmatic monitors
|
|
861
|
-
|
|
874
|
+
pragmaticCleanup = destroyFn(api, editorView);
|
|
862
875
|
return {
|
|
863
876
|
destroy: function destroy() {
|
|
877
|
+
var _pragmaticCleanup;
|
|
864
878
|
if (editorContentArea) {
|
|
865
879
|
resizeObserverWidth.unobserve(editorContentArea);
|
|
866
880
|
}
|
|
867
|
-
pragmaticCleanup();
|
|
881
|
+
(_pragmaticCleanup = pragmaticCleanup) === null || _pragmaticCleanup === void 0 || _pragmaticCleanup();
|
|
868
882
|
}
|
|
869
883
|
};
|
|
870
884
|
}
|
|
@@ -12,7 +12,7 @@ export interface FlagType {
|
|
|
12
12
|
isMultiSelectEnabled: boolean;
|
|
13
13
|
}
|
|
14
14
|
export declare const getDecorations: (state: EditorState) => DecorationSet | undefined;
|
|
15
|
-
export declare const apply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape["formatMessage"], tr: ReadonlyTransaction, currentState: PluginState, newState: EditorState, flags: FlagType, nodeViewPortalProviderAPI: PortalProviderAPI, anchorRectCache?: AnchorRectCache) => {
|
|
15
|
+
export declare const apply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape["formatMessage"], tr: ReadonlyTransaction, currentState: PluginState, newState: EditorState, flags: FlagType, nodeViewPortalProviderAPI: PortalProviderAPI, anchorRectCache?: AnchorRectCache, resizeObserverWidth?: ResizeObserver, pragmaticCleanup?: (() => void) | null) => PluginState | {
|
|
16
16
|
decorations: DecorationSet;
|
|
17
17
|
activeNode: any;
|
|
18
18
|
activeDropTargetNode: ActiveDropTargetNode | undefined;
|
|
@@ -30,4 +30,21 @@ export declare const apply: (api: ExtractInjectionAPI<BlockControlsPlugin> | und
|
|
|
30
30
|
lastDragCancelled: any;
|
|
31
31
|
isSelectedViaDragHandle: any;
|
|
32
32
|
};
|
|
33
|
-
export declare const createPlugin: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, getIntl: () => IntlShape, nodeViewPortalProviderAPI: PortalProviderAPI) => SafePlugin<PluginState
|
|
33
|
+
export declare const createPlugin: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, getIntl: () => IntlShape, nodeViewPortalProviderAPI: PortalProviderAPI) => SafePlugin<PluginState | {
|
|
34
|
+
decorations: DecorationSet;
|
|
35
|
+
activeNode: any;
|
|
36
|
+
activeDropTargetNode: ActiveDropTargetNode | undefined;
|
|
37
|
+
isDragging: any;
|
|
38
|
+
isMenuOpen: boolean | undefined;
|
|
39
|
+
menuTriggerBy: any;
|
|
40
|
+
editorHeight: any;
|
|
41
|
+
editorWidthLeft: any;
|
|
42
|
+
editorWidthRight: any;
|
|
43
|
+
isResizerResizing: boolean;
|
|
44
|
+
isDocSizeLimitEnabled: boolean | null;
|
|
45
|
+
isPMDragging: any;
|
|
46
|
+
multiSelectDnD: import("../blockControlsPluginType").MultiSelectDnD | undefined;
|
|
47
|
+
isShiftDown: any;
|
|
48
|
+
lastDragCancelled: any;
|
|
49
|
+
isSelectedViaDragHandle: any;
|
|
50
|
+
}>;
|
|
@@ -12,7 +12,7 @@ export interface FlagType {
|
|
|
12
12
|
isMultiSelectEnabled: boolean;
|
|
13
13
|
}
|
|
14
14
|
export declare const getDecorations: (state: EditorState) => DecorationSet | undefined;
|
|
15
|
-
export declare const apply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape["formatMessage"], tr: ReadonlyTransaction, currentState: PluginState, newState: EditorState, flags: FlagType, nodeViewPortalProviderAPI: PortalProviderAPI, anchorRectCache?: AnchorRectCache) => {
|
|
15
|
+
export declare const apply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape["formatMessage"], tr: ReadonlyTransaction, currentState: PluginState, newState: EditorState, flags: FlagType, nodeViewPortalProviderAPI: PortalProviderAPI, anchorRectCache?: AnchorRectCache, resizeObserverWidth?: ResizeObserver, pragmaticCleanup?: (() => void) | null) => PluginState | {
|
|
16
16
|
decorations: DecorationSet;
|
|
17
17
|
activeNode: any;
|
|
18
18
|
activeDropTargetNode: ActiveDropTargetNode | undefined;
|
|
@@ -30,4 +30,21 @@ export declare const apply: (api: ExtractInjectionAPI<BlockControlsPlugin> | und
|
|
|
30
30
|
lastDragCancelled: any;
|
|
31
31
|
isSelectedViaDragHandle: any;
|
|
32
32
|
};
|
|
33
|
-
export declare const createPlugin: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, getIntl: () => IntlShape, nodeViewPortalProviderAPI: PortalProviderAPI) => SafePlugin<PluginState
|
|
33
|
+
export declare const createPlugin: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, getIntl: () => IntlShape, nodeViewPortalProviderAPI: PortalProviderAPI) => SafePlugin<PluginState | {
|
|
34
|
+
decorations: DecorationSet;
|
|
35
|
+
activeNode: any;
|
|
36
|
+
activeDropTargetNode: ActiveDropTargetNode | undefined;
|
|
37
|
+
isDragging: any;
|
|
38
|
+
isMenuOpen: boolean | undefined;
|
|
39
|
+
menuTriggerBy: any;
|
|
40
|
+
editorHeight: any;
|
|
41
|
+
editorWidthLeft: any;
|
|
42
|
+
editorWidthRight: any;
|
|
43
|
+
isResizerResizing: boolean;
|
|
44
|
+
isDocSizeLimitEnabled: boolean | null;
|
|
45
|
+
isPMDragging: any;
|
|
46
|
+
multiSelectDnD: import("../blockControlsPluginType").MultiSelectDnD | undefined;
|
|
47
|
+
isShiftDown: any;
|
|
48
|
+
lastDragCancelled: any;
|
|
49
|
+
isSelectedViaDragHandle: any;
|
|
50
|
+
}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.12",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@atlaskit/editor-plugin-editor-disabled": "^3.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-feature-flags": "^2.0.0",
|
|
39
39
|
"@atlaskit/editor-plugin-interaction": "^5.0.0",
|
|
40
|
-
"@atlaskit/editor-plugin-limited-mode": "^0.0.
|
|
40
|
+
"@atlaskit/editor-plugin-limited-mode": "^0.0.3",
|
|
41
41
|
"@atlaskit/editor-plugin-metrics": "^4.0.0",
|
|
42
42
|
"@atlaskit/editor-plugin-quick-insert": "^3.0.0",
|
|
43
43
|
"@atlaskit/editor-plugin-selection": "^3.0.0",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
|
|
56
56
|
"@atlaskit/primitives": "^14.11.0",
|
|
57
57
|
"@atlaskit/theme": "^19.0.0",
|
|
58
|
-
"@atlaskit/tmp-editor-statsig": "^11.
|
|
58
|
+
"@atlaskit/tmp-editor-statsig": "^11.1.0",
|
|
59
59
|
"@atlaskit/tokens": "^6.0.0",
|
|
60
60
|
"@atlaskit/tooltip": "^20.4.0",
|
|
61
61
|
"@babel/runtime": "^7.0.0",
|