@atlaskit/editor-plugin-block-controls 4.1.8 → 4.1.10
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 +14 -0
- package/dist/cjs/pm-plugins/main.js +39 -4
- package/dist/cjs/ui/global-styles.js +1 -8
- package/dist/es2019/pm-plugins/main.js +39 -4
- package/dist/es2019/ui/global-styles.js +1 -11
- package/dist/esm/pm-plugins/main.js +39 -4
- package/dist/esm/ui/global-styles.js +1 -8
- package/dist/types/blockControlsPluginType.d.ts +2 -0
- package/dist/types/editor-commands/move-node.d.ts +2 -2
- package/dist/types/pm-plugins/decorations-drop-target-active.d.ts +1 -1
- package/dist/types/pm-plugins/decorations-drop-target.d.ts +3 -3
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/pm-plugins/utils/active-anchor-tracker.d.ts +0 -3
- package/dist/types/pm-plugins/utils/inline-drop-target.d.ts +5 -1
- package/dist/types/ui/block-menu-items.d.ts +3 -3
- package/dist/types/ui/drop-target-layout.d.ts +1 -1
- package/dist/types/ui/drop-target.d.ts +2 -2
- package/dist/types/ui/inline-drop-target.d.ts +2 -2
- package/dist/types-ts4.5/blockControlsPluginType.d.ts +2 -0
- package/dist/types-ts4.5/editor-commands/move-node.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/decorations-drop-target-active.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/decorations-drop-target.d.ts +3 -3
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/utils/active-anchor-tracker.d.ts +0 -3
- package/dist/types-ts4.5/pm-plugins/utils/inline-drop-target.d.ts +5 -1
- package/dist/types-ts4.5/ui/block-menu-items.d.ts +3 -3
- package/dist/types-ts4.5/ui/drop-target-layout.d.ts +1 -1
- package/dist/types-ts4.5/ui/drop-target.d.ts +2 -2
- package/dist/types-ts4.5/ui/inline-drop-target.d.ts +2 -2
- package/package.json +6 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 4.1.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 4.1.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#198359](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/198359)
|
|
14
|
+
[`077794c6e9512`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/077794c6e9512) -
|
|
15
|
+
Remove fg to ensure safari cursor is not hidden due to block controls
|
|
16
|
+
|
|
3
17
|
## 4.1.8
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -568,7 +568,10 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
568
568
|
},
|
|
569
569
|
props: {
|
|
570
570
|
decorations: function decorations(state) {
|
|
571
|
-
var _api$editorDisabled, _key$getState2;
|
|
571
|
+
var _api$limitedMode, _api$editorDisabled, _key$getState2;
|
|
572
|
+
if (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.enabled) {
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
572
575
|
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;
|
|
573
576
|
if (isDisabled) {
|
|
574
577
|
return;
|
|
@@ -625,6 +628,10 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
625
628
|
return false;
|
|
626
629
|
},
|
|
627
630
|
dragenter: function dragenter(view, event) {
|
|
631
|
+
var _api$limitedMode2;
|
|
632
|
+
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) {
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
628
635
|
if (isHTMLElement(event.target) && (0, _expValEquals.expValEquals)('platform_editor_block_controls_perf_optimization', 'isEnabled', true)) {
|
|
629
636
|
var targetElement = event.target.closest('[data-prosemirror-node-name]');
|
|
630
637
|
if (targetElement) {
|
|
@@ -655,7 +662,10 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
655
662
|
}
|
|
656
663
|
},
|
|
657
664
|
dragstart: function dragstart(view) {
|
|
658
|
-
var _anchorRectCache2;
|
|
665
|
+
var _api$limitedMode3, _anchorRectCache2;
|
|
666
|
+
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) {
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
659
669
|
(0, _performanceMeasures.startMeasure)(EDITOR_BLOCKS_DRAG_INIT);
|
|
660
670
|
if (isAdvancedLayoutEnabled) {
|
|
661
671
|
_activeAnchorTracker.defaultActiveAnchorTracker.reset();
|
|
@@ -670,7 +680,10 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
670
680
|
})));
|
|
671
681
|
},
|
|
672
682
|
dragend: function dragend(view) {
|
|
673
|
-
var _key$getState3;
|
|
683
|
+
var _api$limitedMode4, _key$getState3;
|
|
684
|
+
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) {
|
|
685
|
+
return;
|
|
686
|
+
}
|
|
674
687
|
var state = view.state,
|
|
675
688
|
dispatch = view.dispatch;
|
|
676
689
|
if ((_key$getState3 = key.getState(state)) !== null && _key$getState3 !== void 0 && _key$getState3.isPMDragging) {
|
|
@@ -688,11 +701,25 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
688
701
|
}
|
|
689
702
|
},
|
|
690
703
|
mouseover: function mouseover(view, event) {
|
|
704
|
+
var _api$limitedMode5;
|
|
705
|
+
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) {
|
|
706
|
+
return;
|
|
707
|
+
}
|
|
691
708
|
(0, _handleMouseOver.handleMouseOver)(view, event, api);
|
|
692
709
|
return false;
|
|
693
710
|
},
|
|
694
|
-
mousedown:
|
|
711
|
+
mousedown: function mousedown(view, event) {
|
|
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) {
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
716
|
+
return (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _handleMouseDown.handleMouseDown)(api)(view, event) : undefined;
|
|
717
|
+
},
|
|
695
718
|
keydown: function keydown(view, event) {
|
|
719
|
+
var _api$limitedMode7;
|
|
720
|
+
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) {
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
696
723
|
if (isMultiSelectEnabled) {
|
|
697
724
|
if (event.shiftKey && event.ctrlKey) {
|
|
698
725
|
//prevent holding down key combo from firing repeatedly
|
|
@@ -765,6 +792,10 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
765
792
|
}
|
|
766
793
|
},
|
|
767
794
|
keyup: function keyup(view, event) {
|
|
795
|
+
var _api$limitedMode8;
|
|
796
|
+
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) {
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
768
799
|
if (!event.repeat && event.key === 'Shift') {
|
|
769
800
|
view.dispatch(view.state.tr.setMeta(key, _objectSpread(_objectSpread({}, view.state.tr.getMeta(key)), {}, {
|
|
770
801
|
isShiftDown: false
|
|
@@ -772,6 +803,10 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
772
803
|
}
|
|
773
804
|
},
|
|
774
805
|
blur: function blur(view, event) {
|
|
806
|
+
var _api$limitedMode9;
|
|
807
|
+
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) {
|
|
808
|
+
return;
|
|
809
|
+
}
|
|
775
810
|
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
776
811
|
var _api$core2;
|
|
777
812
|
var isChildOfEditor = event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest("#".concat(_ui.EDIT_AREA_ID)) !== null;
|
|
@@ -11,7 +11,6 @@ var _styles = require("@atlaskit/editor-common/styles");
|
|
|
11
11
|
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
12
12
|
var _whitespace = require("@atlaskit/editor-common/whitespace");
|
|
13
13
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
14
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
14
|
var _constants = require("@atlaskit/theme/constants");
|
|
16
15
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
17
16
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
@@ -269,12 +268,6 @@ var headingWithIndentationInLayoutStyleFix = (0, _react.css)((0, _defineProperty
|
|
|
269
268
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
|
|
270
269
|
marginTop: '0 !important'
|
|
271
270
|
}));
|
|
272
|
-
var withRelativePosStyleLegacy = (0, _react.css)({
|
|
273
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
274
|
-
'.ProseMirror': (0, _defineProperty2.default)({}, "&& ".concat(dragHandlerAnchorSelector), {
|
|
275
|
-
position: 'relative'
|
|
276
|
-
})
|
|
277
|
-
});
|
|
278
271
|
var withRelativePosStyle = (0, _react.css)({
|
|
279
272
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
280
273
|
'.ProseMirror': (0, _defineProperty2.default)((0, _defineProperty2.default)({}, "&& ".concat(dragHandlerAnchorSelector), {
|
|
@@ -316,6 +309,6 @@ var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWra
|
|
|
316
309
|
disabled: !(0, _expValEquals.expValEquals)('platform_editor_block_controls_perf_optimization', 'isEnabled', true)
|
|
317
310
|
});
|
|
318
311
|
return (0, _react.jsx)(_react.Global, {
|
|
319
|
-
styles: [globalStyles(), globalDnDStyle, extendedHoverZone(), isDragging && extendedDragZone, (0, _expValEquals.expValEquals)('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? extendHoverZoneReduced : undefined, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? undefined : withInlineNodeStyle, (0, _experiments.editorExperiment)('platform_editor_block_control_optimise_render', true) ? quickInsertStyles : undefined, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, (0, _experiments.editorExperiment)('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix,
|
|
312
|
+
styles: [globalStyles(), globalDnDStyle, extendedHoverZone(), isDragging && extendedDragZone, (0, _expValEquals.expValEquals)('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? extendHoverZoneReduced : undefined, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? undefined : withInlineNodeStyle, (0, _experiments.editorExperiment)('platform_editor_block_control_optimise_render', true) ? quickInsertStyles : undefined, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, (0, _experiments.editorExperiment)('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix, withRelativePosStyle, topLevelNodeMarginStyles, withAnchorNameZindexStyle]
|
|
320
313
|
});
|
|
321
314
|
};
|
|
@@ -567,7 +567,10 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
|
567
567
|
},
|
|
568
568
|
props: {
|
|
569
569
|
decorations: state => {
|
|
570
|
-
var _api$editorDisabled, _api$editorDisabled$s, _key$getState2;
|
|
570
|
+
var _api$limitedMode, _api$limitedMode$shar, _api$editorDisabled, _api$editorDisabled$s, _key$getState2;
|
|
571
|
+
if (api !== null && api !== void 0 && (_api$limitedMode = api.limitedMode) !== null && _api$limitedMode !== void 0 && (_api$limitedMode$shar = _api$limitedMode.sharedState.currentState()) !== null && _api$limitedMode$shar !== void 0 && _api$limitedMode$shar.enabled) {
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
571
574
|
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;
|
|
572
575
|
if (isDisabled) {
|
|
573
576
|
return;
|
|
@@ -627,6 +630,10 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
|
627
630
|
return false;
|
|
628
631
|
},
|
|
629
632
|
dragenter(view, event) {
|
|
633
|
+
var _api$limitedMode2, _api$limitedMode2$sha;
|
|
634
|
+
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) {
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
630
637
|
if (isHTMLElement(event.target) && expValEquals('platform_editor_block_controls_perf_optimization', 'isEnabled', true)) {
|
|
631
638
|
const targetElement = event.target.closest('[data-prosemirror-node-name]');
|
|
632
639
|
if (targetElement) {
|
|
@@ -657,7 +664,10 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
|
657
664
|
}
|
|
658
665
|
},
|
|
659
666
|
dragstart(view) {
|
|
660
|
-
var _anchorRectCache2;
|
|
667
|
+
var _api$limitedMode3, _api$limitedMode3$sha, _anchorRectCache2;
|
|
668
|
+
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) {
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
661
671
|
startMeasure(EDITOR_BLOCKS_DRAG_INIT);
|
|
662
672
|
if (isAdvancedLayoutEnabled) {
|
|
663
673
|
defaultActiveAnchorTracker.reset();
|
|
@@ -673,7 +683,10 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
|
673
683
|
}));
|
|
674
684
|
},
|
|
675
685
|
dragend(view) {
|
|
676
|
-
var _key$getState3;
|
|
686
|
+
var _api$limitedMode4, _api$limitedMode4$sha, _key$getState3;
|
|
687
|
+
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) {
|
|
688
|
+
return;
|
|
689
|
+
}
|
|
677
690
|
const {
|
|
678
691
|
state,
|
|
679
692
|
dispatch
|
|
@@ -694,11 +707,25 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
|
694
707
|
}
|
|
695
708
|
},
|
|
696
709
|
mouseover: (view, event) => {
|
|
710
|
+
var _api$limitedMode5, _api$limitedMode5$sha;
|
|
711
|
+
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) {
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
697
714
|
handleMouseOver(view, event, api);
|
|
698
715
|
return false;
|
|
699
716
|
},
|
|
700
|
-
mousedown:
|
|
717
|
+
mousedown: (view, event) => {
|
|
718
|
+
var _api$limitedMode6, _api$limitedMode6$sha;
|
|
719
|
+
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) {
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
return editorExperiment('platform_editor_controls', 'variant1') ? handleMouseDown(api)(view, event) : undefined;
|
|
723
|
+
},
|
|
701
724
|
keydown(view, event) {
|
|
725
|
+
var _api$limitedMode7, _api$limitedMode7$sha;
|
|
726
|
+
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) {
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
702
729
|
if (isMultiSelectEnabled) {
|
|
703
730
|
if (event.shiftKey && event.ctrlKey) {
|
|
704
731
|
//prevent holding down key combo from firing repeatedly
|
|
@@ -774,6 +801,10 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
|
774
801
|
}
|
|
775
802
|
},
|
|
776
803
|
keyup(view, event) {
|
|
804
|
+
var _api$limitedMode8, _api$limitedMode8$sha;
|
|
805
|
+
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) {
|
|
806
|
+
return;
|
|
807
|
+
}
|
|
777
808
|
if (!event.repeat && event.key === 'Shift') {
|
|
778
809
|
view.dispatch(view.state.tr.setMeta(key, {
|
|
779
810
|
...view.state.tr.getMeta(key),
|
|
@@ -782,6 +813,10 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
|
782
813
|
}
|
|
783
814
|
},
|
|
784
815
|
blur(view, event) {
|
|
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) {
|
|
818
|
+
return;
|
|
819
|
+
}
|
|
785
820
|
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
786
821
|
var _api$core2;
|
|
787
822
|
const isChildOfEditor = event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest(`#${EDIT_AREA_ID}`) !== null;
|
|
@@ -8,7 +8,6 @@ import { tableControlsSpacing } from '@atlaskit/editor-common/styles';
|
|
|
8
8
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
9
9
|
import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace';
|
|
10
10
|
import { akEditorBreakoutPadding, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout } from '@atlaskit/editor-shared-styles';
|
|
11
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
11
|
import { layers } from '@atlaskit/theme/constants';
|
|
13
12
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
13
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -299,15 +298,6 @@ const headingWithIndentationInLayoutStyleFix = css({
|
|
|
299
298
|
marginTop: '0 !important'
|
|
300
299
|
}
|
|
301
300
|
});
|
|
302
|
-
const withRelativePosStyleLegacy = css({
|
|
303
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
304
|
-
'.ProseMirror': {
|
|
305
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
306
|
-
[`&& ${dragHandlerAnchorSelector}`]: {
|
|
307
|
-
position: 'relative'
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
});
|
|
311
301
|
const withRelativePosStyle = css({
|
|
312
302
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
313
303
|
'.ProseMirror': {
|
|
@@ -355,6 +345,6 @@ export const GlobalStylesWrapper = ({
|
|
|
355
345
|
disabled: !expValEquals('platform_editor_block_controls_perf_optimization', 'isEnabled', true)
|
|
356
346
|
});
|
|
357
347
|
return jsx(Global, {
|
|
358
|
-
styles: [globalStyles(), globalDnDStyle, extendedHoverZone(), isDragging && extendedDragZone, expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? extendHoverZoneReduced : undefined, editorExperiment('platform_editor_controls', 'variant1') ? undefined : withInlineNodeStyle, editorExperiment('platform_editor_block_control_optimise_render', true) ? quickInsertStyles : undefined, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, editorExperiment('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix,
|
|
348
|
+
styles: [globalStyles(), globalDnDStyle, extendedHoverZone(), isDragging && extendedDragZone, expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? extendHoverZoneReduced : undefined, editorExperiment('platform_editor_controls', 'variant1') ? undefined : withInlineNodeStyle, editorExperiment('platform_editor_block_control_optimise_render', true) ? quickInsertStyles : undefined, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, editorExperiment('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix, withRelativePosStyle, topLevelNodeMarginStyles, withAnchorNameZindexStyle]
|
|
359
349
|
});
|
|
360
350
|
};
|
|
@@ -562,7 +562,10 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
562
562
|
},
|
|
563
563
|
props: {
|
|
564
564
|
decorations: function decorations(state) {
|
|
565
|
-
var _api$editorDisabled, _key$getState2;
|
|
565
|
+
var _api$limitedMode, _api$editorDisabled, _key$getState2;
|
|
566
|
+
if (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.enabled) {
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
566
569
|
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;
|
|
567
570
|
if (isDisabled) {
|
|
568
571
|
return;
|
|
@@ -619,6 +622,10 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
619
622
|
return false;
|
|
620
623
|
},
|
|
621
624
|
dragenter: function dragenter(view, event) {
|
|
625
|
+
var _api$limitedMode2;
|
|
626
|
+
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) {
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
622
629
|
if (isHTMLElement(event.target) && expValEquals('platform_editor_block_controls_perf_optimization', 'isEnabled', true)) {
|
|
623
630
|
var targetElement = event.target.closest('[data-prosemirror-node-name]');
|
|
624
631
|
if (targetElement) {
|
|
@@ -649,7 +656,10 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
649
656
|
}
|
|
650
657
|
},
|
|
651
658
|
dragstart: function dragstart(view) {
|
|
652
|
-
var _anchorRectCache2;
|
|
659
|
+
var _api$limitedMode3, _anchorRectCache2;
|
|
660
|
+
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) {
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
653
663
|
startMeasure(EDITOR_BLOCKS_DRAG_INIT);
|
|
654
664
|
if (isAdvancedLayoutEnabled) {
|
|
655
665
|
defaultActiveAnchorTracker.reset();
|
|
@@ -664,7 +674,10 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
664
674
|
})));
|
|
665
675
|
},
|
|
666
676
|
dragend: function dragend(view) {
|
|
667
|
-
var _key$getState3;
|
|
677
|
+
var _api$limitedMode4, _key$getState3;
|
|
678
|
+
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) {
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
668
681
|
var state = view.state,
|
|
669
682
|
dispatch = view.dispatch;
|
|
670
683
|
if ((_key$getState3 = key.getState(state)) !== null && _key$getState3 !== void 0 && _key$getState3.isPMDragging) {
|
|
@@ -682,11 +695,25 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
682
695
|
}
|
|
683
696
|
},
|
|
684
697
|
mouseover: function mouseover(view, event) {
|
|
698
|
+
var _api$limitedMode5;
|
|
699
|
+
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) {
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
685
702
|
handleMouseOver(view, event, api);
|
|
686
703
|
return false;
|
|
687
704
|
},
|
|
688
|
-
mousedown:
|
|
705
|
+
mousedown: function mousedown(view, event) {
|
|
706
|
+
var _api$limitedMode6;
|
|
707
|
+
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) {
|
|
708
|
+
return;
|
|
709
|
+
}
|
|
710
|
+
return editorExperiment('platform_editor_controls', 'variant1') ? handleMouseDown(api)(view, event) : undefined;
|
|
711
|
+
},
|
|
689
712
|
keydown: function keydown(view, event) {
|
|
713
|
+
var _api$limitedMode7;
|
|
714
|
+
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
|
+
return;
|
|
716
|
+
}
|
|
690
717
|
if (isMultiSelectEnabled) {
|
|
691
718
|
if (event.shiftKey && event.ctrlKey) {
|
|
692
719
|
//prevent holding down key combo from firing repeatedly
|
|
@@ -759,6 +786,10 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
759
786
|
}
|
|
760
787
|
},
|
|
761
788
|
keyup: function keyup(view, event) {
|
|
789
|
+
var _api$limitedMode8;
|
|
790
|
+
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) {
|
|
791
|
+
return;
|
|
792
|
+
}
|
|
762
793
|
if (!event.repeat && event.key === 'Shift') {
|
|
763
794
|
view.dispatch(view.state.tr.setMeta(key, _objectSpread(_objectSpread({}, view.state.tr.getMeta(key)), {}, {
|
|
764
795
|
isShiftDown: false
|
|
@@ -766,6 +797,10 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
766
797
|
}
|
|
767
798
|
},
|
|
768
799
|
blur: function blur(view, event) {
|
|
800
|
+
var _api$limitedMode9;
|
|
801
|
+
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) {
|
|
802
|
+
return;
|
|
803
|
+
}
|
|
769
804
|
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
770
805
|
var _api$core2;
|
|
771
806
|
var isChildOfEditor = event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest("#".concat(EDIT_AREA_ID)) !== null;
|
|
@@ -9,7 +9,6 @@ import { tableControlsSpacing } from '@atlaskit/editor-common/styles';
|
|
|
9
9
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
10
10
|
import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace';
|
|
11
11
|
import { akEditorBreakoutPadding, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout } from '@atlaskit/editor-shared-styles';
|
|
12
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
12
|
import { layers } from '@atlaskit/theme/constants';
|
|
14
13
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
15
14
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -262,12 +261,6 @@ var headingWithIndentationInLayoutStyleFix = css(_defineProperty({}, "".concat(d
|
|
|
262
261
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
|
|
263
262
|
marginTop: '0 !important'
|
|
264
263
|
}));
|
|
265
|
-
var withRelativePosStyleLegacy = css({
|
|
266
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
267
|
-
'.ProseMirror': _defineProperty({}, "&& ".concat(dragHandlerAnchorSelector), {
|
|
268
|
-
position: 'relative'
|
|
269
|
-
})
|
|
270
|
-
});
|
|
271
264
|
var withRelativePosStyle = css({
|
|
272
265
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
273
266
|
'.ProseMirror': _defineProperty(_defineProperty({}, "&& ".concat(dragHandlerAnchorSelector), {
|
|
@@ -309,6 +302,6 @@ export var GlobalStylesWrapper = function GlobalStylesWrapper(_ref) {
|
|
|
309
302
|
disabled: !expValEquals('platform_editor_block_controls_perf_optimization', 'isEnabled', true)
|
|
310
303
|
});
|
|
311
304
|
return jsx(Global, {
|
|
312
|
-
styles: [globalStyles(), globalDnDStyle, extendedHoverZone(), isDragging && extendedDragZone, expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? extendHoverZoneReduced : undefined, editorExperiment('platform_editor_controls', 'variant1') ? undefined : withInlineNodeStyle, editorExperiment('platform_editor_block_control_optimise_render', true) ? quickInsertStyles : undefined, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, editorExperiment('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix,
|
|
305
|
+
styles: [globalStyles(), globalDnDStyle, extendedHoverZone(), isDragging && extendedDragZone, expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? extendHoverZoneReduced : undefined, editorExperiment('platform_editor_controls', 'variant1') ? undefined : withInlineNodeStyle, editorExperiment('platform_editor_block_control_optimise_render', true) ? quickInsertStyles : undefined, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, editorExperiment('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix, withRelativePosStyle, topLevelNodeMarginStyles, withAnchorNameZindexStyle]
|
|
313
306
|
});
|
|
314
307
|
};
|
|
@@ -6,6 +6,7 @@ import { type AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
|
6
6
|
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
7
7
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
8
8
|
import type { InteractionPlugin } from '@atlaskit/editor-plugin-interaction';
|
|
9
|
+
import type { LimitedModePlugin } from '@atlaskit/editor-plugin-limited-mode';
|
|
9
10
|
import type { MetricsPlugin } from '@atlaskit/editor-plugin-metrics';
|
|
10
11
|
import type { QuickInsertPlugin } from '@atlaskit/editor-plugin-quick-insert';
|
|
11
12
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
@@ -79,6 +80,7 @@ export type HandleOptions = {
|
|
|
79
80
|
} | undefined;
|
|
80
81
|
export type MoveNode = (start: number, to: number, inputMethod?: MoveNodeMethod, formatMessage?: IntlShape['formatMessage']) => EditorCommand;
|
|
81
82
|
export type BlockControlsPluginDependencies = [
|
|
83
|
+
OptionalPlugin<LimitedModePlugin>,
|
|
82
84
|
OptionalPlugin<EditorDisabledPlugin>,
|
|
83
85
|
OptionalPlugin<WidthPlugin>,
|
|
84
86
|
OptionalPlugin<FeatureFlagsPlugin>,
|
|
@@ -2,5 +2,5 @@ import { type IntlShape } from 'react-intl-next';
|
|
|
2
2
|
import type { Command, EditorCommand, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { BlockControlsPlugin, MoveNodeMethod } from '../blockControlsPluginType';
|
|
4
4
|
import { DIRECTION } from '../pm-plugins/utils/consts';
|
|
5
|
-
export declare const moveNodeViaShortcut: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, direction: DIRECTION, formatMessage?: IntlShape[
|
|
6
|
-
export declare const moveNode: (api?: ExtractInjectionAPI<BlockControlsPlugin>) => (start: number, to: number, inputMethod?: MoveNodeMethod, formatMessage?: IntlShape[
|
|
5
|
+
export declare const moveNodeViaShortcut: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, direction: DIRECTION, formatMessage?: IntlShape["formatMessage"]) => Command;
|
|
6
|
+
export declare const moveNode: (api?: ExtractInjectionAPI<BlockControlsPlugin>) => (start: number, to: number, inputMethod?: MoveNodeMethod, formatMessage?: IntlShape["formatMessage"]) => EditorCommand;
|
|
@@ -7,7 +7,7 @@ import { type Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
|
7
7
|
import type { ActiveDropTargetNode, ActiveNode, BlockControlsPlugin } from '../blockControlsPluginType';
|
|
8
8
|
import type { AnchorRectCache } from './utils/anchor-utils';
|
|
9
9
|
export declare const canMoveNodeOrSliceToPos: (state: EditorState, node: PMNode, parent: PMNode, index: number, $toPos: ResolvedPos, activeNode?: ActiveNode) => boolean | null;
|
|
10
|
-
export declare const getActiveDropTargetDecorations: (activeDropTargetNode: ActiveDropTargetNode, state: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>, existingDecs: Decoration[], formatMessage: IntlShape[
|
|
10
|
+
export declare const getActiveDropTargetDecorations: (activeDropTargetNode: ActiveDropTargetNode, state: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>, existingDecs: Decoration[], formatMessage: IntlShape["formatMessage"], nodeViewPortalProviderAPI: PortalProviderAPI, activeNode?: ActiveNode, anchorRectCache?: AnchorRectCache) => {
|
|
11
11
|
decsToAdd: Decoration[];
|
|
12
12
|
decsToRemove: Decoration[];
|
|
13
13
|
};
|
|
@@ -15,6 +15,6 @@ import { type AnchorRectCache } from './utils/anchor-utils';
|
|
|
15
15
|
* @returns
|
|
16
16
|
*/
|
|
17
17
|
export declare const findDropTargetDecs: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
|
|
18
|
-
export declare const createDropTargetDecoration: (pos: number, props: Omit<DropTargetProps,
|
|
19
|
-
export declare const createLayoutDropTargetDecoration: (pos: number, props: Omit<DropTargetLayoutProps,
|
|
20
|
-
export declare const dropTargetDecorations: (newState: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape[
|
|
18
|
+
export declare const createDropTargetDecoration: (pos: number, props: Omit<DropTargetProps, "getPos">, nodeViewPortalProviderAPI: PortalProviderAPI, side?: number, anchorRectCache?: AnchorRectCache, isSameLayout?: boolean) => Decoration;
|
|
19
|
+
export declare const createLayoutDropTargetDecoration: (pos: number, props: Omit<DropTargetLayoutProps, "getPos">, nodeViewPortalProviderAPI: PortalProviderAPI, anchorRectCache?: AnchorRectCache) => Decoration;
|
|
20
|
+
export declare const dropTargetDecorations: (newState: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape["formatMessage"], nodeViewPortalProviderAPI: PortalProviderAPI, activeNode?: ActiveNode, anchorRectCache?: AnchorRectCache, from?: number, to?: number) => Decoration[];
|
|
@@ -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[
|
|
15
|
+
export declare const apply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape["formatMessage"], tr: ReadonlyTransaction, currentState: PluginState, newState: EditorState, flags: FlagType, nodeViewPortalProviderAPI: PortalProviderAPI, anchorRectCache?: AnchorRectCache) => {
|
|
16
16
|
decorations: DecorationSet;
|
|
17
17
|
activeNode: any;
|
|
18
18
|
activeDropTargetNode: ActiveDropTargetNode | undefined;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import { type ActiveNode } from '../../blockControlsPluginType';
|
|
3
|
-
export declare const shouldAllowInlineDropTarget: (isNested: boolean, node?: PMNode,
|
|
3
|
+
export declare const shouldAllowInlineDropTarget: (isNested: boolean, node?: PMNode,
|
|
4
|
+
/**
|
|
5
|
+
* Is the active node in the same layout as the target node
|
|
6
|
+
*/
|
|
7
|
+
isSameLayout?: boolean, activeNode?: ActiveNode) => boolean;
|
|
@@ -6,10 +6,10 @@ import type { IntlShape } from 'react-intl-next';
|
|
|
6
6
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
7
7
|
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
8
8
|
import type { BlockControlsPlugin } from '../blockControlsPluginType';
|
|
9
|
-
export declare const getBlockMenuItems: (formatMessage: IntlShape[
|
|
9
|
+
export declare const getBlockMenuItems: (formatMessage: IntlShape["formatMessage"]) => {
|
|
10
10
|
items: MenuItem[];
|
|
11
11
|
}[];
|
|
12
12
|
export declare const menuItemsCallback: {
|
|
13
|
-
moveUp: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape[
|
|
14
|
-
moveDown: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape[
|
|
13
|
+
moveUp: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape["formatMessage"]) => import("@atlaskit/editor-common/types").Command;
|
|
14
|
+
moveDown: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape["formatMessage"]) => import("@atlaskit/editor-common/types").Command;
|
|
15
15
|
};
|
|
@@ -11,5 +11,5 @@ export type DropTargetLayoutProps = {
|
|
|
11
11
|
formatMessage?: IntlShape['formatMessage'];
|
|
12
12
|
};
|
|
13
13
|
export declare const DropTargetLayout: (props: DropTargetLayoutProps & {
|
|
14
|
-
anchorRectCache?: AnchorRectCache
|
|
14
|
+
anchorRectCache?: AnchorRectCache;
|
|
15
15
|
}) => jsx.JSX.Element | null;
|
|
@@ -17,6 +17,6 @@ export type DropTargetProps = {
|
|
|
17
17
|
formatMessage?: IntlShape['formatMessage'];
|
|
18
18
|
};
|
|
19
19
|
export declare const DropTarget: (props: DropTargetProps & {
|
|
20
|
-
anchorRectCache?: AnchorRectCache
|
|
21
|
-
isSameLayout?: boolean
|
|
20
|
+
anchorRectCache?: AnchorRectCache;
|
|
21
|
+
isSameLayout?: boolean;
|
|
22
22
|
}) => jsx.JSX.Element;
|
|
@@ -2,6 +2,6 @@ import { jsx } from '@emotion/react';
|
|
|
2
2
|
import { type AnchorRectCache } from '../pm-plugins/utils/anchor-utils';
|
|
3
3
|
import { type DropTargetProps } from './drop-target';
|
|
4
4
|
export declare const InlineDropTarget: ({ api, nextNode, position, anchorRectCache, getPos, }: DropTargetProps & {
|
|
5
|
-
anchorRectCache?: AnchorRectCache
|
|
6
|
-
position:
|
|
5
|
+
anchorRectCache?: AnchorRectCache;
|
|
6
|
+
position: "left" | "right";
|
|
7
7
|
}) => jsx.JSX.Element;
|
|
@@ -6,6 +6,7 @@ import { type AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
|
6
6
|
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
7
7
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
8
8
|
import type { InteractionPlugin } from '@atlaskit/editor-plugin-interaction';
|
|
9
|
+
import type { LimitedModePlugin } from '@atlaskit/editor-plugin-limited-mode';
|
|
9
10
|
import type { MetricsPlugin } from '@atlaskit/editor-plugin-metrics';
|
|
10
11
|
import type { QuickInsertPlugin } from '@atlaskit/editor-plugin-quick-insert';
|
|
11
12
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
@@ -79,6 +80,7 @@ export type HandleOptions = {
|
|
|
79
80
|
} | undefined;
|
|
80
81
|
export type MoveNode = (start: number, to: number, inputMethod?: MoveNodeMethod, formatMessage?: IntlShape['formatMessage']) => EditorCommand;
|
|
81
82
|
export type BlockControlsPluginDependencies = [
|
|
83
|
+
OptionalPlugin<LimitedModePlugin>,
|
|
82
84
|
OptionalPlugin<EditorDisabledPlugin>,
|
|
83
85
|
OptionalPlugin<WidthPlugin>,
|
|
84
86
|
OptionalPlugin<FeatureFlagsPlugin>,
|
|
@@ -2,5 +2,5 @@ import { type IntlShape } from 'react-intl-next';
|
|
|
2
2
|
import type { Command, EditorCommand, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { BlockControlsPlugin, MoveNodeMethod } from '../blockControlsPluginType';
|
|
4
4
|
import { DIRECTION } from '../pm-plugins/utils/consts';
|
|
5
|
-
export declare const moveNodeViaShortcut: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, direction: DIRECTION, formatMessage?: IntlShape[
|
|
6
|
-
export declare const moveNode: (api?: ExtractInjectionAPI<BlockControlsPlugin>) => (start: number, to: number, inputMethod?: MoveNodeMethod, formatMessage?: IntlShape[
|
|
5
|
+
export declare const moveNodeViaShortcut: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, direction: DIRECTION, formatMessage?: IntlShape["formatMessage"]) => Command;
|
|
6
|
+
export declare const moveNode: (api?: ExtractInjectionAPI<BlockControlsPlugin>) => (start: number, to: number, inputMethod?: MoveNodeMethod, formatMessage?: IntlShape["formatMessage"]) => EditorCommand;
|
|
@@ -7,7 +7,7 @@ import { type Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
|
7
7
|
import type { ActiveDropTargetNode, ActiveNode, BlockControlsPlugin } from '../blockControlsPluginType';
|
|
8
8
|
import type { AnchorRectCache } from './utils/anchor-utils';
|
|
9
9
|
export declare const canMoveNodeOrSliceToPos: (state: EditorState, node: PMNode, parent: PMNode, index: number, $toPos: ResolvedPos, activeNode?: ActiveNode) => boolean | null;
|
|
10
|
-
export declare const getActiveDropTargetDecorations: (activeDropTargetNode: ActiveDropTargetNode, state: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>, existingDecs: Decoration[], formatMessage: IntlShape[
|
|
10
|
+
export declare const getActiveDropTargetDecorations: (activeDropTargetNode: ActiveDropTargetNode, state: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>, existingDecs: Decoration[], formatMessage: IntlShape["formatMessage"], nodeViewPortalProviderAPI: PortalProviderAPI, activeNode?: ActiveNode, anchorRectCache?: AnchorRectCache) => {
|
|
11
11
|
decsToAdd: Decoration[];
|
|
12
12
|
decsToRemove: Decoration[];
|
|
13
13
|
};
|
|
@@ -15,6 +15,6 @@ import { type AnchorRectCache } from './utils/anchor-utils';
|
|
|
15
15
|
* @returns
|
|
16
16
|
*/
|
|
17
17
|
export declare const findDropTargetDecs: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
|
|
18
|
-
export declare const createDropTargetDecoration: (pos: number, props: Omit<DropTargetProps,
|
|
19
|
-
export declare const createLayoutDropTargetDecoration: (pos: number, props: Omit<DropTargetLayoutProps,
|
|
20
|
-
export declare const dropTargetDecorations: (newState: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape[
|
|
18
|
+
export declare const createDropTargetDecoration: (pos: number, props: Omit<DropTargetProps, "getPos">, nodeViewPortalProviderAPI: PortalProviderAPI, side?: number, anchorRectCache?: AnchorRectCache, isSameLayout?: boolean) => Decoration;
|
|
19
|
+
export declare const createLayoutDropTargetDecoration: (pos: number, props: Omit<DropTargetLayoutProps, "getPos">, nodeViewPortalProviderAPI: PortalProviderAPI, anchorRectCache?: AnchorRectCache) => Decoration;
|
|
20
|
+
export declare const dropTargetDecorations: (newState: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape["formatMessage"], nodeViewPortalProviderAPI: PortalProviderAPI, activeNode?: ActiveNode, anchorRectCache?: AnchorRectCache, from?: number, to?: number) => Decoration[];
|
|
@@ -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[
|
|
15
|
+
export declare const apply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape["formatMessage"], tr: ReadonlyTransaction, currentState: PluginState, newState: EditorState, flags: FlagType, nodeViewPortalProviderAPI: PortalProviderAPI, anchorRectCache?: AnchorRectCache) => {
|
|
16
16
|
decorations: DecorationSet;
|
|
17
17
|
activeNode: any;
|
|
18
18
|
activeDropTargetNode: ActiveDropTargetNode | undefined;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import { type ActiveNode } from '../../blockControlsPluginType';
|
|
3
|
-
export declare const shouldAllowInlineDropTarget: (isNested: boolean, node?: PMNode,
|
|
3
|
+
export declare const shouldAllowInlineDropTarget: (isNested: boolean, node?: PMNode,
|
|
4
|
+
/**
|
|
5
|
+
* Is the active node in the same layout as the target node
|
|
6
|
+
*/
|
|
7
|
+
isSameLayout?: boolean, activeNode?: ActiveNode) => boolean;
|
|
@@ -6,10 +6,10 @@ import type { IntlShape } from 'react-intl-next';
|
|
|
6
6
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
7
7
|
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
8
8
|
import type { BlockControlsPlugin } from '../blockControlsPluginType';
|
|
9
|
-
export declare const getBlockMenuItems: (formatMessage: IntlShape[
|
|
9
|
+
export declare const getBlockMenuItems: (formatMessage: IntlShape["formatMessage"]) => {
|
|
10
10
|
items: MenuItem[];
|
|
11
11
|
}[];
|
|
12
12
|
export declare const menuItemsCallback: {
|
|
13
|
-
moveUp: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape[
|
|
14
|
-
moveDown: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape[
|
|
13
|
+
moveUp: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape["formatMessage"]) => import("@atlaskit/editor-common/types").Command;
|
|
14
|
+
moveDown: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape["formatMessage"]) => import("@atlaskit/editor-common/types").Command;
|
|
15
15
|
};
|
|
@@ -11,5 +11,5 @@ export type DropTargetLayoutProps = {
|
|
|
11
11
|
formatMessage?: IntlShape['formatMessage'];
|
|
12
12
|
};
|
|
13
13
|
export declare const DropTargetLayout: (props: DropTargetLayoutProps & {
|
|
14
|
-
anchorRectCache?: AnchorRectCache
|
|
14
|
+
anchorRectCache?: AnchorRectCache;
|
|
15
15
|
}) => jsx.JSX.Element | null;
|
|
@@ -17,6 +17,6 @@ export type DropTargetProps = {
|
|
|
17
17
|
formatMessage?: IntlShape['formatMessage'];
|
|
18
18
|
};
|
|
19
19
|
export declare const DropTarget: (props: DropTargetProps & {
|
|
20
|
-
anchorRectCache?: AnchorRectCache
|
|
21
|
-
isSameLayout?: boolean
|
|
20
|
+
anchorRectCache?: AnchorRectCache;
|
|
21
|
+
isSameLayout?: boolean;
|
|
22
22
|
}) => jsx.JSX.Element;
|
|
@@ -2,6 +2,6 @@ import { jsx } from '@emotion/react';
|
|
|
2
2
|
import { type AnchorRectCache } from '../pm-plugins/utils/anchor-utils';
|
|
3
3
|
import { type DropTargetProps } from './drop-target';
|
|
4
4
|
export declare const InlineDropTarget: ({ api, nextNode, position, anchorRectCache, getPos, }: DropTargetProps & {
|
|
5
|
-
anchorRectCache?: AnchorRectCache
|
|
6
|
-
position:
|
|
5
|
+
anchorRectCache?: AnchorRectCache;
|
|
6
|
+
position: "left" | "right";
|
|
7
7
|
}) => jsx.JSX.Element;
|
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.10",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -37,6 +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.1",
|
|
40
41
|
"@atlaskit/editor-plugin-metrics": "^4.0.0",
|
|
41
42
|
"@atlaskit/editor-plugin-quick-insert": "^3.0.0",
|
|
42
43
|
"@atlaskit/editor-plugin-selection": "^3.0.0",
|
|
@@ -44,9 +45,9 @@
|
|
|
44
45
|
"@atlaskit/editor-plugin-user-intent": "^1.1.0",
|
|
45
46
|
"@atlaskit/editor-plugin-width": "^4.0.0",
|
|
46
47
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
47
|
-
"@atlaskit/editor-shared-styles": "^3.
|
|
48
|
+
"@atlaskit/editor-shared-styles": "^3.6.0",
|
|
48
49
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
49
|
-
"@atlaskit/icon": "^27.
|
|
50
|
+
"@atlaskit/icon": "^27.12.0",
|
|
50
51
|
"@atlaskit/link": "^3.2.0",
|
|
51
52
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
52
53
|
"@atlaskit/pragmatic-drag-and-drop": "^1.7.0",
|
|
@@ -54,7 +55,7 @@
|
|
|
54
55
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
|
|
55
56
|
"@atlaskit/primitives": "^14.11.0",
|
|
56
57
|
"@atlaskit/theme": "^19.0.0",
|
|
57
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
58
|
+
"@atlaskit/tmp-editor-statsig": "^10.0.0",
|
|
58
59
|
"@atlaskit/tokens": "^6.0.0",
|
|
59
60
|
"@atlaskit/tooltip": "^20.4.0",
|
|
60
61
|
"@babel/runtime": "^7.0.0",
|
|
@@ -66,7 +67,7 @@
|
|
|
66
67
|
"uuid": "^3.1.0"
|
|
67
68
|
},
|
|
68
69
|
"peerDependencies": {
|
|
69
|
-
"@atlaskit/editor-common": "^107.
|
|
70
|
+
"@atlaskit/editor-common": "^107.25.0",
|
|
70
71
|
"react": "^18.2.0",
|
|
71
72
|
"react-dom": "^18.2.0",
|
|
72
73
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
@@ -149,9 +150,6 @@
|
|
|
149
150
|
"platform_editor_elements_dnd_multi_select_patch_3": {
|
|
150
151
|
"type": "boolean"
|
|
151
152
|
},
|
|
152
|
-
"platform_editor_fix_safari_cursor_hidden_empty": {
|
|
153
|
-
"type": "boolean"
|
|
154
|
-
},
|
|
155
153
|
"platform_editor_drag_and_drop_perf_analytics": {
|
|
156
154
|
"type": "boolean"
|
|
157
155
|
},
|