@atlaskit/editor-plugin-expand 2.10.11 → 2.10.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/legacyExpand/nodeviews/index.js +15 -1
- package/dist/cjs/legacyExpand/plugin.js +2 -0
- package/dist/cjs/legacyExpand/pm-plugins/keymap.js +24 -6
- package/dist/cjs/legacyExpand/pm-plugins/main.js +5 -0
- package/dist/cjs/legacyExpand/ui/ExpandIconButton.js +12 -2
- package/dist/cjs/plugin.js +2 -0
- package/dist/cjs/singlePlayerExpand/commands.js +4 -0
- package/dist/cjs/singlePlayerExpand/node-views/index.js +11 -0
- package/dist/cjs/singlePlayerExpand/plugin.js +2 -0
- package/dist/cjs/singlePlayerExpand/pm-plugins/keymap.js +24 -6
- package/dist/cjs/singlePlayerExpand/pm-plugins/main.js +5 -0
- package/dist/cjs/singlePlayerExpand/toolbar.js +5 -1
- package/dist/cjs/singlePlayerExpand/ui/ExpandButton.js +14 -2
- package/dist/cjs/singlePlayerExpand/ui/NodeView.js +4 -1
- package/dist/es2019/legacyExpand/nodeviews/index.js +16 -2
- package/dist/es2019/legacyExpand/plugin.js +3 -0
- package/dist/es2019/legacyExpand/pm-plugins/keymap.js +24 -6
- package/dist/es2019/legacyExpand/pm-plugins/main.js +9 -2
- package/dist/es2019/legacyExpand/ui/ExpandIconButton.js +12 -2
- package/dist/es2019/plugin.js +2 -0
- package/dist/es2019/singlePlayerExpand/commands.js +4 -0
- package/dist/es2019/singlePlayerExpand/node-views/index.js +11 -0
- package/dist/es2019/singlePlayerExpand/plugin.js +3 -0
- package/dist/es2019/singlePlayerExpand/pm-plugins/keymap.js +24 -6
- package/dist/es2019/singlePlayerExpand/pm-plugins/main.js +9 -2
- package/dist/es2019/singlePlayerExpand/toolbar.js +4 -1
- package/dist/es2019/singlePlayerExpand/ui/ExpandButton.js +14 -2
- package/dist/es2019/singlePlayerExpand/ui/NodeView.js +4 -1
- package/dist/esm/legacyExpand/nodeviews/index.js +15 -1
- package/dist/esm/legacyExpand/plugin.js +3 -0
- package/dist/esm/legacyExpand/pm-plugins/keymap.js +24 -6
- package/dist/esm/legacyExpand/pm-plugins/main.js +4 -0
- package/dist/esm/legacyExpand/ui/ExpandIconButton.js +12 -2
- package/dist/esm/plugin.js +2 -0
- package/dist/esm/singlePlayerExpand/commands.js +4 -0
- package/dist/esm/singlePlayerExpand/node-views/index.js +11 -0
- package/dist/esm/singlePlayerExpand/plugin.js +3 -0
- package/dist/esm/singlePlayerExpand/pm-plugins/keymap.js +24 -6
- package/dist/esm/singlePlayerExpand/pm-plugins/main.js +4 -0
- package/dist/esm/singlePlayerExpand/toolbar.js +5 -1
- package/dist/esm/singlePlayerExpand/ui/ExpandButton.js +14 -2
- package/dist/esm/singlePlayerExpand/ui/NodeView.js +4 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -26,7 +26,10 @@ 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
|
|
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
|
+
) {
|
|
30
33
|
return ['div', {
|
|
31
34
|
// prettier-ignore
|
|
32
35
|
'class': buildExpandClassName(node.type.name, __livePage && (0, _platformFeatureFlags.fg)('platform.editor.live-pages-expand-divergence') ? !node.attrs.__expanded : node.attrs.__expanded),
|
|
@@ -62,6 +65,8 @@ var toDOM = function toDOM(node, __livePage, intl, titleReadOnly, contentEditabl
|
|
|
62
65
|
}, 0]];
|
|
63
66
|
};
|
|
64
67
|
var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
68
|
+
// Ignored via go/ees005
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
65
70
|
function ExpandNodeView(_node, view, getPos, getIntl, isMobile, selectNearNode, api, nodeViewPortalProviderAPI) {
|
|
66
71
|
var _this = this,
|
|
67
72
|
_api$editorDisabled;
|
|
@@ -108,6 +113,9 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
108
113
|
if (typeof pos !== 'number') {
|
|
109
114
|
return;
|
|
110
115
|
}
|
|
116
|
+
|
|
117
|
+
// Ignored via go/ees005
|
|
118
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
111
119
|
var target = event.target;
|
|
112
120
|
var _this$view2 = _this.view,
|
|
113
121
|
state = _this$view2.state,
|
|
@@ -418,7 +426,11 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
418
426
|
this.getPos = getPos;
|
|
419
427
|
this.view = view;
|
|
420
428
|
this.node = _node;
|
|
429
|
+
// Ignored via go/ees005
|
|
430
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
421
431
|
this.dom = dom;
|
|
432
|
+
// Ignored via go/ees005
|
|
433
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
422
434
|
this.contentDOM = contentDOM;
|
|
423
435
|
this.isMobile = isMobile;
|
|
424
436
|
this.api = api;
|
|
@@ -503,6 +515,8 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
503
515
|
}, {
|
|
504
516
|
key: "stopEvent",
|
|
505
517
|
value: function stopEvent(event) {
|
|
518
|
+
// Ignored via go/ees005
|
|
519
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
506
520
|
var target = event.target;
|
|
507
521
|
return target === this.input || target === this.icon || !!(0, _utils.closestElement)(target, ".".concat(_styles.expandClassNames.icon));
|
|
508
522
|
}
|
|
@@ -16,6 +16,8 @@ var _commands = require("./commands");
|
|
|
16
16
|
var _keymap = require("./pm-plugins/keymap");
|
|
17
17
|
var _main = require("./pm-plugins/main");
|
|
18
18
|
var _toolbar = require("./toolbar");
|
|
19
|
+
// Ignored via go/ees005
|
|
20
|
+
// eslint-disable-next-line prefer-const
|
|
19
21
|
var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
20
22
|
var _api$featureFlags, _api$analytics, _api$analytics2;
|
|
21
23
|
var _ref$config = _ref.config,
|
|
@@ -21,7 +21,10 @@ var isExpandSelected = function isExpandSelected(selection) {
|
|
|
21
21
|
};
|
|
22
22
|
function expandKeymap(api, options) {
|
|
23
23
|
var list = {};
|
|
24
|
-
(0, _keymaps.bindKeymapWithCommand)(
|
|
24
|
+
(0, _keymaps.bindKeymapWithCommand)(
|
|
25
|
+
// Ignored via go/ees005
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
27
|
+
_keymaps.moveRight.common, function (state, dispatch, editorView) {
|
|
25
28
|
var _api$selection;
|
|
26
29
|
if (!editorView) {
|
|
27
30
|
return false;
|
|
@@ -34,7 +37,10 @@ function expandKeymap(api, options) {
|
|
|
34
37
|
}
|
|
35
38
|
return false;
|
|
36
39
|
}, list);
|
|
37
|
-
(0, _keymaps.bindKeymapWithCommand)(
|
|
40
|
+
(0, _keymaps.bindKeymapWithCommand)(
|
|
41
|
+
// Ignored via go/ees005
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
43
|
+
_keymaps.moveLeft.common, function (state, dispatch, editorView) {
|
|
38
44
|
var _api$selection2;
|
|
39
45
|
if (!editorView) {
|
|
40
46
|
return false;
|
|
@@ -47,7 +53,10 @@ function expandKeymap(api, options) {
|
|
|
47
53
|
}
|
|
48
54
|
return false;
|
|
49
55
|
}, list);
|
|
50
|
-
(0, _keymaps.bindKeymapWithCommand)(
|
|
56
|
+
(0, _keymaps.bindKeymapWithCommand)(
|
|
57
|
+
// Ignored via go/ees005
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
59
|
+
_keymaps.tab.common, function (state, dispatch, editorView) {
|
|
51
60
|
if (editorView && editorView.dom instanceof HTMLElement) {
|
|
52
61
|
var from = state.selection.from;
|
|
53
62
|
|
|
@@ -73,7 +82,10 @@ function expandKeymap(api, options) {
|
|
|
73
82
|
}
|
|
74
83
|
return false;
|
|
75
84
|
}, list);
|
|
76
|
-
(0, _keymaps.bindKeymapWithCommand)(
|
|
85
|
+
(0, _keymaps.bindKeymapWithCommand)(
|
|
86
|
+
// Ignored via go/ees005
|
|
87
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
88
|
+
_keymaps.moveUp.common, function (state, dispatch, editorView) {
|
|
77
89
|
if (!editorView) {
|
|
78
90
|
return false;
|
|
79
91
|
}
|
|
@@ -120,7 +132,10 @@ function expandKeymap(api, options) {
|
|
|
120
132
|
}
|
|
121
133
|
return false;
|
|
122
134
|
}, list);
|
|
123
|
-
(0, _keymaps.bindKeymapWithCommand)(
|
|
135
|
+
(0, _keymaps.bindKeymapWithCommand)(
|
|
136
|
+
// Ignored via go/ees005
|
|
137
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
138
|
+
_keymaps.moveDown.common, function (state, dispatch, editorView) {
|
|
124
139
|
if (!editorView) {
|
|
125
140
|
return false;
|
|
126
141
|
}
|
|
@@ -147,7 +162,10 @@ function expandKeymap(api, options) {
|
|
|
147
162
|
}
|
|
148
163
|
return false;
|
|
149
164
|
}, list);
|
|
150
|
-
(0, _keymaps.bindKeymapWithCommand)(
|
|
165
|
+
(0, _keymaps.bindKeymapWithCommand)(
|
|
166
|
+
// Ignored via go/ees005
|
|
167
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
168
|
+
_keymaps.backspace.common, function (state, dispatch, editorView) {
|
|
151
169
|
var selection = state.selection;
|
|
152
170
|
var $from = selection.$from;
|
|
153
171
|
if (!editorView || !selection.empty) {
|
|
@@ -17,6 +17,9 @@ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
|
17
17
|
var _commands = require("../commands");
|
|
18
18
|
var _nodeviews = _interopRequireDefault(require("../nodeviews"));
|
|
19
19
|
var _pluginFactory = require("./plugin-factory");
|
|
20
|
+
// Ignored via go/ees005
|
|
21
|
+
// eslint-disable-next-line import/no-named-as-default
|
|
22
|
+
|
|
20
23
|
function containsClass(element, className) {
|
|
21
24
|
var _element$classList;
|
|
22
25
|
return Boolean(element === null || element === void 0 || (_element$classList = element.classList) === null || _element$classList === void 0 ? void 0 : _element$classList.contains(className));
|
|
@@ -66,6 +69,8 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, getInt
|
|
|
66
69
|
}, {
|
|
67
70
|
useLongPressSelection: useLongPressSelection
|
|
68
71
|
}),
|
|
72
|
+
// Ignored via go/ees005
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
69
74
|
handleDrop: function handleDrop(view, event, slice, moved) {
|
|
70
75
|
if ((0, _platformFeatureFlags.fg)('platform_editor_nest_nested_expand_drag_fix')) {
|
|
71
76
|
return handleExpandDrag(view, event, slice);
|
|
@@ -48,7 +48,10 @@ var withTooltip = exports.withTooltip = function withTooltip(WrapperComponent) {
|
|
|
48
48
|
content: label,
|
|
49
49
|
position: "top",
|
|
50
50
|
tag: _ui.ExpandLayoutWrapperWithRef
|
|
51
|
-
}, (0, _react2.jsx)(WrapperComponent
|
|
51
|
+
}, (0, _react2.jsx)(WrapperComponent
|
|
52
|
+
// Ignored via go/ees005
|
|
53
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
54
|
+
, this.props));
|
|
52
55
|
}
|
|
53
56
|
}]);
|
|
54
57
|
}(_react.default.Component);
|
|
@@ -56,7 +59,10 @@ var withTooltip = exports.withTooltip = function withTooltip(WrapperComponent) {
|
|
|
56
59
|
var CustomButton = exports.CustomButton = function CustomButton(props) {
|
|
57
60
|
var allowInteractiveExpand = props.allowInteractiveExpand,
|
|
58
61
|
expanded = props.expanded;
|
|
59
|
-
var useTheme = (0, _react.useCallback)(
|
|
62
|
+
var useTheme = (0, _react.useCallback)(
|
|
63
|
+
// Ignored via go/ees005
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
65
|
+
function (currentTheme, themeProps) {
|
|
60
66
|
var _currentTheme = currentTheme(themeProps),
|
|
61
67
|
buttonStyles = _currentTheme.buttonStyles,
|
|
62
68
|
rest = (0, _objectWithoutProperties2.default)(_currentTheme, _excluded);
|
|
@@ -98,6 +104,8 @@ var ExpandIconButton = exports.ExpandIconButton = function ExpandIconButton(prop
|
|
|
98
104
|
|
|
99
105
|
// hoverEventCheck is to disable tooltips for mobile to prevent incorrect hover state causing issues on iOS
|
|
100
106
|
if (props.allowInteractiveExpand && hoverEventCheck) {
|
|
107
|
+
// Ignored via go/ees005
|
|
108
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
101
109
|
return (0, _react2.jsx)(ButtonWithTooltip, (0, _extends2.default)({
|
|
102
110
|
label: label
|
|
103
111
|
}, props));
|
|
@@ -108,6 +116,8 @@ var ExpandIconButton = exports.ExpandIconButton = function ExpandIconButton(prop
|
|
|
108
116
|
css: _ui.expandLayoutWrapperStyle
|
|
109
117
|
}, (0, _react2.jsx)(ButtonWithoutTooltip, (0, _extends2.default)({
|
|
110
118
|
label: label
|
|
119
|
+
// Ignored via go/ees005
|
|
120
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
111
121
|
}, props)))
|
|
112
122
|
);
|
|
113
123
|
};
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -7,6 +7,8 @@ exports.expandPlugin = void 0;
|
|
|
7
7
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
8
|
var _plugin = require("./legacyExpand/plugin");
|
|
9
9
|
var _plugin2 = require("./singlePlayerExpand/plugin");
|
|
10
|
+
// Ignored via go/ees005
|
|
11
|
+
// eslint-disable-next-line prefer-const
|
|
10
12
|
var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
11
13
|
var _ref$config = _ref.config,
|
|
12
14
|
options = _ref$config === void 0 ? {} : _ref$config,
|
|
@@ -33,6 +33,8 @@ var createExpandNode = exports.createExpandNode = function createExpandNode(stat
|
|
|
33
33
|
var expandType = isSelectionInTable || isSelectionInExpand ? nestedExpand : expand;
|
|
34
34
|
var expandNode = expandType.createAndFill({});
|
|
35
35
|
if (setExpandedState) {
|
|
36
|
+
// Ignored via go/ees005
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
36
38
|
_expand.expandedState.set(expandNode, true);
|
|
37
39
|
}
|
|
38
40
|
return expandNode;
|
|
@@ -47,6 +49,8 @@ var insertExpandWithInputMethod = exports.insertExpandWithInputMethod = function
|
|
|
47
49
|
var tr;
|
|
48
50
|
if (state.selection.empty) {
|
|
49
51
|
tr = (0, _utils2.safeInsert)(expandNode)(state.tr).scrollIntoView();
|
|
52
|
+
// Ignored via go/ees005
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
50
54
|
_expand.expandedState.set(expandNode, true);
|
|
51
55
|
} else {
|
|
52
56
|
tr = (0, _utils.createWrapSelectionTransaction)({
|
|
@@ -25,6 +25,8 @@ var _commands = require("../commands");
|
|
|
25
25
|
var _ExpandButton = require("../ui/ExpandButton");
|
|
26
26
|
var _NodeView = require("../ui/NodeView");
|
|
27
27
|
var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
28
|
+
// Ignored via go/ees005
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
28
30
|
function ExpandNodeView(_node, view, getPos, getIntl, isMobile, selectNearNode, api, nodeViewPortalProviderAPI) {
|
|
29
31
|
var _this = this,
|
|
30
32
|
_api$editorDisabled,
|
|
@@ -72,6 +74,9 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
72
74
|
if (typeof pos !== 'number') {
|
|
73
75
|
return;
|
|
74
76
|
}
|
|
77
|
+
|
|
78
|
+
// Ignored via go/ees005
|
|
79
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
75
80
|
var target = event.target;
|
|
76
81
|
if ((0, _utils.closestElement)(target, ".".concat(_styles.expandClassNames.icon))) {
|
|
77
82
|
var _this$api;
|
|
@@ -395,7 +400,11 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
395
400
|
var _DOMSerializer$render = _model.DOMSerializer.renderSpec(document, (0, _NodeView.toDOM)(_node, this.__livePage, this.intl, api === null || api === void 0 || (_api$editorDisabled = api.editorDisabled) === null || _api$editorDisabled === void 0 || (_api$editorDisabled = _api$editorDisabled.sharedState.currentState()) === null || _api$editorDisabled === void 0 ? void 0 : _api$editorDisabled.editorDisabled)),
|
|
396
401
|
dom = _DOMSerializer$render.dom,
|
|
397
402
|
contentDOM = _DOMSerializer$render.contentDOM;
|
|
403
|
+
// Ignored via go/ees005
|
|
404
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
398
405
|
this.dom = dom;
|
|
406
|
+
// Ignored via go/ees005
|
|
407
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
399
408
|
this.contentDOM = contentDOM;
|
|
400
409
|
this.isMobile = isMobile;
|
|
401
410
|
this.api = api;
|
|
@@ -442,6 +451,8 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
442
451
|
return (0, _createClass2.default)(ExpandNodeView, [{
|
|
443
452
|
key: "stopEvent",
|
|
444
453
|
value: function stopEvent(event) {
|
|
454
|
+
// Ignored via go/ees005
|
|
455
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
445
456
|
var target = event.target;
|
|
446
457
|
return target === this.input || target === this.icon || !!(0, _utils.closestElement)(target, ".".concat(_styles.expandClassNames.icon));
|
|
447
458
|
}
|
|
@@ -16,6 +16,8 @@ var _commands = require("./commands");
|
|
|
16
16
|
var _keymap = require("./pm-plugins/keymap");
|
|
17
17
|
var _main = require("./pm-plugins/main");
|
|
18
18
|
var _toolbar = require("./toolbar");
|
|
19
|
+
// Ignored via go/ees005
|
|
20
|
+
// eslint-disable-next-line prefer-const
|
|
19
21
|
var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
20
22
|
var _api$featureFlags, _api$analytics, _api$analytics2;
|
|
21
23
|
var _ref$config = _ref.config,
|
|
@@ -21,7 +21,10 @@ var isExpandSelected = function isExpandSelected(selection) {
|
|
|
21
21
|
};
|
|
22
22
|
function expandKeymap(api, options) {
|
|
23
23
|
var list = {};
|
|
24
|
-
(0, _keymaps.bindKeymapWithCommand)(
|
|
24
|
+
(0, _keymaps.bindKeymapWithCommand)(
|
|
25
|
+
// Ignored via go/ees005
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
27
|
+
_keymaps.moveRight.common, function (state, dispatch, editorView) {
|
|
25
28
|
var _api$selection;
|
|
26
29
|
if (!editorView) {
|
|
27
30
|
return false;
|
|
@@ -34,7 +37,10 @@ function expandKeymap(api, options) {
|
|
|
34
37
|
}
|
|
35
38
|
return false;
|
|
36
39
|
}, list);
|
|
37
|
-
(0, _keymaps.bindKeymapWithCommand)(
|
|
40
|
+
(0, _keymaps.bindKeymapWithCommand)(
|
|
41
|
+
// Ignored via go/ees005
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
43
|
+
_keymaps.moveLeft.common, function (state, dispatch, editorView) {
|
|
38
44
|
var _api$selection2;
|
|
39
45
|
if (!editorView) {
|
|
40
46
|
return false;
|
|
@@ -47,7 +53,10 @@ function expandKeymap(api, options) {
|
|
|
47
53
|
}
|
|
48
54
|
return false;
|
|
49
55
|
}, list);
|
|
50
|
-
(0, _keymaps.bindKeymapWithCommand)(
|
|
56
|
+
(0, _keymaps.bindKeymapWithCommand)(
|
|
57
|
+
// Ignored via go/ees005
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
59
|
+
_keymaps.tab.common, function (state, dispatch, editorView) {
|
|
51
60
|
if (editorView && editorView.dom instanceof HTMLElement) {
|
|
52
61
|
var from = state.selection.from;
|
|
53
62
|
|
|
@@ -73,7 +82,10 @@ function expandKeymap(api, options) {
|
|
|
73
82
|
}
|
|
74
83
|
return false;
|
|
75
84
|
}, list);
|
|
76
|
-
(0, _keymaps.bindKeymapWithCommand)(
|
|
85
|
+
(0, _keymaps.bindKeymapWithCommand)(
|
|
86
|
+
// Ignored via go/ees005
|
|
87
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
88
|
+
_keymaps.moveUp.common, function (state, dispatch, editorView) {
|
|
77
89
|
if (!editorView) {
|
|
78
90
|
return false;
|
|
79
91
|
}
|
|
@@ -116,7 +128,10 @@ function expandKeymap(api, options) {
|
|
|
116
128
|
}
|
|
117
129
|
return false;
|
|
118
130
|
}, list);
|
|
119
|
-
(0, _keymaps.bindKeymapWithCommand)(
|
|
131
|
+
(0, _keymaps.bindKeymapWithCommand)(
|
|
132
|
+
// Ignored via go/ees005
|
|
133
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
134
|
+
_keymaps.moveDown.common, function (state, dispatch, editorView) {
|
|
120
135
|
if (!editorView) {
|
|
121
136
|
return false;
|
|
122
137
|
}
|
|
@@ -141,7 +156,10 @@ function expandKeymap(api, options) {
|
|
|
141
156
|
}
|
|
142
157
|
return false;
|
|
143
158
|
}, list);
|
|
144
|
-
(0, _keymaps.bindKeymapWithCommand)(
|
|
159
|
+
(0, _keymaps.bindKeymapWithCommand)(
|
|
160
|
+
// Ignored via go/ees005
|
|
161
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
162
|
+
_keymaps.backspace.common, function (state, dispatch, editorView) {
|
|
145
163
|
var selection = state.selection;
|
|
146
164
|
var $from = selection.$from;
|
|
147
165
|
if (!editorView || !selection.empty) {
|
|
@@ -16,6 +16,9 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
16
16
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
17
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
18
18
|
var _nodeViews = _interopRequireDefault(require("../node-views"));
|
|
19
|
+
// Ignored via go/ees005
|
|
20
|
+
// eslint-disable-next-line import/no-named-as-default
|
|
21
|
+
|
|
19
22
|
var pluginKey = exports.pluginKey = new _state.PluginKey('expandPlugin');
|
|
20
23
|
function containsClass(element, className) {
|
|
21
24
|
var _element$classList;
|
|
@@ -64,6 +67,8 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, getInt
|
|
|
64
67
|
}, {
|
|
65
68
|
useLongPressSelection: useLongPressSelection
|
|
66
69
|
}),
|
|
70
|
+
// Ignored via go/ees005
|
|
71
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
67
72
|
handleDrop: function handleDrop(view, event, slice, moved) {
|
|
68
73
|
if ((0, _platformFeatureFlags.fg)('platform_editor_nest_nested_expand_drag_fix')) {
|
|
69
74
|
return handleExpandDrag(view, event, slice);
|
|
@@ -27,7 +27,11 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(api)
|
|
|
27
27
|
return {
|
|
28
28
|
title: 'Expand toolbar',
|
|
29
29
|
getDomRef: function getDomRef(view) {
|
|
30
|
-
return (
|
|
30
|
+
return (
|
|
31
|
+
// Ignored via go/ees005
|
|
32
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
33
|
+
(0, _utils.findDomRefAtPos)(selectedExpandNode.pos, view.domAtPos.bind(view))
|
|
34
|
+
);
|
|
31
35
|
},
|
|
32
36
|
nodeType: [nestedExpand, expand],
|
|
33
37
|
offset: [0, 6],
|
|
@@ -34,11 +34,19 @@ function withTooltip(Component) {
|
|
|
34
34
|
content: props.label,
|
|
35
35
|
position: "top",
|
|
36
36
|
tag: _ui.ExpandLayoutWrapperWithRef
|
|
37
|
-
}, (0, _react2.jsx)(Component
|
|
37
|
+
}, (0, _react2.jsx)(Component
|
|
38
|
+
// Ignored via go/ees005
|
|
39
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
40
|
+
, props));
|
|
38
41
|
};
|
|
39
42
|
}
|
|
40
43
|
var ExpandButtonInner = exports.ExpandButtonInner = function ExpandButtonInner(props) {
|
|
41
|
-
var useTheme = (0, _react.useCallback)(
|
|
44
|
+
var useTheme = (0, _react.useCallback)(
|
|
45
|
+
// Ignored via go/ees005
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
47
|
+
// Ignored via go/ees005
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
49
|
+
function (currentTheme, themeProps) {
|
|
42
50
|
var _currentTheme = currentTheme(themeProps),
|
|
43
51
|
buttonStyles = _currentTheme.buttonStyles,
|
|
44
52
|
rest = (0, _objectWithoutProperties2.default)(_currentTheme, _excluded);
|
|
@@ -80,6 +88,8 @@ var ExpandButton = exports.ExpandButton = function ExpandButton(props) {
|
|
|
80
88
|
|
|
81
89
|
// hoverEventCheck is to disable tooltips for mobile to prevent incorrect hover state causing issues on iOS
|
|
82
90
|
if (props.allowInteractiveExpand && hoverEventCheck) {
|
|
91
|
+
// Ignored via go/ees005
|
|
92
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
83
93
|
return (0, _react2.jsx)(ButtonWithTooltip, (0, _extends2.default)({
|
|
84
94
|
label: label
|
|
85
95
|
}, props));
|
|
@@ -90,6 +100,8 @@ var ExpandButton = exports.ExpandButton = function ExpandButton(props) {
|
|
|
90
100
|
css: _ui.expandLayoutWrapperStyle
|
|
91
101
|
}, (0, _react2.jsx)(ButtonWithoutTooltip, (0, _extends2.default)({
|
|
92
102
|
label: label
|
|
103
|
+
// Ignored via go/ees005
|
|
104
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
93
105
|
}, props)))
|
|
94
106
|
);
|
|
95
107
|
};
|
|
@@ -10,7 +10,10 @@ 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
|
|
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
|
+
) {
|
|
14
17
|
var _expandedState$get;
|
|
15
18
|
return ['div', {
|
|
16
19
|
// prettier-ignore
|
|
@@ -16,7 +16,10 @@ 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
|
|
19
|
+
const toDOM = (node, __livePage, intl, titleReadOnly, contentEditable
|
|
20
|
+
// Ignored via go/ees005
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
22
|
+
) => ['div', {
|
|
20
23
|
// prettier-ignore
|
|
21
24
|
'class': buildExpandClassName(node.type.name, __livePage && fg('platform.editor.live-pages-expand-divergence') ? !node.attrs.__expanded : node.attrs.__expanded),
|
|
22
25
|
'data-node-type': node.type.name,
|
|
@@ -50,6 +53,8 @@ const toDOM = (node, __livePage, intl, titleReadOnly, contentEditable) => ['div'
|
|
|
50
53
|
contenteditable: contentEditable !== undefined ? contentEditable ? 'true' : 'false' : undefined
|
|
51
54
|
}, 0]];
|
|
52
55
|
export class ExpandNodeView {
|
|
56
|
+
// Ignored via go/ees005
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
53
58
|
constructor(_node, view, getPos, getIntl, isMobile, selectNearNode, api, nodeViewPortalProviderAPI, allowInteractiveExpand = true, __livePage = false, cleanUpEditorDisabledOnChange) {
|
|
54
59
|
var _api$editorDisabled, _api$editorDisabled$s;
|
|
55
60
|
_defineProperty(this, "allowInteractiveExpand", true);
|
|
@@ -92,6 +97,9 @@ export class ExpandNodeView {
|
|
|
92
97
|
if (typeof pos !== 'number') {
|
|
93
98
|
return;
|
|
94
99
|
}
|
|
100
|
+
|
|
101
|
+
// Ignored via go/ees005
|
|
102
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
95
103
|
const target = event.target;
|
|
96
104
|
const {
|
|
97
105
|
state,
|
|
@@ -420,7 +428,11 @@ export class ExpandNodeView {
|
|
|
420
428
|
this.getPos = getPos;
|
|
421
429
|
this.view = view;
|
|
422
430
|
this.node = _node;
|
|
431
|
+
// Ignored via go/ees005
|
|
432
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
423
433
|
this.dom = dom;
|
|
434
|
+
// Ignored via go/ees005
|
|
435
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
424
436
|
this.contentDOM = contentDOM;
|
|
425
437
|
this.isMobile = isMobile;
|
|
426
438
|
this.api = api;
|
|
@@ -478,7 +490,7 @@ export class ExpandNodeView {
|
|
|
478
490
|
if (!this.icon) {
|
|
479
491
|
return;
|
|
480
492
|
}
|
|
481
|
-
|
|
493
|
+
const {
|
|
482
494
|
__expanded
|
|
483
495
|
} = node && node.attrs || this.node.attrs;
|
|
484
496
|
if (fg('platform_editor_react18_plugin_portalprovider')) {
|
|
@@ -496,6 +508,8 @@ export class ExpandNodeView {
|
|
|
496
508
|
}
|
|
497
509
|
}
|
|
498
510
|
stopEvent(event) {
|
|
511
|
+
// Ignored via go/ees005
|
|
512
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
499
513
|
const target = event.target;
|
|
500
514
|
return target === this.input || target === this.icon || !!closestElement(target, `.${expandClassNames.icon}`);
|
|
501
515
|
}
|
|
@@ -9,6 +9,9 @@ import { createExpandNode, insertExpand, insertExpandWithInputMethod } from './c
|
|
|
9
9
|
import { expandKeymap } from './pm-plugins/keymap';
|
|
10
10
|
import { createPlugin } from './pm-plugins/main';
|
|
11
11
|
import { getToolbarConfig } from './toolbar';
|
|
12
|
+
|
|
13
|
+
// Ignored via go/ees005
|
|
14
|
+
// eslint-disable-next-line prefer-const
|
|
12
15
|
export let expandPlugin = ({
|
|
13
16
|
config: options = {},
|
|
14
17
|
api
|
|
@@ -13,7 +13,10 @@ const isExpandNode = node => {
|
|
|
13
13
|
const isExpandSelected = selection => selection instanceof NodeSelection && isExpandNode(selection.node);
|
|
14
14
|
export function expandKeymap(api, options) {
|
|
15
15
|
const list = {};
|
|
16
|
-
bindKeymapWithCommand(
|
|
16
|
+
bindKeymapWithCommand(
|
|
17
|
+
// Ignored via go/ees005
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
19
|
+
moveRight.common, (state, dispatch, editorView) => {
|
|
17
20
|
var _api$selection;
|
|
18
21
|
if (!editorView) {
|
|
19
22
|
return false;
|
|
@@ -30,7 +33,10 @@ export function expandKeymap(api, options) {
|
|
|
30
33
|
}
|
|
31
34
|
return false;
|
|
32
35
|
}, list);
|
|
33
|
-
bindKeymapWithCommand(
|
|
36
|
+
bindKeymapWithCommand(
|
|
37
|
+
// Ignored via go/ees005
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
39
|
+
moveLeft.common, (state, dispatch, editorView) => {
|
|
34
40
|
var _api$selection2;
|
|
35
41
|
if (!editorView) {
|
|
36
42
|
return false;
|
|
@@ -47,7 +53,10 @@ export function expandKeymap(api, options) {
|
|
|
47
53
|
}
|
|
48
54
|
return false;
|
|
49
55
|
}, list);
|
|
50
|
-
bindKeymapWithCommand(
|
|
56
|
+
bindKeymapWithCommand(
|
|
57
|
+
// Ignored via go/ees005
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
59
|
+
tab.common, (state, dispatch, editorView) => {
|
|
51
60
|
if (editorView && editorView.dom instanceof HTMLElement) {
|
|
52
61
|
const {
|
|
53
62
|
from
|
|
@@ -75,7 +84,10 @@ export function expandKeymap(api, options) {
|
|
|
75
84
|
}
|
|
76
85
|
return false;
|
|
77
86
|
}, list);
|
|
78
|
-
bindKeymapWithCommand(
|
|
87
|
+
bindKeymapWithCommand(
|
|
88
|
+
// Ignored via go/ees005
|
|
89
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
90
|
+
moveUp.common, (state, dispatch, editorView) => {
|
|
79
91
|
if (!editorView) {
|
|
80
92
|
return false;
|
|
81
93
|
}
|
|
@@ -130,7 +142,10 @@ export function expandKeymap(api, options) {
|
|
|
130
142
|
}
|
|
131
143
|
return false;
|
|
132
144
|
}, list);
|
|
133
|
-
bindKeymapWithCommand(
|
|
145
|
+
bindKeymapWithCommand(
|
|
146
|
+
// Ignored via go/ees005
|
|
147
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
148
|
+
moveDown.common, (state, dispatch, editorView) => {
|
|
134
149
|
if (!editorView) {
|
|
135
150
|
return false;
|
|
136
151
|
}
|
|
@@ -166,7 +181,10 @@ export function expandKeymap(api, options) {
|
|
|
166
181
|
}
|
|
167
182
|
return false;
|
|
168
183
|
}, list);
|
|
169
|
-
bindKeymapWithCommand(
|
|
184
|
+
bindKeymapWithCommand(
|
|
185
|
+
// Ignored via go/ees005
|
|
186
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
187
|
+
backspace.common, (state, dispatch, editorView) => {
|
|
170
188
|
const {
|
|
171
189
|
selection
|
|
172
190
|
} = state;
|
|
@@ -6,13 +6,18 @@ import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
8
8
|
import { setExpandRef } from '../commands';
|
|
9
|
+
// Ignored via go/ees005
|
|
10
|
+
// eslint-disable-next-line import/no-named-as-default
|
|
9
11
|
import ExpandNodeView from '../nodeviews';
|
|
10
12
|
import { createPluginState, getPluginState, pluginKey } from './plugin-factory';
|
|
11
13
|
export function containsClass(element, className) {
|
|
12
14
|
var _element$classList;
|
|
13
15
|
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
16
|
}
|
|
15
|
-
export const createPlugin = (dispatch, getIntl, appearance = 'full-page', useLongPressSelection = false, api, nodeViewPortalProviderAPI, allowInteractiveExpand = true, __livePage = false
|
|
17
|
+
export const createPlugin = (dispatch, getIntl, appearance = 'full-page', useLongPressSelection = false, api, nodeViewPortalProviderAPI, allowInteractiveExpand = true, __livePage = false
|
|
18
|
+
// Ignored via go/ees005
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
20
|
+
) => {
|
|
16
21
|
const state = createPluginState(dispatch, {});
|
|
17
22
|
const isMobile = false;
|
|
18
23
|
return new SafePlugin({
|
|
@@ -49,6 +54,8 @@ export const createPlugin = (dispatch, getIntl, appearance = 'full-page', useLon
|
|
|
49
54
|
handleClickOn: createSelectionClickHandler(['expand', 'nestedExpand'], target => target.classList.contains(expandClassNames.prefix), {
|
|
50
55
|
useLongPressSelection
|
|
51
56
|
}),
|
|
57
|
+
// Ignored via go/ees005
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
52
59
|
handleDrop(view, event, slice, moved) {
|
|
53
60
|
if (fg('platform_editor_nest_nested_expand_drag_fix')) {
|
|
54
61
|
return handleExpandDrag(view, event, slice);
|
|
@@ -115,7 +122,7 @@ export function handleExpandDrag(view, event, slice) {
|
|
|
115
122
|
if (!sliceContainsExpand && !sliceContainsNestedExpand || sliceContainsExpand && sliceContainsNestedExpand) {
|
|
116
123
|
return false;
|
|
117
124
|
}
|
|
118
|
-
|
|
125
|
+
const dropPos = view.posAtCoords({
|
|
119
126
|
left: event.clientX,
|
|
120
127
|
top: event.clientY
|
|
121
128
|
});
|