@atlaskit/editor-plugin-expand 30.0.1 → 30.0.3
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 +15 -0
- package/dist/cjs/legacyExpand/nodeviews/index.js +12 -1
- package/dist/cjs/singlePlayerExpand/node-views/index.js +12 -1
- package/dist/cjs/ui/renderExpandButton.js +48 -0
- package/dist/es2019/legacyExpand/nodeviews/index.js +12 -1
- package/dist/es2019/singlePlayerExpand/node-views/index.js +12 -1
- package/dist/es2019/ui/renderExpandButton.js +43 -0
- package/dist/esm/legacyExpand/nodeviews/index.js +12 -1
- package/dist/esm/singlePlayerExpand/node-views/index.js +12 -1
- package/dist/esm/ui/renderExpandButton.js +42 -0
- package/dist/types/ui/renderExpandButton.d.ts +9 -0
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-expand
|
|
2
2
|
|
|
3
|
+
## 30.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`892a6ad6af76e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/892a6ad6af76e) -
|
|
8
|
+
Use a native expand toggle behind the platform_editor_expand_icon_vanilla experiment while
|
|
9
|
+
preserving the selector used to reveal inline comments.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 30.0.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 30.0.1
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -29,6 +29,7 @@ var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
|
29
29
|
var _redo = require("@atlaskit/prosemirror-history/redo");
|
|
30
30
|
var _undo = require("@atlaskit/prosemirror-history/undo");
|
|
31
31
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
32
|
+
var _renderExpandButton = require("../../ui/renderExpandButton");
|
|
32
33
|
var _commands = require("../commands");
|
|
33
34
|
var _ExpandIconButton = require("../ui/ExpandIconButton");
|
|
34
35
|
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; }
|
|
@@ -625,6 +626,14 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
625
626
|
}
|
|
626
627
|
var _ref2 = node && node.attrs || this.node.attrs,
|
|
627
628
|
__expanded = _ref2.__expanded;
|
|
629
|
+
if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_expand_icon_vanilla')) {
|
|
630
|
+
(0, _renderExpandButton.renderExpandButton)(this.icon, {
|
|
631
|
+
intl: intl,
|
|
632
|
+
allowInteractiveExpand: this.allowInteractiveExpand,
|
|
633
|
+
expanded: this.__livePage ? !__expanded : __expanded
|
|
634
|
+
});
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
628
637
|
this.nodeViewPortalProviderAPI.render(function () {
|
|
629
638
|
return /*#__PURE__*/_react.default.createElement(_ExpandIconButton.ExpandIconButton, {
|
|
630
639
|
intl: intl,
|
|
@@ -756,7 +765,9 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
756
765
|
if (this.icon) {
|
|
757
766
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
758
767
|
this.icon.removeEventListener('keydown', this.handleIconKeyDown);
|
|
759
|
-
|
|
768
|
+
if (!(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_expand_icon_vanilla')) {
|
|
769
|
+
this.nodeViewPortalProviderAPI.remove(this.renderKey);
|
|
770
|
+
}
|
|
760
771
|
}
|
|
761
772
|
(_this$decorationClean2 = this.decorationCleanup) === null || _this$decorationClean2 === void 0 || _this$decorationClean2.call(this);
|
|
762
773
|
if (this.cleanUpEditorDisabledOnChange) {
|
|
@@ -27,6 +27,7 @@ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-ex
|
|
|
27
27
|
var _redo = require("@atlaskit/prosemirror-history/redo");
|
|
28
28
|
var _undo = require("@atlaskit/prosemirror-history/undo");
|
|
29
29
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
30
|
+
var _renderExpandButton = require("../../ui/renderExpandButton");
|
|
30
31
|
var _commands = require("../commands");
|
|
31
32
|
var _ExpandButton = require("../ui/ExpandButton");
|
|
32
33
|
var _NodeView = require("../ui/NodeView");
|
|
@@ -482,6 +483,14 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
482
483
|
if (!icon) {
|
|
483
484
|
return;
|
|
484
485
|
}
|
|
486
|
+
if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_expand_icon_vanilla')) {
|
|
487
|
+
(0, _renderExpandButton.renderExpandButton)(icon, {
|
|
488
|
+
intl: _this.intl,
|
|
489
|
+
allowInteractiveExpand: _this.allowInteractiveExpand,
|
|
490
|
+
expanded: expanded
|
|
491
|
+
});
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
485
494
|
_this.nodeViewPortalProviderAPI.render(function () {
|
|
486
495
|
return /*#__PURE__*/_react.default.createElement(_ExpandButton.ExpandButton, {
|
|
487
496
|
intl: _this.intl,
|
|
@@ -725,7 +734,9 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
725
734
|
if (this.cleanUpEditorDisabledOnChange) {
|
|
726
735
|
this.cleanUpEditorDisabledOnChange();
|
|
727
736
|
}
|
|
728
|
-
|
|
737
|
+
if (!(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_expand_icon_vanilla')) {
|
|
738
|
+
this.nodeViewPortalProviderAPI.remove(this.renderKey);
|
|
739
|
+
}
|
|
729
740
|
}
|
|
730
741
|
}]);
|
|
731
742
|
}();
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.renderExpandButton = renderExpandButton;
|
|
7
|
+
var _expand = require("@atlaskit/editor-common/styles/expand");
|
|
8
|
+
var _uiExpand = require("@atlaskit/editor-common/ui-expand");
|
|
9
|
+
/** Update the existing control without a React portal or tooltip positioning work. */
|
|
10
|
+
function renderExpandButton(container, _ref) {
|
|
11
|
+
var _intl$formatMessage;
|
|
12
|
+
var allowInteractiveExpand = _ref.allowInteractiveExpand,
|
|
13
|
+
expanded = _ref.expanded,
|
|
14
|
+
intl = _ref.intl;
|
|
15
|
+
var button = container.querySelector(".".concat(_expand.expandClassNames.iconButton));
|
|
16
|
+
if (!button) {
|
|
17
|
+
var doc = container.ownerDocument;
|
|
18
|
+
button = doc.createElement('button');
|
|
19
|
+
button.type = 'button';
|
|
20
|
+
// Confluence comment navigation and focusIcon locate and click iconContainer.
|
|
21
|
+
// Dropping that class broke revealing comments inside collapsed expands in ED-29205.
|
|
22
|
+
button.className = "".concat(_expand.expandClassNames.iconButton, " ").concat(_expand.expandClassNames.iconContainer);
|
|
23
|
+
var svg = doc.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
24
|
+
svg.setAttribute('class', _expand.expandClassNames.iconSvg);
|
|
25
|
+
svg.setAttribute('width', '12');
|
|
26
|
+
svg.setAttribute('height', '12');
|
|
27
|
+
svg.setAttribute('viewBox', '0 0 16 16');
|
|
28
|
+
svg.setAttribute('aria-hidden', 'true');
|
|
29
|
+
svg.setAttribute('focusable', 'false');
|
|
30
|
+
var path = doc.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
31
|
+
path.setAttribute('fill', 'currentColor');
|
|
32
|
+
// The ADS small ChevronRightIcon, matching the existing React control.
|
|
33
|
+
path.setAttribute('d', 'm6.03 1.47 6 6a.75.75 0 0 1 .052 1.004l-.052.056-6 6-1.06-1.06L10.44 8 4.97 2.53z');
|
|
34
|
+
svg.appendChild(path);
|
|
35
|
+
button.appendChild(svg);
|
|
36
|
+
container.appendChild(button);
|
|
37
|
+
}
|
|
38
|
+
var message = expanded ? _uiExpand.messages.collapseNode : _uiExpand.messages.expandNode;
|
|
39
|
+
var label = (_intl$formatMessage = intl === null || intl === void 0 ? void 0 : intl.formatMessage(message)) !== null && _intl$formatMessage !== void 0 ? _intl$formatMessage : message.defaultMessage;
|
|
40
|
+
button.setAttribute('aria-label', label);
|
|
41
|
+
button.setAttribute('aria-expanded', String(expanded));
|
|
42
|
+
button.disabled = !allowInteractiveExpand;
|
|
43
|
+
if (allowInteractiveExpand) {
|
|
44
|
+
button.title = label;
|
|
45
|
+
} else {
|
|
46
|
+
button.removeAttribute('title');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -19,6 +19,7 @@ import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
|
19
19
|
import { redo } from '@atlaskit/prosemirror-history/redo';
|
|
20
20
|
import { undo } from '@atlaskit/prosemirror-history/undo';
|
|
21
21
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
22
|
+
import { renderExpandButton } from '../../ui/renderExpandButton';
|
|
22
23
|
import { deleteExpandAtPos, setSelectionInsideExpand, toggleExpandExpanded, updateExpandTitle } from '../commands';
|
|
23
24
|
import { ExpandIconButton } from '../ui/ExpandIconButton';
|
|
24
25
|
function buildExpandClassName(type, expanded) {
|
|
@@ -628,6 +629,14 @@ export class ExpandNodeView {
|
|
|
628
629
|
const {
|
|
629
630
|
__expanded
|
|
630
631
|
} = node && node.attrs || this.node.attrs;
|
|
632
|
+
if (isExperimentEnabled('platform_editor_expand_icon_vanilla')) {
|
|
633
|
+
renderExpandButton(this.icon, {
|
|
634
|
+
intl,
|
|
635
|
+
allowInteractiveExpand: this.allowInteractiveExpand,
|
|
636
|
+
expanded: this.__livePage ? !__expanded : __expanded
|
|
637
|
+
});
|
|
638
|
+
return;
|
|
639
|
+
}
|
|
631
640
|
this.nodeViewPortalProviderAPI.render(() => /*#__PURE__*/React.createElement(ExpandIconButton, {
|
|
632
641
|
intl: intl,
|
|
633
642
|
allowInteractiveExpand: this.allowInteractiveExpand,
|
|
@@ -740,7 +749,9 @@ export class ExpandNodeView {
|
|
|
740
749
|
if (this.icon) {
|
|
741
750
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
742
751
|
this.icon.removeEventListener('keydown', this.handleIconKeyDown);
|
|
743
|
-
|
|
752
|
+
if (!isExperimentEnabled('platform_editor_expand_icon_vanilla')) {
|
|
753
|
+
this.nodeViewPortalProviderAPI.remove(this.renderKey);
|
|
754
|
+
}
|
|
744
755
|
}
|
|
745
756
|
(_this$decorationClean2 = this.decorationCleanup) === null || _this$decorationClean2 === void 0 ? void 0 : _this$decorationClean2.call(this);
|
|
746
757
|
if (this.cleanUpEditorDisabledOnChange) {
|
|
@@ -18,6 +18,7 @@ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-e
|
|
|
18
18
|
import { redo } from '@atlaskit/prosemirror-history/redo';
|
|
19
19
|
import { undo } from '@atlaskit/prosemirror-history/undo';
|
|
20
20
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
21
|
+
import { renderExpandButton } from '../../ui/renderExpandButton';
|
|
21
22
|
import { deleteExpand, setSelectionInsideExpand, toggleExpandExpanded, updateExpandTitle } from '../commands';
|
|
22
23
|
import { ExpandButton } from '../ui/ExpandButton';
|
|
23
24
|
import { buildExpandClassName, getExpandBodyAriaLabel, toDOM } from '../ui/NodeView';
|
|
@@ -486,6 +487,14 @@ export class ExpandNodeView {
|
|
|
486
487
|
if (!icon) {
|
|
487
488
|
return;
|
|
488
489
|
}
|
|
490
|
+
if (isExperimentEnabled('platform_editor_expand_icon_vanilla')) {
|
|
491
|
+
renderExpandButton(icon, {
|
|
492
|
+
intl: this.intl,
|
|
493
|
+
allowInteractiveExpand: this.allowInteractiveExpand,
|
|
494
|
+
expanded
|
|
495
|
+
});
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
489
498
|
this.nodeViewPortalProviderAPI.render(() => /*#__PURE__*/React.createElement(ExpandButton, {
|
|
490
499
|
intl: this.intl,
|
|
491
500
|
allowInteractiveExpand: this.allowInteractiveExpand,
|
|
@@ -703,7 +712,9 @@ export class ExpandNodeView {
|
|
|
703
712
|
if (this.cleanUpEditorDisabledOnChange) {
|
|
704
713
|
this.cleanUpEditorDisabledOnChange();
|
|
705
714
|
}
|
|
706
|
-
|
|
715
|
+
if (!isExperimentEnabled('platform_editor_expand_icon_vanilla')) {
|
|
716
|
+
this.nodeViewPortalProviderAPI.remove(this.renderKey);
|
|
717
|
+
}
|
|
707
718
|
}
|
|
708
719
|
}
|
|
709
720
|
export default function ({
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { expandClassNames } from '@atlaskit/editor-common/styles/expand';
|
|
2
|
+
import { messages } from '@atlaskit/editor-common/ui-expand';
|
|
3
|
+
/** Update the existing control without a React portal or tooltip positioning work. */
|
|
4
|
+
export function renderExpandButton(container, {
|
|
5
|
+
allowInteractiveExpand,
|
|
6
|
+
expanded,
|
|
7
|
+
intl
|
|
8
|
+
}) {
|
|
9
|
+
var _intl$formatMessage;
|
|
10
|
+
let button = container.querySelector(`.${expandClassNames.iconButton}`);
|
|
11
|
+
if (!button) {
|
|
12
|
+
const doc = container.ownerDocument;
|
|
13
|
+
button = doc.createElement('button');
|
|
14
|
+
button.type = 'button';
|
|
15
|
+
// Confluence comment navigation and focusIcon locate and click iconContainer.
|
|
16
|
+
// Dropping that class broke revealing comments inside collapsed expands in ED-29205.
|
|
17
|
+
button.className = `${expandClassNames.iconButton} ${expandClassNames.iconContainer}`;
|
|
18
|
+
const svg = doc.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
19
|
+
svg.setAttribute('class', expandClassNames.iconSvg);
|
|
20
|
+
svg.setAttribute('width', '12');
|
|
21
|
+
svg.setAttribute('height', '12');
|
|
22
|
+
svg.setAttribute('viewBox', '0 0 16 16');
|
|
23
|
+
svg.setAttribute('aria-hidden', 'true');
|
|
24
|
+
svg.setAttribute('focusable', 'false');
|
|
25
|
+
const path = doc.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
26
|
+
path.setAttribute('fill', 'currentColor');
|
|
27
|
+
// The ADS small ChevronRightIcon, matching the existing React control.
|
|
28
|
+
path.setAttribute('d', 'm6.03 1.47 6 6a.75.75 0 0 1 .052 1.004l-.052.056-6 6-1.06-1.06L10.44 8 4.97 2.53z');
|
|
29
|
+
svg.appendChild(path);
|
|
30
|
+
button.appendChild(svg);
|
|
31
|
+
container.appendChild(button);
|
|
32
|
+
}
|
|
33
|
+
const message = expanded ? messages.collapseNode : messages.expandNode;
|
|
34
|
+
const label = (_intl$formatMessage = intl === null || intl === void 0 ? void 0 : intl.formatMessage(message)) !== null && _intl$formatMessage !== void 0 ? _intl$formatMessage : message.defaultMessage;
|
|
35
|
+
button.setAttribute('aria-label', label);
|
|
36
|
+
button.setAttribute('aria-expanded', String(expanded));
|
|
37
|
+
button.disabled = !allowInteractiveExpand;
|
|
38
|
+
if (allowInteractiveExpand) {
|
|
39
|
+
button.title = label;
|
|
40
|
+
} else {
|
|
41
|
+
button.removeAttribute('title');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -23,6 +23,7 @@ import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
|
23
23
|
import { redo } from '@atlaskit/prosemirror-history/redo';
|
|
24
24
|
import { undo } from '@atlaskit/prosemirror-history/undo';
|
|
25
25
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
26
|
+
import { renderExpandButton } from '../../ui/renderExpandButton';
|
|
26
27
|
import { deleteExpandAtPos, setSelectionInsideExpand, toggleExpandExpanded, updateExpandTitle } from '../commands';
|
|
27
28
|
import { ExpandIconButton } from '../ui/ExpandIconButton';
|
|
28
29
|
function buildExpandClassName(type, expanded) {
|
|
@@ -617,6 +618,14 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
617
618
|
}
|
|
618
619
|
var _ref2 = node && node.attrs || this.node.attrs,
|
|
619
620
|
__expanded = _ref2.__expanded;
|
|
621
|
+
if (isExperimentEnabled('platform_editor_expand_icon_vanilla')) {
|
|
622
|
+
renderExpandButton(this.icon, {
|
|
623
|
+
intl: intl,
|
|
624
|
+
allowInteractiveExpand: this.allowInteractiveExpand,
|
|
625
|
+
expanded: this.__livePage ? !__expanded : __expanded
|
|
626
|
+
});
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
620
629
|
this.nodeViewPortalProviderAPI.render(function () {
|
|
621
630
|
return /*#__PURE__*/React.createElement(ExpandIconButton, {
|
|
622
631
|
intl: intl,
|
|
@@ -748,7 +757,9 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
748
757
|
if (this.icon) {
|
|
749
758
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
750
759
|
this.icon.removeEventListener('keydown', this.handleIconKeyDown);
|
|
751
|
-
|
|
760
|
+
if (!isExperimentEnabled('platform_editor_expand_icon_vanilla')) {
|
|
761
|
+
this.nodeViewPortalProviderAPI.remove(this.renderKey);
|
|
762
|
+
}
|
|
752
763
|
}
|
|
753
764
|
(_this$decorationClean2 = this.decorationCleanup) === null || _this$decorationClean2 === void 0 || _this$decorationClean2.call(this);
|
|
754
765
|
if (this.cleanUpEditorDisabledOnChange) {
|
|
@@ -20,6 +20,7 @@ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-e
|
|
|
20
20
|
import { redo } from '@atlaskit/prosemirror-history/redo';
|
|
21
21
|
import { undo } from '@atlaskit/prosemirror-history/undo';
|
|
22
22
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
23
|
+
import { renderExpandButton } from '../../ui/renderExpandButton';
|
|
23
24
|
import { deleteExpand, setSelectionInsideExpand, toggleExpandExpanded, updateExpandTitle } from '../commands';
|
|
24
25
|
import { ExpandButton } from '../ui/ExpandButton';
|
|
25
26
|
import { buildExpandClassName, getExpandBodyAriaLabel, toDOM } from '../ui/NodeView';
|
|
@@ -474,6 +475,14 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
474
475
|
if (!icon) {
|
|
475
476
|
return;
|
|
476
477
|
}
|
|
478
|
+
if (isExperimentEnabled('platform_editor_expand_icon_vanilla')) {
|
|
479
|
+
renderExpandButton(icon, {
|
|
480
|
+
intl: _this.intl,
|
|
481
|
+
allowInteractiveExpand: _this.allowInteractiveExpand,
|
|
482
|
+
expanded: expanded
|
|
483
|
+
});
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
477
486
|
_this.nodeViewPortalProviderAPI.render(function () {
|
|
478
487
|
return /*#__PURE__*/React.createElement(ExpandButton, {
|
|
479
488
|
intl: _this.intl,
|
|
@@ -717,7 +726,9 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
717
726
|
if (this.cleanUpEditorDisabledOnChange) {
|
|
718
727
|
this.cleanUpEditorDisabledOnChange();
|
|
719
728
|
}
|
|
720
|
-
|
|
729
|
+
if (!isExperimentEnabled('platform_editor_expand_icon_vanilla')) {
|
|
730
|
+
this.nodeViewPortalProviderAPI.remove(this.renderKey);
|
|
731
|
+
}
|
|
721
732
|
}
|
|
722
733
|
}]);
|
|
723
734
|
}();
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { expandClassNames } from '@atlaskit/editor-common/styles/expand';
|
|
2
|
+
import { messages } from '@atlaskit/editor-common/ui-expand';
|
|
3
|
+
/** Update the existing control without a React portal or tooltip positioning work. */
|
|
4
|
+
export function renderExpandButton(container, _ref) {
|
|
5
|
+
var _intl$formatMessage;
|
|
6
|
+
var allowInteractiveExpand = _ref.allowInteractiveExpand,
|
|
7
|
+
expanded = _ref.expanded,
|
|
8
|
+
intl = _ref.intl;
|
|
9
|
+
var button = container.querySelector(".".concat(expandClassNames.iconButton));
|
|
10
|
+
if (!button) {
|
|
11
|
+
var doc = container.ownerDocument;
|
|
12
|
+
button = doc.createElement('button');
|
|
13
|
+
button.type = 'button';
|
|
14
|
+
// Confluence comment navigation and focusIcon locate and click iconContainer.
|
|
15
|
+
// Dropping that class broke revealing comments inside collapsed expands in ED-29205.
|
|
16
|
+
button.className = "".concat(expandClassNames.iconButton, " ").concat(expandClassNames.iconContainer);
|
|
17
|
+
var svg = doc.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
18
|
+
svg.setAttribute('class', expandClassNames.iconSvg);
|
|
19
|
+
svg.setAttribute('width', '12');
|
|
20
|
+
svg.setAttribute('height', '12');
|
|
21
|
+
svg.setAttribute('viewBox', '0 0 16 16');
|
|
22
|
+
svg.setAttribute('aria-hidden', 'true');
|
|
23
|
+
svg.setAttribute('focusable', 'false');
|
|
24
|
+
var path = doc.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
25
|
+
path.setAttribute('fill', 'currentColor');
|
|
26
|
+
// The ADS small ChevronRightIcon, matching the existing React control.
|
|
27
|
+
path.setAttribute('d', 'm6.03 1.47 6 6a.75.75 0 0 1 .052 1.004l-.052.056-6 6-1.06-1.06L10.44 8 4.97 2.53z');
|
|
28
|
+
svg.appendChild(path);
|
|
29
|
+
button.appendChild(svg);
|
|
30
|
+
container.appendChild(button);
|
|
31
|
+
}
|
|
32
|
+
var message = expanded ? messages.collapseNode : messages.expandNode;
|
|
33
|
+
var label = (_intl$formatMessage = intl === null || intl === void 0 ? void 0 : intl.formatMessage(message)) !== null && _intl$formatMessage !== void 0 ? _intl$formatMessage : message.defaultMessage;
|
|
34
|
+
button.setAttribute('aria-label', label);
|
|
35
|
+
button.setAttribute('aria-expanded', String(expanded));
|
|
36
|
+
button.disabled = !allowInteractiveExpand;
|
|
37
|
+
if (allowInteractiveExpand) {
|
|
38
|
+
button.title = label;
|
|
39
|
+
} else {
|
|
40
|
+
button.removeAttribute('title');
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IntlShape } from 'react-intl';
|
|
2
|
+
interface ExpandButtonProps {
|
|
3
|
+
allowInteractiveExpand: boolean;
|
|
4
|
+
expanded: boolean;
|
|
5
|
+
intl?: IntlShape;
|
|
6
|
+
}
|
|
7
|
+
/** Update the existing control without a React portal or tooltip positioning work. */
|
|
8
|
+
export declare function renderExpandButton(container: HTMLElement, { allowInteractiveExpand, expanded, intl }: ExpandButtonProps): void;
|
|
9
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-expand",
|
|
3
|
-
"version": "30.0.
|
|
3
|
+
"version": "30.0.3",
|
|
4
4
|
"description": "Expand plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"atlaskit:src": "src/index.ts",
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@atlaskit/adf-schema": "^57.7.0",
|
|
25
|
-
"@atlaskit/button": "^25.
|
|
25
|
+
"@atlaskit/button": "^25.6.0",
|
|
26
26
|
"@atlaskit/editor-plugin-analytics": "^29.0.0",
|
|
27
|
-
"@atlaskit/editor-plugin-block-controls": "^30.
|
|
27
|
+
"@atlaskit/editor-plugin-block-controls": "^30.1.0",
|
|
28
28
|
"@atlaskit/editor-plugin-block-menu": "^28.0.0",
|
|
29
29
|
"@atlaskit/editor-plugin-decorations": "^29.0.0",
|
|
30
30
|
"@atlaskit/editor-plugin-editor-disabled": "^29.0.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@atlaskit/editor-plugin-selection": "^29.0.0",
|
|
35
35
|
"@atlaskit/editor-plugin-selection-marker": "^29.0.0",
|
|
36
36
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
37
|
-
"@atlaskit/editor-shared-styles": "^4.
|
|
37
|
+
"@atlaskit/editor-shared-styles": "^4.6.0",
|
|
38
38
|
"@atlaskit/editor-tables": "^3.2.0",
|
|
39
39
|
"@atlaskit/editor-toolbar": "^2.8.0",
|
|
40
40
|
"@atlaskit/editor-ui-control-model": "^2.10.0",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
45
45
|
"@atlaskit/prosemirror-history": "^1.3.0",
|
|
46
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
46
|
+
"@atlaskit/tmp-editor-statsig": "^244.0.0",
|
|
47
47
|
"@atlaskit/tokens": "^20.6.0",
|
|
48
48
|
"@atlaskit/tooltip": "^24.4.0",
|
|
49
49
|
"@babel/runtime": "^7.0.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"w3c-keyname": "^2.1.8"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@atlaskit/editor-common": "^133.
|
|
55
|
+
"@atlaskit/editor-common": "^133.3.0",
|
|
56
56
|
"react": "^18.2.0 || ^19.2.0",
|
|
57
57
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
58
58
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|