@atlaskit/editor-plugin-expand 1.3.4 → 1.4.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 +13 -0
- package/dist/cjs/legacyExpand/nodeviews/index.js +20 -8
- package/dist/cjs/singlePlayerExpand/node-views/index.js +14 -4
- package/dist/es2019/legacyExpand/nodeviews/index.js +20 -8
- package/dist/es2019/singlePlayerExpand/node-views/index.js +14 -4
- package/dist/esm/legacyExpand/nodeviews/index.js +20 -8
- package/dist/esm/singlePlayerExpand/node-views/index.js +14 -4
- package/dist/types/legacyExpand/nodeviews/index.d.ts +2 -0
- package/dist/types/singlePlayerExpand/node-views/index.d.ts +2 -0
- package/dist/types/types.d.ts +3 -1
- package/dist/types-ts4.5/legacyExpand/nodeviews/index.d.ts +2 -0
- package/dist/types-ts4.5/singlePlayerExpand/node-views/index.d.ts +2 -0
- package/dist/types-ts4.5/types.d.ts +3 -1
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-expand
|
|
2
2
|
|
|
3
|
+
## 1.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#90925](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/90925) [`431c0d17e3e3`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/431c0d17e3e3) - [ux] Improve the selection marker by hiding it when in an expand and improving styling by making it more subtle.
|
|
8
|
+
|
|
9
|
+
## 1.3.5
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#91106](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/91106) [`b6ffa30186b9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b6ffa30186b9) - Bump ADF-schema package to version 35.0.0
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 1.3.4
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -67,6 +67,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
67
67
|
(0, _defineProperty2.default)(this, "isMobile", false);
|
|
68
68
|
(0, _defineProperty2.default)(this, "focusTitle", function () {
|
|
69
69
|
if (_this.input) {
|
|
70
|
+
var _this$api;
|
|
70
71
|
var _this$view = _this.view,
|
|
71
72
|
state = _this$view.state,
|
|
72
73
|
dispatch = _this$view.dispatch;
|
|
@@ -82,6 +83,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
82
83
|
if (typeof pos === 'number') {
|
|
83
84
|
(0, _commands.setSelectionInsideExpand)(pos)(state, dispatch, _this.view);
|
|
84
85
|
}
|
|
86
|
+
_this.decorationCleanup = (_this$api = _this.api) === null || _this$api === void 0 || (_this$api = _this$api.selectionMarker) === null || _this$api === void 0 || (_this$api = _this$api.actions) === null || _this$api === void 0 ? void 0 : _this$api.hideDecoration();
|
|
85
87
|
_this.input.focus();
|
|
86
88
|
}
|
|
87
89
|
});
|
|
@@ -107,7 +109,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
107
109
|
state = _this$view2.state,
|
|
108
110
|
dispatch = _this$view2.dispatch;
|
|
109
111
|
if ((0, _utils.closestElement)(target, ".".concat(_styles.expandClassNames.icon))) {
|
|
110
|
-
var _this$
|
|
112
|
+
var _this$api2;
|
|
111
113
|
if (!_this.allowInteractiveExpand) {
|
|
112
114
|
return;
|
|
113
115
|
}
|
|
@@ -119,7 +121,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
119
121
|
_this.view.dom.blur();
|
|
120
122
|
}
|
|
121
123
|
(0, _commands.toggleExpandExpanded)({
|
|
122
|
-
editorAnalyticsAPI: (_this$
|
|
124
|
+
editorAnalyticsAPI: (_this$api2 = _this.api) === null || _this$api2 === void 0 || (_this$api2 = _this$api2.analytics) === null || _this$api2 === void 0 ? void 0 : _this$api2.actions,
|
|
123
125
|
pos: pos,
|
|
124
126
|
nodeType: _this.node.type,
|
|
125
127
|
__livePage: _this.__livePage
|
|
@@ -154,6 +156,10 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
154
156
|
(0, _defineProperty2.default)(this, "handleFocus", function (event) {
|
|
155
157
|
event.stopImmediatePropagation();
|
|
156
158
|
});
|
|
159
|
+
(0, _defineProperty2.default)(this, "handleBlur", function (event) {
|
|
160
|
+
var _this$decorationClean;
|
|
161
|
+
(_this$decorationClean = _this.decorationCleanup) === null || _this$decorationClean === void 0 || _this$decorationClean.call(_this);
|
|
162
|
+
});
|
|
157
163
|
(0, _defineProperty2.default)(this, "handleTitleKeydown", function (event) {
|
|
158
164
|
switch ((0, _w3cKeyname.keyName)(event)) {
|
|
159
165
|
case 'Enter':
|
|
@@ -194,8 +200,8 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
194
200
|
var state = _this.view.state;
|
|
195
201
|
var expandNode = _this.node;
|
|
196
202
|
if (expandNode && (0, _utils.isEmptyNode)(state.schema)(expandNode)) {
|
|
197
|
-
var _this$
|
|
198
|
-
(0, _commands.deleteExpandAtPos)((_this$
|
|
203
|
+
var _this$api3;
|
|
204
|
+
(0, _commands.deleteExpandAtPos)((_this$api3 = _this.api) === null || _this$api3 === void 0 || (_this$api3 = _this$api3.analytics) === null || _this$api3 === void 0 ? void 0 : _this$api3.actions)(pos, expandNode)(state, _this.view.dispatch);
|
|
199
205
|
}
|
|
200
206
|
});
|
|
201
207
|
(0, _defineProperty2.default)(this, "toggleExpand", function () {
|
|
@@ -204,12 +210,12 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
204
210
|
return;
|
|
205
211
|
}
|
|
206
212
|
if (_this.allowInteractiveExpand) {
|
|
207
|
-
var _this$
|
|
213
|
+
var _this$api4;
|
|
208
214
|
var _this$view4 = _this.view,
|
|
209
215
|
state = _this$view4.state,
|
|
210
216
|
dispatch = _this$view4.dispatch;
|
|
211
217
|
(0, _commands.toggleExpandExpanded)({
|
|
212
|
-
editorAnalyticsAPI: (_this$
|
|
218
|
+
editorAnalyticsAPI: (_this$api4 = _this.api) === null || _this$api4 === void 0 || (_this$api4 = _this$api4.analytics) === null || _this$api4 === void 0 ? void 0 : _this$api4.actions,
|
|
213
219
|
pos: pos,
|
|
214
220
|
nodeType: _this.node.type,
|
|
215
221
|
__livePage: _this.__livePage
|
|
@@ -330,13 +336,13 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
330
336
|
selectionStart = _this$input5.selectionStart,
|
|
331
337
|
selectionEnd = _this$input5.selectionEnd;
|
|
332
338
|
if (selectionStart === selectionEnd && selectionStart === 0) {
|
|
333
|
-
var _this$
|
|
339
|
+
var _this$api5;
|
|
334
340
|
event.preventDefault();
|
|
335
341
|
var _this$view9 = _this.view,
|
|
336
342
|
state = _this$view9.state,
|
|
337
343
|
dispatch = _this$view9.dispatch;
|
|
338
344
|
_this.view.focus();
|
|
339
|
-
var selectionSharedState = ((_this$
|
|
345
|
+
var selectionSharedState = ((_this$api5 = _this.api) === null || _this$api5 === void 0 || (_this$api5 = _this$api5.selection) === null || _this$api5 === void 0 ? void 0 : _this$api5.sharedState.currentState()) || {};
|
|
340
346
|
// selectionRelativeToNode is undefined when user clicked to select node, then hit left to get focus in title
|
|
341
347
|
// This is a special case where we want to bypass node selection and jump straight to gap cursor
|
|
342
348
|
if ((selectionSharedState === null || selectionSharedState === void 0 ? void 0 : selectionSharedState.selectionRelativeToNode) === undefined) {
|
|
@@ -391,6 +397,8 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
391
397
|
if (this.input) {
|
|
392
398
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
393
399
|
this.input.addEventListener('keydown', this.handleTitleKeydown);
|
|
400
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
401
|
+
this.input.addEventListener('blur', this.handleBlur);
|
|
394
402
|
}
|
|
395
403
|
if (this.titleContainer) {
|
|
396
404
|
// If the user interacts in our title bar (either toggle or input)
|
|
@@ -470,6 +478,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
470
478
|
}, {
|
|
471
479
|
key: "destroy",
|
|
472
480
|
value: function destroy() {
|
|
481
|
+
var _this$decorationClean2;
|
|
473
482
|
if (this.dom) {
|
|
474
483
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
475
484
|
this.dom.removeEventListener('click', this.handleClick);
|
|
@@ -479,6 +488,8 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
479
488
|
if (this.input) {
|
|
480
489
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
481
490
|
this.input.removeEventListener('keydown', this.handleTitleKeydown);
|
|
491
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
492
|
+
this.input.removeEventListener('blur', this.handleBlur);
|
|
482
493
|
}
|
|
483
494
|
if (this.titleContainer) {
|
|
484
495
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -489,6 +500,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
489
500
|
this.icon.removeEventListener('keydown', this.handleIconKeyDown);
|
|
490
501
|
_reactDom.default.unmountComponentAtNode(this.icon);
|
|
491
502
|
}
|
|
503
|
+
(_this$decorationClean2 = this.decorationCleanup) === null || _this$decorationClean2 === void 0 || _this$decorationClean2.call(this);
|
|
492
504
|
|
|
493
505
|
// @ts-ignore - [unblock prosemirror bump] reset non optional prop to undefined to clear reference
|
|
494
506
|
this.dom = undefined;
|
|
@@ -28,6 +28,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
28
28
|
(0, _defineProperty2.default)(this, "isMobile", false);
|
|
29
29
|
(0, _defineProperty2.default)(this, "focusTitle", function () {
|
|
30
30
|
if (_this.input) {
|
|
31
|
+
var _this$api;
|
|
31
32
|
var _this$view = _this.view,
|
|
32
33
|
state = _this$view.state,
|
|
33
34
|
dispatch = _this$view.dispatch;
|
|
@@ -43,6 +44,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
43
44
|
if (typeof pos === 'number') {
|
|
44
45
|
(0, _commands.setSelectionInsideExpand)(pos)(state, dispatch, _this.view);
|
|
45
46
|
}
|
|
47
|
+
_this.decorationCleanup = (_this$api = _this.api) === null || _this$api === void 0 || (_this$api = _this$api.selectionMarker) === null || _this$api === void 0 || (_this$api = _this$api.actions) === null || _this$api === void 0 ? void 0 : _this$api.hideDecoration();
|
|
46
48
|
_this.input.focus();
|
|
47
49
|
}
|
|
48
50
|
});
|
|
@@ -108,6 +110,10 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
108
110
|
(0, _defineProperty2.default)(this, "handleFocus", function (event) {
|
|
109
111
|
event.stopImmediatePropagation();
|
|
110
112
|
});
|
|
113
|
+
(0, _defineProperty2.default)(this, "handleBlur", function (event) {
|
|
114
|
+
var _this$decorationClean;
|
|
115
|
+
(_this$decorationClean = _this.decorationCleanup) === null || _this$decorationClean === void 0 || _this$decorationClean.call(_this);
|
|
116
|
+
});
|
|
111
117
|
(0, _defineProperty2.default)(this, "handleTitleKeydown", function (event) {
|
|
112
118
|
switch ((0, _w3cKeyname.keyName)(event)) {
|
|
113
119
|
case 'Enter':
|
|
@@ -144,8 +150,8 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
144
150
|
return;
|
|
145
151
|
}
|
|
146
152
|
if (expandNode && (0, _utils.isEmptyNode)(state.schema)(expandNode)) {
|
|
147
|
-
var _this$
|
|
148
|
-
(0, _commands.deleteExpand)((_this$
|
|
153
|
+
var _this$api2;
|
|
154
|
+
(0, _commands.deleteExpand)((_this$api2 = _this.api) === null || _this$api2 === void 0 || (_this$api2 = _this$api2.analytics) === null || _this$api2 === void 0 ? void 0 : _this$api2.actions)(state, _this.view.dispatch);
|
|
149
155
|
}
|
|
150
156
|
});
|
|
151
157
|
(0, _defineProperty2.default)(this, "moveToOutsideOfTitle", function (event) {
|
|
@@ -260,13 +266,13 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
260
266
|
selectionStart = _this$input5.selectionStart,
|
|
261
267
|
selectionEnd = _this$input5.selectionEnd;
|
|
262
268
|
if (selectionStart === selectionEnd && selectionStart === 0) {
|
|
263
|
-
var _this$
|
|
269
|
+
var _this$api3;
|
|
264
270
|
event.preventDefault();
|
|
265
271
|
var _this$view7 = _this.view,
|
|
266
272
|
state = _this$view7.state,
|
|
267
273
|
dispatch = _this$view7.dispatch;
|
|
268
274
|
_this.view.focus();
|
|
269
|
-
var selectionSharedState = ((_this$
|
|
275
|
+
var selectionSharedState = ((_this$api3 = _this.api) === null || _this$api3 === void 0 || (_this$api3 = _this$api3.selection) === null || _this$api3 === void 0 ? void 0 : _this$api3.sharedState.currentState()) || {};
|
|
270
276
|
// selectionRelativeToNode is undefined when user clicked to select node, then hit left to get focus in title
|
|
271
277
|
// This is a special case where we want to bypass node selection and jump straight to gap cursor
|
|
272
278
|
if ((selectionSharedState === null || selectionSharedState === void 0 ? void 0 : selectionSharedState.selectionRelativeToNode) === undefined) {
|
|
@@ -315,6 +321,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
315
321
|
this.dom.addEventListener('click', this.handleClick);
|
|
316
322
|
this.dom.addEventListener('input', this.handleInput);
|
|
317
323
|
this.input.addEventListener('keydown', this.handleTitleKeydown);
|
|
324
|
+
this.input.addEventListener('blur', this.handleBlur);
|
|
318
325
|
// If the user interacts in our title bar (either toggle or input)
|
|
319
326
|
// Prevent ProseMirror from getting a focus event (causes weird selection issues).
|
|
320
327
|
this.titleContainer.addEventListener('focus', this.handleFocus);
|
|
@@ -363,14 +370,17 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
363
370
|
}, {
|
|
364
371
|
key: "destroy",
|
|
365
372
|
value: function destroy() {
|
|
373
|
+
var _this$decorationClean2;
|
|
366
374
|
if (!this.dom || !this.input || !this.titleContainer || !this.icon) {
|
|
367
375
|
return;
|
|
368
376
|
}
|
|
369
377
|
this.dom.removeEventListener('click', this.handleClick);
|
|
370
378
|
this.dom.removeEventListener('input', this.handleInput);
|
|
371
379
|
this.input.removeEventListener('keydown', this.handleTitleKeydown);
|
|
380
|
+
this.input.removeEventListener('blur', this.handleBlur);
|
|
372
381
|
this.titleContainer.removeEventListener('focus', this.handleFocus);
|
|
373
382
|
this.icon.removeEventListener('keydown', this.handleIconKeyDown);
|
|
383
|
+
(_this$decorationClean2 = this.decorationCleanup) === null || _this$decorationClean2 === void 0 || _this$decorationClean2.call(this);
|
|
374
384
|
_reactDom.default.unmountComponentAtNode(this.icon);
|
|
375
385
|
}
|
|
376
386
|
}]);
|
|
@@ -51,6 +51,7 @@ export class ExpandNodeView {
|
|
|
51
51
|
_defineProperty(this, "isMobile", false);
|
|
52
52
|
_defineProperty(this, "focusTitle", () => {
|
|
53
53
|
if (this.input) {
|
|
54
|
+
var _this$api, _this$api$selectionMa, _this$api$selectionMa2;
|
|
54
55
|
const {
|
|
55
56
|
state,
|
|
56
57
|
dispatch
|
|
@@ -67,6 +68,7 @@ export class ExpandNodeView {
|
|
|
67
68
|
if (typeof pos === 'number') {
|
|
68
69
|
setSelectionInsideExpand(pos)(state, dispatch, this.view);
|
|
69
70
|
}
|
|
71
|
+
this.decorationCleanup = (_this$api = this.api) === null || _this$api === void 0 ? void 0 : (_this$api$selectionMa = _this$api.selectionMarker) === null || _this$api$selectionMa === void 0 ? void 0 : (_this$api$selectionMa2 = _this$api$selectionMa.actions) === null || _this$api$selectionMa2 === void 0 ? void 0 : _this$api$selectionMa2.hideDecoration();
|
|
70
72
|
this.input.focus();
|
|
71
73
|
}
|
|
72
74
|
});
|
|
@@ -93,7 +95,7 @@ export class ExpandNodeView {
|
|
|
93
95
|
dispatch
|
|
94
96
|
} = this.view;
|
|
95
97
|
if (closestElement(target, `.${expandClassNames.icon}`)) {
|
|
96
|
-
var _this$
|
|
98
|
+
var _this$api2, _this$api2$analytics;
|
|
97
99
|
if (!this.allowInteractiveExpand) {
|
|
98
100
|
return;
|
|
99
101
|
}
|
|
@@ -105,7 +107,7 @@ export class ExpandNodeView {
|
|
|
105
107
|
this.view.dom.blur();
|
|
106
108
|
}
|
|
107
109
|
toggleExpandExpanded({
|
|
108
|
-
editorAnalyticsAPI: (_this$
|
|
110
|
+
editorAnalyticsAPI: (_this$api2 = this.api) === null || _this$api2 === void 0 ? void 0 : (_this$api2$analytics = _this$api2.analytics) === null || _this$api2$analytics === void 0 ? void 0 : _this$api2$analytics.actions,
|
|
109
111
|
pos,
|
|
110
112
|
nodeType: this.node.type,
|
|
111
113
|
__livePage: this.__livePage
|
|
@@ -141,6 +143,10 @@ export class ExpandNodeView {
|
|
|
141
143
|
_defineProperty(this, "handleFocus", event => {
|
|
142
144
|
event.stopImmediatePropagation();
|
|
143
145
|
});
|
|
146
|
+
_defineProperty(this, "handleBlur", event => {
|
|
147
|
+
var _this$decorationClean;
|
|
148
|
+
(_this$decorationClean = this.decorationCleanup) === null || _this$decorationClean === void 0 ? void 0 : _this$decorationClean.call(this);
|
|
149
|
+
});
|
|
144
150
|
_defineProperty(this, "handleTitleKeydown", event => {
|
|
145
151
|
switch (keyName(event)) {
|
|
146
152
|
case 'Enter':
|
|
@@ -184,8 +190,8 @@ export class ExpandNodeView {
|
|
|
184
190
|
} = this.view;
|
|
185
191
|
const expandNode = this.node;
|
|
186
192
|
if (expandNode && isEmptyNode(state.schema)(expandNode)) {
|
|
187
|
-
var _this$
|
|
188
|
-
deleteExpandAtPos((_this$
|
|
193
|
+
var _this$api3, _this$api3$analytics;
|
|
194
|
+
deleteExpandAtPos((_this$api3 = this.api) === null || _this$api3 === void 0 ? void 0 : (_this$api3$analytics = _this$api3.analytics) === null || _this$api3$analytics === void 0 ? void 0 : _this$api3$analytics.actions)(pos, expandNode)(state, this.view.dispatch);
|
|
189
195
|
}
|
|
190
196
|
});
|
|
191
197
|
_defineProperty(this, "toggleExpand", () => {
|
|
@@ -194,13 +200,13 @@ export class ExpandNodeView {
|
|
|
194
200
|
return;
|
|
195
201
|
}
|
|
196
202
|
if (this.allowInteractiveExpand) {
|
|
197
|
-
var _this$
|
|
203
|
+
var _this$api4, _this$api4$analytics;
|
|
198
204
|
const {
|
|
199
205
|
state,
|
|
200
206
|
dispatch
|
|
201
207
|
} = this.view;
|
|
202
208
|
toggleExpandExpanded({
|
|
203
|
-
editorAnalyticsAPI: (_this$
|
|
209
|
+
editorAnalyticsAPI: (_this$api4 = this.api) === null || _this$api4 === void 0 ? void 0 : (_this$api4$analytics = _this$api4.analytics) === null || _this$api4$analytics === void 0 ? void 0 : _this$api4$analytics.actions,
|
|
204
210
|
pos,
|
|
205
211
|
nodeType: this.node.type,
|
|
206
212
|
__livePage: this.__livePage
|
|
@@ -329,14 +335,14 @@ export class ExpandNodeView {
|
|
|
329
335
|
selectionEnd
|
|
330
336
|
} = this.input;
|
|
331
337
|
if (selectionStart === selectionEnd && selectionStart === 0) {
|
|
332
|
-
var _this$
|
|
338
|
+
var _this$api5, _this$api5$selection;
|
|
333
339
|
event.preventDefault();
|
|
334
340
|
const {
|
|
335
341
|
state,
|
|
336
342
|
dispatch
|
|
337
343
|
} = this.view;
|
|
338
344
|
this.view.focus();
|
|
339
|
-
const selectionSharedState = ((_this$
|
|
345
|
+
const selectionSharedState = ((_this$api5 = this.api) === null || _this$api5 === void 0 ? void 0 : (_this$api5$selection = _this$api5.selection) === null || _this$api5$selection === void 0 ? void 0 : _this$api5$selection.sharedState.currentState()) || {};
|
|
340
346
|
// selectionRelativeToNode is undefined when user clicked to select node, then hit left to get focus in title
|
|
341
347
|
// This is a special case where we want to bypass node selection and jump straight to gap cursor
|
|
342
348
|
if ((selectionSharedState === null || selectionSharedState === void 0 ? void 0 : selectionSharedState.selectionRelativeToNode) === undefined) {
|
|
@@ -390,6 +396,8 @@ export class ExpandNodeView {
|
|
|
390
396
|
if (this.input) {
|
|
391
397
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
392
398
|
this.input.addEventListener('keydown', this.handleTitleKeydown);
|
|
399
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
400
|
+
this.input.addEventListener('blur', this.handleBlur);
|
|
393
401
|
}
|
|
394
402
|
if (this.titleContainer) {
|
|
395
403
|
// If the user interacts in our title bar (either toggle or input)
|
|
@@ -459,6 +467,7 @@ export class ExpandNodeView {
|
|
|
459
467
|
return false;
|
|
460
468
|
}
|
|
461
469
|
destroy() {
|
|
470
|
+
var _this$decorationClean2;
|
|
462
471
|
if (this.dom) {
|
|
463
472
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
464
473
|
this.dom.removeEventListener('click', this.handleClick);
|
|
@@ -468,6 +477,8 @@ export class ExpandNodeView {
|
|
|
468
477
|
if (this.input) {
|
|
469
478
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
470
479
|
this.input.removeEventListener('keydown', this.handleTitleKeydown);
|
|
480
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
481
|
+
this.input.removeEventListener('blur', this.handleBlur);
|
|
471
482
|
}
|
|
472
483
|
if (this.titleContainer) {
|
|
473
484
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -478,6 +489,7 @@ export class ExpandNodeView {
|
|
|
478
489
|
this.icon.removeEventListener('keydown', this.handleIconKeyDown);
|
|
479
490
|
ReactDOM.unmountComponentAtNode(this.icon);
|
|
480
491
|
}
|
|
492
|
+
(_this$decorationClean2 = this.decorationCleanup) === null || _this$decorationClean2 === void 0 ? void 0 : _this$decorationClean2.call(this);
|
|
481
493
|
|
|
482
494
|
// @ts-ignore - [unblock prosemirror bump] reset non optional prop to undefined to clear reference
|
|
483
495
|
this.dom = undefined;
|
|
@@ -14,6 +14,7 @@ export class ExpandNodeView {
|
|
|
14
14
|
_defineProperty(this, "isMobile", false);
|
|
15
15
|
_defineProperty(this, "focusTitle", () => {
|
|
16
16
|
if (this.input) {
|
|
17
|
+
var _this$api, _this$api$selectionMa, _this$api$selectionMa2;
|
|
17
18
|
const {
|
|
18
19
|
state,
|
|
19
20
|
dispatch
|
|
@@ -30,6 +31,7 @@ export class ExpandNodeView {
|
|
|
30
31
|
if (typeof pos === 'number') {
|
|
31
32
|
setSelectionInsideExpand(pos)(state, dispatch, this.view);
|
|
32
33
|
}
|
|
34
|
+
this.decorationCleanup = (_this$api = this.api) === null || _this$api === void 0 ? void 0 : (_this$api$selectionMa = _this$api.selectionMarker) === null || _this$api$selectionMa === void 0 ? void 0 : (_this$api$selectionMa2 = _this$api$selectionMa.actions) === null || _this$api$selectionMa2 === void 0 ? void 0 : _this$api$selectionMa2.hideDecoration();
|
|
33
35
|
this.input.focus();
|
|
34
36
|
}
|
|
35
37
|
});
|
|
@@ -96,6 +98,10 @@ export class ExpandNodeView {
|
|
|
96
98
|
_defineProperty(this, "handleFocus", event => {
|
|
97
99
|
event.stopImmediatePropagation();
|
|
98
100
|
});
|
|
101
|
+
_defineProperty(this, "handleBlur", event => {
|
|
102
|
+
var _this$decorationClean;
|
|
103
|
+
(_this$decorationClean = this.decorationCleanup) === null || _this$decorationClean === void 0 ? void 0 : _this$decorationClean.call(this);
|
|
104
|
+
});
|
|
99
105
|
_defineProperty(this, "handleTitleKeydown", event => {
|
|
100
106
|
switch (keyName(event)) {
|
|
101
107
|
case 'Enter':
|
|
@@ -135,8 +141,8 @@ export class ExpandNodeView {
|
|
|
135
141
|
return;
|
|
136
142
|
}
|
|
137
143
|
if (expandNode && isEmptyNode(state.schema)(expandNode)) {
|
|
138
|
-
var _this$
|
|
139
|
-
deleteExpand((_this$
|
|
144
|
+
var _this$api2, _this$api2$analytics;
|
|
145
|
+
deleteExpand((_this$api2 = this.api) === null || _this$api2 === void 0 ? void 0 : (_this$api2$analytics = _this$api2.analytics) === null || _this$api2$analytics === void 0 ? void 0 : _this$api2$analytics.actions)(state, this.view.dispatch);
|
|
140
146
|
}
|
|
141
147
|
});
|
|
142
148
|
_defineProperty(this, "moveToOutsideOfTitle", event => {
|
|
@@ -259,14 +265,14 @@ export class ExpandNodeView {
|
|
|
259
265
|
selectionEnd
|
|
260
266
|
} = this.input;
|
|
261
267
|
if (selectionStart === selectionEnd && selectionStart === 0) {
|
|
262
|
-
var _this$
|
|
268
|
+
var _this$api3, _this$api3$selection;
|
|
263
269
|
event.preventDefault();
|
|
264
270
|
const {
|
|
265
271
|
state,
|
|
266
272
|
dispatch
|
|
267
273
|
} = this.view;
|
|
268
274
|
this.view.focus();
|
|
269
|
-
const selectionSharedState = ((_this$
|
|
275
|
+
const selectionSharedState = ((_this$api3 = this.api) === null || _this$api3 === void 0 ? void 0 : (_this$api3$selection = _this$api3.selection) === null || _this$api3$selection === void 0 ? void 0 : _this$api3$selection.sharedState.currentState()) || {};
|
|
270
276
|
// selectionRelativeToNode is undefined when user clicked to select node, then hit left to get focus in title
|
|
271
277
|
// This is a special case where we want to bypass node selection and jump straight to gap cursor
|
|
272
278
|
if ((selectionSharedState === null || selectionSharedState === void 0 ? void 0 : selectionSharedState.selectionRelativeToNode) === undefined) {
|
|
@@ -316,6 +322,7 @@ export class ExpandNodeView {
|
|
|
316
322
|
this.dom.addEventListener('click', this.handleClick);
|
|
317
323
|
this.dom.addEventListener('input', this.handleInput);
|
|
318
324
|
this.input.addEventListener('keydown', this.handleTitleKeydown);
|
|
325
|
+
this.input.addEventListener('blur', this.handleBlur);
|
|
319
326
|
// If the user interacts in our title bar (either toggle or input)
|
|
320
327
|
// Prevent ProseMirror from getting a focus event (causes weird selection issues).
|
|
321
328
|
this.titleContainer.addEventListener('focus', this.handleFocus);
|
|
@@ -355,14 +362,17 @@ export class ExpandNodeView {
|
|
|
355
362
|
return false;
|
|
356
363
|
}
|
|
357
364
|
destroy() {
|
|
365
|
+
var _this$decorationClean2;
|
|
358
366
|
if (!this.dom || !this.input || !this.titleContainer || !this.icon) {
|
|
359
367
|
return;
|
|
360
368
|
}
|
|
361
369
|
this.dom.removeEventListener('click', this.handleClick);
|
|
362
370
|
this.dom.removeEventListener('input', this.handleInput);
|
|
363
371
|
this.input.removeEventListener('keydown', this.handleTitleKeydown);
|
|
372
|
+
this.input.removeEventListener('blur', this.handleBlur);
|
|
364
373
|
this.titleContainer.removeEventListener('focus', this.handleFocus);
|
|
365
374
|
this.icon.removeEventListener('keydown', this.handleIconKeyDown);
|
|
375
|
+
(_this$decorationClean2 = this.decorationCleanup) === null || _this$decorationClean2 === void 0 ? void 0 : _this$decorationClean2.call(this);
|
|
366
376
|
ReactDOM.unmountComponentAtNode(this.icon);
|
|
367
377
|
}
|
|
368
378
|
}
|
|
@@ -59,6 +59,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
59
59
|
_defineProperty(this, "isMobile", false);
|
|
60
60
|
_defineProperty(this, "focusTitle", function () {
|
|
61
61
|
if (_this.input) {
|
|
62
|
+
var _this$api;
|
|
62
63
|
var _this$view = _this.view,
|
|
63
64
|
state = _this$view.state,
|
|
64
65
|
dispatch = _this$view.dispatch;
|
|
@@ -74,6 +75,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
74
75
|
if (typeof pos === 'number') {
|
|
75
76
|
setSelectionInsideExpand(pos)(state, dispatch, _this.view);
|
|
76
77
|
}
|
|
78
|
+
_this.decorationCleanup = (_this$api = _this.api) === null || _this$api === void 0 || (_this$api = _this$api.selectionMarker) === null || _this$api === void 0 || (_this$api = _this$api.actions) === null || _this$api === void 0 ? void 0 : _this$api.hideDecoration();
|
|
77
79
|
_this.input.focus();
|
|
78
80
|
}
|
|
79
81
|
});
|
|
@@ -99,7 +101,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
99
101
|
state = _this$view2.state,
|
|
100
102
|
dispatch = _this$view2.dispatch;
|
|
101
103
|
if (closestElement(target, ".".concat(expandClassNames.icon))) {
|
|
102
|
-
var _this$
|
|
104
|
+
var _this$api2;
|
|
103
105
|
if (!_this.allowInteractiveExpand) {
|
|
104
106
|
return;
|
|
105
107
|
}
|
|
@@ -111,7 +113,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
111
113
|
_this.view.dom.blur();
|
|
112
114
|
}
|
|
113
115
|
toggleExpandExpanded({
|
|
114
|
-
editorAnalyticsAPI: (_this$
|
|
116
|
+
editorAnalyticsAPI: (_this$api2 = _this.api) === null || _this$api2 === void 0 || (_this$api2 = _this$api2.analytics) === null || _this$api2 === void 0 ? void 0 : _this$api2.actions,
|
|
115
117
|
pos: pos,
|
|
116
118
|
nodeType: _this.node.type,
|
|
117
119
|
__livePage: _this.__livePage
|
|
@@ -146,6 +148,10 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
146
148
|
_defineProperty(this, "handleFocus", function (event) {
|
|
147
149
|
event.stopImmediatePropagation();
|
|
148
150
|
});
|
|
151
|
+
_defineProperty(this, "handleBlur", function (event) {
|
|
152
|
+
var _this$decorationClean;
|
|
153
|
+
(_this$decorationClean = _this.decorationCleanup) === null || _this$decorationClean === void 0 || _this$decorationClean.call(_this);
|
|
154
|
+
});
|
|
149
155
|
_defineProperty(this, "handleTitleKeydown", function (event) {
|
|
150
156
|
switch (keyName(event)) {
|
|
151
157
|
case 'Enter':
|
|
@@ -186,8 +192,8 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
186
192
|
var state = _this.view.state;
|
|
187
193
|
var expandNode = _this.node;
|
|
188
194
|
if (expandNode && isEmptyNode(state.schema)(expandNode)) {
|
|
189
|
-
var _this$
|
|
190
|
-
deleteExpandAtPos((_this$
|
|
195
|
+
var _this$api3;
|
|
196
|
+
deleteExpandAtPos((_this$api3 = _this.api) === null || _this$api3 === void 0 || (_this$api3 = _this$api3.analytics) === null || _this$api3 === void 0 ? void 0 : _this$api3.actions)(pos, expandNode)(state, _this.view.dispatch);
|
|
191
197
|
}
|
|
192
198
|
});
|
|
193
199
|
_defineProperty(this, "toggleExpand", function () {
|
|
@@ -196,12 +202,12 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
196
202
|
return;
|
|
197
203
|
}
|
|
198
204
|
if (_this.allowInteractiveExpand) {
|
|
199
|
-
var _this$
|
|
205
|
+
var _this$api4;
|
|
200
206
|
var _this$view4 = _this.view,
|
|
201
207
|
state = _this$view4.state,
|
|
202
208
|
dispatch = _this$view4.dispatch;
|
|
203
209
|
toggleExpandExpanded({
|
|
204
|
-
editorAnalyticsAPI: (_this$
|
|
210
|
+
editorAnalyticsAPI: (_this$api4 = _this.api) === null || _this$api4 === void 0 || (_this$api4 = _this$api4.analytics) === null || _this$api4 === void 0 ? void 0 : _this$api4.actions,
|
|
205
211
|
pos: pos,
|
|
206
212
|
nodeType: _this.node.type,
|
|
207
213
|
__livePage: _this.__livePage
|
|
@@ -322,13 +328,13 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
322
328
|
selectionStart = _this$input5.selectionStart,
|
|
323
329
|
selectionEnd = _this$input5.selectionEnd;
|
|
324
330
|
if (selectionStart === selectionEnd && selectionStart === 0) {
|
|
325
|
-
var _this$
|
|
331
|
+
var _this$api5;
|
|
326
332
|
event.preventDefault();
|
|
327
333
|
var _this$view9 = _this.view,
|
|
328
334
|
state = _this$view9.state,
|
|
329
335
|
dispatch = _this$view9.dispatch;
|
|
330
336
|
_this.view.focus();
|
|
331
|
-
var selectionSharedState = ((_this$
|
|
337
|
+
var selectionSharedState = ((_this$api5 = _this.api) === null || _this$api5 === void 0 || (_this$api5 = _this$api5.selection) === null || _this$api5 === void 0 ? void 0 : _this$api5.sharedState.currentState()) || {};
|
|
332
338
|
// selectionRelativeToNode is undefined when user clicked to select node, then hit left to get focus in title
|
|
333
339
|
// This is a special case where we want to bypass node selection and jump straight to gap cursor
|
|
334
340
|
if ((selectionSharedState === null || selectionSharedState === void 0 ? void 0 : selectionSharedState.selectionRelativeToNode) === undefined) {
|
|
@@ -383,6 +389,8 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
383
389
|
if (this.input) {
|
|
384
390
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
385
391
|
this.input.addEventListener('keydown', this.handleTitleKeydown);
|
|
392
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
393
|
+
this.input.addEventListener('blur', this.handleBlur);
|
|
386
394
|
}
|
|
387
395
|
if (this.titleContainer) {
|
|
388
396
|
// If the user interacts in our title bar (either toggle or input)
|
|
@@ -462,6 +470,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
462
470
|
}, {
|
|
463
471
|
key: "destroy",
|
|
464
472
|
value: function destroy() {
|
|
473
|
+
var _this$decorationClean2;
|
|
465
474
|
if (this.dom) {
|
|
466
475
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
467
476
|
this.dom.removeEventListener('click', this.handleClick);
|
|
@@ -471,6 +480,8 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
471
480
|
if (this.input) {
|
|
472
481
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
473
482
|
this.input.removeEventListener('keydown', this.handleTitleKeydown);
|
|
483
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
484
|
+
this.input.removeEventListener('blur', this.handleBlur);
|
|
474
485
|
}
|
|
475
486
|
if (this.titleContainer) {
|
|
476
487
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -481,6 +492,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
481
492
|
this.icon.removeEventListener('keydown', this.handleIconKeyDown);
|
|
482
493
|
ReactDOM.unmountComponentAtNode(this.icon);
|
|
483
494
|
}
|
|
495
|
+
(_this$decorationClean2 = this.decorationCleanup) === null || _this$decorationClean2 === void 0 || _this$decorationClean2.call(this);
|
|
484
496
|
|
|
485
497
|
// @ts-ignore - [unblock prosemirror bump] reset non optional prop to undefined to clear reference
|
|
486
498
|
this.dom = undefined;
|
|
@@ -20,6 +20,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
20
20
|
_defineProperty(this, "isMobile", false);
|
|
21
21
|
_defineProperty(this, "focusTitle", function () {
|
|
22
22
|
if (_this.input) {
|
|
23
|
+
var _this$api;
|
|
23
24
|
var _this$view = _this.view,
|
|
24
25
|
state = _this$view.state,
|
|
25
26
|
dispatch = _this$view.dispatch;
|
|
@@ -35,6 +36,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
35
36
|
if (typeof pos === 'number') {
|
|
36
37
|
setSelectionInsideExpand(pos)(state, dispatch, _this.view);
|
|
37
38
|
}
|
|
39
|
+
_this.decorationCleanup = (_this$api = _this.api) === null || _this$api === void 0 || (_this$api = _this$api.selectionMarker) === null || _this$api === void 0 || (_this$api = _this$api.actions) === null || _this$api === void 0 ? void 0 : _this$api.hideDecoration();
|
|
38
40
|
_this.input.focus();
|
|
39
41
|
}
|
|
40
42
|
});
|
|
@@ -100,6 +102,10 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
100
102
|
_defineProperty(this, "handleFocus", function (event) {
|
|
101
103
|
event.stopImmediatePropagation();
|
|
102
104
|
});
|
|
105
|
+
_defineProperty(this, "handleBlur", function (event) {
|
|
106
|
+
var _this$decorationClean;
|
|
107
|
+
(_this$decorationClean = _this.decorationCleanup) === null || _this$decorationClean === void 0 || _this$decorationClean.call(_this);
|
|
108
|
+
});
|
|
103
109
|
_defineProperty(this, "handleTitleKeydown", function (event) {
|
|
104
110
|
switch (keyName(event)) {
|
|
105
111
|
case 'Enter':
|
|
@@ -136,8 +142,8 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
136
142
|
return;
|
|
137
143
|
}
|
|
138
144
|
if (expandNode && isEmptyNode(state.schema)(expandNode)) {
|
|
139
|
-
var _this$
|
|
140
|
-
deleteExpand((_this$
|
|
145
|
+
var _this$api2;
|
|
146
|
+
deleteExpand((_this$api2 = _this.api) === null || _this$api2 === void 0 || (_this$api2 = _this$api2.analytics) === null || _this$api2 === void 0 ? void 0 : _this$api2.actions)(state, _this.view.dispatch);
|
|
141
147
|
}
|
|
142
148
|
});
|
|
143
149
|
_defineProperty(this, "moveToOutsideOfTitle", function (event) {
|
|
@@ -252,13 +258,13 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
252
258
|
selectionStart = _this$input5.selectionStart,
|
|
253
259
|
selectionEnd = _this$input5.selectionEnd;
|
|
254
260
|
if (selectionStart === selectionEnd && selectionStart === 0) {
|
|
255
|
-
var _this$
|
|
261
|
+
var _this$api3;
|
|
256
262
|
event.preventDefault();
|
|
257
263
|
var _this$view7 = _this.view,
|
|
258
264
|
state = _this$view7.state,
|
|
259
265
|
dispatch = _this$view7.dispatch;
|
|
260
266
|
_this.view.focus();
|
|
261
|
-
var selectionSharedState = ((_this$
|
|
267
|
+
var selectionSharedState = ((_this$api3 = _this.api) === null || _this$api3 === void 0 || (_this$api3 = _this$api3.selection) === null || _this$api3 === void 0 ? void 0 : _this$api3.sharedState.currentState()) || {};
|
|
262
268
|
// selectionRelativeToNode is undefined when user clicked to select node, then hit left to get focus in title
|
|
263
269
|
// This is a special case where we want to bypass node selection and jump straight to gap cursor
|
|
264
270
|
if ((selectionSharedState === null || selectionSharedState === void 0 ? void 0 : selectionSharedState.selectionRelativeToNode) === undefined) {
|
|
@@ -307,6 +313,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
307
313
|
this.dom.addEventListener('click', this.handleClick);
|
|
308
314
|
this.dom.addEventListener('input', this.handleInput);
|
|
309
315
|
this.input.addEventListener('keydown', this.handleTitleKeydown);
|
|
316
|
+
this.input.addEventListener('blur', this.handleBlur);
|
|
310
317
|
// If the user interacts in our title bar (either toggle or input)
|
|
311
318
|
// Prevent ProseMirror from getting a focus event (causes weird selection issues).
|
|
312
319
|
this.titleContainer.addEventListener('focus', this.handleFocus);
|
|
@@ -355,14 +362,17 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
355
362
|
}, {
|
|
356
363
|
key: "destroy",
|
|
357
364
|
value: function destroy() {
|
|
365
|
+
var _this$decorationClean2;
|
|
358
366
|
if (!this.dom || !this.input || !this.titleContainer || !this.icon) {
|
|
359
367
|
return;
|
|
360
368
|
}
|
|
361
369
|
this.dom.removeEventListener('click', this.handleClick);
|
|
362
370
|
this.dom.removeEventListener('input', this.handleInput);
|
|
363
371
|
this.input.removeEventListener('keydown', this.handleTitleKeydown);
|
|
372
|
+
this.input.removeEventListener('blur', this.handleBlur);
|
|
364
373
|
this.titleContainer.removeEventListener('focus', this.handleFocus);
|
|
365
374
|
this.icon.removeEventListener('keydown', this.handleIconKeyDown);
|
|
375
|
+
(_this$decorationClean2 = this.decorationCleanup) === null || _this$decorationClean2 === void 0 || _this$decorationClean2.call(this);
|
|
366
376
|
ReactDOM.unmountComponentAtNode(this.icon);
|
|
367
377
|
}
|
|
368
378
|
}]);
|
|
@@ -20,6 +20,7 @@ export declare class ExpandNodeView implements NodeView {
|
|
|
20
20
|
allowInteractiveExpand: boolean;
|
|
21
21
|
isMobile: boolean;
|
|
22
22
|
api: ExtractInjectionAPI<ExpandPlugin> | undefined;
|
|
23
|
+
decorationCleanup?: () => boolean | undefined;
|
|
23
24
|
constructor(node: PmNode, view: EditorView, getPos: getPosHandlerNode, getIntl: () => IntlShape, isMobile: boolean, selectNearNode: SetSelectionRelativeToNode | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, allowInteractiveExpand?: boolean, __livePage?: boolean);
|
|
24
25
|
private initHandlers;
|
|
25
26
|
private focusTitle;
|
|
@@ -28,6 +29,7 @@ export declare class ExpandNodeView implements NodeView {
|
|
|
28
29
|
private handleClick;
|
|
29
30
|
private handleInput;
|
|
30
31
|
private handleFocus;
|
|
32
|
+
private handleBlur;
|
|
31
33
|
private handleTitleKeydown;
|
|
32
34
|
private deleteExpand;
|
|
33
35
|
private toggleExpand;
|
|
@@ -20,12 +20,14 @@ export declare class ExpandNodeView implements NodeView {
|
|
|
20
20
|
allowInteractiveExpand: boolean;
|
|
21
21
|
isMobile: boolean;
|
|
22
22
|
api: ExtractInjectionAPI<ExpandPlugin> | undefined;
|
|
23
|
+
decorationCleanup?: () => boolean | undefined;
|
|
23
24
|
constructor(node: PmNode, view: EditorView, getPos: getPosHandlerNode, getIntl: () => IntlShape, isMobile: boolean, selectNearNode: SetSelectionRelativeToNode | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, allowInteractiveExpand?: boolean, __livePage?: boolean);
|
|
24
25
|
private focusTitle;
|
|
25
26
|
private handleIconKeyDown;
|
|
26
27
|
private handleClick;
|
|
27
28
|
private handleInput;
|
|
28
29
|
private handleFocus;
|
|
30
|
+
private handleBlur;
|
|
29
31
|
private handleTitleKeydown;
|
|
30
32
|
private deleteEmptyExpand;
|
|
31
33
|
private moveToOutsideOfTitle;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { EditorAppearance, LongPressSelectionPluginOptions, NextEditorPlugi
|
|
|
2
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
3
|
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
4
4
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
5
|
+
import type { SelectionMarkerPlugin } from '@atlaskit/editor-plugin-selection-marker';
|
|
5
6
|
import type { insertExpand } from './legacyExpand/commands';
|
|
6
7
|
export interface ExpandPluginState {
|
|
7
8
|
expandRef?: HTMLDivElement | null;
|
|
@@ -37,7 +38,8 @@ export type ExpandPlugin = NextEditorPlugin<'expand', {
|
|
|
37
38
|
dependencies: [
|
|
38
39
|
DecorationsPlugin,
|
|
39
40
|
SelectionPlugin,
|
|
40
|
-
OptionalPlugin<AnalyticsPlugin
|
|
41
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
42
|
+
OptionalPlugin<SelectionMarkerPlugin>
|
|
41
43
|
];
|
|
42
44
|
actions: {
|
|
43
45
|
insertExpand: ReturnType<typeof insertExpand>;
|
|
@@ -20,6 +20,7 @@ export declare class ExpandNodeView implements NodeView {
|
|
|
20
20
|
allowInteractiveExpand: boolean;
|
|
21
21
|
isMobile: boolean;
|
|
22
22
|
api: ExtractInjectionAPI<ExpandPlugin> | undefined;
|
|
23
|
+
decorationCleanup?: () => boolean | undefined;
|
|
23
24
|
constructor(node: PmNode, view: EditorView, getPos: getPosHandlerNode, getIntl: () => IntlShape, isMobile: boolean, selectNearNode: SetSelectionRelativeToNode | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, allowInteractiveExpand?: boolean, __livePage?: boolean);
|
|
24
25
|
private initHandlers;
|
|
25
26
|
private focusTitle;
|
|
@@ -28,6 +29,7 @@ export declare class ExpandNodeView implements NodeView {
|
|
|
28
29
|
private handleClick;
|
|
29
30
|
private handleInput;
|
|
30
31
|
private handleFocus;
|
|
32
|
+
private handleBlur;
|
|
31
33
|
private handleTitleKeydown;
|
|
32
34
|
private deleteExpand;
|
|
33
35
|
private toggleExpand;
|
|
@@ -20,12 +20,14 @@ export declare class ExpandNodeView implements NodeView {
|
|
|
20
20
|
allowInteractiveExpand: boolean;
|
|
21
21
|
isMobile: boolean;
|
|
22
22
|
api: ExtractInjectionAPI<ExpandPlugin> | undefined;
|
|
23
|
+
decorationCleanup?: () => boolean | undefined;
|
|
23
24
|
constructor(node: PmNode, view: EditorView, getPos: getPosHandlerNode, getIntl: () => IntlShape, isMobile: boolean, selectNearNode: SetSelectionRelativeToNode | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, allowInteractiveExpand?: boolean, __livePage?: boolean);
|
|
24
25
|
private focusTitle;
|
|
25
26
|
private handleIconKeyDown;
|
|
26
27
|
private handleClick;
|
|
27
28
|
private handleInput;
|
|
28
29
|
private handleFocus;
|
|
30
|
+
private handleBlur;
|
|
29
31
|
private handleTitleKeydown;
|
|
30
32
|
private deleteEmptyExpand;
|
|
31
33
|
private moveToOutsideOfTitle;
|
|
@@ -2,6 +2,7 @@ import type { EditorAppearance, LongPressSelectionPluginOptions, NextEditorPlugi
|
|
|
2
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
3
|
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
4
4
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
5
|
+
import type { SelectionMarkerPlugin } from '@atlaskit/editor-plugin-selection-marker';
|
|
5
6
|
import type { insertExpand } from './legacyExpand/commands';
|
|
6
7
|
export interface ExpandPluginState {
|
|
7
8
|
expandRef?: HTMLDivElement | null;
|
|
@@ -37,7 +38,8 @@ export type ExpandPlugin = NextEditorPlugin<'expand', {
|
|
|
37
38
|
dependencies: [
|
|
38
39
|
DecorationsPlugin,
|
|
39
40
|
SelectionPlugin,
|
|
40
|
-
OptionalPlugin<AnalyticsPlugin
|
|
41
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
42
|
+
OptionalPlugin<SelectionMarkerPlugin>
|
|
41
43
|
];
|
|
42
44
|
actions: {
|
|
43
45
|
insertExpand: ReturnType<typeof insertExpand>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-expand",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Expand plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,12 +33,13 @@
|
|
|
33
33
|
".": "./src/index.ts"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@atlaskit/adf-schema": "^35.
|
|
36
|
+
"@atlaskit/adf-schema": "^35.9.0",
|
|
37
37
|
"@atlaskit/button": "^17.12.0",
|
|
38
|
-
"@atlaskit/editor-common": "^78.
|
|
38
|
+
"@atlaskit/editor-common": "^78.28.0",
|
|
39
39
|
"@atlaskit/editor-plugin-analytics": "^1.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-decorations": "^1.0.0",
|
|
41
41
|
"@atlaskit/editor-plugin-selection": "^1.1.0",
|
|
42
|
+
"@atlaskit/editor-plugin-selection-marker": "^1.2.0",
|
|
42
43
|
"@atlaskit/editor-prosemirror": "3.0.0",
|
|
43
44
|
"@atlaskit/editor-shared-styles": "^2.9.0",
|
|
44
45
|
"@atlaskit/editor-tables": "^2.6.0",
|