@atlaskit/editor-plugin-block-controls 3.8.2 → 3.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/pm-plugins/decorations-drag-handle.js +26 -12
- package/dist/cjs/pm-plugins/decorations-quick-insert-button.js +32 -13
- package/dist/cjs/ui/drag-handle.js +22 -1
- package/dist/cjs/ui/quick-insert-button.js +37 -5
- package/dist/cjs/ui/visibility-container.js +30 -0
- package/dist/es2019/pm-plugins/decorations-drag-handle.js +27 -13
- package/dist/es2019/pm-plugins/decorations-quick-insert-button.js +29 -12
- package/dist/es2019/ui/drag-handle.js +22 -0
- package/dist/es2019/ui/quick-insert-button.js +37 -4
- package/dist/es2019/ui/visibility-container.js +24 -0
- package/dist/esm/pm-plugins/decorations-drag-handle.js +27 -13
- package/dist/esm/pm-plugins/decorations-quick-insert-button.js +33 -14
- package/dist/esm/ui/drag-handle.js +21 -0
- package/dist/esm/ui/quick-insert-button.js +36 -4
- package/dist/esm/ui/visibility-container.js +23 -0
- package/dist/types/ui/drag-handle.d.ts +7 -4
- package/dist/types/ui/quick-insert-button.d.ts +1 -0
- package/dist/types/ui/visibility-container.d.ts +9 -0
- package/dist/types-ts4.5/ui/drag-handle.d.ts +7 -4
- package/dist/types-ts4.5/ui/quick-insert-button.d.ts +1 -0
- package/dist/types-ts4.5/ui/visibility-container.d.ts +9 -0
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 3.8.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#136942](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/136942)
|
|
8
|
+
[`47faad73d7f6c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/47faad73d7f6c) -
|
|
9
|
+
Add visibility container which wraps both block control widgets to control their visibility
|
|
10
|
+
|
|
11
|
+
## 3.8.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 3.8.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -11,6 +11,7 @@ var _bindEventListener = require("bind-event-listener");
|
|
|
11
11
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
12
12
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
13
13
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
14
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
15
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
15
16
|
var _dragHandle = require("../ui/drag-handle");
|
|
16
17
|
var _decorationsCommon = require("./decorations-common");
|
|
@@ -92,18 +93,31 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
|
|
|
92
93
|
// key,
|
|
93
94
|
// );
|
|
94
95
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
96
|
+
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_widget_visibility')) {
|
|
97
|
+
_reactDom.default.render( /*#__PURE__*/(0, _react.createElement)(_dragHandle.DragHandleWithVisibility, {
|
|
98
|
+
view: view,
|
|
99
|
+
api: api,
|
|
100
|
+
formatMessage: formatMessage,
|
|
101
|
+
getPos: getPos,
|
|
102
|
+
anchorName: anchorName,
|
|
103
|
+
nodeType: nodeType,
|
|
104
|
+
handleOptions: handleOptions,
|
|
105
|
+
isTopLevelNode: isTopLevelNode,
|
|
106
|
+
anchorRectCache: anchorRectCache
|
|
107
|
+
}), element);
|
|
108
|
+
} else {
|
|
109
|
+
_reactDom.default.render( /*#__PURE__*/(0, _react.createElement)(_dragHandle.DragHandle, {
|
|
110
|
+
view: view,
|
|
111
|
+
api: api,
|
|
112
|
+
formatMessage: formatMessage,
|
|
113
|
+
getPos: getPos,
|
|
114
|
+
anchorName: anchorName,
|
|
115
|
+
nodeType: nodeType,
|
|
116
|
+
handleOptions: handleOptions,
|
|
117
|
+
isTopLevelNode: isTopLevelNode,
|
|
118
|
+
anchorRectCache: anchorRectCache
|
|
119
|
+
}), element);
|
|
120
|
+
}
|
|
107
121
|
return element;
|
|
108
122
|
}, {
|
|
109
123
|
side: -1,
|
|
@@ -8,6 +8,7 @@ exports.quickInsertButtonDecoration = exports.findQuickInsertInsertButtonDecorat
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
10
10
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
12
|
var _quickInsertButton = require("../ui/quick-insert-button");
|
|
12
13
|
var TYPE_QUICK_INSERT = 'INSERT_BUTTON';
|
|
13
14
|
var findQuickInsertInsertButtonDecoration = exports.findQuickInsertInsertButtonDecoration = function findQuickInsertInsertButtonDecoration(decorations, from, to) {
|
|
@@ -22,19 +23,37 @@ var quickInsertButtonDecoration = exports.quickInsertButtonDecoration = function
|
|
|
22
23
|
element.contentEditable = 'false';
|
|
23
24
|
element.setAttribute('data-blocks-quick-insert-container', 'true');
|
|
24
25
|
element.setAttribute('data-testid', 'block-ctrl-quick-insert-button');
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
26
|
+
|
|
27
|
+
// all changes already under experiment
|
|
28
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_controls_widget_visibility')) {
|
|
29
|
+
nodeViewPortalProviderAPI.render(function () {
|
|
30
|
+
return /*#__PURE__*/(0, _react.createElement)(_quickInsertButton.QuickInsertWithVisibility, {
|
|
31
|
+
api: api,
|
|
32
|
+
getPos: getPos,
|
|
33
|
+
formatMessage: formatMessage,
|
|
34
|
+
view: view,
|
|
35
|
+
nodeType: nodeType,
|
|
36
|
+
anchorName: anchorName,
|
|
37
|
+
rootAnchorName: rootAnchorName,
|
|
38
|
+
rootNodeType: rootNodeType !== null && rootNodeType !== void 0 ? rootNodeType : nodeType,
|
|
39
|
+
anchorRectCache: anchorRectCache
|
|
40
|
+
});
|
|
41
|
+
}, element, key);
|
|
42
|
+
} else {
|
|
43
|
+
nodeViewPortalProviderAPI.render(function () {
|
|
44
|
+
return /*#__PURE__*/(0, _react.createElement)(_quickInsertButton.TypeAheadControl, {
|
|
45
|
+
api: api,
|
|
46
|
+
getPos: getPos,
|
|
47
|
+
formatMessage: formatMessage,
|
|
48
|
+
view: view,
|
|
49
|
+
nodeType: nodeType,
|
|
50
|
+
anchorName: anchorName,
|
|
51
|
+
rootAnchorName: rootAnchorName,
|
|
52
|
+
rootNodeType: rootNodeType !== null && rootNodeType !== void 0 ? rootNodeType : nodeType,
|
|
53
|
+
anchorRectCache: anchorRectCache
|
|
54
|
+
});
|
|
55
|
+
}, element, key);
|
|
56
|
+
}
|
|
38
57
|
return element;
|
|
39
58
|
}, {
|
|
40
59
|
side: -2,
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.DragHandle = void 0;
|
|
7
|
+
exports.DragHandleWithVisibility = exports.DragHandle = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
@@ -35,6 +35,7 @@ var _selection = require("../pm-plugins/utils/selection");
|
|
|
35
35
|
var _consts = require("./consts");
|
|
36
36
|
var _dragPreview = require("./drag-preview");
|
|
37
37
|
var _anchorName = require("./utils/anchor-name");
|
|
38
|
+
var _visibilityContainer = require("./visibility-container");
|
|
38
39
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
39
40
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /**
|
|
40
41
|
* @jsxRuntime classic
|
|
@@ -782,4 +783,24 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
782
783
|
var stickyRender = isTooltip ? stickyWithTooltip() : stickyWithoutTooltip();
|
|
783
784
|
var render = isTooltip ? buttonWithTooltip() : renderButton();
|
|
784
785
|
return (0, _platformFeatureFlags.fg)('platform_editor_controls_sticky_controls') ? stickyRender : render;
|
|
786
|
+
};
|
|
787
|
+
var DragHandleWithVisibility = exports.DragHandleWithVisibility = function DragHandleWithVisibility(_ref8) {
|
|
788
|
+
var view = _ref8.view,
|
|
789
|
+
api = _ref8.api,
|
|
790
|
+
formatMessage = _ref8.formatMessage,
|
|
791
|
+
getPos = _ref8.getPos,
|
|
792
|
+
anchorName = _ref8.anchorName,
|
|
793
|
+
nodeType = _ref8.nodeType,
|
|
794
|
+
anchorRectCache = _ref8.anchorRectCache;
|
|
795
|
+
return (0, _react2.jsx)(_visibilityContainer.VisibilityContainer, {
|
|
796
|
+
api: api
|
|
797
|
+
}, (0, _react2.jsx)(DragHandle, {
|
|
798
|
+
view: view,
|
|
799
|
+
api: api,
|
|
800
|
+
formatMessage: formatMessage,
|
|
801
|
+
getPos: getPos,
|
|
802
|
+
anchorName: anchorName,
|
|
803
|
+
nodeType: nodeType,
|
|
804
|
+
anchorRectCache: anchorRectCache
|
|
805
|
+
}));
|
|
785
806
|
};
|
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.TypeAheadControl = void 0;
|
|
8
|
+
exports.TypeAheadControl = exports.QuickInsertWithVisibility = void 0;
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -25,6 +25,7 @@ var _consts = require("./consts");
|
|
|
25
25
|
var _anchorName = require("./utils/anchor-name");
|
|
26
26
|
var _documentChecks = require("./utils/document-checks");
|
|
27
27
|
var _editorCommands = require("./utils/editor-commands");
|
|
28
|
+
var _visibilityContainer = require("./visibility-container");
|
|
28
29
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
29
30
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
30
31
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -114,6 +115,7 @@ var TypeAheadControl = exports.TypeAheadControl = function TypeAheadControl(_ref
|
|
|
114
115
|
rootNodeType = _ref.rootNodeType,
|
|
115
116
|
anchorRectCache = _ref.anchorRectCache;
|
|
116
117
|
var macroInteractionUpdates = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'featureFlags.macroInteractionUpdates');
|
|
118
|
+
// remove when platform_editor_controls_patch_1 is removed
|
|
117
119
|
var isTypeAheadOpen = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'typeAhead.isOpen');
|
|
118
120
|
var _useState = (0, _react.useState)({
|
|
119
121
|
display: 'none'
|
|
@@ -267,21 +269,51 @@ var TypeAheadControl = exports.TypeAheadControl = function TypeAheadControl(_ref
|
|
|
267
269
|
testId: "editor-quick-insert-button",
|
|
268
270
|
type: "button",
|
|
269
271
|
"aria-label": formatMessage(_messages.blockControlsMessages.insert),
|
|
270
|
-
xcss: [(0, _platformFeatureFlags.fg)('platform_editor_controls_sticky_controls') ? buttonStyles : stickyButtonStyles,
|
|
272
|
+
xcss: [(0, _platformFeatureFlags.fg)('platform_editor_controls_sticky_controls') ? buttonStyles : stickyButtonStyles,
|
|
273
|
+
// remove disabledStyles and platform_editor_controls_widget_visibility check when platform_editor_controls_patch_1 is removed
|
|
274
|
+
isTypeAheadOpen && !(0, _platformFeatureFlags.fg)('platform_editor_controls_widget_visibility') && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_1') ? disabledStyles : undefined],
|
|
271
275
|
onClick: handleQuickInsert,
|
|
272
276
|
onMouseDown: (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_1') ? undefined : handleMouseDown,
|
|
273
|
-
isDisabled: (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_1')
|
|
277
|
+
isDisabled: !(0, _platformFeatureFlags.fg)('platform_editor_controls_widget_visibility') && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_1') && isTypeAheadOpen
|
|
274
278
|
}, /*#__PURE__*/_react.default.createElement(_add.default, {
|
|
275
279
|
label: "add",
|
|
276
|
-
color:
|
|
280
|
+
color:
|
|
281
|
+
// remove color.icon.disabled when platform_editor_controls_patch_1 is removed
|
|
282
|
+
isTypeAheadOpen && !(0, _platformFeatureFlags.fg)('platform_editor_controls_widget_visibility') ? "var(--ds-icon-disabled, #091E424F)" : "var(--ds-icon-subtle, #626F86)"
|
|
277
283
|
})));
|
|
278
284
|
};
|
|
279
285
|
return /*#__PURE__*/_react.default.createElement(_primitives.Box
|
|
280
286
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
281
287
|
, {
|
|
282
288
|
style: positionStyles,
|
|
283
|
-
xcss: [containerStaticStyles,
|
|
289
|
+
xcss: [containerStaticStyles,
|
|
290
|
+
// remove disabledContainerStyles and platform_editor_controls_widget_visibility check when platform_editor_controls_patch_1 is removed
|
|
291
|
+
isTypeAheadOpen && !(0, _platformFeatureFlags.fg)('platform_editor_controls_widget_visibility') && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_1') && disabledContainerStyles]
|
|
284
292
|
}, (0, _platformFeatureFlags.fg)('platform_editor_controls_sticky_controls') ? /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
285
293
|
xcss: [tooltipContainerStyles]
|
|
286
294
|
}, tooltipPressable()) : tooltipPressable());
|
|
295
|
+
};
|
|
296
|
+
var QuickInsertWithVisibility = exports.QuickInsertWithVisibility = function QuickInsertWithVisibility(_ref4) {
|
|
297
|
+
var view = _ref4.view,
|
|
298
|
+
api = _ref4.api,
|
|
299
|
+
formatMessage = _ref4.formatMessage,
|
|
300
|
+
getPos = _ref4.getPos,
|
|
301
|
+
nodeType = _ref4.nodeType,
|
|
302
|
+
anchorName = _ref4.anchorName,
|
|
303
|
+
rootAnchorName = _ref4.rootAnchorName,
|
|
304
|
+
rootNodeType = _ref4.rootNodeType,
|
|
305
|
+
anchorRectCache = _ref4.anchorRectCache;
|
|
306
|
+
return /*#__PURE__*/_react.default.createElement(_visibilityContainer.VisibilityContainer, {
|
|
307
|
+
api: api
|
|
308
|
+
}, /*#__PURE__*/_react.default.createElement(TypeAheadControl, {
|
|
309
|
+
view: view,
|
|
310
|
+
api: api,
|
|
311
|
+
formatMessage: formatMessage,
|
|
312
|
+
getPos: getPos,
|
|
313
|
+
nodeType: nodeType,
|
|
314
|
+
anchorName: anchorName,
|
|
315
|
+
rootAnchorName: rootAnchorName,
|
|
316
|
+
rootNodeType: rootNodeType,
|
|
317
|
+
anchorRectCache: anchorRectCache
|
|
318
|
+
}));
|
|
287
319
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.VisibilityContainer = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
10
|
+
var _primitives = require("@atlaskit/primitives");
|
|
11
|
+
var baseStyles = (0, _primitives.xcss)({
|
|
12
|
+
transition: 'opacity 0.1s ease-in-out, visibility 0.1s ease-in-out'
|
|
13
|
+
});
|
|
14
|
+
var visibleStyles = (0, _primitives.xcss)({
|
|
15
|
+
opacity: 1,
|
|
16
|
+
visibility: 'visible'
|
|
17
|
+
});
|
|
18
|
+
var hiddenStyles = (0, _primitives.xcss)({
|
|
19
|
+
opacity: 0,
|
|
20
|
+
// CONFIRM this change doesnt cause this issue to regress https://product-fabric.atlassian.net/browse/ED-24136
|
|
21
|
+
visibility: 'hidden'
|
|
22
|
+
});
|
|
23
|
+
var VisibilityContainer = exports.VisibilityContainer = function VisibilityContainer(_ref) {
|
|
24
|
+
var api = _ref.api,
|
|
25
|
+
children = _ref.children;
|
|
26
|
+
var isOpen = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'typeAhead.isOpen');
|
|
27
|
+
return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
28
|
+
xcss: [baseStyles, isOpen ? hiddenStyles : visibleStyles]
|
|
29
|
+
}, children);
|
|
30
|
+
};
|
|
@@ -3,8 +3,9 @@ import { bind } from 'bind-event-listener';
|
|
|
3
3
|
import ReactDOM from 'react-dom';
|
|
4
4
|
import uuid from 'uuid';
|
|
5
5
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
|
-
import { DragHandle } from '../ui/drag-handle';
|
|
8
|
+
import { DragHandle, DragHandleWithVisibility } from '../ui/drag-handle';
|
|
8
9
|
import { TYPE_HANDLE_DEC, TYPE_NODE_DEC, unmountDecorations } from './decorations-common';
|
|
9
10
|
export const emptyParagraphNodeDecorations = () => {
|
|
10
11
|
const anchorName = `--node-anchor-paragraph-0`;
|
|
@@ -83,18 +84,31 @@ export const dragHandleDecoration = (api, formatMessage, pos, anchorName, nodeTy
|
|
|
83
84
|
// key,
|
|
84
85
|
// );
|
|
85
86
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
87
|
+
if (editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_widget_visibility')) {
|
|
88
|
+
ReactDOM.render( /*#__PURE__*/createElement(DragHandleWithVisibility, {
|
|
89
|
+
view,
|
|
90
|
+
api,
|
|
91
|
+
formatMessage,
|
|
92
|
+
getPos,
|
|
93
|
+
anchorName,
|
|
94
|
+
nodeType,
|
|
95
|
+
handleOptions,
|
|
96
|
+
isTopLevelNode,
|
|
97
|
+
anchorRectCache
|
|
98
|
+
}), element);
|
|
99
|
+
} else {
|
|
100
|
+
ReactDOM.render( /*#__PURE__*/createElement(DragHandle, {
|
|
101
|
+
view,
|
|
102
|
+
api,
|
|
103
|
+
formatMessage,
|
|
104
|
+
getPos,
|
|
105
|
+
anchorName,
|
|
106
|
+
nodeType,
|
|
107
|
+
handleOptions,
|
|
108
|
+
isTopLevelNode,
|
|
109
|
+
anchorRectCache
|
|
110
|
+
}), element);
|
|
111
|
+
}
|
|
98
112
|
return element;
|
|
99
113
|
}, {
|
|
100
114
|
side: -1,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createElement } from 'react';
|
|
2
2
|
import uuid from 'uuid';
|
|
3
3
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
import {
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
|
+
import { QuickInsertWithVisibility, TypeAheadControl } from '../ui/quick-insert-button';
|
|
5
6
|
const TYPE_QUICK_INSERT = 'INSERT_BUTTON';
|
|
6
7
|
export const findQuickInsertInsertButtonDecoration = (decorations, from, to) => {
|
|
7
8
|
return decorations.find(from, to, spec => spec.type === TYPE_QUICK_INSERT);
|
|
@@ -13,17 +14,33 @@ export const quickInsertButtonDecoration = (api, formatMessage, rootPos, anchorN
|
|
|
13
14
|
element.contentEditable = 'false';
|
|
14
15
|
element.setAttribute('data-blocks-quick-insert-container', 'true');
|
|
15
16
|
element.setAttribute('data-testid', 'block-ctrl-quick-insert-button');
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
|
|
18
|
+
// all changes already under experiment
|
|
19
|
+
if (fg('platform_editor_controls_widget_visibility')) {
|
|
20
|
+
nodeViewPortalProviderAPI.render(() => /*#__PURE__*/createElement(QuickInsertWithVisibility, {
|
|
21
|
+
api,
|
|
22
|
+
getPos,
|
|
23
|
+
formatMessage,
|
|
24
|
+
view,
|
|
25
|
+
nodeType,
|
|
26
|
+
anchorName,
|
|
27
|
+
rootAnchorName,
|
|
28
|
+
rootNodeType: rootNodeType !== null && rootNodeType !== void 0 ? rootNodeType : nodeType,
|
|
29
|
+
anchorRectCache
|
|
30
|
+
}), element, key);
|
|
31
|
+
} else {
|
|
32
|
+
nodeViewPortalProviderAPI.render(() => /*#__PURE__*/createElement(TypeAheadControl, {
|
|
33
|
+
api,
|
|
34
|
+
getPos,
|
|
35
|
+
formatMessage,
|
|
36
|
+
view,
|
|
37
|
+
nodeType,
|
|
38
|
+
anchorName,
|
|
39
|
+
rootAnchorName,
|
|
40
|
+
rootNodeType: rootNodeType !== null && rootNodeType !== void 0 ? rootNodeType : nodeType,
|
|
41
|
+
anchorRectCache
|
|
42
|
+
}), element, key);
|
|
43
|
+
}
|
|
27
44
|
return element;
|
|
28
45
|
}, {
|
|
29
46
|
side: -2,
|
|
@@ -32,6 +32,7 @@ import { alignAnchorHeadInDirectionOfPos, expandSelectionHeadToNodeAtPos } from
|
|
|
32
32
|
import { BLOCK_MENU_ENABLED, DRAG_HANDLE_BORDER_RADIUS, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH, DRAG_HANDLE_WIDTH, DRAG_HANDLE_ZINDEX, dragHandleGap, nodeMargins, spacingBetweenNodesForPreview, topPositionAdjustment } from './consts';
|
|
33
33
|
import { dragPreview } from './drag-preview';
|
|
34
34
|
import { refreshAnchorName } from './utils/anchor-name';
|
|
35
|
+
import { VisibilityContainer } from './visibility-container';
|
|
35
36
|
const iconWrapperStyles = xcss({
|
|
36
37
|
display: 'flex',
|
|
37
38
|
justifyContent: 'center',
|
|
@@ -761,4 +762,25 @@ export const DragHandle = ({
|
|
|
761
762
|
const stickyRender = isTooltip ? stickyWithTooltip() : stickyWithoutTooltip();
|
|
762
763
|
const render = isTooltip ? buttonWithTooltip() : renderButton();
|
|
763
764
|
return fg('platform_editor_controls_sticky_controls') ? stickyRender : render;
|
|
765
|
+
};
|
|
766
|
+
export const DragHandleWithVisibility = ({
|
|
767
|
+
view,
|
|
768
|
+
api,
|
|
769
|
+
formatMessage,
|
|
770
|
+
getPos,
|
|
771
|
+
anchorName,
|
|
772
|
+
nodeType,
|
|
773
|
+
anchorRectCache
|
|
774
|
+
}) => {
|
|
775
|
+
return jsx(VisibilityContainer, {
|
|
776
|
+
api: api
|
|
777
|
+
}, jsx(DragHandle, {
|
|
778
|
+
view: view,
|
|
779
|
+
api: api,
|
|
780
|
+
formatMessage: formatMessage,
|
|
781
|
+
getPos: getPos,
|
|
782
|
+
anchorName: anchorName,
|
|
783
|
+
nodeType: nodeType,
|
|
784
|
+
anchorRectCache: anchorRectCache
|
|
785
|
+
}));
|
|
764
786
|
};
|
|
@@ -15,6 +15,7 @@ import { rootElementGap, topPositionAdjustment, QUICK_INSERT_DIMENSIONS, QUICK_I
|
|
|
15
15
|
import { refreshAnchorName } from './utils/anchor-name';
|
|
16
16
|
import { isInTextSelection, isNestedNodeSelected, isNonEditableBlock, isSelectionInNode } from './utils/document-checks';
|
|
17
17
|
import { createNewLine } from './utils/editor-commands';
|
|
18
|
+
import { VisibilityContainer } from './visibility-container';
|
|
18
19
|
const TEXT_PARENT_TYPES = ['paragraph', 'heading', 'blockquote', 'taskItem', 'decisionItem'];
|
|
19
20
|
const buttonStyles = xcss({
|
|
20
21
|
boxSizing: 'border-box',
|
|
@@ -101,6 +102,7 @@ export const TypeAheadControl = ({
|
|
|
101
102
|
anchorRectCache
|
|
102
103
|
}) => {
|
|
103
104
|
const macroInteractionUpdates = useSharedPluginStateSelector(api, 'featureFlags.macroInteractionUpdates');
|
|
105
|
+
// remove when platform_editor_controls_patch_1 is removed
|
|
104
106
|
const isTypeAheadOpen = useSharedPluginStateSelector(api, 'typeAhead.isOpen');
|
|
105
107
|
const [positionStyles, setPositionStyles] = useState({
|
|
106
108
|
display: 'none'
|
|
@@ -252,20 +254,51 @@ export const TypeAheadControl = ({
|
|
|
252
254
|
testId: "editor-quick-insert-button",
|
|
253
255
|
type: "button",
|
|
254
256
|
"aria-label": formatMessage(messages.insert),
|
|
255
|
-
xcss: [fg('platform_editor_controls_sticky_controls') ? buttonStyles : stickyButtonStyles,
|
|
257
|
+
xcss: [fg('platform_editor_controls_sticky_controls') ? buttonStyles : stickyButtonStyles,
|
|
258
|
+
// remove disabledStyles and platform_editor_controls_widget_visibility check when platform_editor_controls_patch_1 is removed
|
|
259
|
+
isTypeAheadOpen && !fg('platform_editor_controls_widget_visibility') && fg('platform_editor_controls_patch_1') ? disabledStyles : undefined],
|
|
256
260
|
onClick: handleQuickInsert,
|
|
257
261
|
onMouseDown: fg('platform_editor_controls_patch_1') ? undefined : handleMouseDown,
|
|
258
|
-
isDisabled: fg('platform_editor_controls_patch_1')
|
|
262
|
+
isDisabled: !fg('platform_editor_controls_widget_visibility') && fg('platform_editor_controls_patch_1') && isTypeAheadOpen
|
|
259
263
|
}, /*#__PURE__*/React.createElement(AddIcon, {
|
|
260
264
|
label: "add",
|
|
261
|
-
color:
|
|
265
|
+
color:
|
|
266
|
+
// remove color.icon.disabled when platform_editor_controls_patch_1 is removed
|
|
267
|
+
isTypeAheadOpen && !fg('platform_editor_controls_widget_visibility') ? "var(--ds-icon-disabled, #091E424F)" : "var(--ds-icon-subtle, #626F86)"
|
|
262
268
|
})));
|
|
263
269
|
return /*#__PURE__*/React.createElement(Box
|
|
264
270
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
265
271
|
, {
|
|
266
272
|
style: positionStyles,
|
|
267
|
-
xcss: [containerStaticStyles,
|
|
273
|
+
xcss: [containerStaticStyles,
|
|
274
|
+
// remove disabledContainerStyles and platform_editor_controls_widget_visibility check when platform_editor_controls_patch_1 is removed
|
|
275
|
+
isTypeAheadOpen && !fg('platform_editor_controls_widget_visibility') && fg('platform_editor_controls_patch_1') && disabledContainerStyles]
|
|
268
276
|
}, fg('platform_editor_controls_sticky_controls') ? /*#__PURE__*/React.createElement(Box, {
|
|
269
277
|
xcss: [tooltipContainerStyles]
|
|
270
278
|
}, tooltipPressable()) : tooltipPressable());
|
|
279
|
+
};
|
|
280
|
+
export const QuickInsertWithVisibility = ({
|
|
281
|
+
view,
|
|
282
|
+
api,
|
|
283
|
+
formatMessage,
|
|
284
|
+
getPos,
|
|
285
|
+
nodeType,
|
|
286
|
+
anchorName,
|
|
287
|
+
rootAnchorName,
|
|
288
|
+
rootNodeType,
|
|
289
|
+
anchorRectCache
|
|
290
|
+
}) => {
|
|
291
|
+
return /*#__PURE__*/React.createElement(VisibilityContainer, {
|
|
292
|
+
api: api
|
|
293
|
+
}, /*#__PURE__*/React.createElement(TypeAheadControl, {
|
|
294
|
+
view: view,
|
|
295
|
+
api: api,
|
|
296
|
+
formatMessage: formatMessage,
|
|
297
|
+
getPos: getPos,
|
|
298
|
+
nodeType: nodeType,
|
|
299
|
+
anchorName: anchorName,
|
|
300
|
+
rootAnchorName: rootAnchorName,
|
|
301
|
+
rootNodeType: rootNodeType,
|
|
302
|
+
anchorRectCache: anchorRectCache
|
|
303
|
+
}));
|
|
271
304
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
3
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
4
|
+
const baseStyles = xcss({
|
|
5
|
+
transition: 'opacity 0.1s ease-in-out, visibility 0.1s ease-in-out'
|
|
6
|
+
});
|
|
7
|
+
const visibleStyles = xcss({
|
|
8
|
+
opacity: 1,
|
|
9
|
+
visibility: 'visible'
|
|
10
|
+
});
|
|
11
|
+
const hiddenStyles = xcss({
|
|
12
|
+
opacity: 0,
|
|
13
|
+
// CONFIRM this change doesnt cause this issue to regress https://product-fabric.atlassian.net/browse/ED-24136
|
|
14
|
+
visibility: 'hidden'
|
|
15
|
+
});
|
|
16
|
+
export const VisibilityContainer = ({
|
|
17
|
+
api,
|
|
18
|
+
children
|
|
19
|
+
}) => {
|
|
20
|
+
const isOpen = useSharedPluginStateSelector(api, 'typeAhead.isOpen');
|
|
21
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
22
|
+
xcss: [baseStyles, isOpen ? hiddenStyles : visibleStyles]
|
|
23
|
+
}, children);
|
|
24
|
+
};
|
|
@@ -4,8 +4,9 @@ import { bind } from 'bind-event-listener';
|
|
|
4
4
|
import ReactDOM from 'react-dom';
|
|
5
5
|
import uuid from 'uuid';
|
|
6
6
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
8
|
-
import { DragHandle } from '../ui/drag-handle';
|
|
9
|
+
import { DragHandle, DragHandleWithVisibility } from '../ui/drag-handle';
|
|
9
10
|
import { TYPE_HANDLE_DEC, TYPE_NODE_DEC, unmountDecorations } from './decorations-common';
|
|
10
11
|
export var emptyParagraphNodeDecorations = function emptyParagraphNodeDecorations() {
|
|
11
12
|
var anchorName = "--node-anchor-paragraph-0";
|
|
@@ -85,18 +86,31 @@ export var dragHandleDecoration = function dragHandleDecoration(api, formatMessa
|
|
|
85
86
|
// key,
|
|
86
87
|
// );
|
|
87
88
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
89
|
+
if (editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_widget_visibility')) {
|
|
90
|
+
ReactDOM.render( /*#__PURE__*/createElement(DragHandleWithVisibility, {
|
|
91
|
+
view: view,
|
|
92
|
+
api: api,
|
|
93
|
+
formatMessage: formatMessage,
|
|
94
|
+
getPos: getPos,
|
|
95
|
+
anchorName: anchorName,
|
|
96
|
+
nodeType: nodeType,
|
|
97
|
+
handleOptions: handleOptions,
|
|
98
|
+
isTopLevelNode: isTopLevelNode,
|
|
99
|
+
anchorRectCache: anchorRectCache
|
|
100
|
+
}), element);
|
|
101
|
+
} else {
|
|
102
|
+
ReactDOM.render( /*#__PURE__*/createElement(DragHandle, {
|
|
103
|
+
view: view,
|
|
104
|
+
api: api,
|
|
105
|
+
formatMessage: formatMessage,
|
|
106
|
+
getPos: getPos,
|
|
107
|
+
anchorName: anchorName,
|
|
108
|
+
nodeType: nodeType,
|
|
109
|
+
handleOptions: handleOptions,
|
|
110
|
+
isTopLevelNode: isTopLevelNode,
|
|
111
|
+
anchorRectCache: anchorRectCache
|
|
112
|
+
}), element);
|
|
113
|
+
}
|
|
100
114
|
return element;
|
|
101
115
|
}, {
|
|
102
116
|
side: -1,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createElement } from 'react';
|
|
2
2
|
import uuid from 'uuid';
|
|
3
3
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
import {
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
|
+
import { QuickInsertWithVisibility, TypeAheadControl } from '../ui/quick-insert-button';
|
|
5
6
|
var TYPE_QUICK_INSERT = 'INSERT_BUTTON';
|
|
6
7
|
export var findQuickInsertInsertButtonDecoration = function findQuickInsertInsertButtonDecoration(decorations, from, to) {
|
|
7
8
|
return decorations.find(from, to, function (spec) {
|
|
@@ -15,19 +16,37 @@ export var quickInsertButtonDecoration = function quickInsertButtonDecoration(ap
|
|
|
15
16
|
element.contentEditable = 'false';
|
|
16
17
|
element.setAttribute('data-blocks-quick-insert-container', 'true');
|
|
17
18
|
element.setAttribute('data-testid', 'block-ctrl-quick-insert-button');
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
|
|
20
|
+
// all changes already under experiment
|
|
21
|
+
if (fg('platform_editor_controls_widget_visibility')) {
|
|
22
|
+
nodeViewPortalProviderAPI.render(function () {
|
|
23
|
+
return /*#__PURE__*/createElement(QuickInsertWithVisibility, {
|
|
24
|
+
api: api,
|
|
25
|
+
getPos: getPos,
|
|
26
|
+
formatMessage: formatMessage,
|
|
27
|
+
view: view,
|
|
28
|
+
nodeType: nodeType,
|
|
29
|
+
anchorName: anchorName,
|
|
30
|
+
rootAnchorName: rootAnchorName,
|
|
31
|
+
rootNodeType: rootNodeType !== null && rootNodeType !== void 0 ? rootNodeType : nodeType,
|
|
32
|
+
anchorRectCache: anchorRectCache
|
|
33
|
+
});
|
|
34
|
+
}, element, key);
|
|
35
|
+
} else {
|
|
36
|
+
nodeViewPortalProviderAPI.render(function () {
|
|
37
|
+
return /*#__PURE__*/createElement(TypeAheadControl, {
|
|
38
|
+
api: api,
|
|
39
|
+
getPos: getPos,
|
|
40
|
+
formatMessage: formatMessage,
|
|
41
|
+
view: view,
|
|
42
|
+
nodeType: nodeType,
|
|
43
|
+
anchorName: anchorName,
|
|
44
|
+
rootAnchorName: rootAnchorName,
|
|
45
|
+
rootNodeType: rootNodeType !== null && rootNodeType !== void 0 ? rootNodeType : nodeType,
|
|
46
|
+
anchorRectCache: anchorRectCache
|
|
47
|
+
});
|
|
48
|
+
}, element, key);
|
|
49
|
+
}
|
|
31
50
|
return element;
|
|
32
51
|
}, {
|
|
33
52
|
side: -2,
|
|
@@ -37,6 +37,7 @@ import { alignAnchorHeadInDirectionOfPos, expandSelectionHeadToNodeAtPos } from
|
|
|
37
37
|
import { BLOCK_MENU_ENABLED, DRAG_HANDLE_BORDER_RADIUS, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH, DRAG_HANDLE_WIDTH, DRAG_HANDLE_ZINDEX, dragHandleGap, nodeMargins, spacingBetweenNodesForPreview, topPositionAdjustment } from './consts';
|
|
38
38
|
import { dragPreview } from './drag-preview';
|
|
39
39
|
import { refreshAnchorName } from './utils/anchor-name';
|
|
40
|
+
import { VisibilityContainer } from './visibility-container';
|
|
40
41
|
var iconWrapperStyles = xcss({
|
|
41
42
|
display: 'flex',
|
|
42
43
|
justifyContent: 'center',
|
|
@@ -779,4 +780,24 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
779
780
|
var stickyRender = isTooltip ? stickyWithTooltip() : stickyWithoutTooltip();
|
|
780
781
|
var render = isTooltip ? buttonWithTooltip() : renderButton();
|
|
781
782
|
return fg('platform_editor_controls_sticky_controls') ? stickyRender : render;
|
|
783
|
+
};
|
|
784
|
+
export var DragHandleWithVisibility = function DragHandleWithVisibility(_ref8) {
|
|
785
|
+
var view = _ref8.view,
|
|
786
|
+
api = _ref8.api,
|
|
787
|
+
formatMessage = _ref8.formatMessage,
|
|
788
|
+
getPos = _ref8.getPos,
|
|
789
|
+
anchorName = _ref8.anchorName,
|
|
790
|
+
nodeType = _ref8.nodeType,
|
|
791
|
+
anchorRectCache = _ref8.anchorRectCache;
|
|
792
|
+
return jsx(VisibilityContainer, {
|
|
793
|
+
api: api
|
|
794
|
+
}, jsx(DragHandle, {
|
|
795
|
+
view: view,
|
|
796
|
+
api: api,
|
|
797
|
+
formatMessage: formatMessage,
|
|
798
|
+
getPos: getPos,
|
|
799
|
+
anchorName: anchorName,
|
|
800
|
+
nodeType: nodeType,
|
|
801
|
+
anchorRectCache: anchorRectCache
|
|
802
|
+
}));
|
|
782
803
|
};
|
|
@@ -19,6 +19,7 @@ import { rootElementGap, topPositionAdjustment, QUICK_INSERT_DIMENSIONS, QUICK_I
|
|
|
19
19
|
import { refreshAnchorName } from './utils/anchor-name';
|
|
20
20
|
import { isInTextSelection, isNestedNodeSelected, isNonEditableBlock, isSelectionInNode } from './utils/document-checks';
|
|
21
21
|
import { createNewLine } from './utils/editor-commands';
|
|
22
|
+
import { VisibilityContainer } from './visibility-container';
|
|
22
23
|
var TEXT_PARENT_TYPES = ['paragraph', 'heading', 'blockquote', 'taskItem', 'decisionItem'];
|
|
23
24
|
var buttonStyles = xcss({
|
|
24
25
|
boxSizing: 'border-box',
|
|
@@ -104,6 +105,7 @@ export var TypeAheadControl = function TypeAheadControl(_ref) {
|
|
|
104
105
|
rootNodeType = _ref.rootNodeType,
|
|
105
106
|
anchorRectCache = _ref.anchorRectCache;
|
|
106
107
|
var macroInteractionUpdates = useSharedPluginStateSelector(api, 'featureFlags.macroInteractionUpdates');
|
|
108
|
+
// remove when platform_editor_controls_patch_1 is removed
|
|
107
109
|
var isTypeAheadOpen = useSharedPluginStateSelector(api, 'typeAhead.isOpen');
|
|
108
110
|
var _useState = useState({
|
|
109
111
|
display: 'none'
|
|
@@ -257,21 +259,51 @@ export var TypeAheadControl = function TypeAheadControl(_ref) {
|
|
|
257
259
|
testId: "editor-quick-insert-button",
|
|
258
260
|
type: "button",
|
|
259
261
|
"aria-label": formatMessage(messages.insert),
|
|
260
|
-
xcss: [fg('platform_editor_controls_sticky_controls') ? buttonStyles : stickyButtonStyles,
|
|
262
|
+
xcss: [fg('platform_editor_controls_sticky_controls') ? buttonStyles : stickyButtonStyles,
|
|
263
|
+
// remove disabledStyles and platform_editor_controls_widget_visibility check when platform_editor_controls_patch_1 is removed
|
|
264
|
+
isTypeAheadOpen && !fg('platform_editor_controls_widget_visibility') && fg('platform_editor_controls_patch_1') ? disabledStyles : undefined],
|
|
261
265
|
onClick: handleQuickInsert,
|
|
262
266
|
onMouseDown: fg('platform_editor_controls_patch_1') ? undefined : handleMouseDown,
|
|
263
|
-
isDisabled: fg('platform_editor_controls_patch_1')
|
|
267
|
+
isDisabled: !fg('platform_editor_controls_widget_visibility') && fg('platform_editor_controls_patch_1') && isTypeAheadOpen
|
|
264
268
|
}, /*#__PURE__*/React.createElement(AddIcon, {
|
|
265
269
|
label: "add",
|
|
266
|
-
color:
|
|
270
|
+
color:
|
|
271
|
+
// remove color.icon.disabled when platform_editor_controls_patch_1 is removed
|
|
272
|
+
isTypeAheadOpen && !fg('platform_editor_controls_widget_visibility') ? "var(--ds-icon-disabled, #091E424F)" : "var(--ds-icon-subtle, #626F86)"
|
|
267
273
|
})));
|
|
268
274
|
};
|
|
269
275
|
return /*#__PURE__*/React.createElement(Box
|
|
270
276
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
271
277
|
, {
|
|
272
278
|
style: positionStyles,
|
|
273
|
-
xcss: [containerStaticStyles,
|
|
279
|
+
xcss: [containerStaticStyles,
|
|
280
|
+
// remove disabledContainerStyles and platform_editor_controls_widget_visibility check when platform_editor_controls_patch_1 is removed
|
|
281
|
+
isTypeAheadOpen && !fg('platform_editor_controls_widget_visibility') && fg('platform_editor_controls_patch_1') && disabledContainerStyles]
|
|
274
282
|
}, fg('platform_editor_controls_sticky_controls') ? /*#__PURE__*/React.createElement(Box, {
|
|
275
283
|
xcss: [tooltipContainerStyles]
|
|
276
284
|
}, tooltipPressable()) : tooltipPressable());
|
|
285
|
+
};
|
|
286
|
+
export var QuickInsertWithVisibility = function QuickInsertWithVisibility(_ref4) {
|
|
287
|
+
var view = _ref4.view,
|
|
288
|
+
api = _ref4.api,
|
|
289
|
+
formatMessage = _ref4.formatMessage,
|
|
290
|
+
getPos = _ref4.getPos,
|
|
291
|
+
nodeType = _ref4.nodeType,
|
|
292
|
+
anchorName = _ref4.anchorName,
|
|
293
|
+
rootAnchorName = _ref4.rootAnchorName,
|
|
294
|
+
rootNodeType = _ref4.rootNodeType,
|
|
295
|
+
anchorRectCache = _ref4.anchorRectCache;
|
|
296
|
+
return /*#__PURE__*/React.createElement(VisibilityContainer, {
|
|
297
|
+
api: api
|
|
298
|
+
}, /*#__PURE__*/React.createElement(TypeAheadControl, {
|
|
299
|
+
view: view,
|
|
300
|
+
api: api,
|
|
301
|
+
formatMessage: formatMessage,
|
|
302
|
+
getPos: getPos,
|
|
303
|
+
nodeType: nodeType,
|
|
304
|
+
anchorName: anchorName,
|
|
305
|
+
rootAnchorName: rootAnchorName,
|
|
306
|
+
rootNodeType: rootNodeType,
|
|
307
|
+
anchorRectCache: anchorRectCache
|
|
308
|
+
}));
|
|
277
309
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
3
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
4
|
+
var baseStyles = xcss({
|
|
5
|
+
transition: 'opacity 0.1s ease-in-out, visibility 0.1s ease-in-out'
|
|
6
|
+
});
|
|
7
|
+
var visibleStyles = xcss({
|
|
8
|
+
opacity: 1,
|
|
9
|
+
visibility: 'visible'
|
|
10
|
+
});
|
|
11
|
+
var hiddenStyles = xcss({
|
|
12
|
+
opacity: 0,
|
|
13
|
+
// CONFIRM this change doesnt cause this issue to regress https://product-fabric.atlassian.net/browse/ED-24136
|
|
14
|
+
visibility: 'hidden'
|
|
15
|
+
});
|
|
16
|
+
export var VisibilityContainer = function VisibilityContainer(_ref) {
|
|
17
|
+
var api = _ref.api,
|
|
18
|
+
children = _ref.children;
|
|
19
|
+
var isOpen = useSharedPluginStateSelector(api, 'typeAhead.isOpen');
|
|
20
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
21
|
+
xcss: [baseStyles, isOpen ? hiddenStyles : visibleStyles]
|
|
22
|
+
}, children);
|
|
23
|
+
};
|
|
@@ -4,7 +4,7 @@ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
|
4
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import type { BlockControlsPlugin, HandleOptions } from '../blockControlsPluginType';
|
|
6
6
|
import { AnchorRectCache } from '../pm-plugins/utils/anchor-utils';
|
|
7
|
-
|
|
7
|
+
type DragHandleProps = {
|
|
8
8
|
view: EditorView;
|
|
9
9
|
api: ExtractInjectionAPI<BlockControlsPlugin> | undefined;
|
|
10
10
|
formatMessage: IntlShape['formatMessage'];
|
|
@@ -12,6 +12,9 @@ export declare const DragHandle: ({ view, api, formatMessage, getPos, anchorName
|
|
|
12
12
|
anchorName: string;
|
|
13
13
|
nodeType: string;
|
|
14
14
|
handleOptions?: HandleOptions;
|
|
15
|
-
isTopLevelNode?: boolean
|
|
16
|
-
anchorRectCache?: AnchorRectCache
|
|
17
|
-
}
|
|
15
|
+
isTopLevelNode?: boolean;
|
|
16
|
+
anchorRectCache?: AnchorRectCache;
|
|
17
|
+
};
|
|
18
|
+
export declare const DragHandle: ({ view, api, formatMessage, getPos, anchorName, nodeType, handleOptions, isTopLevelNode, anchorRectCache, }: DragHandleProps) => jsx.JSX.Element;
|
|
19
|
+
export declare const DragHandleWithVisibility: ({ view, api, formatMessage, getPos, anchorName, nodeType, anchorRectCache, }: DragHandleProps) => jsx.JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -16,4 +16,5 @@ type Props = {
|
|
|
16
16
|
anchorRectCache?: AnchorRectCache;
|
|
17
17
|
};
|
|
18
18
|
export declare const TypeAheadControl: ({ view, api, formatMessage, getPos, nodeType, anchorName, rootAnchorName, rootNodeType, anchorRectCache, }: Props) => React.JSX.Element;
|
|
19
|
+
export declare const QuickInsertWithVisibility: ({ view, api, formatMessage, getPos, nodeType, anchorName, rootAnchorName, rootNodeType, anchorRectCache, }: Props) => React.JSX.Element;
|
|
19
20
|
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import { BlockControlsPlugin } from '../blockControlsPluginType';
|
|
4
|
+
interface VisibilityContainerProps {
|
|
5
|
+
api?: ExtractInjectionAPI<BlockControlsPlugin>;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const VisibilityContainer: ({ api, children }: VisibilityContainerProps) => React.JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -4,7 +4,7 @@ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
|
4
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import type { BlockControlsPlugin, HandleOptions } from '../blockControlsPluginType';
|
|
6
6
|
import { AnchorRectCache } from '../pm-plugins/utils/anchor-utils';
|
|
7
|
-
|
|
7
|
+
type DragHandleProps = {
|
|
8
8
|
view: EditorView;
|
|
9
9
|
api: ExtractInjectionAPI<BlockControlsPlugin> | undefined;
|
|
10
10
|
formatMessage: IntlShape['formatMessage'];
|
|
@@ -12,6 +12,9 @@ export declare const DragHandle: ({ view, api, formatMessage, getPos, anchorName
|
|
|
12
12
|
anchorName: string;
|
|
13
13
|
nodeType: string;
|
|
14
14
|
handleOptions?: HandleOptions;
|
|
15
|
-
isTopLevelNode?: boolean
|
|
16
|
-
anchorRectCache?: AnchorRectCache
|
|
17
|
-
}
|
|
15
|
+
isTopLevelNode?: boolean;
|
|
16
|
+
anchorRectCache?: AnchorRectCache;
|
|
17
|
+
};
|
|
18
|
+
export declare const DragHandle: ({ view, api, formatMessage, getPos, anchorName, nodeType, handleOptions, isTopLevelNode, anchorRectCache, }: DragHandleProps) => jsx.JSX.Element;
|
|
19
|
+
export declare const DragHandleWithVisibility: ({ view, api, formatMessage, getPos, anchorName, nodeType, anchorRectCache, }: DragHandleProps) => jsx.JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -16,4 +16,5 @@ type Props = {
|
|
|
16
16
|
anchorRectCache?: AnchorRectCache;
|
|
17
17
|
};
|
|
18
18
|
export declare const TypeAheadControl: ({ view, api, formatMessage, getPos, nodeType, anchorName, rootAnchorName, rootNodeType, anchorRectCache, }: Props) => React.JSX.Element;
|
|
19
|
+
export declare const QuickInsertWithVisibility: ({ view, api, formatMessage, getPos, nodeType, anchorName, rootAnchorName, rootNodeType, anchorRectCache, }: Props) => React.JSX.Element;
|
|
19
20
|
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import { BlockControlsPlugin } from '../blockControlsPluginType';
|
|
4
|
+
interface VisibilityContainerProps {
|
|
5
|
+
api?: ExtractInjectionAPI<BlockControlsPlugin>;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const VisibilityContainer: ({ api, children }: VisibilityContainerProps) => React.JSX.Element;
|
|
9
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.4",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
36
|
-
"@atlaskit/editor-common": "^
|
|
36
|
+
"@atlaskit/editor-common": "^103.0.0",
|
|
37
37
|
"@atlaskit/editor-plugin-accessibility-utils": "^2.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-disabled": "^2.0.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@atlaskit/primitives": "^14.3.0",
|
|
55
55
|
"@atlaskit/theme": "^18.0.0",
|
|
56
56
|
"@atlaskit/tmp-editor-statsig": "^4.6.0",
|
|
57
|
-
"@atlaskit/tokens": "^4.
|
|
57
|
+
"@atlaskit/tokens": "^4.7.0",
|
|
58
58
|
"@atlaskit/tooltip": "^20.0.0",
|
|
59
59
|
"@babel/runtime": "^7.0.0",
|
|
60
60
|
"@emotion/react": "^11.7.1",
|
|
@@ -173,6 +173,9 @@
|
|
|
173
173
|
},
|
|
174
174
|
"platform_editor_controls_patch_2": {
|
|
175
175
|
"type": "boolean"
|
|
176
|
+
},
|
|
177
|
+
"platform_editor_controls_widget_visibility": {
|
|
178
|
+
"type": "boolean"
|
|
176
179
|
}
|
|
177
180
|
}
|
|
178
181
|
}
|