@atlaskit/editor-plugin-expand 2.10.14 → 2.11.0
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 +12 -0
- package/dist/cjs/legacyExpand/nodeviews/index.js +1 -6
- package/dist/cjs/legacyExpand/pm-plugins/main.js +0 -2
- package/dist/cjs/legacyExpand/ui/ExpandIconButton.js +11 -8
- package/dist/cjs/singlePlayerExpand/node-views/index.js +25 -12
- package/dist/cjs/singlePlayerExpand/pm-plugins/main.js +0 -2
- package/dist/cjs/singlePlayerExpand/ui/ExpandButton.js +11 -8
- package/dist/cjs/singlePlayerExpand/ui/NodeView.js +1 -4
- package/dist/es2019/legacyExpand/nodeviews/index.js +1 -6
- package/dist/es2019/legacyExpand/pm-plugins/main.js +1 -6
- package/dist/es2019/legacyExpand/ui/ExpandIconButton.js +11 -8
- package/dist/es2019/singlePlayerExpand/node-views/index.js +25 -12
- package/dist/es2019/singlePlayerExpand/pm-plugins/main.js +1 -6
- package/dist/es2019/singlePlayerExpand/ui/ExpandButton.js +11 -8
- package/dist/es2019/singlePlayerExpand/ui/NodeView.js +1 -4
- package/dist/esm/legacyExpand/nodeviews/index.js +1 -6
- package/dist/esm/legacyExpand/pm-plugins/main.js +0 -2
- package/dist/esm/legacyExpand/ui/ExpandIconButton.js +11 -8
- package/dist/esm/singlePlayerExpand/node-views/index.js +25 -12
- package/dist/esm/singlePlayerExpand/pm-plugins/main.js +0 -2
- package/dist/esm/singlePlayerExpand/ui/ExpandButton.js +11 -8
- package/dist/esm/singlePlayerExpand/ui/NodeView.js +1 -4
- package/dist/types/legacyExpand/ui/ExpandIconButton.d.ts +2 -4
- package/dist/types/singlePlayerExpand/node-views/index.d.ts +1 -0
- package/dist/types/types.d.ts +11 -8
- package/dist/types-ts4.5/legacyExpand/ui/ExpandIconButton.d.ts +2 -4
- package/dist/types-ts4.5/singlePlayerExpand/node-views/index.d.ts +1 -0
- package/dist/types-ts4.5/types.d.ts +11 -8
- package/package.json +20 -19
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-expand
|
|
2
2
|
|
|
3
|
+
## 2.11.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#109060](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/109060)
|
|
8
|
+
[`4660ec858a305`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4660ec858a305) -
|
|
9
|
+
Update `React` from v16 to v18
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 2.10.14
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -26,10 +26,7 @@ var _ExpandIconButton = require("../ui/ExpandIconButton");
|
|
|
26
26
|
function buildExpandClassName(type, expanded) {
|
|
27
27
|
return "".concat(_styles.expandClassNames.prefix, " ").concat(_styles.expandClassNames.type(type), " ").concat(expanded ? _styles.expandClassNames.expanded : '');
|
|
28
28
|
}
|
|
29
|
-
var toDOM = function toDOM(node, __livePage, intl, titleReadOnly, contentEditable
|
|
30
|
-
// Ignored via go/ees005
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
32
|
-
) {
|
|
29
|
+
var toDOM = function toDOM(node, __livePage, intl, titleReadOnly, contentEditable) {
|
|
33
30
|
return ['div', {
|
|
34
31
|
// prettier-ignore
|
|
35
32
|
'class': buildExpandClassName(node.type.name, __livePage && (0, _platformFeatureFlags.fg)('platform.editor.live-pages-expand-divergence') ? !node.attrs.__expanded : node.attrs.__expanded),
|
|
@@ -65,8 +62,6 @@ var toDOM = function toDOM(node, __livePage, intl, titleReadOnly, contentEditabl
|
|
|
65
62
|
}, 0]];
|
|
66
63
|
};
|
|
67
64
|
var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
68
|
-
// Ignored via go/ees005
|
|
69
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
70
65
|
function ExpandNodeView(_node, view, getPos, getIntl, isMobile, selectNearNode, api, nodeViewPortalProviderAPI) {
|
|
71
66
|
var _this = this,
|
|
72
67
|
_api$editorDisabled;
|
|
@@ -68,8 +68,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, getInt
|
|
|
68
68
|
}, {
|
|
69
69
|
useLongPressSelection: useLongPressSelection
|
|
70
70
|
}),
|
|
71
|
-
// Ignored via go/ees005
|
|
72
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
73
71
|
handleDrop: function handleDrop(view, event, slice, moved) {
|
|
74
72
|
return handleExpandDrag(view, event, slice);
|
|
75
73
|
}
|
|
@@ -44,14 +44,17 @@ var withTooltip = exports.withTooltip = function withTooltip(WrapperComponent) {
|
|
|
44
44
|
key: "render",
|
|
45
45
|
value: function render() {
|
|
46
46
|
var label = this.props.label;
|
|
47
|
-
return (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
return (
|
|
48
|
+
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
49
|
+
(0, _react2.jsx)(_tooltip.default, {
|
|
50
|
+
content: label,
|
|
51
|
+
position: "top",
|
|
52
|
+
tag: _ui.ExpandLayoutWrapperWithRef
|
|
53
|
+
}, (0, _react2.jsx)(WrapperComponent
|
|
54
|
+
// Ignored via go/ees005
|
|
55
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
56
|
+
, this.props))
|
|
57
|
+
);
|
|
55
58
|
}
|
|
56
59
|
}]);
|
|
57
60
|
}(_react.default.Component);
|
|
@@ -21,16 +21,15 @@ var _history = require("@atlaskit/editor-prosemirror/history");
|
|
|
21
21
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
22
22
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
23
23
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
24
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
24
25
|
var _commands = require("../commands");
|
|
25
26
|
var _ExpandButton = require("../ui/ExpandButton");
|
|
26
27
|
var _NodeView = require("../ui/NodeView");
|
|
27
28
|
var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
28
|
-
// Ignored via go/ees005
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
30
29
|
function ExpandNodeView(_node, view, getPos, getIntl, isMobile, selectNearNode, api, nodeViewPortalProviderAPI) {
|
|
31
30
|
var _this = this,
|
|
32
31
|
_api$editorDisabled,
|
|
33
|
-
_this$
|
|
32
|
+
_this$api8;
|
|
34
33
|
var allowInteractiveExpand = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : true;
|
|
35
34
|
var __livePage = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
|
|
36
35
|
var cleanUpEditorDisabledOnChange = arguments.length > 10 ? arguments[10] : undefined;
|
|
@@ -125,9 +124,17 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
125
124
|
(0, _defineProperty2.default)(this, "handleFocus", function (event) {
|
|
126
125
|
event.stopImmediatePropagation();
|
|
127
126
|
});
|
|
127
|
+
(0, _defineProperty2.default)(this, "handleInputClick", function () {
|
|
128
|
+
if (!(0, _experiments.editorExperiment)('live_pages_graceful_edit', 'control')) {
|
|
129
|
+
var _this$api2, _this$api3;
|
|
130
|
+
(_this$api2 = _this.api) === null || _this$api2 === void 0 || (_this$api2 = _this$api2.core) === null || _this$api2 === void 0 || (_this$api2 = _this$api2.actions) === null || _this$api2 === void 0 || _this$api2.execute((_this$api3 = _this.api) === null || _this$api3 === void 0 || (_this$api3 = _this$api3.editorViewMode) === null || _this$api3 === void 0 ? void 0 : _this$api3.commands.updateContentMode({
|
|
131
|
+
type: 'intent-to-edit'
|
|
132
|
+
}));
|
|
133
|
+
}
|
|
134
|
+
});
|
|
128
135
|
(0, _defineProperty2.default)(this, "handleInputFocus", function () {
|
|
129
|
-
var _this$
|
|
130
|
-
_this.decorationCleanup = (_this$
|
|
136
|
+
var _this$api4;
|
|
137
|
+
_this.decorationCleanup = (_this$api4 = _this.api) === null || _this$api4 === void 0 || (_this$api4 = _this$api4.selectionMarker) === null || _this$api4 === void 0 || (_this$api4 = _this$api4.actions) === null || _this$api4 === void 0 ? void 0 : _this$api4.hideDecoration();
|
|
131
138
|
});
|
|
132
139
|
(0, _defineProperty2.default)(this, "handleBlur", function () {
|
|
133
140
|
var _this$decorationClean;
|
|
@@ -179,8 +186,8 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
179
186
|
return;
|
|
180
187
|
}
|
|
181
188
|
if (expandNode && (0, _utils.isEmptyNode)(state.schema)(expandNode)) {
|
|
182
|
-
var _this$
|
|
183
|
-
(0, _commands.deleteExpand)((_this$
|
|
189
|
+
var _this$api5;
|
|
190
|
+
(0, _commands.deleteExpand)((_this$api5 = _this.api) === null || _this$api5 === void 0 || (_this$api5 = _this$api5.analytics) === null || _this$api5 === void 0 ? void 0 : _this$api5.actions)(state, _this.view.dispatch);
|
|
184
191
|
}
|
|
185
192
|
});
|
|
186
193
|
(0, _defineProperty2.default)(this, "toggleExpand", function () {
|
|
@@ -189,12 +196,12 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
189
196
|
return;
|
|
190
197
|
}
|
|
191
198
|
if (_this.allowInteractiveExpand) {
|
|
192
|
-
var _this$
|
|
199
|
+
var _this$api6;
|
|
193
200
|
var _this$view3 = _this.view,
|
|
194
201
|
state = _this$view3.state,
|
|
195
202
|
dispatch = _this$view3.dispatch;
|
|
196
203
|
(0, _commands.toggleExpandExpanded)({
|
|
197
|
-
editorAnalyticsAPI: (_this$
|
|
204
|
+
editorAnalyticsAPI: (_this$api6 = _this.api) === null || _this$api6 === void 0 || (_this$api6 = _this$api6.analytics) === null || _this$api6 === void 0 ? void 0 : _this$api6.actions,
|
|
198
205
|
pos: pos,
|
|
199
206
|
node: _this.node
|
|
200
207
|
})(state, dispatch);
|
|
@@ -316,13 +323,13 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
316
323
|
selectionStart = _this$input5.selectionStart,
|
|
317
324
|
selectionEnd = _this$input5.selectionEnd;
|
|
318
325
|
if (selectionStart === selectionEnd && selectionStart === 0) {
|
|
319
|
-
var _this$
|
|
326
|
+
var _this$api7;
|
|
320
327
|
event.preventDefault();
|
|
321
328
|
var _this$view8 = _this.view,
|
|
322
329
|
state = _this$view8.state,
|
|
323
330
|
dispatch = _this$view8.dispatch;
|
|
324
331
|
_this.view.focus();
|
|
325
|
-
var selectionSharedState = ((_this$
|
|
332
|
+
var selectionSharedState = ((_this$api7 = _this.api) === null || _this$api7 === void 0 || (_this$api7 = _this$api7.selection) === null || _this$api7 === void 0 ? void 0 : _this$api7.sharedState.currentState()) || {};
|
|
326
333
|
// selectionRelativeToNode is undefined when user clicked to select node, then hit left to get focus in title
|
|
327
334
|
// This is a special case where we want to bypass node selection and jump straight to gap cursor
|
|
328
335
|
if ((selectionSharedState === null || selectionSharedState === void 0 ? void 0 : selectionSharedState.selectionRelativeToNode) === undefined) {
|
|
@@ -431,8 +438,11 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
431
438
|
// If the user interacts in our title bar (either toggle or input)
|
|
432
439
|
// Prevent ProseMirror from getting a focus event (causes weird selection issues).
|
|
433
440
|
this.titleContainer.addEventListener('focus', this.handleFocus);
|
|
441
|
+
if (!(0, _experiments.editorExperiment)('live_pages_graceful_edit', 'control')) {
|
|
442
|
+
this.input.addEventListener('click', this.handleInputClick);
|
|
443
|
+
}
|
|
434
444
|
this.icon.addEventListener('keydown', this.handleIconKeyDown);
|
|
435
|
-
if ((_this$
|
|
445
|
+
if ((_this$api8 = this.api) !== null && _this$api8 !== void 0 && _this$api8.editorDisabled) {
|
|
436
446
|
this.cleanUpEditorDisabledOnChange = this.api.editorDisabled.sharedState.onChange(function (sharedState) {
|
|
437
447
|
var editorDisabled = sharedState.nextSharedState.editorDisabled;
|
|
438
448
|
if (_this.input) {
|
|
@@ -532,6 +542,9 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
532
542
|
this.input.removeEventListener('blur', this.handleBlur);
|
|
533
543
|
this.input.removeEventListener('focus', this.handleInputFocus);
|
|
534
544
|
this.titleContainer.removeEventListener('focus', this.handleFocus);
|
|
545
|
+
if (!(0, _experiments.editorExperiment)('live_pages_graceful_edit', 'control')) {
|
|
546
|
+
this.input.removeEventListener('click', this.handleInputClick);
|
|
547
|
+
}
|
|
535
548
|
this.icon.removeEventListener('keydown', this.handleIconKeyDown);
|
|
536
549
|
(_this$decorationClean2 = this.decorationCleanup) === null || _this$decorationClean2 === void 0 || _this$decorationClean2.call(this);
|
|
537
550
|
if (this.cleanUpEditorDisabledOnChange) {
|
|
@@ -66,8 +66,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, getInt
|
|
|
66
66
|
}, {
|
|
67
67
|
useLongPressSelection: useLongPressSelection
|
|
68
68
|
}),
|
|
69
|
-
// Ignored via go/ees005
|
|
70
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
71
69
|
handleDrop: function handleDrop(view, event, slice, moved) {
|
|
72
70
|
return handleExpandDrag(view, event, slice);
|
|
73
71
|
}
|
|
@@ -30,14 +30,17 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
30
30
|
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; }
|
|
31
31
|
function withTooltip(Component) {
|
|
32
32
|
return function WithTooltip(props) {
|
|
33
|
-
return (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
return (
|
|
34
|
+
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
35
|
+
(0, _react2.jsx)(_tooltip.default, {
|
|
36
|
+
content: props.label,
|
|
37
|
+
position: "top",
|
|
38
|
+
tag: _ui.ExpandLayoutWrapperWithRef
|
|
39
|
+
}, (0, _react2.jsx)(Component
|
|
40
|
+
// Ignored via go/ees005
|
|
41
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
42
|
+
, props))
|
|
43
|
+
);
|
|
41
44
|
};
|
|
42
45
|
}
|
|
43
46
|
var ExpandButtonInner = exports.ExpandButtonInner = function ExpandButtonInner(props) {
|
|
@@ -10,10 +10,7 @@ var _ui = require("@atlaskit/editor-common/ui");
|
|
|
10
10
|
var buildExpandClassName = exports.buildExpandClassName = function buildExpandClassName(type, expanded) {
|
|
11
11
|
return "".concat(_styles.expandClassNames.prefix, " ").concat(_styles.expandClassNames.type(type), " ").concat(expanded ? _styles.expandClassNames.expanded : '');
|
|
12
12
|
};
|
|
13
|
-
var toDOM = exports.toDOM = function toDOM(node, __livePage, intl, titleReadOnly, contentEditable
|
|
14
|
-
// Ignored via go/ees005
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
16
|
-
) {
|
|
13
|
+
var toDOM = exports.toDOM = function toDOM(node, __livePage, intl, titleReadOnly, contentEditable) {
|
|
17
14
|
var _expandedState$get;
|
|
18
15
|
return ['div', {
|
|
19
16
|
// prettier-ignore
|
|
@@ -16,10 +16,7 @@ import { ExpandIconButton } from '../ui/ExpandIconButton';
|
|
|
16
16
|
function buildExpandClassName(type, expanded) {
|
|
17
17
|
return `${expandClassNames.prefix} ${expandClassNames.type(type)} ${expanded ? expandClassNames.expanded : ''}`;
|
|
18
18
|
}
|
|
19
|
-
const toDOM = (node, __livePage, intl, titleReadOnly, contentEditable
|
|
20
|
-
// Ignored via go/ees005
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
22
|
-
) => ['div', {
|
|
19
|
+
const toDOM = (node, __livePage, intl, titleReadOnly, contentEditable) => ['div', {
|
|
23
20
|
// prettier-ignore
|
|
24
21
|
'class': buildExpandClassName(node.type.name, __livePage && fg('platform.editor.live-pages-expand-divergence') ? !node.attrs.__expanded : node.attrs.__expanded),
|
|
25
22
|
'data-node-type': node.type.name,
|
|
@@ -53,8 +50,6 @@ const toDOM = (node, __livePage, intl, titleReadOnly, contentEditable
|
|
|
53
50
|
contenteditable: contentEditable !== undefined ? contentEditable ? 'true' : 'false' : undefined
|
|
54
51
|
}, 0]];
|
|
55
52
|
export class ExpandNodeView {
|
|
56
|
-
// Ignored via go/ees005
|
|
57
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
58
53
|
constructor(_node, view, getPos, getIntl, isMobile, selectNearNode, api, nodeViewPortalProviderAPI, allowInteractiveExpand = true, __livePage = false, cleanUpEditorDisabledOnChange) {
|
|
59
54
|
var _api$editorDisabled, _api$editorDisabled$s;
|
|
60
55
|
_defineProperty(this, "allowInteractiveExpand", true);
|
|
@@ -13,10 +13,7 @@ export function containsClass(element, className) {
|
|
|
13
13
|
var _element$classList;
|
|
14
14
|
return Boolean(element === null || element === void 0 ? void 0 : (_element$classList = element.classList) === null || _element$classList === void 0 ? void 0 : _element$classList.contains(className));
|
|
15
15
|
}
|
|
16
|
-
export const createPlugin = (dispatch, getIntl, appearance = 'full-page', useLongPressSelection = false, api, nodeViewPortalProviderAPI, allowInteractiveExpand = true, __livePage = false
|
|
17
|
-
// Ignored via go/ees005
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
19
|
-
) => {
|
|
16
|
+
export const createPlugin = (dispatch, getIntl, appearance = 'full-page', useLongPressSelection = false, api, nodeViewPortalProviderAPI, allowInteractiveExpand = true, __livePage = false) => {
|
|
20
17
|
const state = createPluginState(dispatch, {});
|
|
21
18
|
const isMobile = false;
|
|
22
19
|
return new SafePlugin({
|
|
@@ -53,8 +50,6 @@ export const createPlugin = (dispatch, getIntl, appearance = 'full-page', useLon
|
|
|
53
50
|
handleClickOn: createSelectionClickHandler(['expand', 'nestedExpand'], target => target.classList.contains(expandClassNames.prefix), {
|
|
54
51
|
useLongPressSelection
|
|
55
52
|
}),
|
|
56
|
-
// Ignored via go/ees005
|
|
57
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
58
53
|
handleDrop(view, event, slice, moved) {
|
|
59
54
|
return handleExpandDrag(view, event, slice);
|
|
60
55
|
}
|
|
@@ -23,14 +23,17 @@ export const withTooltip = WrapperComponent => {
|
|
|
23
23
|
const {
|
|
24
24
|
label
|
|
25
25
|
} = this.props;
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
return (
|
|
27
|
+
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
28
|
+
jsx(Tooltip, {
|
|
29
|
+
content: label,
|
|
30
|
+
position: "top",
|
|
31
|
+
tag: ExpandLayoutWrapperWithRef
|
|
32
|
+
}, jsx(WrapperComponent
|
|
33
|
+
// Ignored via go/ees005
|
|
34
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
35
|
+
, this.props))
|
|
36
|
+
);
|
|
34
37
|
}
|
|
35
38
|
};
|
|
36
39
|
};
|
|
@@ -11,14 +11,13 @@ import { redo, undo } from '@atlaskit/editor-prosemirror/history';
|
|
|
11
11
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
12
12
|
import { NodeSelection, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
13
13
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
14
15
|
import { deleteExpand, setSelectionInsideExpand, toggleExpandExpanded, updateExpandTitle } from '../commands';
|
|
15
16
|
import { ExpandButton } from '../ui/ExpandButton';
|
|
16
17
|
import { buildExpandClassName, toDOM } from '../ui/NodeView';
|
|
17
18
|
export class ExpandNodeView {
|
|
18
|
-
// Ignored via go/ees005
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
20
19
|
constructor(_node, view, getPos, getIntl, isMobile, selectNearNode, api, nodeViewPortalProviderAPI, allowInteractiveExpand = true, __livePage = false, cleanUpEditorDisabledOnChange) {
|
|
21
|
-
var _api$editorDisabled, _api$editorDisabled$s, _this$
|
|
20
|
+
var _api$editorDisabled, _api$editorDisabled$s, _this$api8;
|
|
22
21
|
_defineProperty(this, "allowInteractiveExpand", true);
|
|
23
22
|
_defineProperty(this, "isMobile", false);
|
|
24
23
|
_defineProperty(this, "focusTitle", () => {
|
|
@@ -111,9 +110,17 @@ export class ExpandNodeView {
|
|
|
111
110
|
_defineProperty(this, "handleFocus", event => {
|
|
112
111
|
event.stopImmediatePropagation();
|
|
113
112
|
});
|
|
113
|
+
_defineProperty(this, "handleInputClick", () => {
|
|
114
|
+
if (!editorExperiment('live_pages_graceful_edit', 'control')) {
|
|
115
|
+
var _this$api2, _this$api2$core, _this$api2$core$actio, _this$api3, _this$api3$editorView;
|
|
116
|
+
(_this$api2 = this.api) === null || _this$api2 === void 0 ? void 0 : (_this$api2$core = _this$api2.core) === null || _this$api2$core === void 0 ? void 0 : (_this$api2$core$actio = _this$api2$core.actions) === null || _this$api2$core$actio === void 0 ? void 0 : _this$api2$core$actio.execute((_this$api3 = this.api) === null || _this$api3 === void 0 ? void 0 : (_this$api3$editorView = _this$api3.editorViewMode) === null || _this$api3$editorView === void 0 ? void 0 : _this$api3$editorView.commands.updateContentMode({
|
|
117
|
+
type: 'intent-to-edit'
|
|
118
|
+
}));
|
|
119
|
+
}
|
|
120
|
+
});
|
|
114
121
|
_defineProperty(this, "handleInputFocus", () => {
|
|
115
|
-
var _this$
|
|
116
|
-
this.decorationCleanup = (_this$
|
|
122
|
+
var _this$api4, _this$api4$selectionM, _this$api4$selectionM2;
|
|
123
|
+
this.decorationCleanup = (_this$api4 = this.api) === null || _this$api4 === void 0 ? void 0 : (_this$api4$selectionM = _this$api4.selectionMarker) === null || _this$api4$selectionM === void 0 ? void 0 : (_this$api4$selectionM2 = _this$api4$selectionM.actions) === null || _this$api4$selectionM2 === void 0 ? void 0 : _this$api4$selectionM2.hideDecoration();
|
|
117
124
|
});
|
|
118
125
|
_defineProperty(this, "handleBlur", () => {
|
|
119
126
|
var _this$decorationClean;
|
|
@@ -168,8 +175,8 @@ export class ExpandNodeView {
|
|
|
168
175
|
return;
|
|
169
176
|
}
|
|
170
177
|
if (expandNode && isEmptyNode(state.schema)(expandNode)) {
|
|
171
|
-
var _this$
|
|
172
|
-
deleteExpand((_this$
|
|
178
|
+
var _this$api5, _this$api5$analytics;
|
|
179
|
+
deleteExpand((_this$api5 = this.api) === null || _this$api5 === void 0 ? void 0 : (_this$api5$analytics = _this$api5.analytics) === null || _this$api5$analytics === void 0 ? void 0 : _this$api5$analytics.actions)(state, this.view.dispatch);
|
|
173
180
|
}
|
|
174
181
|
});
|
|
175
182
|
_defineProperty(this, "toggleExpand", () => {
|
|
@@ -178,13 +185,13 @@ export class ExpandNodeView {
|
|
|
178
185
|
return;
|
|
179
186
|
}
|
|
180
187
|
if (this.allowInteractiveExpand) {
|
|
181
|
-
var _this$
|
|
188
|
+
var _this$api6, _this$api6$analytics;
|
|
182
189
|
const {
|
|
183
190
|
state,
|
|
184
191
|
dispatch
|
|
185
192
|
} = this.view;
|
|
186
193
|
toggleExpandExpanded({
|
|
187
|
-
editorAnalyticsAPI: (_this$
|
|
194
|
+
editorAnalyticsAPI: (_this$api6 = this.api) === null || _this$api6 === void 0 ? void 0 : (_this$api6$analytics = _this$api6.analytics) === null || _this$api6$analytics === void 0 ? void 0 : _this$api6$analytics.actions,
|
|
188
195
|
pos,
|
|
189
196
|
node: this.node
|
|
190
197
|
})(state, dispatch);
|
|
@@ -314,14 +321,14 @@ export class ExpandNodeView {
|
|
|
314
321
|
selectionEnd
|
|
315
322
|
} = this.input;
|
|
316
323
|
if (selectionStart === selectionEnd && selectionStart === 0) {
|
|
317
|
-
var _this$
|
|
324
|
+
var _this$api7, _this$api7$selection;
|
|
318
325
|
event.preventDefault();
|
|
319
326
|
const {
|
|
320
327
|
state,
|
|
321
328
|
dispatch
|
|
322
329
|
} = this.view;
|
|
323
330
|
this.view.focus();
|
|
324
|
-
const selectionSharedState = ((_this$
|
|
331
|
+
const selectionSharedState = ((_this$api7 = this.api) === null || _this$api7 === void 0 ? void 0 : (_this$api7$selection = _this$api7.selection) === null || _this$api7$selection === void 0 ? void 0 : _this$api7$selection.sharedState.currentState()) || {};
|
|
325
332
|
// selectionRelativeToNode is undefined when user clicked to select node, then hit left to get focus in title
|
|
326
333
|
// This is a special case where we want to bypass node selection and jump straight to gap cursor
|
|
327
334
|
if ((selectionSharedState === null || selectionSharedState === void 0 ? void 0 : selectionSharedState.selectionRelativeToNode) === undefined) {
|
|
@@ -431,8 +438,11 @@ export class ExpandNodeView {
|
|
|
431
438
|
// If the user interacts in our title bar (either toggle or input)
|
|
432
439
|
// Prevent ProseMirror from getting a focus event (causes weird selection issues).
|
|
433
440
|
this.titleContainer.addEventListener('focus', this.handleFocus);
|
|
441
|
+
if (!editorExperiment('live_pages_graceful_edit', 'control')) {
|
|
442
|
+
this.input.addEventListener('click', this.handleInputClick);
|
|
443
|
+
}
|
|
434
444
|
this.icon.addEventListener('keydown', this.handleIconKeyDown);
|
|
435
|
-
if ((_this$
|
|
445
|
+
if ((_this$api8 = this.api) !== null && _this$api8 !== void 0 && _this$api8.editorDisabled) {
|
|
436
446
|
this.cleanUpEditorDisabledOnChange = this.api.editorDisabled.sharedState.onChange(sharedState => {
|
|
437
447
|
const editorDisabled = sharedState.nextSharedState.editorDisabled;
|
|
438
448
|
if (this.input) {
|
|
@@ -519,6 +529,9 @@ export class ExpandNodeView {
|
|
|
519
529
|
this.input.removeEventListener('blur', this.handleBlur);
|
|
520
530
|
this.input.removeEventListener('focus', this.handleInputFocus);
|
|
521
531
|
this.titleContainer.removeEventListener('focus', this.handleFocus);
|
|
532
|
+
if (!editorExperiment('live_pages_graceful_edit', 'control')) {
|
|
533
|
+
this.input.removeEventListener('click', this.handleInputClick);
|
|
534
|
+
}
|
|
522
535
|
this.icon.removeEventListener('keydown', this.handleIconKeyDown);
|
|
523
536
|
(_this$decorationClean2 = this.decorationCleanup) === null || _this$decorationClean2 === void 0 ? void 0 : _this$decorationClean2.call(this);
|
|
524
537
|
if (this.cleanUpEditorDisabledOnChange) {
|
|
@@ -12,10 +12,7 @@ export function containsClass(element, className) {
|
|
|
12
12
|
var _element$classList;
|
|
13
13
|
return Boolean(element === null || element === void 0 ? void 0 : (_element$classList = element.classList) === null || _element$classList === void 0 ? void 0 : _element$classList.contains(className));
|
|
14
14
|
}
|
|
15
|
-
export const createPlugin = (dispatch, getIntl, appearance = 'full-page', useLongPressSelection = false, api, nodeViewPortalProviderAPI, allowInteractiveExpand = true, __livePage = false
|
|
16
|
-
// Ignored via go/ees005
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
18
|
-
) => {
|
|
15
|
+
export const createPlugin = (dispatch, getIntl, appearance = 'full-page', useLongPressSelection = false, api, nodeViewPortalProviderAPI, allowInteractiveExpand = true, __livePage = false) => {
|
|
19
16
|
const isMobile = false;
|
|
20
17
|
return new SafePlugin({
|
|
21
18
|
key: pluginKey,
|
|
@@ -50,8 +47,6 @@ export const createPlugin = (dispatch, getIntl, appearance = 'full-page', useLon
|
|
|
50
47
|
handleClickOn: createSelectionClickHandler(['expand', 'nestedExpand'], target => target.classList.contains(expandClassNames.prefix), {
|
|
51
48
|
useLongPressSelection
|
|
52
49
|
}),
|
|
53
|
-
// Ignored via go/ees005
|
|
54
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
55
50
|
handleDrop(view, event, slice, moved) {
|
|
56
51
|
return handleExpandDrag(view, event, slice);
|
|
57
52
|
}
|
|
@@ -16,14 +16,17 @@ import ChevronRightIcon from '@atlaskit/icon/utility/chevron-right';
|
|
|
16
16
|
import Tooltip from '@atlaskit/tooltip';
|
|
17
17
|
function withTooltip(Component) {
|
|
18
18
|
return function WithTooltip(props) {
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
return (
|
|
20
|
+
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
21
|
+
jsx(Tooltip, {
|
|
22
|
+
content: props.label,
|
|
23
|
+
position: "top",
|
|
24
|
+
tag: ExpandLayoutWrapperWithRef
|
|
25
|
+
}, jsx(Component
|
|
26
|
+
// Ignored via go/ees005
|
|
27
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
28
|
+
, props))
|
|
29
|
+
);
|
|
27
30
|
};
|
|
28
31
|
}
|
|
29
32
|
export const ExpandButtonInner = props => {
|
|
@@ -4,10 +4,7 @@ import { expandMessages } from '@atlaskit/editor-common/ui';
|
|
|
4
4
|
export const buildExpandClassName = (type, expanded) => {
|
|
5
5
|
return `${expandClassNames.prefix} ${expandClassNames.type(type)} ${expanded ? expandClassNames.expanded : ''}`;
|
|
6
6
|
};
|
|
7
|
-
export const toDOM = (node, __livePage, intl, titleReadOnly, contentEditable
|
|
8
|
-
// Ignored via go/ees005
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
10
|
-
) => {
|
|
7
|
+
export const toDOM = (node, __livePage, intl, titleReadOnly, contentEditable) => {
|
|
11
8
|
var _expandedState$get;
|
|
12
9
|
return ['div', {
|
|
13
10
|
// prettier-ignore
|
|
@@ -18,10 +18,7 @@ import { ExpandIconButton } from '../ui/ExpandIconButton';
|
|
|
18
18
|
function buildExpandClassName(type, expanded) {
|
|
19
19
|
return "".concat(expandClassNames.prefix, " ").concat(expandClassNames.type(type), " ").concat(expanded ? expandClassNames.expanded : '');
|
|
20
20
|
}
|
|
21
|
-
var toDOM = function toDOM(node, __livePage, intl, titleReadOnly, contentEditable
|
|
22
|
-
// Ignored via go/ees005
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
24
|
-
) {
|
|
21
|
+
var toDOM = function toDOM(node, __livePage, intl, titleReadOnly, contentEditable) {
|
|
25
22
|
return ['div', {
|
|
26
23
|
// prettier-ignore
|
|
27
24
|
'class': buildExpandClassName(node.type.name, __livePage && fg('platform.editor.live-pages-expand-divergence') ? !node.attrs.__expanded : node.attrs.__expanded),
|
|
@@ -57,8 +54,6 @@ var toDOM = function toDOM(node, __livePage, intl, titleReadOnly, contentEditabl
|
|
|
57
54
|
}, 0]];
|
|
58
55
|
};
|
|
59
56
|
export var ExpandNodeView = /*#__PURE__*/function () {
|
|
60
|
-
// Ignored via go/ees005
|
|
61
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
62
57
|
function ExpandNodeView(_node, view, getPos, getIntl, isMobile, selectNearNode, api, nodeViewPortalProviderAPI) {
|
|
63
58
|
var _this = this,
|
|
64
59
|
_api$editorDisabled;
|
|
@@ -58,8 +58,6 @@ export var createPlugin = function createPlugin(dispatch, getIntl) {
|
|
|
58
58
|
}, {
|
|
59
59
|
useLongPressSelection: useLongPressSelection
|
|
60
60
|
}),
|
|
61
|
-
// Ignored via go/ees005
|
|
62
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
63
61
|
handleDrop: function handleDrop(view, event, slice, moved) {
|
|
64
62
|
return handleExpandDrag(view, event, slice);
|
|
65
63
|
}
|
|
@@ -37,14 +37,17 @@ export var withTooltip = function withTooltip(WrapperComponent) {
|
|
|
37
37
|
key: "render",
|
|
38
38
|
value: function render() {
|
|
39
39
|
var label = this.props.label;
|
|
40
|
-
return
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
return (
|
|
41
|
+
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
42
|
+
jsx(Tooltip, {
|
|
43
|
+
content: label,
|
|
44
|
+
position: "top",
|
|
45
|
+
tag: ExpandLayoutWrapperWithRef
|
|
46
|
+
}, jsx(WrapperComponent
|
|
47
|
+
// Ignored via go/ees005
|
|
48
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
49
|
+
, this.props))
|
|
50
|
+
);
|
|
48
51
|
}
|
|
49
52
|
}]);
|
|
50
53
|
}(React.Component);
|
|
@@ -13,16 +13,15 @@ import { redo, undo } from '@atlaskit/editor-prosemirror/history';
|
|
|
13
13
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
14
14
|
import { NodeSelection, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
15
15
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
16
17
|
import { deleteExpand, setSelectionInsideExpand, toggleExpandExpanded, updateExpandTitle } from '../commands';
|
|
17
18
|
import { ExpandButton } from '../ui/ExpandButton';
|
|
18
19
|
import { buildExpandClassName, toDOM } from '../ui/NodeView';
|
|
19
20
|
export var ExpandNodeView = /*#__PURE__*/function () {
|
|
20
|
-
// Ignored via go/ees005
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
22
21
|
function ExpandNodeView(_node, view, getPos, getIntl, isMobile, selectNearNode, api, nodeViewPortalProviderAPI) {
|
|
23
22
|
var _this = this,
|
|
24
23
|
_api$editorDisabled,
|
|
25
|
-
_this$
|
|
24
|
+
_this$api8;
|
|
26
25
|
var allowInteractiveExpand = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : true;
|
|
27
26
|
var __livePage = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
|
|
28
27
|
var cleanUpEditorDisabledOnChange = arguments.length > 10 ? arguments[10] : undefined;
|
|
@@ -117,9 +116,17 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
117
116
|
_defineProperty(this, "handleFocus", function (event) {
|
|
118
117
|
event.stopImmediatePropagation();
|
|
119
118
|
});
|
|
119
|
+
_defineProperty(this, "handleInputClick", function () {
|
|
120
|
+
if (!editorExperiment('live_pages_graceful_edit', 'control')) {
|
|
121
|
+
var _this$api2, _this$api3;
|
|
122
|
+
(_this$api2 = _this.api) === null || _this$api2 === void 0 || (_this$api2 = _this$api2.core) === null || _this$api2 === void 0 || (_this$api2 = _this$api2.actions) === null || _this$api2 === void 0 || _this$api2.execute((_this$api3 = _this.api) === null || _this$api3 === void 0 || (_this$api3 = _this$api3.editorViewMode) === null || _this$api3 === void 0 ? void 0 : _this$api3.commands.updateContentMode({
|
|
123
|
+
type: 'intent-to-edit'
|
|
124
|
+
}));
|
|
125
|
+
}
|
|
126
|
+
});
|
|
120
127
|
_defineProperty(this, "handleInputFocus", function () {
|
|
121
|
-
var _this$
|
|
122
|
-
_this.decorationCleanup = (_this$
|
|
128
|
+
var _this$api4;
|
|
129
|
+
_this.decorationCleanup = (_this$api4 = _this.api) === null || _this$api4 === void 0 || (_this$api4 = _this$api4.selectionMarker) === null || _this$api4 === void 0 || (_this$api4 = _this$api4.actions) === null || _this$api4 === void 0 ? void 0 : _this$api4.hideDecoration();
|
|
123
130
|
});
|
|
124
131
|
_defineProperty(this, "handleBlur", function () {
|
|
125
132
|
var _this$decorationClean;
|
|
@@ -171,8 +178,8 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
171
178
|
return;
|
|
172
179
|
}
|
|
173
180
|
if (expandNode && isEmptyNode(state.schema)(expandNode)) {
|
|
174
|
-
var _this$
|
|
175
|
-
deleteExpand((_this$
|
|
181
|
+
var _this$api5;
|
|
182
|
+
deleteExpand((_this$api5 = _this.api) === null || _this$api5 === void 0 || (_this$api5 = _this$api5.analytics) === null || _this$api5 === void 0 ? void 0 : _this$api5.actions)(state, _this.view.dispatch);
|
|
176
183
|
}
|
|
177
184
|
});
|
|
178
185
|
_defineProperty(this, "toggleExpand", function () {
|
|
@@ -181,12 +188,12 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
181
188
|
return;
|
|
182
189
|
}
|
|
183
190
|
if (_this.allowInteractiveExpand) {
|
|
184
|
-
var _this$
|
|
191
|
+
var _this$api6;
|
|
185
192
|
var _this$view3 = _this.view,
|
|
186
193
|
state = _this$view3.state,
|
|
187
194
|
dispatch = _this$view3.dispatch;
|
|
188
195
|
toggleExpandExpanded({
|
|
189
|
-
editorAnalyticsAPI: (_this$
|
|
196
|
+
editorAnalyticsAPI: (_this$api6 = _this.api) === null || _this$api6 === void 0 || (_this$api6 = _this$api6.analytics) === null || _this$api6 === void 0 ? void 0 : _this$api6.actions,
|
|
190
197
|
pos: pos,
|
|
191
198
|
node: _this.node
|
|
192
199
|
})(state, dispatch);
|
|
@@ -308,13 +315,13 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
308
315
|
selectionStart = _this$input5.selectionStart,
|
|
309
316
|
selectionEnd = _this$input5.selectionEnd;
|
|
310
317
|
if (selectionStart === selectionEnd && selectionStart === 0) {
|
|
311
|
-
var _this$
|
|
318
|
+
var _this$api7;
|
|
312
319
|
event.preventDefault();
|
|
313
320
|
var _this$view8 = _this.view,
|
|
314
321
|
state = _this$view8.state,
|
|
315
322
|
dispatch = _this$view8.dispatch;
|
|
316
323
|
_this.view.focus();
|
|
317
|
-
var selectionSharedState = ((_this$
|
|
324
|
+
var selectionSharedState = ((_this$api7 = _this.api) === null || _this$api7 === void 0 || (_this$api7 = _this$api7.selection) === null || _this$api7 === void 0 ? void 0 : _this$api7.sharedState.currentState()) || {};
|
|
318
325
|
// selectionRelativeToNode is undefined when user clicked to select node, then hit left to get focus in title
|
|
319
326
|
// This is a special case where we want to bypass node selection and jump straight to gap cursor
|
|
320
327
|
if ((selectionSharedState === null || selectionSharedState === void 0 ? void 0 : selectionSharedState.selectionRelativeToNode) === undefined) {
|
|
@@ -423,8 +430,11 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
423
430
|
// If the user interacts in our title bar (either toggle or input)
|
|
424
431
|
// Prevent ProseMirror from getting a focus event (causes weird selection issues).
|
|
425
432
|
this.titleContainer.addEventListener('focus', this.handleFocus);
|
|
433
|
+
if (!editorExperiment('live_pages_graceful_edit', 'control')) {
|
|
434
|
+
this.input.addEventListener('click', this.handleInputClick);
|
|
435
|
+
}
|
|
426
436
|
this.icon.addEventListener('keydown', this.handleIconKeyDown);
|
|
427
|
-
if ((_this$
|
|
437
|
+
if ((_this$api8 = this.api) !== null && _this$api8 !== void 0 && _this$api8.editorDisabled) {
|
|
428
438
|
this.cleanUpEditorDisabledOnChange = this.api.editorDisabled.sharedState.onChange(function (sharedState) {
|
|
429
439
|
var editorDisabled = sharedState.nextSharedState.editorDisabled;
|
|
430
440
|
if (_this.input) {
|
|
@@ -524,6 +534,9 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
524
534
|
this.input.removeEventListener('blur', this.handleBlur);
|
|
525
535
|
this.input.removeEventListener('focus', this.handleInputFocus);
|
|
526
536
|
this.titleContainer.removeEventListener('focus', this.handleFocus);
|
|
537
|
+
if (!editorExperiment('live_pages_graceful_edit', 'control')) {
|
|
538
|
+
this.input.removeEventListener('click', this.handleInputClick);
|
|
539
|
+
}
|
|
527
540
|
this.icon.removeEventListener('keydown', this.handleIconKeyDown);
|
|
528
541
|
(_this$decorationClean2 = this.decorationCleanup) === null || _this$decorationClean2 === void 0 || _this$decorationClean2.call(this);
|
|
529
542
|
if (this.cleanUpEditorDisabledOnChange) {
|
|
@@ -55,8 +55,6 @@ export var createPlugin = function createPlugin(dispatch, getIntl) {
|
|
|
55
55
|
}, {
|
|
56
56
|
useLongPressSelection: useLongPressSelection
|
|
57
57
|
}),
|
|
58
|
-
// Ignored via go/ees005
|
|
59
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
60
58
|
handleDrop: function handleDrop(view, event, slice, moved) {
|
|
61
59
|
return handleExpandDrag(view, event, slice);
|
|
62
60
|
}
|
|
@@ -21,14 +21,17 @@ import ChevronRightIcon from '@atlaskit/icon/utility/chevron-right';
|
|
|
21
21
|
import Tooltip from '@atlaskit/tooltip';
|
|
22
22
|
function withTooltip(Component) {
|
|
23
23
|
return function WithTooltip(props) {
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
return (
|
|
25
|
+
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
26
|
+
jsx(Tooltip, {
|
|
27
|
+
content: props.label,
|
|
28
|
+
position: "top",
|
|
29
|
+
tag: ExpandLayoutWrapperWithRef
|
|
30
|
+
}, jsx(Component
|
|
31
|
+
// Ignored via go/ees005
|
|
32
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
33
|
+
, props))
|
|
34
|
+
);
|
|
32
35
|
};
|
|
33
36
|
}
|
|
34
37
|
export var ExpandButtonInner = function ExpandButtonInner(props) {
|
|
@@ -4,10 +4,7 @@ import { expandMessages } from '@atlaskit/editor-common/ui';
|
|
|
4
4
|
export var buildExpandClassName = function buildExpandClassName(type, expanded) {
|
|
5
5
|
return "".concat(expandClassNames.prefix, " ").concat(expandClassNames.type(type), " ").concat(expanded ? expandClassNames.expanded : '');
|
|
6
6
|
};
|
|
7
|
-
export var toDOM = function toDOM(node, __livePage, intl, titleReadOnly, contentEditable
|
|
8
|
-
// Ignored via go/ees005
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
10
|
-
) {
|
|
7
|
+
export var toDOM = function toDOM(node, __livePage, intl, titleReadOnly, contentEditable) {
|
|
11
8
|
var _expandedState$get;
|
|
12
9
|
return ['div', {
|
|
13
10
|
// prettier-ignore
|
|
@@ -16,12 +16,10 @@ interface ExpandIconButtonWithLabelProps extends ExpandIconButtonProps {
|
|
|
16
16
|
export declare const withTooltip: (WrapperComponent: React.ElementType) => {
|
|
17
17
|
new (props: ExpandIconButtonWithLabelProps): {
|
|
18
18
|
render(): jsx.JSX.Element;
|
|
19
|
-
context:
|
|
19
|
+
context: unknown;
|
|
20
20
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<ExpandIconButtonWithLabelProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
21
21
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
22
|
-
readonly props: Readonly<ExpandIconButtonWithLabelProps
|
|
23
|
-
children?: React.ReactNode;
|
|
24
|
-
}>;
|
|
22
|
+
readonly props: Readonly<ExpandIconButtonWithLabelProps>;
|
|
25
23
|
state: Readonly<{}>;
|
|
26
24
|
refs: {
|
|
27
25
|
[key: string]: React.ReactInstance;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { EditorAppearance, LongPressSelectionPluginOptions, NextEditorPlugi
|
|
|
3
3
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
4
|
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
5
5
|
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
6
|
+
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
6
7
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
7
8
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
8
9
|
import type { SelectionMarkerPlugin } from '@atlaskit/editor-plugin-selection-marker';
|
|
@@ -37,16 +38,18 @@ export interface ExpandPluginOptions extends LongPressSelectionPluginOptions {
|
|
|
37
38
|
*/
|
|
38
39
|
__livePage?: boolean;
|
|
39
40
|
}
|
|
41
|
+
export type ExpandPluginDependencies = [
|
|
42
|
+
DecorationsPlugin,
|
|
43
|
+
SelectionPlugin,
|
|
44
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
45
|
+
OptionalPlugin<SelectionMarkerPlugin>,
|
|
46
|
+
OptionalPlugin<EditorDisabledPlugin>,
|
|
47
|
+
OptionalPlugin<FeatureFlagsPlugin>,
|
|
48
|
+
OptionalPlugin<EditorViewModePlugin>
|
|
49
|
+
];
|
|
40
50
|
export type ExpandPlugin = NextEditorPlugin<'expand', {
|
|
41
51
|
pluginConfiguration: ExpandPluginOptions | undefined;
|
|
42
|
-
dependencies:
|
|
43
|
-
DecorationsPlugin,
|
|
44
|
-
SelectionPlugin,
|
|
45
|
-
OptionalPlugin<AnalyticsPlugin>,
|
|
46
|
-
OptionalPlugin<SelectionMarkerPlugin>,
|
|
47
|
-
OptionalPlugin<EditorDisabledPlugin>,
|
|
48
|
-
OptionalPlugin<FeatureFlagsPlugin>
|
|
49
|
-
];
|
|
52
|
+
dependencies: ExpandPluginDependencies;
|
|
50
53
|
actions: {
|
|
51
54
|
/**
|
|
52
55
|
* Insert an expand node and dispatch event with `insertMenu` inputMethod
|
|
@@ -16,12 +16,10 @@ interface ExpandIconButtonWithLabelProps extends ExpandIconButtonProps {
|
|
|
16
16
|
export declare const withTooltip: (WrapperComponent: React.ElementType) => {
|
|
17
17
|
new (props: ExpandIconButtonWithLabelProps): {
|
|
18
18
|
render(): jsx.JSX.Element;
|
|
19
|
-
context:
|
|
19
|
+
context: unknown;
|
|
20
20
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<ExpandIconButtonWithLabelProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
21
21
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
22
|
-
readonly props: Readonly<ExpandIconButtonWithLabelProps
|
|
23
|
-
children?: React.ReactNode;
|
|
24
|
-
}>;
|
|
22
|
+
readonly props: Readonly<ExpandIconButtonWithLabelProps>;
|
|
25
23
|
state: Readonly<{}>;
|
|
26
24
|
refs: {
|
|
27
25
|
[key: string]: React.ReactInstance;
|
|
@@ -3,6 +3,7 @@ import type { EditorAppearance, LongPressSelectionPluginOptions, NextEditorPlugi
|
|
|
3
3
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
4
|
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
5
5
|
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
6
|
+
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
6
7
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
7
8
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
8
9
|
import type { SelectionMarkerPlugin } from '@atlaskit/editor-plugin-selection-marker';
|
|
@@ -37,16 +38,18 @@ export interface ExpandPluginOptions extends LongPressSelectionPluginOptions {
|
|
|
37
38
|
*/
|
|
38
39
|
__livePage?: boolean;
|
|
39
40
|
}
|
|
41
|
+
export type ExpandPluginDependencies = [
|
|
42
|
+
DecorationsPlugin,
|
|
43
|
+
SelectionPlugin,
|
|
44
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
45
|
+
OptionalPlugin<SelectionMarkerPlugin>,
|
|
46
|
+
OptionalPlugin<EditorDisabledPlugin>,
|
|
47
|
+
OptionalPlugin<FeatureFlagsPlugin>,
|
|
48
|
+
OptionalPlugin<EditorViewModePlugin>
|
|
49
|
+
];
|
|
40
50
|
export type ExpandPlugin = NextEditorPlugin<'expand', {
|
|
41
51
|
pluginConfiguration: ExpandPluginOptions | undefined;
|
|
42
|
-
dependencies:
|
|
43
|
-
DecorationsPlugin,
|
|
44
|
-
SelectionPlugin,
|
|
45
|
-
OptionalPlugin<AnalyticsPlugin>,
|
|
46
|
-
OptionalPlugin<SelectionMarkerPlugin>,
|
|
47
|
-
OptionalPlugin<EditorDisabledPlugin>,
|
|
48
|
-
OptionalPlugin<FeatureFlagsPlugin>
|
|
49
|
-
];
|
|
52
|
+
dependencies: ExpandPluginDependencies;
|
|
50
53
|
actions: {
|
|
51
54
|
/**
|
|
52
55
|
* Insert an expand node and dispatch event with `insertMenu` inputMethod
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-expand",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.0",
|
|
4
4
|
"description": "Expand plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,21 +32,22 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^46.1.0",
|
|
35
|
-
"@atlaskit/button": "^20.
|
|
36
|
-
"@atlaskit/editor-common": "^99.
|
|
37
|
-
"@atlaskit/editor-plugin-analytics": "^1.
|
|
38
|
-
"@atlaskit/editor-plugin-decorations": "^1.
|
|
39
|
-
"@atlaskit/editor-plugin-editor-disabled": "^1.
|
|
35
|
+
"@atlaskit/button": "^20.4.0",
|
|
36
|
+
"@atlaskit/editor-common": "^99.6.0",
|
|
37
|
+
"@atlaskit/editor-plugin-analytics": "^1.11.0",
|
|
38
|
+
"@atlaskit/editor-plugin-decorations": "^1.4.0",
|
|
39
|
+
"@atlaskit/editor-plugin-editor-disabled": "^1.4.0",
|
|
40
|
+
"@atlaskit/editor-plugin-editor-viewmode": "^2.1.16",
|
|
40
41
|
"@atlaskit/editor-plugin-selection": "^1.6.0",
|
|
41
|
-
"@atlaskit/editor-plugin-selection-marker": "^1.
|
|
42
|
+
"@atlaskit/editor-plugin-selection-marker": "^1.7.0",
|
|
42
43
|
"@atlaskit/editor-prosemirror": "6.2.1",
|
|
43
44
|
"@atlaskit/editor-shared-styles": "^3.2.0",
|
|
44
45
|
"@atlaskit/editor-tables": "^2.8.0",
|
|
45
|
-
"@atlaskit/icon": "^23.
|
|
46
|
+
"@atlaskit/icon": "^23.5.0",
|
|
46
47
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
47
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
48
|
-
"@atlaskit/tokens": "^3.
|
|
49
|
-
"@atlaskit/tooltip": "^19.
|
|
48
|
+
"@atlaskit/tmp-editor-statsig": "^2.41.0",
|
|
49
|
+
"@atlaskit/tokens": "^3.3.0",
|
|
50
|
+
"@atlaskit/tooltip": "^19.1.0",
|
|
50
51
|
"@babel/runtime": "^7.0.0",
|
|
51
52
|
"@emotion/react": "^11.7.1",
|
|
52
53
|
"uuid": "^3.1.0",
|
|
@@ -58,15 +59,15 @@
|
|
|
58
59
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
61
|
-
"@atlaskit/analytics-next": "^10.
|
|
62
|
-
"@atlaskit/editor-plugin-content-insertion": "^1.
|
|
63
|
-
"@atlaskit/editor-plugin-guideline": "^1.
|
|
64
|
-
"@atlaskit/editor-plugin-quick-insert": "^1.
|
|
65
|
-
"@atlaskit/editor-plugin-table": "^9.
|
|
66
|
-
"@atlaskit/editor-plugin-type-ahead": "^1.
|
|
62
|
+
"@atlaskit/analytics-next": "^10.3.0",
|
|
63
|
+
"@atlaskit/editor-plugin-content-insertion": "^1.12.0",
|
|
64
|
+
"@atlaskit/editor-plugin-guideline": "^1.3.0",
|
|
65
|
+
"@atlaskit/editor-plugin-quick-insert": "^1.9.0",
|
|
66
|
+
"@atlaskit/editor-plugin-table": "^9.3.0",
|
|
67
|
+
"@atlaskit/editor-plugin-type-ahead": "^1.12.0",
|
|
67
68
|
"@atlaskit/editor-plugin-width": "^2.0.0",
|
|
68
|
-
"@testing-library/react": "^
|
|
69
|
-
"react-test-renderer": "^
|
|
69
|
+
"@testing-library/react": "^13.4.0",
|
|
70
|
+
"react-test-renderer": "^18.2.0",
|
|
70
71
|
"typescript": "~5.4.2"
|
|
71
72
|
},
|
|
72
73
|
"techstack": {
|