@atlaskit/editor-plugin-expand 1.3.0 → 1.3.1
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
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-expand
|
|
2
2
|
|
|
3
|
+
## 1.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#89499](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/89499) [`1a3ac47ce689`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1a3ac47ce689) - ED-22666 Disable editing when editor in view mode or edtable is false
|
|
8
|
+
|
|
3
9
|
## 1.3.0
|
|
4
10
|
|
|
5
11
|
### Minor 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, editable) {
|
|
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,11 +50,13 @@ var toDOM = function toDOM(node, __livePage, intl) {
|
|
|
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'
|
|
53
|
+
type: 'text',
|
|
54
|
+
readonly: !editable ? 'true' : undefined
|
|
54
55
|
}]]],
|
|
55
56
|
// prettier-ignore
|
|
56
57
|
['div', {
|
|
57
|
-
'class': _styles.expandClassNames.content
|
|
58
|
+
'class': _styles.expandClassNames.content,
|
|
59
|
+
contenteditable: editable
|
|
58
60
|
}, 0]];
|
|
59
61
|
};
|
|
60
62
|
var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
@@ -361,7 +363,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
361
363
|
this.selectNearNode = selectNearNode;
|
|
362
364
|
this.__livePage = __livePage;
|
|
363
365
|
this.intl = getIntl();
|
|
364
|
-
var _DOMSerializer$render = _model.DOMSerializer.renderSpec(document, toDOM(node, this.__livePage, this.intl)),
|
|
366
|
+
var _DOMSerializer$render = _model.DOMSerializer.renderSpec(document, toDOM(node, this.__livePage, this.intl, view.editable)),
|
|
365
367
|
dom = _DOMSerializer$render.dom,
|
|
366
368
|
contentDOM = _DOMSerializer$render.contentDOM;
|
|
367
369
|
this.allowInteractiveExpand = allowInteractiveExpand;
|
|
@@ -450,7 +452,18 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
450
452
|
}
|
|
451
453
|
if (this.content) {
|
|
452
454
|
// Disallow interaction/selection inside when collapsed.
|
|
453
|
-
this.content.setAttribute('contenteditable', (0, _platformFeatureFlags.getBooleanFF)('platform.editor.live-pages-expand-divergence') && this.__livePage ? !node.attrs.__expanded : node.attrs.__expanded);
|
|
455
|
+
this.content.setAttribute('contenteditable', this.view.editable && ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.live-pages-expand-divergence') && this.__livePage ? !node.attrs.__expanded : node.attrs.__expanded));
|
|
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');
|
|
454
467
|
}
|
|
455
468
|
}
|
|
456
469
|
|
|
@@ -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) => ['div', {
|
|
17
|
+
const toDOM = (node, __livePage, intl, editable) => ['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,11 +39,13 @@ const toDOM = (node, __livePage, intl) => ['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'
|
|
42
|
+
type: 'text',
|
|
43
|
+
readonly: !editable ? 'true' : undefined
|
|
43
44
|
}]]],
|
|
44
45
|
// prettier-ignore
|
|
45
46
|
['div', {
|
|
46
|
-
'class': expandClassNames.content
|
|
47
|
+
'class': expandClassNames.content,
|
|
48
|
+
contenteditable: editable
|
|
47
49
|
}, 0]];
|
|
48
50
|
export class ExpandNodeView {
|
|
49
51
|
constructor(node, view, getPos, getIntl, isMobile, selectNearNode, api, allowInteractiveExpand = true, __livePage = false) {
|
|
@@ -364,7 +366,7 @@ export class ExpandNodeView {
|
|
|
364
366
|
const {
|
|
365
367
|
dom,
|
|
366
368
|
contentDOM
|
|
367
|
-
} = DOMSerializer.renderSpec(document, toDOM(node, this.__livePage, this.intl));
|
|
369
|
+
} = DOMSerializer.renderSpec(document, toDOM(node, this.__livePage, this.intl, view.editable));
|
|
368
370
|
this.allowInteractiveExpand = allowInteractiveExpand;
|
|
369
371
|
this.getPos = getPos;
|
|
370
372
|
this.view = view;
|
|
@@ -441,7 +443,18 @@ export class ExpandNodeView {
|
|
|
441
443
|
}
|
|
442
444
|
if (this.content) {
|
|
443
445
|
// Disallow interaction/selection inside when collapsed.
|
|
444
|
-
this.content.setAttribute('contenteditable', getBooleanFF('platform.editor.live-pages-expand-divergence') && this.__livePage ? !node.attrs.__expanded : node.attrs.__expanded);
|
|
446
|
+
this.content.setAttribute('contenteditable', this.view.editable && (getBooleanFF('platform.editor.live-pages-expand-divergence') && this.__livePage ? !node.attrs.__expanded : node.attrs.__expanded));
|
|
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');
|
|
445
458
|
}
|
|
446
459
|
}
|
|
447
460
|
|
|
@@ -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, editable) {
|
|
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,11 +42,13 @@ var toDOM = function toDOM(node, __livePage, intl) {
|
|
|
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'
|
|
45
|
+
type: 'text',
|
|
46
|
+
readonly: !editable ? 'true' : undefined
|
|
46
47
|
}]]],
|
|
47
48
|
// prettier-ignore
|
|
48
49
|
['div', {
|
|
49
|
-
'class': expandClassNames.content
|
|
50
|
+
'class': expandClassNames.content,
|
|
51
|
+
contenteditable: editable
|
|
50
52
|
}, 0]];
|
|
51
53
|
};
|
|
52
54
|
export var ExpandNodeView = /*#__PURE__*/function () {
|
|
@@ -353,7 +355,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
353
355
|
this.selectNearNode = selectNearNode;
|
|
354
356
|
this.__livePage = __livePage;
|
|
355
357
|
this.intl = getIntl();
|
|
356
|
-
var _DOMSerializer$render = DOMSerializer.renderSpec(document, toDOM(node, this.__livePage, this.intl)),
|
|
358
|
+
var _DOMSerializer$render = DOMSerializer.renderSpec(document, toDOM(node, this.__livePage, this.intl, view.editable)),
|
|
357
359
|
dom = _DOMSerializer$render.dom,
|
|
358
360
|
contentDOM = _DOMSerializer$render.contentDOM;
|
|
359
361
|
this.allowInteractiveExpand = allowInteractiveExpand;
|
|
@@ -442,7 +444,18 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
442
444
|
}
|
|
443
445
|
if (this.content) {
|
|
444
446
|
// Disallow interaction/selection inside when collapsed.
|
|
445
|
-
this.content.setAttribute('contenteditable', getBooleanFF('platform.editor.live-pages-expand-divergence') && this.__livePage ? !node.attrs.__expanded : node.attrs.__expanded);
|
|
447
|
+
this.content.setAttribute('contenteditable', this.view.editable && (getBooleanFF('platform.editor.live-pages-expand-divergence') && this.__livePage ? !node.attrs.__expanded : node.attrs.__expanded));
|
|
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');
|
|
446
459
|
}
|
|
447
460
|
}
|
|
448
461
|
|
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.1",
|
|
4
4
|
"description": "Expand plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@atlaskit/adf-schema": "^35.8.0",
|
|
37
|
-
"@atlaskit/button": "^17.
|
|
38
|
-
"@atlaskit/editor-common": "^78.
|
|
37
|
+
"@atlaskit/button": "^17.12.0",
|
|
38
|
+
"@atlaskit/editor-common": "^78.26.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",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@atlaskit/editor-tables": "^2.6.0",
|
|
45
45
|
"@atlaskit/icon": "^22.1.0",
|
|
46
46
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
47
|
-
"@atlaskit/tooltip": "^18.
|
|
47
|
+
"@atlaskit/tooltip": "^18.2.0",
|
|
48
48
|
"@babel/runtime": "^7.0.0",
|
|
49
49
|
"@emotion/react": "^11.7.1",
|
|
50
50
|
"w3c-keyname": "^2.1.8"
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@atlaskit/editor-plugin-content-insertion": "^1.0.0",
|
|
60
60
|
"@atlaskit/editor-plugin-guideline": "^1.0.0",
|
|
61
61
|
"@atlaskit/editor-plugin-quick-insert": "^1.0.0",
|
|
62
|
-
"@atlaskit/editor-plugin-table": "^7.
|
|
62
|
+
"@atlaskit/editor-plugin-table": "^7.7.0",
|
|
63
63
|
"@atlaskit/editor-plugin-type-ahead": "^1.0.0",
|
|
64
64
|
"@atlaskit/editor-plugin-width": "^1.0.0",
|
|
65
65
|
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
|