@atlaskit/editor-plugin-expand 1.3.2 → 1.3.4
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 +5 -18
- package/dist/cjs/singlePlayerExpand/node-views/index.js +23 -14
- package/dist/es2019/legacyExpand/nodeviews/index.js +5 -18
- package/dist/es2019/singlePlayerExpand/node-views/index.js +10 -0
- package/dist/esm/legacyExpand/nodeviews/index.js +5 -18
- package/dist/esm/singlePlayerExpand/node-views/index.js +23 -14
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-expand
|
|
2
2
|
|
|
3
|
+
## 1.3.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#91146](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/91146) [`c982f92adfee`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c982f92adfee) - [ux] Revert changes from ED-22666 as expand is not editable when not selected initially
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
10
|
+
## 1.3.3
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#90914](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/90914) [`a4a9d317e5b8`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a4a9d317e5b8) - [ux] [ED-23013] Fix bug in single player expand where backspace in the title would delete entire expand even if the title had content.
|
|
15
|
+
|
|
3
16
|
## 1.3.2
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -24,7 +24,7 @@ var _ExpandIconButton = require("../ui/ExpandIconButton");
|
|
|
24
24
|
function buildExpandClassName(type, expanded) {
|
|
25
25
|
return "".concat(_styles.expandClassNames.prefix, " ").concat(_styles.expandClassNames.type(type), " ").concat(expanded ? _styles.expandClassNames.expanded : '');
|
|
26
26
|
}
|
|
27
|
-
var toDOM = function toDOM(node, __livePage, intl
|
|
27
|
+
var toDOM = function toDOM(node, __livePage, intl) {
|
|
28
28
|
return ['div', {
|
|
29
29
|
// prettier-ignore
|
|
30
30
|
'class': buildExpandClassName(node.type.name, (0, _platformFeatureFlags.getBooleanFF)('platform.editor.live-pages-expand-divergence') && __livePage ? !node.attrs.__expanded : node.attrs.__expanded),
|
|
@@ -50,13 +50,11 @@ var toDOM = function toDOM(node, __livePage, intl, editable) {
|
|
|
50
50
|
'class': _styles.expandClassNames.titleInput,
|
|
51
51
|
value: node.attrs.title,
|
|
52
52
|
placeholder: intl && intl.formatMessage(_ui.expandMessages.expandPlaceholderText) || _ui.expandMessages.expandPlaceholderText.defaultMessage,
|
|
53
|
-
type: 'text'
|
|
54
|
-
readonly: !editable ? 'true' : undefined
|
|
53
|
+
type: 'text'
|
|
55
54
|
}]]],
|
|
56
55
|
// prettier-ignore
|
|
57
56
|
['div', {
|
|
58
|
-
'class': _styles.expandClassNames.content
|
|
59
|
-
contenteditable: editable
|
|
57
|
+
'class': _styles.expandClassNames.content
|
|
60
58
|
}, 0]];
|
|
61
59
|
};
|
|
62
60
|
var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
@@ -363,7 +361,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
363
361
|
this.selectNearNode = selectNearNode;
|
|
364
362
|
this.__livePage = __livePage;
|
|
365
363
|
this.intl = getIntl();
|
|
366
|
-
var _DOMSerializer$render = _model.DOMSerializer.renderSpec(document, toDOM(node, this.__livePage, this.intl
|
|
364
|
+
var _DOMSerializer$render = _model.DOMSerializer.renderSpec(document, toDOM(node, this.__livePage, this.intl)),
|
|
367
365
|
dom = _DOMSerializer$render.dom,
|
|
368
366
|
contentDOM = _DOMSerializer$render.contentDOM;
|
|
369
367
|
this.allowInteractiveExpand = allowInteractiveExpand;
|
|
@@ -452,18 +450,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
452
450
|
}
|
|
453
451
|
if (this.content) {
|
|
454
452
|
// Disallow interaction/selection inside when collapsed.
|
|
455
|
-
this.content.setAttribute('contenteditable',
|
|
456
|
-
}
|
|
457
|
-
} else {
|
|
458
|
-
if (this.content) {
|
|
459
|
-
this.content.setAttribute('contenteditable', this.view.editable ? 'true' : 'false');
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
if (this.input) {
|
|
463
|
-
if (!this.view.editable) {
|
|
464
|
-
this.input.setAttribute('readonly', 'true');
|
|
465
|
-
} else {
|
|
466
|
-
this.input.removeAttribute('readonly');
|
|
453
|
+
this.content.setAttribute('contenteditable', (0, _platformFeatureFlags.getBooleanFF)('platform.editor.live-pages-expand-divergence') && this.__livePage ? !node.attrs.__expanded : node.attrs.__expanded);
|
|
467
454
|
}
|
|
468
455
|
}
|
|
469
456
|
|
|
@@ -134,6 +134,15 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
134
134
|
(0, _defineProperty2.default)(this, "deleteEmptyExpand", function () {
|
|
135
135
|
var state = _this.view.state;
|
|
136
136
|
var expandNode = _this.node;
|
|
137
|
+
if (!_this.input) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
var _this$input = _this.input,
|
|
141
|
+
selectionStart = _this$input.selectionStart,
|
|
142
|
+
selectionEnd = _this$input.selectionEnd;
|
|
143
|
+
if (selectionStart !== selectionEnd || selectionStart !== 0) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
137
146
|
if (expandNode && (0, _utils.isEmptyNode)(state.schema)(expandNode)) {
|
|
138
147
|
var _this$api;
|
|
139
148
|
(0, _commands.deleteExpand)((_this$api = _this.api) === null || _this$api === void 0 || (_this$api = _this$api.analytics) === null || _this$api === void 0 ? void 0 : _this$api.actions)(state, _this.view.dispatch);
|
|
@@ -179,10 +188,10 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
179
188
|
if (typeof pos !== 'number') {
|
|
180
189
|
return;
|
|
181
190
|
}
|
|
182
|
-
var _this$
|
|
183
|
-
value = _this$
|
|
184
|
-
selectionStart = _this$
|
|
185
|
-
selectionEnd = _this$
|
|
191
|
+
var _this$input2 = _this.input,
|
|
192
|
+
value = _this$input2.value,
|
|
193
|
+
selectionStart = _this$input2.selectionStart,
|
|
194
|
+
selectionEnd = _this$input2.selectionEnd;
|
|
186
195
|
if (selectionStart === selectionEnd && selectionStart === value.length) {
|
|
187
196
|
var _this$view4 = _this.view,
|
|
188
197
|
state = _this$view4.state,
|
|
@@ -200,9 +209,9 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
200
209
|
if (typeof pos !== 'number') {
|
|
201
210
|
return;
|
|
202
211
|
}
|
|
203
|
-
var _this$
|
|
204
|
-
selectionStart = _this$
|
|
205
|
-
selectionEnd = _this$
|
|
212
|
+
var _this$input3 = _this.input,
|
|
213
|
+
selectionStart = _this$input3.selectionStart,
|
|
214
|
+
selectionEnd = _this$input3.selectionEnd;
|
|
206
215
|
if (selectionStart === selectionEnd && selectionStart === 0) {
|
|
207
216
|
event.preventDefault();
|
|
208
217
|
var _this$view5 = _this.view,
|
|
@@ -220,10 +229,10 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
220
229
|
if (typeof pos !== 'number') {
|
|
221
230
|
return;
|
|
222
231
|
}
|
|
223
|
-
var _this$
|
|
224
|
-
value = _this$
|
|
225
|
-
selectionStart = _this$
|
|
226
|
-
selectionEnd = _this$
|
|
232
|
+
var _this$input4 = _this.input,
|
|
233
|
+
value = _this$input4.value,
|
|
234
|
+
selectionStart = _this$input4.selectionStart,
|
|
235
|
+
selectionEnd = _this$input4.selectionEnd;
|
|
227
236
|
if (selectionStart === selectionEnd && selectionStart === value.length) {
|
|
228
237
|
event.preventDefault();
|
|
229
238
|
var _this$view6 = _this.view,
|
|
@@ -247,9 +256,9 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
247
256
|
if (typeof pos !== 'number') {
|
|
248
257
|
return;
|
|
249
258
|
}
|
|
250
|
-
var _this$
|
|
251
|
-
selectionStart = _this$
|
|
252
|
-
selectionEnd = _this$
|
|
259
|
+
var _this$input5 = _this.input,
|
|
260
|
+
selectionStart = _this$input5.selectionStart,
|
|
261
|
+
selectionEnd = _this$input5.selectionEnd;
|
|
253
262
|
if (selectionStart === selectionEnd && selectionStart === 0) {
|
|
254
263
|
var _this$api2;
|
|
255
264
|
event.preventDefault();
|
|
@@ -14,7 +14,7 @@ import { ExpandIconButton } from '../ui/ExpandIconButton';
|
|
|
14
14
|
function buildExpandClassName(type, expanded) {
|
|
15
15
|
return `${expandClassNames.prefix} ${expandClassNames.type(type)} ${expanded ? expandClassNames.expanded : ''}`;
|
|
16
16
|
}
|
|
17
|
-
const toDOM = (node, __livePage, intl
|
|
17
|
+
const toDOM = (node, __livePage, intl) => ['div', {
|
|
18
18
|
// prettier-ignore
|
|
19
19
|
'class': buildExpandClassName(node.type.name, getBooleanFF('platform.editor.live-pages-expand-divergence') && __livePage ? !node.attrs.__expanded : node.attrs.__expanded),
|
|
20
20
|
'data-node-type': node.type.name,
|
|
@@ -39,13 +39,11 @@ const toDOM = (node, __livePage, intl, editable) => ['div', {
|
|
|
39
39
|
'class': expandClassNames.titleInput,
|
|
40
40
|
value: node.attrs.title,
|
|
41
41
|
placeholder: intl && intl.formatMessage(expandMessages.expandPlaceholderText) || expandMessages.expandPlaceholderText.defaultMessage,
|
|
42
|
-
type: 'text'
|
|
43
|
-
readonly: !editable ? 'true' : undefined
|
|
42
|
+
type: 'text'
|
|
44
43
|
}]]],
|
|
45
44
|
// prettier-ignore
|
|
46
45
|
['div', {
|
|
47
|
-
'class': expandClassNames.content
|
|
48
|
-
contenteditable: editable
|
|
46
|
+
'class': expandClassNames.content
|
|
49
47
|
}, 0]];
|
|
50
48
|
export class ExpandNodeView {
|
|
51
49
|
constructor(node, view, getPos, getIntl, isMobile, selectNearNode, api, allowInteractiveExpand = true, __livePage = false) {
|
|
@@ -366,7 +364,7 @@ export class ExpandNodeView {
|
|
|
366
364
|
const {
|
|
367
365
|
dom,
|
|
368
366
|
contentDOM
|
|
369
|
-
} = DOMSerializer.renderSpec(document, toDOM(node, this.__livePage, this.intl
|
|
367
|
+
} = DOMSerializer.renderSpec(document, toDOM(node, this.__livePage, this.intl));
|
|
370
368
|
this.allowInteractiveExpand = allowInteractiveExpand;
|
|
371
369
|
this.getPos = getPos;
|
|
372
370
|
this.view = view;
|
|
@@ -443,18 +441,7 @@ export class ExpandNodeView {
|
|
|
443
441
|
}
|
|
444
442
|
if (this.content) {
|
|
445
443
|
// Disallow interaction/selection inside when collapsed.
|
|
446
|
-
this.content.setAttribute('contenteditable',
|
|
447
|
-
}
|
|
448
|
-
} else {
|
|
449
|
-
if (this.content) {
|
|
450
|
-
this.content.setAttribute('contenteditable', this.view.editable ? 'true' : 'false');
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
if (this.input) {
|
|
454
|
-
if (!this.view.editable) {
|
|
455
|
-
this.input.setAttribute('readonly', 'true');
|
|
456
|
-
} else {
|
|
457
|
-
this.input.removeAttribute('readonly');
|
|
444
|
+
this.content.setAttribute('contenteditable', getBooleanFF('platform.editor.live-pages-expand-divergence') && this.__livePage ? !node.attrs.__expanded : node.attrs.__expanded);
|
|
458
445
|
}
|
|
459
446
|
}
|
|
460
447
|
|
|
@@ -124,6 +124,16 @@ export class ExpandNodeView {
|
|
|
124
124
|
state
|
|
125
125
|
} = this.view;
|
|
126
126
|
const expandNode = this.node;
|
|
127
|
+
if (!this.input) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const {
|
|
131
|
+
selectionStart,
|
|
132
|
+
selectionEnd
|
|
133
|
+
} = this.input;
|
|
134
|
+
if (selectionStart !== selectionEnd || selectionStart !== 0) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
127
137
|
if (expandNode && isEmptyNode(state.schema)(expandNode)) {
|
|
128
138
|
var _this$api, _this$api$analytics;
|
|
129
139
|
deleteExpand((_this$api = this.api) === null || _this$api === void 0 ? void 0 : (_this$api$analytics = _this$api.analytics) === null || _this$api$analytics === void 0 ? void 0 : _this$api$analytics.actions)(state, this.view.dispatch);
|
|
@@ -16,7 +16,7 @@ import { ExpandIconButton } from '../ui/ExpandIconButton';
|
|
|
16
16
|
function buildExpandClassName(type, expanded) {
|
|
17
17
|
return "".concat(expandClassNames.prefix, " ").concat(expandClassNames.type(type), " ").concat(expanded ? expandClassNames.expanded : '');
|
|
18
18
|
}
|
|
19
|
-
var toDOM = function toDOM(node, __livePage, intl
|
|
19
|
+
var toDOM = function toDOM(node, __livePage, intl) {
|
|
20
20
|
return ['div', {
|
|
21
21
|
// prettier-ignore
|
|
22
22
|
'class': buildExpandClassName(node.type.name, getBooleanFF('platform.editor.live-pages-expand-divergence') && __livePage ? !node.attrs.__expanded : node.attrs.__expanded),
|
|
@@ -42,13 +42,11 @@ var toDOM = function toDOM(node, __livePage, intl, editable) {
|
|
|
42
42
|
'class': expandClassNames.titleInput,
|
|
43
43
|
value: node.attrs.title,
|
|
44
44
|
placeholder: intl && intl.formatMessage(expandMessages.expandPlaceholderText) || expandMessages.expandPlaceholderText.defaultMessage,
|
|
45
|
-
type: 'text'
|
|
46
|
-
readonly: !editable ? 'true' : undefined
|
|
45
|
+
type: 'text'
|
|
47
46
|
}]]],
|
|
48
47
|
// prettier-ignore
|
|
49
48
|
['div', {
|
|
50
|
-
'class': expandClassNames.content
|
|
51
|
-
contenteditable: editable
|
|
49
|
+
'class': expandClassNames.content
|
|
52
50
|
}, 0]];
|
|
53
51
|
};
|
|
54
52
|
export var ExpandNodeView = /*#__PURE__*/function () {
|
|
@@ -355,7 +353,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
355
353
|
this.selectNearNode = selectNearNode;
|
|
356
354
|
this.__livePage = __livePage;
|
|
357
355
|
this.intl = getIntl();
|
|
358
|
-
var _DOMSerializer$render = DOMSerializer.renderSpec(document, toDOM(node, this.__livePage, this.intl
|
|
356
|
+
var _DOMSerializer$render = DOMSerializer.renderSpec(document, toDOM(node, this.__livePage, this.intl)),
|
|
359
357
|
dom = _DOMSerializer$render.dom,
|
|
360
358
|
contentDOM = _DOMSerializer$render.contentDOM;
|
|
361
359
|
this.allowInteractiveExpand = allowInteractiveExpand;
|
|
@@ -444,18 +442,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
444
442
|
}
|
|
445
443
|
if (this.content) {
|
|
446
444
|
// Disallow interaction/selection inside when collapsed.
|
|
447
|
-
this.content.setAttribute('contenteditable',
|
|
448
|
-
}
|
|
449
|
-
} else {
|
|
450
|
-
if (this.content) {
|
|
451
|
-
this.content.setAttribute('contenteditable', this.view.editable ? 'true' : 'false');
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
if (this.input) {
|
|
455
|
-
if (!this.view.editable) {
|
|
456
|
-
this.input.setAttribute('readonly', 'true');
|
|
457
|
-
} else {
|
|
458
|
-
this.input.removeAttribute('readonly');
|
|
445
|
+
this.content.setAttribute('contenteditable', getBooleanFF('platform.editor.live-pages-expand-divergence') && this.__livePage ? !node.attrs.__expanded : node.attrs.__expanded);
|
|
459
446
|
}
|
|
460
447
|
}
|
|
461
448
|
|
|
@@ -126,6 +126,15 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
126
126
|
_defineProperty(this, "deleteEmptyExpand", function () {
|
|
127
127
|
var state = _this.view.state;
|
|
128
128
|
var expandNode = _this.node;
|
|
129
|
+
if (!_this.input) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
var _this$input = _this.input,
|
|
133
|
+
selectionStart = _this$input.selectionStart,
|
|
134
|
+
selectionEnd = _this$input.selectionEnd;
|
|
135
|
+
if (selectionStart !== selectionEnd || selectionStart !== 0) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
129
138
|
if (expandNode && isEmptyNode(state.schema)(expandNode)) {
|
|
130
139
|
var _this$api;
|
|
131
140
|
deleteExpand((_this$api = _this.api) === null || _this$api === void 0 || (_this$api = _this$api.analytics) === null || _this$api === void 0 ? void 0 : _this$api.actions)(state, _this.view.dispatch);
|
|
@@ -171,10 +180,10 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
171
180
|
if (typeof pos !== 'number') {
|
|
172
181
|
return;
|
|
173
182
|
}
|
|
174
|
-
var _this$
|
|
175
|
-
value = _this$
|
|
176
|
-
selectionStart = _this$
|
|
177
|
-
selectionEnd = _this$
|
|
183
|
+
var _this$input2 = _this.input,
|
|
184
|
+
value = _this$input2.value,
|
|
185
|
+
selectionStart = _this$input2.selectionStart,
|
|
186
|
+
selectionEnd = _this$input2.selectionEnd;
|
|
178
187
|
if (selectionStart === selectionEnd && selectionStart === value.length) {
|
|
179
188
|
var _this$view4 = _this.view,
|
|
180
189
|
state = _this$view4.state,
|
|
@@ -192,9 +201,9 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
192
201
|
if (typeof pos !== 'number') {
|
|
193
202
|
return;
|
|
194
203
|
}
|
|
195
|
-
var _this$
|
|
196
|
-
selectionStart = _this$
|
|
197
|
-
selectionEnd = _this$
|
|
204
|
+
var _this$input3 = _this.input,
|
|
205
|
+
selectionStart = _this$input3.selectionStart,
|
|
206
|
+
selectionEnd = _this$input3.selectionEnd;
|
|
198
207
|
if (selectionStart === selectionEnd && selectionStart === 0) {
|
|
199
208
|
event.preventDefault();
|
|
200
209
|
var _this$view5 = _this.view,
|
|
@@ -212,10 +221,10 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
212
221
|
if (typeof pos !== 'number') {
|
|
213
222
|
return;
|
|
214
223
|
}
|
|
215
|
-
var _this$
|
|
216
|
-
value = _this$
|
|
217
|
-
selectionStart = _this$
|
|
218
|
-
selectionEnd = _this$
|
|
224
|
+
var _this$input4 = _this.input,
|
|
225
|
+
value = _this$input4.value,
|
|
226
|
+
selectionStart = _this$input4.selectionStart,
|
|
227
|
+
selectionEnd = _this$input4.selectionEnd;
|
|
219
228
|
if (selectionStart === selectionEnd && selectionStart === value.length) {
|
|
220
229
|
event.preventDefault();
|
|
221
230
|
var _this$view6 = _this.view,
|
|
@@ -239,9 +248,9 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
239
248
|
if (typeof pos !== 'number') {
|
|
240
249
|
return;
|
|
241
250
|
}
|
|
242
|
-
var _this$
|
|
243
|
-
selectionStart = _this$
|
|
244
|
-
selectionEnd = _this$
|
|
251
|
+
var _this$input5 = _this.input,
|
|
252
|
+
selectionStart = _this$input5.selectionStart,
|
|
253
|
+
selectionEnd = _this$input5.selectionEnd;
|
|
245
254
|
if (selectionStart === selectionEnd && selectionStart === 0) {
|
|
246
255
|
var _this$api2;
|
|
247
256
|
event.preventDefault();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-expand",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"description": "Expand plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@atlaskit/adf-schema": "^35.8.0",
|
|
37
37
|
"@atlaskit/button": "^17.12.0",
|
|
38
|
-
"@atlaskit/editor-common": "^78.
|
|
38
|
+
"@atlaskit/editor-common": "^78.27.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",
|