@atlaskit/editor-plugin-block-controls 2.0.3 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/cjs/ui/drop-target.js +28 -6
- package/dist/cjs/ui/empty-block-experiment/widget.js +22 -2
- package/dist/es2019/ui/drop-target.js +29 -5
- package/dist/es2019/ui/empty-block-experiment/widget.js +20 -2
- package/dist/esm/ui/drop-target.js +28 -6
- package/dist/esm/ui/empty-block-experiment/widget.js +21 -2
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 2.0.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#142267](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/142267)
|
|
8
|
+
[`9ed8707898875`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9ed8707898875) -
|
|
9
|
+
[ux] ED-24996 Delay appearance of line prompt quickinsert button
|
|
10
|
+
|
|
11
|
+
## 2.0.4
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#141778](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/141778)
|
|
16
|
+
[`1c6f578277694`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1c6f578277694) -
|
|
17
|
+
ED-24870 & ED-24864 - Add the logic to gate the nested media in quotes functionality behind the
|
|
18
|
+
nest-media-and-codeblock-in-quote experiment. Also adjust the logic so the nested expands are now
|
|
19
|
+
behind the nested-expand-in-expand experiment.
|
|
20
|
+
|
|
3
21
|
## 2.0.3
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -100,6 +100,28 @@ var DropTarget = exports.DropTarget = function DropTarget(_ref3) {
|
|
|
100
100
|
if (!element) {
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
|
+
|
|
104
|
+
// Place experiments here instead of just inside move-node.ts as it stops the drag marker from appearing.
|
|
105
|
+
if ((0, _experiments.editorExperiment)('nest-media-and-codeblock-in-quote', false)) {
|
|
106
|
+
var _api$blockControls;
|
|
107
|
+
var _ref4 = (api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {},
|
|
108
|
+
activeNode = _ref4.activeNode;
|
|
109
|
+
var parentNodeType = parentNode === null || parentNode === void 0 ? void 0 : parentNode.type.name;
|
|
110
|
+
var activeNodeType = activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType;
|
|
111
|
+
if (parentNodeType === 'blockquote' && (activeNodeType === 'mediaGroup' || activeNodeType === 'mediaSingle' || activeNodeType === 'codeBlock')) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if ((0, _experiments.editorExperiment)('nested-expand-in-expand', false)) {
|
|
116
|
+
var _api$blockControls2;
|
|
117
|
+
var _ref5 = (api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.sharedState.currentState()) || {},
|
|
118
|
+
_activeNode = _ref5.activeNode;
|
|
119
|
+
var _parentNodeType = parentNode === null || parentNode === void 0 ? void 0 : parentNode.type.name;
|
|
120
|
+
var _activeNodeType = _activeNode === null || _activeNode === void 0 ? void 0 : _activeNode.nodeType;
|
|
121
|
+
if (_parentNodeType === 'expand' && (_activeNodeType === 'expand' || _activeNodeType === 'nestedExpand')) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
103
125
|
return (0, _adapter.dropTargetForElements)({
|
|
104
126
|
element: element,
|
|
105
127
|
getIsSticky: function getIsSticky() {
|
|
@@ -112,21 +134,21 @@ var DropTarget = exports.DropTarget = function DropTarget(_ref3) {
|
|
|
112
134
|
setIsDraggedOver(false);
|
|
113
135
|
},
|
|
114
136
|
onDrop: function onDrop() {
|
|
115
|
-
var _api$
|
|
116
|
-
var
|
|
117
|
-
activeNode =
|
|
137
|
+
var _api$blockControls3;
|
|
138
|
+
var _ref6 = (api === null || api === void 0 || (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 ? void 0 : _api$blockControls3.sharedState.currentState()) || {},
|
|
139
|
+
activeNode = _ref6.activeNode;
|
|
118
140
|
if (!activeNode) {
|
|
119
141
|
return;
|
|
120
142
|
}
|
|
121
143
|
var pos = getPos();
|
|
122
144
|
if (activeNode && pos !== undefined) {
|
|
123
|
-
var _api$core, _api$
|
|
145
|
+
var _api$core, _api$blockControls4;
|
|
124
146
|
var start = activeNode.pos;
|
|
125
|
-
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$
|
|
147
|
+
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 || (_api$blockControls4 = _api$blockControls4.commands) === null || _api$blockControls4 === void 0 ? void 0 : _api$blockControls4.moveNode(start, pos, undefined, formatMessage));
|
|
126
148
|
}
|
|
127
149
|
}
|
|
128
150
|
});
|
|
129
|
-
}, [api, formatMessage, getPos]);
|
|
151
|
+
}, [api, formatMessage, getPos, parentNode]);
|
|
130
152
|
var dropTargetOffsetStyle = (0, _react.useMemo)(function () {
|
|
131
153
|
/**
|
|
132
154
|
* First child of a nested node.
|
|
@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.createEmptyBlockWidgetDecoration = exports.TypeAheadControl = void 0;
|
|
9
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _react2 = require("@emotion/react");
|
|
10
12
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
11
13
|
var _reactIntlNext = require("react-intl-next");
|
|
12
14
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
@@ -15,15 +17,32 @@ var _whitespace = require("@atlaskit/editor-common/whitespace");
|
|
|
15
17
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
16
18
|
var _view2 = require("@atlaskit/editor-prosemirror/view");
|
|
17
19
|
var _add = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/add"));
|
|
20
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
21
|
var _primitives = require("@atlaskit/primitives");
|
|
19
22
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
20
23
|
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); }
|
|
21
24
|
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; }
|
|
25
|
+
/* eslint-disable @atlaskit/ui-styling-standard/use-compiled */
|
|
26
|
+
|
|
22
27
|
var wrapperStyles = (0, _primitives.xcss)({
|
|
23
28
|
position: 'absolute',
|
|
24
29
|
top: "calc('50%' - ".concat("var(--ds-space-150, 12px)", ")"),
|
|
25
30
|
left: "calc(".concat("var(--ds-space-negative-300, -24px)", " + ", "var(--ds-space-negative-100, -8px)", ")")
|
|
26
31
|
});
|
|
32
|
+
var appear = (0, _react2.keyframes)({
|
|
33
|
+
from: {
|
|
34
|
+
visibility: 'hidden'
|
|
35
|
+
},
|
|
36
|
+
to: {
|
|
37
|
+
visibility: 'visible'
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
var delayedAppearance = (0, _primitives.xcss)({
|
|
41
|
+
visibility: 'hidden',
|
|
42
|
+
animation: "".concat(appear, " 0.1s"),
|
|
43
|
+
animationDelay: '2s',
|
|
44
|
+
animationFillMode: 'forwards'
|
|
45
|
+
});
|
|
27
46
|
var buttonStyles = (0, _primitives.xcss)({
|
|
28
47
|
boxSizing: 'border-box',
|
|
29
48
|
display: 'flex',
|
|
@@ -53,7 +72,8 @@ var TypeAheadControl = exports.TypeAheadControl = function TypeAheadControl(_ref
|
|
|
53
72
|
getPos = _ref.getPos,
|
|
54
73
|
formatMessage = _ref.intl.formatMessage;
|
|
55
74
|
return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
56
|
-
xcss: [wrapperStyles]
|
|
75
|
+
xcss: [wrapperStyles],
|
|
76
|
+
testId: "editor-empty-line-prompt-experiment"
|
|
57
77
|
}, /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
58
78
|
content: /*#__PURE__*/_react.default.createElement(_keymaps.ToolTipContent, {
|
|
59
79
|
description: formatMessage(_messages.blockControlsMessages.insert),
|
|
@@ -62,7 +82,7 @@ var TypeAheadControl = exports.TypeAheadControl = function TypeAheadControl(_ref
|
|
|
62
82
|
}, /*#__PURE__*/_react.default.createElement(_primitives.Pressable, {
|
|
63
83
|
type: "button",
|
|
64
84
|
"aria-label": formatMessage(_messages.blockControlsMessages.insert),
|
|
65
|
-
xcss: [buttonStyles],
|
|
85
|
+
xcss: [buttonStyles].concat((0, _toConsumableArray2.default)((0, _platformFeatureFlags.fg)('platform_editor_empty_line_prompt_delay') ? [delayedAppearance] : [])),
|
|
66
86
|
onClick: function onClick() {
|
|
67
87
|
var _api$core, _api$quickInsert;
|
|
68
88
|
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref2) {
|
|
@@ -83,6 +83,30 @@ export const DropTarget = ({
|
|
|
83
83
|
if (!element) {
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
|
+
|
|
87
|
+
// Place experiments here instead of just inside move-node.ts as it stops the drag marker from appearing.
|
|
88
|
+
if (editorExperiment('nest-media-and-codeblock-in-quote', false)) {
|
|
89
|
+
var _api$blockControls;
|
|
90
|
+
const {
|
|
91
|
+
activeNode
|
|
92
|
+
} = (api === null || api === void 0 ? void 0 : (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {};
|
|
93
|
+
const parentNodeType = parentNode === null || parentNode === void 0 ? void 0 : parentNode.type.name;
|
|
94
|
+
const activeNodeType = activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType;
|
|
95
|
+
if (parentNodeType === 'blockquote' && (activeNodeType === 'mediaGroup' || activeNodeType === 'mediaSingle' || activeNodeType === 'codeBlock')) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (editorExperiment('nested-expand-in-expand', false)) {
|
|
100
|
+
var _api$blockControls2;
|
|
101
|
+
const {
|
|
102
|
+
activeNode
|
|
103
|
+
} = (api === null || api === void 0 ? void 0 : (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.sharedState.currentState()) || {};
|
|
104
|
+
const parentNodeType = parentNode === null || parentNode === void 0 ? void 0 : parentNode.type.name;
|
|
105
|
+
const activeNodeType = activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType;
|
|
106
|
+
if (parentNodeType === 'expand' && (activeNodeType === 'expand' || activeNodeType === 'nestedExpand')) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
86
110
|
return dropTargetForElements({
|
|
87
111
|
element,
|
|
88
112
|
getIsSticky: () => true,
|
|
@@ -93,24 +117,24 @@ export const DropTarget = ({
|
|
|
93
117
|
setIsDraggedOver(false);
|
|
94
118
|
},
|
|
95
119
|
onDrop: () => {
|
|
96
|
-
var _api$
|
|
120
|
+
var _api$blockControls3;
|
|
97
121
|
const {
|
|
98
122
|
activeNode
|
|
99
|
-
} = (api === null || api === void 0 ? void 0 : (_api$
|
|
123
|
+
} = (api === null || api === void 0 ? void 0 : (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 ? void 0 : _api$blockControls3.sharedState.currentState()) || {};
|
|
100
124
|
if (!activeNode) {
|
|
101
125
|
return;
|
|
102
126
|
}
|
|
103
127
|
const pos = getPos();
|
|
104
128
|
if (activeNode && pos !== undefined) {
|
|
105
|
-
var _api$core, _api$
|
|
129
|
+
var _api$core, _api$blockControls4, _api$blockControls4$c;
|
|
106
130
|
const {
|
|
107
131
|
pos: start
|
|
108
132
|
} = activeNode;
|
|
109
|
-
api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api === null || api === void 0 ? void 0 : (_api$
|
|
133
|
+
api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 ? void 0 : (_api$blockControls4$c = _api$blockControls4.commands) === null || _api$blockControls4$c === void 0 ? void 0 : _api$blockControls4$c.moveNode(start, pos, undefined, formatMessage));
|
|
110
134
|
}
|
|
111
135
|
}
|
|
112
136
|
});
|
|
113
|
-
}, [api, formatMessage, getPos]);
|
|
137
|
+
}, [api, formatMessage, getPos, parentNode]);
|
|
114
138
|
const dropTargetOffsetStyle = useMemo(() => {
|
|
115
139
|
/**
|
|
116
140
|
* First child of a nested node.
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
/* eslint-disable @atlaskit/ui-styling-standard/use-compiled */
|
|
1
2
|
import React, { createElement } from 'react';
|
|
3
|
+
import { keyframes } from '@emotion/react';
|
|
2
4
|
import ReactDOM from 'react-dom';
|
|
3
5
|
import { injectIntl, RawIntlProvider } from 'react-intl-next';
|
|
4
6
|
import { ToolTipContent } from '@atlaskit/editor-common/keymaps';
|
|
@@ -7,6 +9,7 @@ import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace';
|
|
|
7
9
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
10
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
9
11
|
import EditorAddIcon from '@atlaskit/icon/glyph/editor/add';
|
|
12
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
13
|
import { Box, Pressable, xcss } from '@atlaskit/primitives';
|
|
11
14
|
import Tooltip from '@atlaskit/tooltip';
|
|
12
15
|
const wrapperStyles = xcss({
|
|
@@ -14,6 +17,20 @@ const wrapperStyles = xcss({
|
|
|
14
17
|
top: `calc('50%' - ${"var(--ds-space-150, 12px)"})`,
|
|
15
18
|
left: `calc(${"var(--ds-space-negative-300, -24px)"} + ${"var(--ds-space-negative-100, -8px)"})`
|
|
16
19
|
});
|
|
20
|
+
const appear = keyframes({
|
|
21
|
+
from: {
|
|
22
|
+
visibility: 'hidden'
|
|
23
|
+
},
|
|
24
|
+
to: {
|
|
25
|
+
visibility: 'visible'
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
const delayedAppearance = xcss({
|
|
29
|
+
visibility: 'hidden',
|
|
30
|
+
animation: `${appear} 0.1s`,
|
|
31
|
+
animationDelay: '2s',
|
|
32
|
+
animationFillMode: 'forwards'
|
|
33
|
+
});
|
|
17
34
|
const buttonStyles = xcss({
|
|
18
35
|
boxSizing: 'border-box',
|
|
19
36
|
display: 'flex',
|
|
@@ -46,7 +63,8 @@ export const TypeAheadControl = ({
|
|
|
46
63
|
}
|
|
47
64
|
}) => {
|
|
48
65
|
return /*#__PURE__*/React.createElement(Box, {
|
|
49
|
-
xcss: [wrapperStyles]
|
|
66
|
+
xcss: [wrapperStyles],
|
|
67
|
+
testId: "editor-empty-line-prompt-experiment"
|
|
50
68
|
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
51
69
|
content: /*#__PURE__*/React.createElement(ToolTipContent, {
|
|
52
70
|
description: formatMessage(messages.insert),
|
|
@@ -55,7 +73,7 @@ export const TypeAheadControl = ({
|
|
|
55
73
|
}, /*#__PURE__*/React.createElement(Pressable, {
|
|
56
74
|
type: "button",
|
|
57
75
|
"aria-label": formatMessage(messages.insert),
|
|
58
|
-
xcss: [buttonStyles],
|
|
76
|
+
xcss: [buttonStyles, ...(fg('platform_editor_empty_line_prompt_delay') ? [delayedAppearance] : [])],
|
|
59
77
|
onClick: () => {
|
|
60
78
|
var _api$core, _api$quickInsert;
|
|
61
79
|
api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(({
|
|
@@ -92,6 +92,28 @@ export var DropTarget = function DropTarget(_ref3) {
|
|
|
92
92
|
if (!element) {
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
|
+
|
|
96
|
+
// Place experiments here instead of just inside move-node.ts as it stops the drag marker from appearing.
|
|
97
|
+
if (editorExperiment('nest-media-and-codeblock-in-quote', false)) {
|
|
98
|
+
var _api$blockControls;
|
|
99
|
+
var _ref4 = (api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {},
|
|
100
|
+
activeNode = _ref4.activeNode;
|
|
101
|
+
var parentNodeType = parentNode === null || parentNode === void 0 ? void 0 : parentNode.type.name;
|
|
102
|
+
var activeNodeType = activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType;
|
|
103
|
+
if (parentNodeType === 'blockquote' && (activeNodeType === 'mediaGroup' || activeNodeType === 'mediaSingle' || activeNodeType === 'codeBlock')) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (editorExperiment('nested-expand-in-expand', false)) {
|
|
108
|
+
var _api$blockControls2;
|
|
109
|
+
var _ref5 = (api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.sharedState.currentState()) || {},
|
|
110
|
+
_activeNode = _ref5.activeNode;
|
|
111
|
+
var _parentNodeType = parentNode === null || parentNode === void 0 ? void 0 : parentNode.type.name;
|
|
112
|
+
var _activeNodeType = _activeNode === null || _activeNode === void 0 ? void 0 : _activeNode.nodeType;
|
|
113
|
+
if (_parentNodeType === 'expand' && (_activeNodeType === 'expand' || _activeNodeType === 'nestedExpand')) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
95
117
|
return dropTargetForElements({
|
|
96
118
|
element: element,
|
|
97
119
|
getIsSticky: function getIsSticky() {
|
|
@@ -104,21 +126,21 @@ export var DropTarget = function DropTarget(_ref3) {
|
|
|
104
126
|
setIsDraggedOver(false);
|
|
105
127
|
},
|
|
106
128
|
onDrop: function onDrop() {
|
|
107
|
-
var _api$
|
|
108
|
-
var
|
|
109
|
-
activeNode =
|
|
129
|
+
var _api$blockControls3;
|
|
130
|
+
var _ref6 = (api === null || api === void 0 || (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 ? void 0 : _api$blockControls3.sharedState.currentState()) || {},
|
|
131
|
+
activeNode = _ref6.activeNode;
|
|
110
132
|
if (!activeNode) {
|
|
111
133
|
return;
|
|
112
134
|
}
|
|
113
135
|
var pos = getPos();
|
|
114
136
|
if (activeNode && pos !== undefined) {
|
|
115
|
-
var _api$core, _api$
|
|
137
|
+
var _api$core, _api$blockControls4;
|
|
116
138
|
var start = activeNode.pos;
|
|
117
|
-
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$
|
|
139
|
+
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 || (_api$blockControls4 = _api$blockControls4.commands) === null || _api$blockControls4 === void 0 ? void 0 : _api$blockControls4.moveNode(start, pos, undefined, formatMessage));
|
|
118
140
|
}
|
|
119
141
|
}
|
|
120
142
|
});
|
|
121
|
-
}, [api, formatMessage, getPos]);
|
|
143
|
+
}, [api, formatMessage, getPos, parentNode]);
|
|
122
144
|
var dropTargetOffsetStyle = useMemo(function () {
|
|
123
145
|
/**
|
|
124
146
|
* First child of a nested node.
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
/* eslint-disable @atlaskit/ui-styling-standard/use-compiled */
|
|
1
3
|
import React, { createElement } from 'react';
|
|
4
|
+
import { keyframes } from '@emotion/react';
|
|
2
5
|
import ReactDOM from 'react-dom';
|
|
3
6
|
import { injectIntl, RawIntlProvider } from 'react-intl-next';
|
|
4
7
|
import { ToolTipContent } from '@atlaskit/editor-common/keymaps';
|
|
@@ -7,6 +10,7 @@ import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace';
|
|
|
7
10
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
11
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
9
12
|
import EditorAddIcon from '@atlaskit/icon/glyph/editor/add';
|
|
13
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
14
|
import { Box, Pressable, xcss } from '@atlaskit/primitives';
|
|
11
15
|
import Tooltip from '@atlaskit/tooltip';
|
|
12
16
|
var wrapperStyles = xcss({
|
|
@@ -14,6 +18,20 @@ var wrapperStyles = xcss({
|
|
|
14
18
|
top: "calc('50%' - ".concat("var(--ds-space-150, 12px)", ")"),
|
|
15
19
|
left: "calc(".concat("var(--ds-space-negative-300, -24px)", " + ", "var(--ds-space-negative-100, -8px)", ")")
|
|
16
20
|
});
|
|
21
|
+
var appear = keyframes({
|
|
22
|
+
from: {
|
|
23
|
+
visibility: 'hidden'
|
|
24
|
+
},
|
|
25
|
+
to: {
|
|
26
|
+
visibility: 'visible'
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
var delayedAppearance = xcss({
|
|
30
|
+
visibility: 'hidden',
|
|
31
|
+
animation: "".concat(appear, " 0.1s"),
|
|
32
|
+
animationDelay: '2s',
|
|
33
|
+
animationFillMode: 'forwards'
|
|
34
|
+
});
|
|
17
35
|
var buttonStyles = xcss({
|
|
18
36
|
boxSizing: 'border-box',
|
|
19
37
|
display: 'flex',
|
|
@@ -43,7 +61,8 @@ export var TypeAheadControl = function TypeAheadControl(_ref) {
|
|
|
43
61
|
getPos = _ref.getPos,
|
|
44
62
|
formatMessage = _ref.intl.formatMessage;
|
|
45
63
|
return /*#__PURE__*/React.createElement(Box, {
|
|
46
|
-
xcss: [wrapperStyles]
|
|
64
|
+
xcss: [wrapperStyles],
|
|
65
|
+
testId: "editor-empty-line-prompt-experiment"
|
|
47
66
|
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
48
67
|
content: /*#__PURE__*/React.createElement(ToolTipContent, {
|
|
49
68
|
description: formatMessage(messages.insert),
|
|
@@ -52,7 +71,7 @@ export var TypeAheadControl = function TypeAheadControl(_ref) {
|
|
|
52
71
|
}, /*#__PURE__*/React.createElement(Pressable, {
|
|
53
72
|
type: "button",
|
|
54
73
|
"aria-label": formatMessage(messages.insert),
|
|
55
|
-
xcss: [buttonStyles],
|
|
74
|
+
xcss: [buttonStyles].concat(_toConsumableArray(fg('platform_editor_empty_line_prompt_delay') ? [delayedAppearance] : [])),
|
|
56
75
|
onClick: function onClick() {
|
|
57
76
|
var _api$core, _api$quickInsert;
|
|
58
77
|
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref2) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -131,6 +131,9 @@
|
|
|
131
131
|
},
|
|
132
132
|
"platform_editor_element_drag_and_drop_ed_24885": {
|
|
133
133
|
"type": "boolean"
|
|
134
|
+
},
|
|
135
|
+
"platform_editor_empty_line_prompt_delay": {
|
|
136
|
+
"type": "boolean"
|
|
134
137
|
}
|
|
135
138
|
}
|
|
136
139
|
}
|