@atlaskit/editor-plugin-expand 27.0.4 → 27.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 +6 -0
- package/dist/cjs/legacyExpand/commands.js +27 -25
- package/dist/cjs/legacyExpand/nodeviews/index.js +34 -31
- package/dist/cjs/legacyExpand/plugin.js +16 -15
- package/dist/cjs/legacyExpand/pm-plugins/keymap.js +6 -4
- package/dist/cjs/legacyExpand/pm-plugins/main.js +6 -6
- package/dist/cjs/legacyExpand/pm-plugins/plugin-factory.js +2 -2
- package/dist/cjs/legacyExpand/ui/ExpandIconButton.js +9 -9
- package/dist/cjs/singlePlayerExpand/commands.js +33 -31
- package/dist/cjs/singlePlayerExpand/node-views/index.js +18 -15
- package/dist/cjs/singlePlayerExpand/plugin.js +16 -15
- package/dist/cjs/singlePlayerExpand/pm-plugins/keymap.js +6 -4
- package/dist/cjs/singlePlayerExpand/pm-plugins/main.js +6 -6
- package/dist/cjs/singlePlayerExpand/ui/ExpandButton.js +9 -9
- package/dist/cjs/singlePlayerExpand/ui/NodeView.js +16 -16
- package/dist/cjs/ui/ExpandBlockMenuItem.js +7 -7
- package/dist/cjs/ui/quick-insert/ExpandQuickInsertMenuItem.js +15 -15
- package/dist/cjs/ui/quick-insert/getExpandQuickInsertComponents.js +3 -3
- package/dist/es2019/legacyExpand/commands.js +6 -4
- package/dist/es2019/legacyExpand/nodeviews/index.js +7 -4
- package/dist/es2019/legacyExpand/plugin.js +5 -4
- package/dist/es2019/legacyExpand/pm-plugins/keymap.js +3 -1
- package/dist/es2019/legacyExpand/pm-plugins/main.js +1 -1
- package/dist/es2019/legacyExpand/pm-plugins/plugin-factory.js +1 -1
- package/dist/es2019/legacyExpand/ui/ExpandIconButton.js +3 -3
- package/dist/es2019/singlePlayerExpand/commands.js +6 -4
- package/dist/es2019/singlePlayerExpand/node-views/index.js +6 -3
- package/dist/es2019/singlePlayerExpand/plugin.js +5 -4
- package/dist/es2019/singlePlayerExpand/pm-plugins/keymap.js +3 -1
- package/dist/es2019/singlePlayerExpand/pm-plugins/main.js +1 -1
- package/dist/es2019/singlePlayerExpand/ui/ExpandButton.js +3 -3
- package/dist/es2019/singlePlayerExpand/ui/NodeView.js +2 -2
- package/dist/es2019/ui/ExpandBlockMenuItem.js +3 -3
- package/dist/es2019/ui/quick-insert/ExpandQuickInsertMenuItem.js +4 -4
- package/dist/es2019/ui/quick-insert/getExpandQuickInsertComponents.js +1 -1
- package/dist/esm/legacyExpand/commands.js +6 -4
- package/dist/esm/legacyExpand/nodeviews/index.js +7 -4
- package/dist/esm/legacyExpand/plugin.js +5 -4
- package/dist/esm/legacyExpand/pm-plugins/keymap.js +3 -1
- package/dist/esm/legacyExpand/pm-plugins/main.js +1 -1
- package/dist/esm/legacyExpand/pm-plugins/plugin-factory.js +1 -1
- package/dist/esm/legacyExpand/ui/ExpandIconButton.js +3 -3
- package/dist/esm/singlePlayerExpand/commands.js +6 -4
- package/dist/esm/singlePlayerExpand/node-views/index.js +6 -3
- package/dist/esm/singlePlayerExpand/plugin.js +5 -4
- package/dist/esm/singlePlayerExpand/pm-plugins/keymap.js +3 -1
- package/dist/esm/singlePlayerExpand/pm-plugins/main.js +1 -1
- package/dist/esm/singlePlayerExpand/ui/ExpandButton.js +3 -3
- package/dist/esm/singlePlayerExpand/ui/NodeView.js +2 -2
- package/dist/esm/ui/ExpandBlockMenuItem.js +3 -3
- package/dist/esm/ui/quick-insert/ExpandQuickInsertMenuItem.js +4 -4
- package/dist/esm/ui/quick-insert/getExpandQuickInsertComponents.js +1 -1
- package/dist/types/legacyExpand/commands.d.ts +3 -2
- package/dist/types/legacyExpand/nodeviews/index.d.ts +4 -3
- package/dist/types/legacyExpand/pm-plugins/keymap.d.ts +1 -1
- package/dist/types/legacyExpand/pm-plugins/main.d.ts +3 -2
- package/dist/types/legacyExpand/pm-plugins/plugin-factory.d.ts +1 -1
- package/dist/types/legacyExpand/toolbar.d.ts +2 -1
- package/dist/types/singlePlayerExpand/commands.d.ts +4 -3
- package/dist/types/singlePlayerExpand/node-views/index.d.ts +4 -3
- package/dist/types/singlePlayerExpand/pm-plugins/keymap.d.ts +1 -1
- package/dist/types/singlePlayerExpand/pm-plugins/main.d.ts +3 -2
- package/dist/types/singlePlayerExpand/toolbar.d.ts +2 -1
- package/dist/types/types.d.ts +16 -13
- package/dist/types/ui/ExpandBlockMenuItem.d.ts +1 -1
- package/dist/types/ui/quick-insert/ExpandQuickInsertMenuItem.d.ts +1 -1
- package/dist/types/ui/quick-insert/getExpandQuickInsertComponents.d.ts +1 -1
- package/package.json +2 -2
|
@@ -8,17 +8,19 @@ exports.wrapSelectionAndSetExpandedState = exports.updateExpandTitle = exports.t
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _uuid = require("uuid");
|
|
10
10
|
var _setAttrs = require("@atlaskit/adf-schema/steps/set-attrs");
|
|
11
|
-
var
|
|
11
|
+
var _enums = require("@atlaskit/editor-common/analytics/types/enums");
|
|
12
|
+
var _generalEvents = require("@atlaskit/editor-common/analytics/types/general-events");
|
|
12
13
|
var _expand = require("@atlaskit/editor-common/expand");
|
|
13
14
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
14
|
-
var
|
|
15
|
+
var _selection2 = require("@atlaskit/editor-common/selection/gap-cursor/selection");
|
|
16
|
+
var _expand2 = require("@atlaskit/editor-common/styles/expand");
|
|
15
17
|
var _transforms = require("@atlaskit/editor-common/transforms");
|
|
16
|
-
var
|
|
18
|
+
var _createWrapSelectionTransaction = require("@atlaskit/editor-common/utils/create-wrap-selection-transaction");
|
|
17
19
|
var _state2 = require("@atlaskit/editor-prosemirror/state");
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
+
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
21
|
+
var _utils2 = require("@atlaskit/editor-tables/utils");
|
|
20
22
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
21
|
-
var
|
|
23
|
+
var _utils3 = require("../utils");
|
|
22
24
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
23
25
|
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; } // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
24
26
|
// oxlint-disable-next-line import/no-duplicates
|
|
@@ -30,8 +32,8 @@ var createExpandNode = exports.createExpandNode = function createExpandNode(stat
|
|
|
30
32
|
expand = _state$schema$nodes.expand,
|
|
31
33
|
nestedExpand = _state$schema$nodes.nestedExpand,
|
|
32
34
|
paragraph = _state$schema$nodes.paragraph;
|
|
33
|
-
var isSelectionInTable = !!(0,
|
|
34
|
-
var isSelectionInExpand = (0,
|
|
35
|
+
var isSelectionInTable = !!(0, _utils2.findTable)(state.selection);
|
|
36
|
+
var isSelectionInExpand = (0, _utils3.isNestedInExpand)(state);
|
|
35
37
|
var expandType = isSelectionInTable || isSelectionInExpand ? nestedExpand : expand;
|
|
36
38
|
var expandNode = (0, _fg.fg)('platform_editor_adf_with_localid') ? expandType.createAndFill(addLocalId ? {
|
|
37
39
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
@@ -54,12 +56,12 @@ var createExpandNode = exports.createExpandNode = function createExpandNode(stat
|
|
|
54
56
|
* in insertExpandWithInputMethod.
|
|
55
57
|
*/
|
|
56
58
|
var wrapSelectionAndSetExpandedState = exports.wrapSelectionAndSetExpandedState = function wrapSelectionAndSetExpandedState(state, node) {
|
|
57
|
-
var tr = (0,
|
|
59
|
+
var tr = (0, _createWrapSelectionTransaction.createWrapSelectionTransaction)({
|
|
58
60
|
state: state,
|
|
59
61
|
type: node.type,
|
|
60
62
|
nodeAttributes: node.attrs
|
|
61
63
|
});
|
|
62
|
-
var wrapperNode = (0,
|
|
64
|
+
var wrapperNode = (0, _utils.findParentNodeOfType)(node.type)(tr.selection);
|
|
63
65
|
if (wrapperNode) {
|
|
64
66
|
_expand.expandedState.set(wrapperNode.node, true);
|
|
65
67
|
}
|
|
@@ -74,28 +76,28 @@ var insertExpandWithInputMethod = exports.insertExpandWithInputMethod = function
|
|
|
74
76
|
}
|
|
75
77
|
var tr;
|
|
76
78
|
if (state.selection.empty) {
|
|
77
|
-
tr = (0,
|
|
79
|
+
tr = (0, _utils.safeInsert)(expandNode)(state.tr).scrollIntoView();
|
|
78
80
|
_expand.expandedState.set(expandNode, true);
|
|
79
81
|
} else {
|
|
80
|
-
tr = (0,
|
|
82
|
+
tr = (0, _createWrapSelectionTransaction.createWrapSelectionTransaction)(_objectSpread({
|
|
81
83
|
state: state,
|
|
82
84
|
type: expandNode.type
|
|
83
85
|
}, (0, _fg.fg)('platform_editor_adf_with_localid') && {
|
|
84
86
|
nodeAttributes: expandNode.attrs
|
|
85
87
|
}));
|
|
86
|
-
var wrapperNode = (0,
|
|
88
|
+
var wrapperNode = (0, _utils.findParentNodeOfType)(expandNode.type)(tr.selection);
|
|
87
89
|
if (wrapperNode) {
|
|
88
90
|
_expand.expandedState.set(wrapperNode.node, true);
|
|
89
91
|
}
|
|
90
92
|
}
|
|
91
93
|
var payload = {
|
|
92
|
-
action:
|
|
93
|
-
actionSubject:
|
|
94
|
-
actionSubjectId: (expandNode === null || expandNode === void 0 ? void 0 : expandNode.type) === state.schema.nodes.expand ?
|
|
94
|
+
action: _enums.ACTION.INSERTED,
|
|
95
|
+
actionSubject: _enums.ACTION_SUBJECT.DOCUMENT,
|
|
96
|
+
actionSubjectId: (expandNode === null || expandNode === void 0 ? void 0 : expandNode.type) === state.schema.nodes.expand ? _enums.ACTION_SUBJECT_ID.EXPAND : _enums.ACTION_SUBJECT_ID.NESTED_EXPAND,
|
|
95
97
|
attributes: {
|
|
96
98
|
inputMethod: inputMethod
|
|
97
99
|
},
|
|
98
|
-
eventType:
|
|
100
|
+
eventType: _enums.EVENT_TYPE.TRACK
|
|
99
101
|
};
|
|
100
102
|
if (dispatch) {
|
|
101
103
|
var _api$analytics;
|
|
@@ -108,7 +110,7 @@ var insertExpandWithInputMethod = exports.insertExpandWithInputMethod = function
|
|
|
108
110
|
};
|
|
109
111
|
var insertExpand = exports.insertExpand = function insertExpand(api) {
|
|
110
112
|
return function (state, dispatch) {
|
|
111
|
-
return insertExpandWithInputMethod(api)(
|
|
113
|
+
return insertExpandWithInputMethod(api)(_enums.INPUT_METHOD.INSERT_MENU)(state, dispatch);
|
|
112
114
|
};
|
|
113
115
|
};
|
|
114
116
|
var deleteExpand = exports.deleteExpand = function deleteExpand(editorAnalyticsAPI) {
|
|
@@ -127,12 +129,12 @@ var deleteExpandAtPos = exports.deleteExpandAtPos = function deleteExpandAtPos(e
|
|
|
127
129
|
return false;
|
|
128
130
|
}
|
|
129
131
|
var payload = {
|
|
130
|
-
action:
|
|
131
|
-
actionSubject: expandNode.type === state.schema.nodes.expand ?
|
|
132
|
+
action: _enums.ACTION.DELETED,
|
|
133
|
+
actionSubject: expandNode.type === state.schema.nodes.expand ? _enums.ACTION_SUBJECT.EXPAND : _enums.ACTION_SUBJECT.NESTED_EXPAND,
|
|
132
134
|
attributes: {
|
|
133
|
-
inputMethod:
|
|
135
|
+
inputMethod: _enums.INPUT_METHOD.FLOATING_TB
|
|
134
136
|
},
|
|
135
|
-
eventType:
|
|
137
|
+
eventType: _enums.EVENT_TYPE.TRACK
|
|
136
138
|
};
|
|
137
139
|
if (expandNode && dispatch) {
|
|
138
140
|
var tr = state.tr;
|
|
@@ -183,20 +185,20 @@ var toggleExpandExpanded = exports.toggleExpandExpanded = function toggleExpandE
|
|
|
183
185
|
// Move to a right gap cursor, if the toolbar is interacted (or an API),
|
|
184
186
|
// it will insert below rather than inside (which will be invisible).
|
|
185
187
|
if (isExpandedNext === true) {
|
|
186
|
-
tr.setSelection(new
|
|
188
|
+
tr.setSelection(new _selection2.GapCursorSelection(tr.doc.resolve(pos + node.nodeSize), _selection.Side.RIGHT));
|
|
187
189
|
}
|
|
188
190
|
|
|
189
191
|
// log when people open/close expands
|
|
190
192
|
// TODO: ED-8523 - make platform/mode global attributes?
|
|
191
193
|
var payload = {
|
|
192
|
-
action:
|
|
193
|
-
actionSubject: node.type === state.schema.nodes.expand ?
|
|
194
|
+
action: _enums.ACTION.TOGGLE_EXPAND,
|
|
195
|
+
actionSubject: node.type === state.schema.nodes.expand ? _enums.ACTION_SUBJECT.EXPAND : _enums.ACTION_SUBJECT.NESTED_EXPAND,
|
|
194
196
|
attributes: {
|
|
195
|
-
platform:
|
|
196
|
-
mode:
|
|
197
|
+
platform: _generalEvents.PLATFORMS.WEB,
|
|
198
|
+
mode: _generalEvents.MODE.EDITOR,
|
|
197
199
|
expanded: isExpandedNext
|
|
198
200
|
},
|
|
199
|
-
eventType:
|
|
201
|
+
eventType: _enums.EVENT_TYPE.TRACK
|
|
200
202
|
};
|
|
201
203
|
tr.setMeta('scrollIntoView', false);
|
|
202
204
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(payload)(tr);
|
|
@@ -243,7 +245,7 @@ var focusIcon = exports.focusIcon = function focusIcon(expand) {
|
|
|
243
245
|
if (!(expand instanceof HTMLElement)) {
|
|
244
246
|
return false;
|
|
245
247
|
}
|
|
246
|
-
var iconContainer = expand.querySelector(".".concat(
|
|
248
|
+
var iconContainer = expand.querySelector(".".concat(_expand2.expandClassNames.iconContainer));
|
|
247
249
|
if (iconContainer && iconContainer.focus) {
|
|
248
250
|
var tr = state.tr;
|
|
249
251
|
var pos = state.selection.from;
|
|
@@ -265,7 +267,7 @@ var toggleExpandWithMatch = exports.toggleExpandWithMatch = function toggleExpan
|
|
|
265
267
|
expand = _tr$doc$type$schema$n.expand,
|
|
266
268
|
nestedExpand = _tr$doc$type$schema$n.nestedExpand;
|
|
267
269
|
// if match is inside a nested expand, open the nested expand
|
|
268
|
-
var nestedExpandNode = (0,
|
|
270
|
+
var nestedExpandNode = (0, _utils.findParentNodeOfType)(nestedExpand)(selection);
|
|
269
271
|
if (nestedExpandNode) {
|
|
270
272
|
var _expandedState$get2;
|
|
271
273
|
var expanded = (_expandedState$get2 = _expand.expandedState.get(nestedExpandNode.node)) !== null && _expandedState$get2 !== void 0 ? _expandedState$get2 : false;
|
|
@@ -274,7 +276,7 @@ var toggleExpandWithMatch = exports.toggleExpandWithMatch = function toggleExpan
|
|
|
274
276
|
}
|
|
275
277
|
}
|
|
276
278
|
// if match is (also) inside an expand, open the expand
|
|
277
|
-
var expandNode = (0,
|
|
279
|
+
var expandNode = (0, _utils.findParentNodeOfType)(expand)(selection);
|
|
278
280
|
if (expandNode) {
|
|
279
281
|
var _expandedState$get3;
|
|
280
282
|
var _expanded = (_expandedState$get3 = _expand.expandedState.get(expandNode.node)) !== null && _expandedState$get3 !== void 0 ? _expandedState$get3 : false;
|
|
@@ -15,9 +15,12 @@ var _w3cKeyname = require("w3c-keyname");
|
|
|
15
15
|
var _surfaceKeys = require("@atlaskit/editor-common/block-controls/surface-keys");
|
|
16
16
|
var _expand = require("@atlaskit/editor-common/expand");
|
|
17
17
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
18
|
-
var
|
|
18
|
+
var _selection2 = require("@atlaskit/editor-common/selection/gap-cursor/selection");
|
|
19
|
+
var _types = require("@atlaskit/editor-common/selection/types");
|
|
20
|
+
var _expand2 = require("@atlaskit/editor-common/styles/expand");
|
|
19
21
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
20
22
|
var _contentVisibility = require("@atlaskit/editor-common/utils/content-visibility");
|
|
23
|
+
var _dom2 = require("@atlaskit/editor-common/utils/dom");
|
|
21
24
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
22
25
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
23
26
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
@@ -51,7 +54,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
51
54
|
dispatch = _this$view.dispatch;
|
|
52
55
|
if (_this.selectNearNode) {
|
|
53
56
|
var tr = _this.selectNearNode({
|
|
54
|
-
selectionRelativeToNode:
|
|
57
|
+
selectionRelativeToNode: _types.RelativeSelectionPos.Start
|
|
55
58
|
})(state);
|
|
56
59
|
if (dispatch) {
|
|
57
60
|
dispatch(tr);
|
|
@@ -85,7 +88,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
85
88
|
// Ignored via go/ees005
|
|
86
89
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
87
90
|
var target = event.target;
|
|
88
|
-
if ((0,
|
|
91
|
+
if ((0, _dom2.closestElement)(target, ".".concat(_expand2.expandClassNames.icon))) {
|
|
89
92
|
var _this$api;
|
|
90
93
|
if (!_this.allowInteractiveExpand) {
|
|
91
94
|
return;
|
|
@@ -330,7 +333,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
330
333
|
dispatch = _this$view5.dispatch;
|
|
331
334
|
event.preventDefault();
|
|
332
335
|
_this.view.focus();
|
|
333
|
-
dispatch(state.tr.setSelection(new
|
|
336
|
+
dispatch(state.tr.setSelection(new _selection2.GapCursorSelection(state.doc.resolve(_this.node.nodeSize + pos), _selection.Side.RIGHT)));
|
|
334
337
|
}
|
|
335
338
|
});
|
|
336
339
|
(0, _defineProperty2.default)(this, "moveToPreviousLine", function (event) {
|
|
@@ -381,7 +384,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
381
384
|
state = _this$view7.state,
|
|
382
385
|
dispatch = _this$view7.dispatch;
|
|
383
386
|
_this.view.focus();
|
|
384
|
-
dispatch(state.tr.setSelection(new
|
|
387
|
+
dispatch(state.tr.setSelection(new _selection2.GapCursorSelection(state.doc.resolve(pos), _selection.Side.LEFT)));
|
|
385
388
|
}
|
|
386
389
|
});
|
|
387
390
|
(0, _defineProperty2.default)(this, "handleArrowRightFromTitle", function (event) {
|
|
@@ -403,7 +406,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
403
406
|
dispatch = _this$view8.dispatch;
|
|
404
407
|
_this.view.focus();
|
|
405
408
|
var tr = _this.selectNearNode({
|
|
406
|
-
selectionRelativeToNode:
|
|
409
|
+
selectionRelativeToNode: _types.RelativeSelectionPos.End,
|
|
407
410
|
selection: _state.NodeSelection.create(state.doc, pos)
|
|
408
411
|
})(state);
|
|
409
412
|
if (dispatch) {
|
|
@@ -435,14 +438,14 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
435
438
|
if ((selectionSharedState === null || selectionSharedState === void 0 ? void 0 : selectionSharedState.selectionRelativeToNode) === undefined) {
|
|
436
439
|
var tr = _this.selectNearNode({
|
|
437
440
|
selectionRelativeToNode: undefined,
|
|
438
|
-
selection: new
|
|
441
|
+
selection: new _selection2.GapCursorSelection(state.doc.resolve(pos), _selection.Side.LEFT)
|
|
439
442
|
})(state);
|
|
440
443
|
if (dispatch) {
|
|
441
444
|
dispatch(tr);
|
|
442
445
|
}
|
|
443
446
|
} else {
|
|
444
447
|
var _tr = _this.selectNearNode({
|
|
445
|
-
selectionRelativeToNode:
|
|
448
|
+
selectionRelativeToNode: _types.RelativeSelectionPos.Start,
|
|
446
449
|
selection: _state.NodeSelection.create(state.doc, pos)
|
|
447
450
|
})(state);
|
|
448
451
|
if (dispatch) {
|
|
@@ -511,12 +514,12 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
511
514
|
this.contentDOM = contentDOM;
|
|
512
515
|
this.isMobile = isMobile;
|
|
513
516
|
this.api = api;
|
|
514
|
-
this.icon = this.dom.querySelector(".".concat(
|
|
515
|
-
this.input = this.dom.querySelector(".".concat(
|
|
516
|
-
this.titleContainer = this.dom.querySelector(".".concat(
|
|
517
|
+
this.icon = this.dom.querySelector(".".concat(_expand2.expandClassNames.icon));
|
|
518
|
+
this.input = this.dom.querySelector(".".concat(_expand2.expandClassNames.titleInput));
|
|
519
|
+
this.titleContainer = this.dom.querySelector(".".concat(_expand2.expandClassNames.titleContainer));
|
|
517
520
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
518
521
|
this.renderKey = (0, _uuid.v4)();
|
|
519
|
-
this.content = this.dom.querySelector(".".concat(
|
|
522
|
+
this.content = this.dom.querySelector(".".concat(_expand2.expandClassNames.content));
|
|
520
523
|
if (!_expand.expandedState.has(this.node)) {
|
|
521
524
|
_expand.expandedState.set(this.node, false);
|
|
522
525
|
}
|
|
@@ -583,7 +586,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
583
586
|
// Ignored via go/ees005
|
|
584
587
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
585
588
|
var target = event.target;
|
|
586
|
-
return target === this.input || target === this.icon || !!(0,
|
|
589
|
+
return target === this.input || target === this.icon || !!(0, _dom2.closestElement)(target, ".".concat(_expand2.expandClassNames.icon));
|
|
587
590
|
}
|
|
588
591
|
}, {
|
|
589
592
|
key: "ignoreMutation",
|
|
@@ -684,9 +687,9 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
684
687
|
value: function updateDisplayStyle(node) {
|
|
685
688
|
if (this.content) {
|
|
686
689
|
if ((0, _expand.isExpandCollapsed)(node)) {
|
|
687
|
-
this.content.classList.add(
|
|
690
|
+
this.content.classList.add(_expand2.expandClassNames.contentCollapsed);
|
|
688
691
|
} else {
|
|
689
|
-
this.content.classList.remove(
|
|
692
|
+
this.content.classList.remove(_expand2.expandClassNames.contentCollapsed);
|
|
690
693
|
}
|
|
691
694
|
}
|
|
692
695
|
// Collapsed vs expanded changes the reserved height, so re-apply the intrinsic-size estimate.
|
|
@@ -9,11 +9,12 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _expand = require("@atlaskit/adf-schema/expand");
|
|
11
11
|
var _nestedExpand = require("@atlaskit/adf-schema/nested-expand");
|
|
12
|
-
var
|
|
12
|
+
var _enums = require("@atlaskit/editor-common/analytics/types/enums");
|
|
13
13
|
var _assets = require("@atlaskit/editor-common/assets");
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
14
|
+
var _key = require("@atlaskit/editor-common/block-menu/key");
|
|
15
|
+
var _rank = require("@atlaskit/editor-common/block-menu/rank");
|
|
16
|
+
var _insertBlock = require("@atlaskit/editor-common/messages/insert-block");
|
|
17
|
+
var _createWrapSelectionTransaction = require("@atlaskit/editor-common/utils/create-wrap-selection-transaction");
|
|
17
18
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
18
19
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
19
20
|
var _toggleExpandRange = require("../editor-commands/toggleExpandRange");
|
|
@@ -36,11 +37,11 @@ var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
|
36
37
|
var isRegisteredSlashCommandEnabled = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_slash_command');
|
|
37
38
|
api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 || _api$blockMenu.actions.registerBlockMenuComponents([{
|
|
38
39
|
type: 'block-menu-item',
|
|
39
|
-
key:
|
|
40
|
+
key: _key.TRANSFORM_STRUCTURE_EXPAND_MENU_ITEM.key,
|
|
40
41
|
parent: {
|
|
41
42
|
type: 'block-menu-section',
|
|
42
|
-
key:
|
|
43
|
-
rank:
|
|
43
|
+
key: _key.TRANSFORM_STRUCTURE_MENU_SECTION.key,
|
|
44
|
+
rank: _rank.TRANSFORM_STRUCTURE_MENU_SECTION_RANK[_key.TRANSFORM_STRUCTURE_EXPAND_MENU_ITEM.key]
|
|
44
45
|
},
|
|
45
46
|
component: (0, _ExpandBlockMenuItem.createExpandBlockMenuItem)(api),
|
|
46
47
|
isHidden: function isHidden() {
|
|
@@ -109,8 +110,8 @@ var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
|
109
110
|
}
|
|
110
111
|
return [{
|
|
111
112
|
id: 'expand',
|
|
112
|
-
title: formatMessage(
|
|
113
|
-
description: formatMessage(
|
|
113
|
+
title: formatMessage(_insertBlock.toolbarInsertBlockMessages.expand),
|
|
114
|
+
description: formatMessage(_insertBlock.toolbarInsertBlockMessages.expandDescription),
|
|
114
115
|
keywords: ['accordion', 'collapse'],
|
|
115
116
|
priority: 600,
|
|
116
117
|
icon: function icon() {
|
|
@@ -122,18 +123,18 @@ var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
|
122
123
|
if (!node) {
|
|
123
124
|
return false;
|
|
124
125
|
}
|
|
125
|
-
var tr = state.selection.empty ? insert(node) : (0, _fg.fg)('platform_editor_adf_with_localid') ? (0, _commands.wrapSelectionAndSetExpandedState)(state, node) : (0,
|
|
126
|
+
var tr = state.selection.empty ? insert(node) : (0, _fg.fg)('platform_editor_adf_with_localid') ? (0, _commands.wrapSelectionAndSetExpandedState)(state, node) : (0, _createWrapSelectionTransaction.createWrapSelectionTransaction)({
|
|
126
127
|
state: state,
|
|
127
128
|
type: node.type
|
|
128
129
|
});
|
|
129
130
|
api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.attachAnalyticsEvent({
|
|
130
|
-
action:
|
|
131
|
-
actionSubject:
|
|
132
|
-
actionSubjectId: node.type === state.schema.nodes.nestedExpand ?
|
|
131
|
+
action: _enums.ACTION.INSERTED,
|
|
132
|
+
actionSubject: _enums.ACTION_SUBJECT.DOCUMENT,
|
|
133
|
+
actionSubjectId: node.type === state.schema.nodes.nestedExpand ? _enums.ACTION_SUBJECT_ID.NESTED_EXPAND : _enums.ACTION_SUBJECT_ID.EXPAND,
|
|
133
134
|
attributes: {
|
|
134
|
-
inputMethod: source !== null && source !== void 0 ? source :
|
|
135
|
+
inputMethod: source !== null && source !== void 0 ? source : _enums.INPUT_METHOD.QUICK_INSERT
|
|
135
136
|
},
|
|
136
|
-
eventType:
|
|
137
|
+
eventType: _enums.EVENT_TYPE.TRACK
|
|
137
138
|
})(tr);
|
|
138
139
|
return tr;
|
|
139
140
|
}
|
|
@@ -7,6 +7,8 @@ exports.expandKeymap = expandKeymap;
|
|
|
7
7
|
var _expand2 = require("@atlaskit/editor-common/expand");
|
|
8
8
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
9
9
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
10
|
+
var _selection2 = require("@atlaskit/editor-common/selection/gap-cursor/selection");
|
|
11
|
+
var _types = require("@atlaskit/editor-common/selection/types");
|
|
10
12
|
var _transforms = require("@atlaskit/editor-common/transforms");
|
|
11
13
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
12
14
|
var _keymap = require("@atlaskit/editor-prosemirror/keymap");
|
|
@@ -33,7 +35,7 @@ function expandKeymap(api) {
|
|
|
33
35
|
var selection = state.selection;
|
|
34
36
|
var selectionSharedState = (api === null || api === void 0 || (_api$selection = api.selection) === null || _api$selection === void 0 ? void 0 : _api$selection.sharedState.currentState()) || {};
|
|
35
37
|
var selectionRelativeToNode = selectionSharedState.selectionRelativeToNode;
|
|
36
|
-
if (isExpandSelected(selection) && selectionRelativeToNode ===
|
|
38
|
+
if (isExpandSelected(selection) && selectionRelativeToNode === _types.RelativeSelectionPos.Start) {
|
|
37
39
|
return (0, _commands.focusTitle)(selection.from + 1)(state, dispatch, editorView);
|
|
38
40
|
}
|
|
39
41
|
return false;
|
|
@@ -49,7 +51,7 @@ function expandKeymap(api) {
|
|
|
49
51
|
var selection = state.selection;
|
|
50
52
|
var selectionSharedState = (api === null || api === void 0 || (_api$selection2 = api.selection) === null || _api$selection2 === void 0 ? void 0 : _api$selection2.sharedState.currentState()) || {};
|
|
51
53
|
var selectionRelativeToNode = selectionSharedState.selectionRelativeToNode;
|
|
52
|
-
if (isExpandSelected(selection) && (selectionRelativeToNode === undefined || selectionRelativeToNode ===
|
|
54
|
+
if (isExpandSelected(selection) && (selectionRelativeToNode === undefined || selectionRelativeToNode === _types.RelativeSelectionPos.End)) {
|
|
53
55
|
return (0, _commands.focusTitle)(selection.from + 1)(state, dispatch, editorView);
|
|
54
56
|
}
|
|
55
57
|
return false;
|
|
@@ -93,7 +95,7 @@ function expandKeymap(api) {
|
|
|
93
95
|
var selection = state.selection,
|
|
94
96
|
schema = state.schema;
|
|
95
97
|
var nodeBefore = selection.$from.nodeBefore;
|
|
96
|
-
if (selection instanceof
|
|
98
|
+
if (selection instanceof _selection2.GapCursorSelection && selection.side === _selection.Side.RIGHT && nodeBefore && (nodeBefore.type === schema.nodes.expand || nodeBefore.type === schema.nodes.nestedExpand) && (0, _expand2.isExpandCollapsed)(nodeBefore)) {
|
|
97
99
|
var _$from = selection.$from;
|
|
98
100
|
return (0, _commands.focusTitle)(Math.max(_$from.pos - 1, 0))(state, dispatch, editorView);
|
|
99
101
|
}
|
|
@@ -141,7 +143,7 @@ function expandKeymap(api) {
|
|
|
141
143
|
nestedExpand = _state$schema$nodes.nestedExpand;
|
|
142
144
|
var selection = state.selection;
|
|
143
145
|
var nodeAfter = selection.$from.nodeAfter;
|
|
144
|
-
if (selection instanceof
|
|
146
|
+
if (selection instanceof _selection2.GapCursorSelection && selection.side === _selection.Side.LEFT && nodeAfter && (nodeAfter.type === expand || nodeAfter.type === nestedExpand) && (0, _expand2.isExpandCollapsed)(nodeAfter)) {
|
|
145
147
|
var $from = selection.$from;
|
|
146
148
|
return (0, _commands.focusTitle)($from.pos + 1)(state, dispatch, editorView);
|
|
147
149
|
}
|
|
@@ -10,7 +10,7 @@ exports.handleExpandDrag = handleExpandDrag;
|
|
|
10
10
|
exports.pluginKey = void 0;
|
|
11
11
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
12
12
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
13
|
-
var
|
|
13
|
+
var _expand = require("@atlaskit/editor-common/styles/expand");
|
|
14
14
|
var _transforms = require("@atlaskit/editor-common/transforms");
|
|
15
15
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
16
16
|
var _view2 = require("@atlaskit/editor-prosemirror/view");
|
|
@@ -85,16 +85,16 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, getInt
|
|
|
85
85
|
})
|
|
86
86
|
},
|
|
87
87
|
handleKeyDown: function handleKeyDown(_view, event) {
|
|
88
|
-
return containsClass(event.target,
|
|
88
|
+
return containsClass(event.target, _expand.expandClassNames.titleContainer);
|
|
89
89
|
},
|
|
90
90
|
handleKeyPress: function handleKeyPress(_view, event) {
|
|
91
|
-
return containsClass(event.target,
|
|
91
|
+
return containsClass(event.target, _expand.expandClassNames.titleContainer);
|
|
92
92
|
},
|
|
93
93
|
handleScrollToSelection: function handleScrollToSelection() {
|
|
94
|
-
return containsClass(document.activeElement,
|
|
94
|
+
return containsClass(document.activeElement, _expand.expandClassNames.titleInput);
|
|
95
95
|
},
|
|
96
96
|
handleClickOn: (0, _selection.createSelectionClickHandler)(['expand', 'nestedExpand'], function (target) {
|
|
97
|
-
return target.classList.contains(
|
|
97
|
+
return target.classList.contains(_expand.expandClassNames.prefix);
|
|
98
98
|
}, {
|
|
99
99
|
useLongPressSelection: useLongPressSelection
|
|
100
100
|
}),
|
|
@@ -104,7 +104,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, getInt
|
|
|
104
104
|
},
|
|
105
105
|
// @see ED-8027 to follow up on this work-around
|
|
106
106
|
filterTransaction: function filterTransaction(tr) {
|
|
107
|
-
if (containsClass(document.activeElement,
|
|
107
|
+
if (containsClass(document.activeElement, _expand.expandClassNames.titleInput) && tr.selectionSet && (!tr.steps.length || tr.isGeneric)) {
|
|
108
108
|
return false;
|
|
109
109
|
}
|
|
110
110
|
return true;
|
|
@@ -12,9 +12,9 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _react2 = require("@emotion/react");
|
|
14
14
|
var _customThemeButton = _interopRequireDefault(require("@atlaskit/button/custom-theme-button/custom-theme-button"));
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
15
|
+
var _expand = require("@atlaskit/editor-common/styles/expand");
|
|
16
|
+
var _uiExpand = require("@atlaskit/editor-common/ui-expand");
|
|
17
|
+
var _constants = require("@atlaskit/editor-shared-styles/constants");
|
|
18
18
|
var _chevronRight = _interopRequireDefault(require("@atlaskit/icon/core/chevron-right"));
|
|
19
19
|
var _Tooltip = _interopRequireDefault(require("@atlaskit/tooltip/Tooltip"));
|
|
20
20
|
var _excluded = ["buttonStyles"];
|
|
@@ -33,7 +33,7 @@ function withTooltip(Component) {
|
|
|
33
33
|
(0, _react2.jsx)(_Tooltip.default, {
|
|
34
34
|
content: props.label,
|
|
35
35
|
position: "top",
|
|
36
|
-
tag:
|
|
36
|
+
tag: _uiExpand.ExpandLayoutWrapperWithRef
|
|
37
37
|
}, (0, _react2.jsx)(Component
|
|
38
38
|
// Ignored via go/ees005
|
|
39
39
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
@@ -56,20 +56,20 @@ var ExpandButtonInner = exports.ExpandButtonInner = function ExpandButtonInner(p
|
|
|
56
56
|
height: '100%',
|
|
57
57
|
'& svg': {
|
|
58
58
|
transform: props.expanded ? 'transform: rotate(90deg);' : 'transform: rotate(0deg);',
|
|
59
|
-
transition: "transform 0.2s ".concat(
|
|
59
|
+
transition: "transform 0.2s ".concat(_constants.akEditorSwoopCubicBezier, ";")
|
|
60
60
|
}
|
|
61
61
|
})
|
|
62
62
|
}, rest);
|
|
63
63
|
}, [props]);
|
|
64
64
|
var intl = props.intl,
|
|
65
65
|
expanded = props.expanded;
|
|
66
|
-
var label = expanded ?
|
|
66
|
+
var label = expanded ? _uiExpand.messages.collapseNode : _uiExpand.messages.expandNode;
|
|
67
67
|
var labelIntl = intl ? intl.formatMessage(label) : label.defaultMessage;
|
|
68
68
|
return (0, _react2.jsx)(_customThemeButton.default, {
|
|
69
69
|
appearance: "subtle"
|
|
70
70
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
71
71
|
,
|
|
72
|
-
className:
|
|
72
|
+
className: _expand.expandClassNames.iconContainer,
|
|
73
73
|
iconBefore: (0, _react2.jsx)(_chevronRight.default, {
|
|
74
74
|
label: '',
|
|
75
75
|
size: "small"
|
|
@@ -86,7 +86,7 @@ var ButtonWithoutTooltip = ExpandButtonInner;
|
|
|
86
86
|
var ExpandButton = exports.ExpandButton = function ExpandButton(props) {
|
|
87
87
|
var expanded = props.expanded,
|
|
88
88
|
intl = props.intl;
|
|
89
|
-
var message = expanded ?
|
|
89
|
+
var message = expanded ? _uiExpand.messages.collapseNode : _uiExpand.messages.expandNode;
|
|
90
90
|
var label = intl && intl.formatMessage(message) || message.defaultMessage;
|
|
91
91
|
// check to ensure device supports any-hover
|
|
92
92
|
var supportsAnyHover = !!window.matchMedia ? window.matchMedia('(any-hover: hover)').matches !== window.matchMedia('(any-hover: none)').matches : false;
|
|
@@ -103,7 +103,7 @@ var ExpandButton = exports.ExpandButton = function ExpandButton(props) {
|
|
|
103
103
|
return (
|
|
104
104
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
105
105
|
(0, _react2.jsx)("div", {
|
|
106
|
-
css:
|
|
106
|
+
css: _uiExpand.expandLayoutWrapperStyle
|
|
107
107
|
}, (0, _react2.jsx)(ButtonWithoutTooltip, (0, _extends2.default)({
|
|
108
108
|
label: label
|
|
109
109
|
// Ignored via go/ees005
|
|
@@ -7,20 +7,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.toDOM = exports.getExpandBodyAriaLabel = exports.buildExpandClassName = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _expand = require("@atlaskit/editor-common/expand");
|
|
10
|
-
var
|
|
11
|
-
var
|
|
10
|
+
var _expand2 = require("@atlaskit/editor-common/styles/expand");
|
|
11
|
+
var _uiExpand = require("@atlaskit/editor-common/ui-expand");
|
|
12
12
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
13
13
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
14
14
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
15
|
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; }
|
|
16
16
|
var buildExpandClassName = exports.buildExpandClassName = function buildExpandClassName(type, expanded) {
|
|
17
|
-
return "".concat(
|
|
17
|
+
return "".concat(_expand2.expandClassNames.prefix, " ").concat(_expand2.expandClassNames.type(type), " ").concat(expanded ? _expand2.expandClassNames.expanded : '');
|
|
18
18
|
};
|
|
19
19
|
var getExpandBodyAriaLabel = exports.getExpandBodyAriaLabel = function getExpandBodyAriaLabel(title, intl) {
|
|
20
|
-
var safeTitle = title.trim() || (intl === null || intl === void 0 ? void 0 : intl.formatMessage(
|
|
21
|
-
return (intl === null || intl === void 0 ? void 0 : intl.formatMessage(
|
|
20
|
+
var safeTitle = title.trim() || (intl === null || intl === void 0 ? void 0 : intl.formatMessage(_uiExpand.messages.expandBodyAriaLabelUntitled)) || _uiExpand.messages.expandBodyAriaLabelUntitled.defaultMessage;
|
|
21
|
+
return (intl === null || intl === void 0 ? void 0 : intl.formatMessage(_uiExpand.messages.expandBodyAriaLabel, {
|
|
22
22
|
title: safeTitle
|
|
23
|
-
})) ||
|
|
23
|
+
})) || _uiExpand.messages.expandBodyAriaLabel.defaultMessage.replace('{title}', safeTitle);
|
|
24
24
|
};
|
|
25
25
|
var toDOM = exports.toDOM = function toDOM(node, __livePage, intl, titleReadOnly, contentEditable) {
|
|
26
26
|
var _expandedState$get, _node$attrs$title, _intl$formatMessage;
|
|
@@ -33,7 +33,7 @@ var toDOM = exports.toDOM = function toDOM(node, __livePage, intl, titleReadOnly
|
|
|
33
33
|
'data-local-id': node.attrs.localId
|
|
34
34
|
}), ['div', {
|
|
35
35
|
// prettier-ignore
|
|
36
|
-
'class':
|
|
36
|
+
'class': _expand2.expandClassNames.titleContainer,
|
|
37
37
|
contenteditable: 'false',
|
|
38
38
|
// Element gains access to focus events.
|
|
39
39
|
// This is needed to prevent PM gaining access
|
|
@@ -42,30 +42,30 @@ var toDOM = exports.toDOM = function toDOM(node, __livePage, intl, titleReadOnly
|
|
|
42
42
|
},
|
|
43
43
|
// prettier-ignore
|
|
44
44
|
['div', {
|
|
45
|
-
'class':
|
|
45
|
+
'class': _expand2.expandClassNames.icon,
|
|
46
46
|
style: "display: flex; width: ".concat("var(--ds-space-300, 24px)", "; height: ", "var(--ds-space-300, 24px)")
|
|
47
47
|
}], ['div', {
|
|
48
48
|
// prettier-ignore
|
|
49
|
-
'class':
|
|
49
|
+
'class': _expand2.expandClassNames.inputContainer
|
|
50
50
|
}, ['input', {
|
|
51
51
|
// prettier-ignore
|
|
52
|
-
'class':
|
|
53
|
-
'aria-label': intl && intl.formatMessage(
|
|
52
|
+
'class': _expand2.expandClassNames.titleInput,
|
|
53
|
+
'aria-label': intl && intl.formatMessage(_uiExpand.messages.expandArialabel) || _uiExpand.messages.expandArialabel.defaultMessage,
|
|
54
54
|
value: node.attrs.title,
|
|
55
|
-
placeholder: intl && typeof intl.formatMessage === 'function' && intl.formatMessage(
|
|
55
|
+
placeholder: intl && typeof intl.formatMessage === 'function' && intl.formatMessage(_uiExpand.messages.expandPlaceholderText) || _uiExpand.messages.expandPlaceholderText.defaultMessage,
|
|
56
56
|
type: 'text',
|
|
57
57
|
readonly: titleReadOnly ? 'true' : undefined
|
|
58
58
|
}]]], [(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_expand_content_a11y_2') ? 'section' : 'div', _objectSpread(_objectSpread({
|
|
59
59
|
// prettier-ignore
|
|
60
|
-
class: "".concat(
|
|
60
|
+
class: "".concat(_expand2.expandClassNames.content, " ").concat(_expand.expandedState.get(node) ? '' : _expand2.expandClassNames.contentCollapsed),
|
|
61
61
|
contenteditable: contentEditable !== undefined ? contentEditable ? 'true' : 'false' : undefined
|
|
62
62
|
}, !(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_expand_content_a11y_2') && {
|
|
63
63
|
role: 'textbox',
|
|
64
64
|
'aria-multiline': 'true',
|
|
65
|
-
'aria-label': intl && intl.formatMessage(
|
|
65
|
+
'aria-label': intl && intl.formatMessage(_uiExpand.messages.expandBodyAriaLabelOriginal) || _uiExpand.messages.expandBodyAriaLabelOriginal.defaultMessage
|
|
66
66
|
}), (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_expand_content_a11y_2') && {
|
|
67
67
|
'aria-label': getExpandBodyAriaLabel((_node$attrs$title = node.attrs.title) !== null && _node$attrs$title !== void 0 ? _node$attrs$title : '', intl),
|
|
68
|
-
'aria-description': (intl === null || intl === void 0 ? void 0 : intl.formatMessage(
|
|
69
|
-
'aria-roledescription': (_intl$formatMessage = intl === null || intl === void 0 ? void 0 : intl.formatMessage(
|
|
68
|
+
'aria-description': (intl === null || intl === void 0 ? void 0 : intl.formatMessage(_uiExpand.messages.expandBodyAriaDescription)) || _uiExpand.messages.expandBodyAriaDescription.defaultMessage,
|
|
69
|
+
'aria-roledescription': (_intl$formatMessage = intl === null || intl === void 0 ? void 0 : intl.formatMessage(_uiExpand.messages.expandBodyRoleDescription)) !== null && _intl$formatMessage !== void 0 ? _intl$formatMessage : _uiExpand.messages.expandBodyRoleDescription.defaultMessage
|
|
70
70
|
}), 0]];
|
|
71
71
|
};
|
|
@@ -7,9 +7,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.createExpandBlockMenuItem = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _reactIntl = require("react-intl");
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
10
|
+
var _enums = require("@atlaskit/editor-common/analytics/types/enums");
|
|
11
|
+
var _insertBlock = require("@atlaskit/editor-common/messages/insert-block");
|
|
12
|
+
var _toolbarDropdownItem = require("@atlaskit/editor-toolbar/toolbar-dropdown-item");
|
|
13
13
|
var _expandElement = _interopRequireDefault(require("@atlaskit/icon-lab/core/expand-element"));
|
|
14
14
|
var NODE_NAME = 'expand';
|
|
15
15
|
var ExpandBlockMenuItem = function ExpandBlockMenuItem(_ref) {
|
|
@@ -18,8 +18,8 @@ var ExpandBlockMenuItem = function ExpandBlockMenuItem(_ref) {
|
|
|
18
18
|
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
19
19
|
formatMessage = _useIntl.formatMessage;
|
|
20
20
|
var handleClick = function handleClick(event) {
|
|
21
|
-
var triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ?
|
|
22
|
-
var inputMethod =
|
|
21
|
+
var triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? _enums.INPUT_METHOD.KEYBOARD : _enums.INPUT_METHOD.MOUSE;
|
|
22
|
+
var inputMethod = _enums.INPUT_METHOD.BLOCK_MENU;
|
|
23
23
|
api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
|
|
24
24
|
var _api$blockMenu;
|
|
25
25
|
var tr = _ref2.tr;
|
|
@@ -34,13 +34,13 @@ var ExpandBlockMenuItem = function ExpandBlockMenuItem(_ref) {
|
|
|
34
34
|
}) : null;
|
|
35
35
|
});
|
|
36
36
|
};
|
|
37
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
37
|
+
return /*#__PURE__*/_react.default.createElement(_toolbarDropdownItem.ToolbarDropdownItem, {
|
|
38
38
|
onClick: handleClick,
|
|
39
39
|
elemBefore: /*#__PURE__*/_react.default.createElement(_expandElement.default, {
|
|
40
40
|
label: "",
|
|
41
41
|
size: "small"
|
|
42
42
|
})
|
|
43
|
-
}, formatMessage(
|
|
43
|
+
}, formatMessage(_insertBlock.toolbarInsertBlockMessages.expand));
|
|
44
44
|
};
|
|
45
45
|
var createExpandBlockMenuItem = exports.createExpandBlockMenuItem = function createExpandBlockMenuItem(api) {
|
|
46
46
|
return function () {
|