@atlaskit/editor-plugin-expand 23.0.1 → 23.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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/editor-plugin-expand
2
2
 
3
+ ## 23.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 23.0.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [`f2cc6b030e5c6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f2cc6b030e5c6) -
14
+ Clean up experiment `platform_editor_vc90_transition_expand_icon`.
15
+ - Updated dependencies
16
+
3
17
  ## 23.0.1
4
18
 
5
19
  ### Patch Changes
@@ -15,7 +15,6 @@ var _utils = require("@atlaskit/editor-common/utils");
15
15
  var _state2 = require("@atlaskit/editor-prosemirror/state");
16
16
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
17
17
  var _utils3 = require("@atlaskit/editor-tables/utils");
18
- var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
19
18
  var _utils4 = require("../utils");
20
19
  var _pluginFactory = require("./pm-plugins/plugin-factory");
21
20
  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; }
@@ -207,9 +206,7 @@ var focusIcon = exports.focusIcon = function focusIcon(expand) {
207
206
  if (!(expand instanceof HTMLElement)) {
208
207
  return false;
209
208
  }
210
-
211
- // TODO: ED-29205 - During platform_editor_vc90_transition_expand_icon cleanup, rename `iconContainer` to `iconButton`.
212
- var iconContainer = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_vc90_transition_expand_icon') ? expand.querySelector(".".concat(_styles.expandClassNames.iconButton)) : expand.querySelector(".".concat(_styles.expandClassNames.iconContainer));
209
+ var iconContainer = expand.querySelector(".".concat(_styles.expandClassNames.iconContainer));
213
210
  if (iconContainer && iconContainer.focus) {
214
211
  var tr = state.tr;
215
212
  var pos = state.selection.from;
@@ -26,7 +26,6 @@ var _fg = require("@atlaskit/platform-feature-flags/fg");
26
26
  var _redo = require("@atlaskit/prosemirror-history/redo");
27
27
  var _undo = require("@atlaskit/prosemirror-history/undo");
28
28
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
29
- var _renderExpandButton = require("../../ui/renderExpandButton");
30
29
  var _commands = require("../commands");
31
30
  var _ExpandIconButton = require("../ui/ExpandIconButton");
32
31
  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; }
@@ -567,11 +566,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
567
566
  });
568
567
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
569
568
  this.renderKey = (0, _uuid.v4)();
570
- if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_vc90_transition_expand_icon')) {
571
- this.renderNativeIcon(this.node);
572
- } else {
573
- this.renderIcon(this.intl);
574
- }
569
+ this.renderIcon(this.intl);
575
570
  this.initHandlers();
576
571
  }
577
572
  return (0, _createClass2.default)(ExpandNodeView, [{
@@ -620,19 +615,6 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
620
615
  });
621
616
  }
622
617
  }
623
- }, {
624
- key: "renderNativeIcon",
625
- value: function renderNativeIcon(node) {
626
- if (!this.icon) {
627
- return;
628
- }
629
- var __expanded = node.attrs.__expanded;
630
- (0, _renderExpandButton.renderExpandButton)(this.icon, {
631
- expanded: this.__livePage ? !__expanded : __expanded,
632
- allowInteractiveExpand: this.allowInteractiveExpand,
633
- intl: this.intl
634
- });
635
- }
636
618
  }, {
637
619
  key: "renderIcon",
638
620
  value: function renderIcon(intl, node) {
@@ -720,11 +702,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
720
702
  // we toggle a class name to hide the content and animate the chevron.
721
703
  if (this.dom) {
722
704
  this.dom.classList.toggle(_styles.expandClassNames.expanded);
723
- if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_vc90_transition_expand_icon')) {
724
- this.renderNativeIcon(node);
725
- } else {
726
- this.renderIcon(this && this.intl, node);
727
- }
705
+ this.renderIcon(this.intl, node);
728
706
  }
729
707
  if (this.content) {
730
708
  // Disallow interaction/selection inside when collapsed.
@@ -17,7 +17,6 @@ var _utils = require("@atlaskit/editor-common/utils");
17
17
  var _state2 = require("@atlaskit/editor-prosemirror/state");
18
18
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
19
19
  var _utils3 = require("@atlaskit/editor-tables/utils");
20
- var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
21
20
  var _fg = require("@atlaskit/platform-feature-flags/fg");
22
21
  var _utils4 = require("../utils");
23
22
  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; }
@@ -244,9 +243,7 @@ var focusIcon = exports.focusIcon = function focusIcon(expand) {
244
243
  if (!(expand instanceof HTMLElement)) {
245
244
  return false;
246
245
  }
247
-
248
- // TODO: ED-29205 - During platform_editor_vc90_transition_expand_icon cleanup, rename `iconContainer` to `iconButton`.
249
- var iconContainer = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_vc90_transition_expand_icon') ? expand.querySelector(".".concat(_styles.expandClassNames.iconButton)) : expand.querySelector(".".concat(_styles.expandClassNames.iconContainer));
246
+ var iconContainer = expand.querySelector(".".concat(_styles.expandClassNames.iconContainer));
250
247
  if (iconContainer && iconContainer.focus) {
251
248
  var tr = state.tr;
252
249
  var pos = state.selection.from;
@@ -24,7 +24,6 @@ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-ex
24
24
  var _redo = require("@atlaskit/prosemirror-history/redo");
25
25
  var _undo = require("@atlaskit/prosemirror-history/undo");
26
26
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
27
- var _renderExpandButton = require("../../ui/renderExpandButton");
28
27
  var _commands = require("../commands");
29
28
  var _ExpandButton = require("../ui/ExpandButton");
30
29
  var _NodeView = require("../ui/NodeView");
@@ -528,11 +527,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
528
527
  height: (0, _contentVisibility.estimateExpandIntrinsicHeight)(_this.node, !(0, _expand.isExpandCollapsed)(_this.node))
529
528
  };
530
529
  });
531
- if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_vc90_transition_expand_icon')) {
532
- this.renderNativeIcon(this.node);
533
- } else {
534
- this.renderIcon(this.icon, !(0, _expand.isExpandCollapsed)(this.node));
535
- }
530
+ this.renderIcon(this.icon, !(0, _expand.isExpandCollapsed)(this.node));
536
531
  if (!this.input || !this.titleContainer || !this.icon) {
537
532
  return;
538
533
  }
@@ -659,6 +654,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
659
654
  value: function updateExpandToggleIcon(node) {
660
655
  var expanded = _expand.expandedState.get(node) ? _expand.expandedState.get(node) : false;
661
656
  if (this.dom && expanded !== undefined) {
657
+ var _this$icon, _expandedState$get3;
662
658
  var classes = this.dom.className.split(' ');
663
659
  // find & replace styles might be applied to the expand title and we need to keep them
664
660
  var findReplaceDecorationsApplied = classes.filter(function (className) {
@@ -666,12 +662,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
666
662
  }).join(' ');
667
663
  this.dom.className = findReplaceDecorationsApplied ? (0, _NodeView.buildExpandClassName)(node.type.name, expanded) + " ".concat(findReplaceDecorationsApplied) : (0, _NodeView.buildExpandClassName)(node.type.name, expanded);
668
664
  // Re-render the icon to update the aria-expanded attribute
669
- if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_vc90_transition_expand_icon')) {
670
- this.renderNativeIcon(node);
671
- } else {
672
- var _expandedState$get3;
673
- this.renderIcon(this.icon ? this.icon : null, (_expandedState$get3 = _expand.expandedState.get(node)) !== null && _expandedState$get3 !== void 0 ? _expandedState$get3 : false);
674
- }
665
+ this.renderIcon((_this$icon = this.icon) !== null && _this$icon !== void 0 ? _this$icon : null, (_expandedState$get3 = _expand.expandedState.get(node)) !== null && _expandedState$get3 !== void 0 ? _expandedState$get3 : false);
675
666
  }
676
667
  this.updateExpandBodyContentEditable();
677
668
  this.isExpanded = {
@@ -715,18 +706,6 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
715
706
  this.content.setAttribute('contenteditable', this.getContentEditable(this.node) ? 'true' : 'false');
716
707
  }
717
708
  }
718
- }, {
719
- key: "renderNativeIcon",
720
- value: function renderNativeIcon(node) {
721
- if (!this.icon) {
722
- return;
723
- }
724
- (0, _renderExpandButton.renderExpandButton)(this.icon, {
725
- expanded: !(0, _expand.isExpandCollapsed)(node),
726
- allowInteractiveExpand: this.allowInteractiveExpand,
727
- intl: this.intl
728
- });
729
- }
730
709
  }, {
731
710
  key: "destroy",
732
711
  value: function destroy() {
@@ -7,7 +7,6 @@ import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
7
7
  import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
8
8
  import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
9
9
  import { findTable } from '@atlaskit/editor-tables/utils';
10
- import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
11
10
  import { isNestedInExpand } from '../utils';
12
11
  import { createCommand } from './pm-plugins/plugin-factory';
13
12
  export const setExpandRef = ref => createCommand({
@@ -187,9 +186,7 @@ export const focusIcon = expand => (state, dispatch, editorView) => {
187
186
  if (!(expand instanceof HTMLElement)) {
188
187
  return false;
189
188
  }
190
-
191
- // TODO: ED-29205 - During platform_editor_vc90_transition_expand_icon cleanup, rename `iconContainer` to `iconButton`.
192
- const iconContainer = isExperimentEnabled('platform_editor_vc90_transition_expand_icon') ? expand.querySelector(`.${expandClassNames.iconButton}`) : expand.querySelector(`.${expandClassNames.iconContainer}`);
189
+ const iconContainer = expand.querySelector(`.${expandClassNames.iconContainer}`);
193
190
  if (iconContainer && iconContainer.focus) {
194
191
  const {
195
192
  tr
@@ -16,7 +16,6 @@ import { fg } from '@atlaskit/platform-feature-flags/fg';
16
16
  import { redo } from '@atlaskit/prosemirror-history/redo';
17
17
  import { undo } from '@atlaskit/prosemirror-history/undo';
18
18
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
19
- import { renderExpandButton } from '../../ui/renderExpandButton';
20
19
  import { deleteExpandAtPos, setSelectionInsideExpand, toggleExpandExpanded, updateExpandTitle } from '../commands';
21
20
  import { ExpandIconButton } from '../ui/ExpandIconButton';
22
21
  function buildExpandClassName(type, expanded) {
@@ -575,11 +574,7 @@ export class ExpandNodeView {
575
574
  }));
576
575
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
577
576
  this.renderKey = uuid();
578
- if (isExperimentEnabled('platform_editor_vc90_transition_expand_icon')) {
579
- this.renderNativeIcon(this.node);
580
- } else {
581
- this.renderIcon(this.intl);
582
- }
577
+ this.renderIcon(this.intl);
583
578
  this.initHandlers();
584
579
  }
585
580
  initHandlers() {
@@ -625,19 +620,6 @@ export class ExpandNodeView {
625
620
  });
626
621
  }
627
622
  }
628
- renderNativeIcon(node) {
629
- if (!this.icon) {
630
- return;
631
- }
632
- const {
633
- __expanded
634
- } = node.attrs;
635
- renderExpandButton(this.icon, {
636
- expanded: this.__livePage ? !__expanded : __expanded,
637
- allowInteractiveExpand: this.allowInteractiveExpand,
638
- intl: this.intl
639
- });
640
- }
641
623
  renderIcon(intl, node) {
642
624
  if (!this.icon) {
643
625
  return;
@@ -706,11 +688,7 @@ export class ExpandNodeView {
706
688
  // we toggle a class name to hide the content and animate the chevron.
707
689
  if (this.dom) {
708
690
  this.dom.classList.toggle(expandClassNames.expanded);
709
- if (isExperimentEnabled('platform_editor_vc90_transition_expand_icon')) {
710
- this.renderNativeIcon(node);
711
- } else {
712
- this.renderIcon(this && this.intl, node);
713
- }
691
+ this.renderIcon(this.intl, node);
714
692
  }
715
693
  if (this.content) {
716
694
  // Disallow interaction/selection inside when collapsed.
@@ -12,7 +12,6 @@ import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
12
12
  import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
13
13
  import { findParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
14
14
  import { findTable } from '@atlaskit/editor-tables/utils';
15
- import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
16
15
  import { fg } from '@atlaskit/platform-feature-flags/fg';
17
16
  import { isNestedInExpand } from '../utils';
18
17
 
@@ -225,9 +224,7 @@ export const focusIcon = expand => (state, dispatch, editorView) => {
225
224
  if (!(expand instanceof HTMLElement)) {
226
225
  return false;
227
226
  }
228
-
229
- // TODO: ED-29205 - During platform_editor_vc90_transition_expand_icon cleanup, rename `iconContainer` to `iconButton`.
230
- const iconContainer = isExperimentEnabled('platform_editor_vc90_transition_expand_icon') ? expand.querySelector(`.${expandClassNames.iconButton}`) : expand.querySelector(`.${expandClassNames.iconContainer}`);
227
+ const iconContainer = expand.querySelector(`.${expandClassNames.iconContainer}`);
231
228
  if (iconContainer && iconContainer.focus) {
232
229
  const {
233
230
  tr
@@ -15,7 +15,6 @@ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-e
15
15
  import { redo } from '@atlaskit/prosemirror-history/redo';
16
16
  import { undo } from '@atlaskit/prosemirror-history/undo';
17
17
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
18
- import { renderExpandButton } from '../../ui/renderExpandButton';
19
18
  import { deleteExpand, setSelectionInsideExpand, toggleExpandExpanded, updateExpandTitle } from '../commands';
20
19
  import { ExpandButton } from '../ui/ExpandButton';
21
20
  import { buildExpandClassName, getExpandBodyAriaLabel, toDOM } from '../ui/NodeView';
@@ -529,11 +528,7 @@ export class ExpandNodeView {
529
528
  applyContentVisibility(this.dom, this.isLimitedModeEnabled(), () => ({
530
529
  height: estimateExpandIntrinsicHeight(this.node, !isExpandCollapsed(this.node))
531
530
  }));
532
- if (isExperimentEnabled('platform_editor_vc90_transition_expand_icon')) {
533
- this.renderNativeIcon(this.node);
534
- } else {
535
- this.renderIcon(this.icon, !isExpandCollapsed(this.node));
536
- }
531
+ this.renderIcon(this.icon, !isExpandCollapsed(this.node));
537
532
  if (!this.input || !this.titleContainer || !this.icon) {
538
533
  return;
539
534
  }
@@ -649,17 +644,13 @@ export class ExpandNodeView {
649
644
  updateExpandToggleIcon(node) {
650
645
  const expanded = expandedState.get(node) ? expandedState.get(node) : false;
651
646
  if (this.dom && expanded !== undefined) {
647
+ var _this$icon, _expandedState$get3;
652
648
  const classes = this.dom.className.split(' ');
653
649
  // find & replace styles might be applied to the expand title and we need to keep them
654
650
  const findReplaceDecorationsApplied = classes.filter(className => findReplaceExpandDecorations.includes(className)).join(' ');
655
651
  this.dom.className = findReplaceDecorationsApplied ? buildExpandClassName(node.type.name, expanded) + ` ${findReplaceDecorationsApplied}` : buildExpandClassName(node.type.name, expanded);
656
652
  // Re-render the icon to update the aria-expanded attribute
657
- if (isExperimentEnabled('platform_editor_vc90_transition_expand_icon')) {
658
- this.renderNativeIcon(node);
659
- } else {
660
- var _expandedState$get3;
661
- this.renderIcon(this.icon ? this.icon : null, (_expandedState$get3 = expandedState.get(node)) !== null && _expandedState$get3 !== void 0 ? _expandedState$get3 : false);
662
- }
653
+ this.renderIcon((_this$icon = this.icon) !== null && _this$icon !== void 0 ? _this$icon : null, (_expandedState$get3 = expandedState.get(node)) !== null && _expandedState$get3 !== void 0 ? _expandedState$get3 : false);
663
654
  }
664
655
  this.updateExpandBodyContentEditable();
665
656
  this.isExpanded = {
@@ -695,16 +686,6 @@ export class ExpandNodeView {
695
686
  this.content.setAttribute('contenteditable', this.getContentEditable(this.node) ? 'true' : 'false');
696
687
  }
697
688
  }
698
- renderNativeIcon(node) {
699
- if (!this.icon) {
700
- return;
701
- }
702
- renderExpandButton(this.icon, {
703
- expanded: !isExpandCollapsed(node),
704
- allowInteractiveExpand: this.allowInteractiveExpand,
705
- intl: this.intl
706
- });
707
- }
708
689
  destroy() {
709
690
  var _this$decorationClean2;
710
691
  if (!this.dom || !this.input || !this.titleContainer || !this.icon) {
@@ -10,7 +10,6 @@ import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
10
10
  import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
11
11
  import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
12
12
  import { findTable } from '@atlaskit/editor-tables/utils';
13
- import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
14
13
  import { isNestedInExpand } from '../utils';
15
14
  import { createCommand } from './pm-plugins/plugin-factory';
16
15
  export var setExpandRef = function setExpandRef(ref) {
@@ -200,9 +199,7 @@ export var focusIcon = function focusIcon(expand) {
200
199
  if (!(expand instanceof HTMLElement)) {
201
200
  return false;
202
201
  }
203
-
204
- // TODO: ED-29205 - During platform_editor_vc90_transition_expand_icon cleanup, rename `iconContainer` to `iconButton`.
205
- var iconContainer = isExperimentEnabled('platform_editor_vc90_transition_expand_icon') ? expand.querySelector(".".concat(expandClassNames.iconButton)) : expand.querySelector(".".concat(expandClassNames.iconContainer));
202
+ var iconContainer = expand.querySelector(".".concat(expandClassNames.iconContainer));
206
203
  if (iconContainer && iconContainer.focus) {
207
204
  var tr = state.tr;
208
205
  var pos = state.selection.from;
@@ -20,7 +20,6 @@ import { fg } from '@atlaskit/platform-feature-flags/fg';
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';
24
23
  import { deleteExpandAtPos, setSelectionInsideExpand, toggleExpandExpanded, updateExpandTitle } from '../commands';
25
24
  import { ExpandIconButton } from '../ui/ExpandIconButton';
26
25
  function buildExpandClassName(type, expanded) {
@@ -559,11 +558,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
559
558
  });
560
559
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
561
560
  this.renderKey = uuid();
562
- if (isExperimentEnabled('platform_editor_vc90_transition_expand_icon')) {
563
- this.renderNativeIcon(this.node);
564
- } else {
565
- this.renderIcon(this.intl);
566
- }
561
+ this.renderIcon(this.intl);
567
562
  this.initHandlers();
568
563
  }
569
564
  return _createClass(ExpandNodeView, [{
@@ -612,19 +607,6 @@ export var ExpandNodeView = /*#__PURE__*/function () {
612
607
  });
613
608
  }
614
609
  }
615
- }, {
616
- key: "renderNativeIcon",
617
- value: function renderNativeIcon(node) {
618
- if (!this.icon) {
619
- return;
620
- }
621
- var __expanded = node.attrs.__expanded;
622
- renderExpandButton(this.icon, {
623
- expanded: this.__livePage ? !__expanded : __expanded,
624
- allowInteractiveExpand: this.allowInteractiveExpand,
625
- intl: this.intl
626
- });
627
- }
628
610
  }, {
629
611
  key: "renderIcon",
630
612
  value: function renderIcon(intl, node) {
@@ -712,11 +694,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
712
694
  // we toggle a class name to hide the content and animate the chevron.
713
695
  if (this.dom) {
714
696
  this.dom.classList.toggle(expandClassNames.expanded);
715
- if (isExperimentEnabled('platform_editor_vc90_transition_expand_icon')) {
716
- this.renderNativeIcon(node);
717
- } else {
718
- this.renderIcon(this && this.intl, node);
719
- }
697
+ this.renderIcon(this.intl, node);
720
698
  }
721
699
  if (this.content) {
722
700
  // Disallow interaction/selection inside when collapsed.
@@ -15,7 +15,6 @@ import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
15
15
  import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
16
16
  import { findParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
17
17
  import { findTable } from '@atlaskit/editor-tables/utils';
18
- import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
19
18
  import { fg } from '@atlaskit/platform-feature-flags/fg';
20
19
  import { isNestedInExpand } from '../utils';
21
20
 
@@ -240,9 +239,7 @@ export var focusIcon = function focusIcon(expand) {
240
239
  if (!(expand instanceof HTMLElement)) {
241
240
  return false;
242
241
  }
243
-
244
- // TODO: ED-29205 - During platform_editor_vc90_transition_expand_icon cleanup, rename `iconContainer` to `iconButton`.
245
- var iconContainer = isExperimentEnabled('platform_editor_vc90_transition_expand_icon') ? expand.querySelector(".".concat(expandClassNames.iconButton)) : expand.querySelector(".".concat(expandClassNames.iconContainer));
242
+ var iconContainer = expand.querySelector(".".concat(expandClassNames.iconContainer));
246
243
  if (iconContainer && iconContainer.focus) {
247
244
  var tr = state.tr;
248
245
  var pos = state.selection.from;
@@ -17,7 +17,6 @@ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-e
17
17
  import { redo } from '@atlaskit/prosemirror-history/redo';
18
18
  import { undo } from '@atlaskit/prosemirror-history/undo';
19
19
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
20
- import { renderExpandButton } from '../../ui/renderExpandButton';
21
20
  import { deleteExpand, setSelectionInsideExpand, toggleExpandExpanded, updateExpandTitle } from '../commands';
22
21
  import { ExpandButton } from '../ui/ExpandButton';
23
22
  import { buildExpandClassName, getExpandBodyAriaLabel, toDOM } from '../ui/NodeView';
@@ -520,11 +519,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
520
519
  height: estimateExpandIntrinsicHeight(_this.node, !isExpandCollapsed(_this.node))
521
520
  };
522
521
  });
523
- if (isExperimentEnabled('platform_editor_vc90_transition_expand_icon')) {
524
- this.renderNativeIcon(this.node);
525
- } else {
526
- this.renderIcon(this.icon, !isExpandCollapsed(this.node));
527
- }
522
+ this.renderIcon(this.icon, !isExpandCollapsed(this.node));
528
523
  if (!this.input || !this.titleContainer || !this.icon) {
529
524
  return;
530
525
  }
@@ -651,6 +646,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
651
646
  value: function updateExpandToggleIcon(node) {
652
647
  var expanded = expandedState.get(node) ? expandedState.get(node) : false;
653
648
  if (this.dom && expanded !== undefined) {
649
+ var _this$icon, _expandedState$get3;
654
650
  var classes = this.dom.className.split(' ');
655
651
  // find & replace styles might be applied to the expand title and we need to keep them
656
652
  var findReplaceDecorationsApplied = classes.filter(function (className) {
@@ -658,12 +654,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
658
654
  }).join(' ');
659
655
  this.dom.className = findReplaceDecorationsApplied ? buildExpandClassName(node.type.name, expanded) + " ".concat(findReplaceDecorationsApplied) : buildExpandClassName(node.type.name, expanded);
660
656
  // Re-render the icon to update the aria-expanded attribute
661
- if (isExperimentEnabled('platform_editor_vc90_transition_expand_icon')) {
662
- this.renderNativeIcon(node);
663
- } else {
664
- var _expandedState$get3;
665
- this.renderIcon(this.icon ? this.icon : null, (_expandedState$get3 = expandedState.get(node)) !== null && _expandedState$get3 !== void 0 ? _expandedState$get3 : false);
666
- }
657
+ this.renderIcon((_this$icon = this.icon) !== null && _this$icon !== void 0 ? _this$icon : null, (_expandedState$get3 = expandedState.get(node)) !== null && _expandedState$get3 !== void 0 ? _expandedState$get3 : false);
667
658
  }
668
659
  this.updateExpandBodyContentEditable();
669
660
  this.isExpanded = {
@@ -707,18 +698,6 @@ export var ExpandNodeView = /*#__PURE__*/function () {
707
698
  this.content.setAttribute('contenteditable', this.getContentEditable(this.node) ? 'true' : 'false');
708
699
  }
709
700
  }
710
- }, {
711
- key: "renderNativeIcon",
712
- value: function renderNativeIcon(node) {
713
- if (!this.icon) {
714
- return;
715
- }
716
- renderExpandButton(this.icon, {
717
- expanded: !isExpandCollapsed(node),
718
- allowInteractiveExpand: this.allowInteractiveExpand,
719
- intl: this.intl
720
- });
721
- }
722
701
  }, {
723
702
  key: "destroy",
724
703
  value: function destroy() {
@@ -30,7 +30,6 @@ export declare class ExpandNodeView implements NodeView {
30
30
  private initHandlers;
31
31
  private focusTitle;
32
32
  private handleIconKeyDown;
33
- private renderNativeIcon;
34
33
  private renderIcon;
35
34
  private handleClick;
36
35
  private handleInput;
@@ -60,7 +60,6 @@ export declare class ExpandNodeView implements NodeView {
60
60
  private isLimitedModeEnabled;
61
61
  private updateDisplayStyle;
62
62
  updateExpandBodyContentEditable(): void;
63
- private renderNativeIcon;
64
63
  renderIcon: (icon: HTMLElement | null, expanded: boolean) => void;
65
64
  destroy(): void;
66
65
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-expand",
3
- "version": "23.0.1",
3
+ "version": "23.0.3",
4
4
  "description": "Expand plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -42,8 +42,8 @@
42
42
  "@atlaskit/icon-lab": "^7.10.0",
43
43
  "@atlaskit/platform-feature-experiments": "^0.3.0",
44
44
  "@atlaskit/platform-feature-flags": "^2.2.0",
45
- "@atlaskit/prosemirror-history": "^1.2.0",
46
- "@atlaskit/tmp-editor-statsig": "^210.0.0",
45
+ "@atlaskit/prosemirror-history": "^1.3.0",
46
+ "@atlaskit/tmp-editor-statsig": "^212.0.0",
47
47
  "@atlaskit/tokens": "^20.1.0",
48
48
  "@atlaskit/tooltip": "^24.3.0",
49
49
  "@babel/runtime": "^7.0.0",
@@ -1,60 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.renderExpandButton = renderExpandButton;
7
- var _styles = require("@atlaskit/editor-common/styles");
8
- var _ui = require("@atlaskit/editor-common/ui");
9
- /**
10
- * Renders or updates the expand/collapse button inside the provided container element.
11
- *
12
- * @param container - The HTML element that will contain the expand/collapse button.
13
- * @param buttonProps - Properties for configuring the button's behavior and appearance.
14
- */
15
- function renderExpandButton(container, buttonProps) {
16
- var allowInteractiveExpand = buttonProps.allowInteractiveExpand,
17
- expanded = buttonProps.expanded,
18
- intl = buttonProps.intl;
19
-
20
- // Update existing button attributes
21
- var label = intl.formatMessage(expanded ? _ui.expandMessages.collapseNode : _ui.expandMessages.expandNode);
22
- var existingButton = container.querySelector(".".concat(_styles.expandClassNames.iconButton));
23
- if (existingButton) {
24
- existingButton.setAttribute('aria-label', label);
25
- existingButton.setAttribute('aria-expanded', String(expanded));
26
- if (allowInteractiveExpand) {
27
- existingButton.setAttribute('title', label);
28
- existingButton.removeAttribute('disabled');
29
- } else {
30
- existingButton.removeAttribute('title');
31
- existingButton.setAttribute('disabled', 'true');
32
- }
33
- } else {
34
- var doc = container.ownerDocument;
35
- if (!doc) {
36
- return;
37
- }
38
- var button = doc.createElement('button');
39
- button.className = _styles.expandClassNames.iconButton;
40
- button.setAttribute('aria-label', label);
41
- button.setAttribute('aria-expanded', String(expanded));
42
- if (allowInteractiveExpand) {
43
- button.setAttribute('title', label);
44
- } else {
45
- button.setAttribute('disabled', 'true');
46
- }
47
- container.appendChild(button);
48
- var svgIcon = doc.createElementNS('http://www.w3.org/2000/svg', 'svg');
49
- svgIcon.setAttribute('class', _styles.expandClassNames.iconSvg);
50
- svgIcon.setAttribute('width', '12');
51
- svgIcon.setAttribute('height', '12');
52
- svgIcon.setAttribute('viewBox', '0 0 16 16');
53
- svgIcon.setAttribute('role', 'presentation');
54
- var path = doc.createElementNS('http://www.w3.org/2000/svg', 'path');
55
- path.setAttribute('fill', 'currentcolor');
56
- 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');
57
- svgIcon.appendChild(path);
58
- button.appendChild(svgIcon);
59
- }
60
- }
@@ -1,56 +0,0 @@
1
- import { expandClassNames } from '@atlaskit/editor-common/styles';
2
- import { expandMessages } from '@atlaskit/editor-common/ui';
3
- /**
4
- * Renders or updates the expand/collapse button inside the provided container element.
5
- *
6
- * @param container - The HTML element that will contain the expand/collapse button.
7
- * @param buttonProps - Properties for configuring the button's behavior and appearance.
8
- */
9
- export function renderExpandButton(container, buttonProps) {
10
- const {
11
- allowInteractiveExpand,
12
- expanded,
13
- intl
14
- } = buttonProps;
15
-
16
- // Update existing button attributes
17
- const label = intl.formatMessage(expanded ? expandMessages.collapseNode : expandMessages.expandNode);
18
- const existingButton = container.querySelector(`.${expandClassNames.iconButton}`);
19
- if (existingButton) {
20
- existingButton.setAttribute('aria-label', label);
21
- existingButton.setAttribute('aria-expanded', String(expanded));
22
- if (allowInteractiveExpand) {
23
- existingButton.setAttribute('title', label);
24
- existingButton.removeAttribute('disabled');
25
- } else {
26
- existingButton.removeAttribute('title');
27
- existingButton.setAttribute('disabled', 'true');
28
- }
29
- } else {
30
- const doc = container.ownerDocument;
31
- if (!doc) {
32
- return;
33
- }
34
- const button = doc.createElement('button');
35
- button.className = expandClassNames.iconButton;
36
- button.setAttribute('aria-label', label);
37
- button.setAttribute('aria-expanded', String(expanded));
38
- if (allowInteractiveExpand) {
39
- button.setAttribute('title', label);
40
- } else {
41
- button.setAttribute('disabled', 'true');
42
- }
43
- container.appendChild(button);
44
- const svgIcon = doc.createElementNS('http://www.w3.org/2000/svg', 'svg');
45
- svgIcon.setAttribute('class', expandClassNames.iconSvg);
46
- svgIcon.setAttribute('width', '12');
47
- svgIcon.setAttribute('height', '12');
48
- svgIcon.setAttribute('viewBox', '0 0 16 16');
49
- svgIcon.setAttribute('role', 'presentation');
50
- const path = doc.createElementNS('http://www.w3.org/2000/svg', 'path');
51
- path.setAttribute('fill', 'currentcolor');
52
- 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');
53
- svgIcon.appendChild(path);
54
- button.appendChild(svgIcon);
55
- }
56
- }
@@ -1,54 +0,0 @@
1
- import { expandClassNames } from '@atlaskit/editor-common/styles';
2
- import { expandMessages } from '@atlaskit/editor-common/ui';
3
- /**
4
- * Renders or updates the expand/collapse button inside the provided container element.
5
- *
6
- * @param container - The HTML element that will contain the expand/collapse button.
7
- * @param buttonProps - Properties for configuring the button's behavior and appearance.
8
- */
9
- export function renderExpandButton(container, buttonProps) {
10
- var allowInteractiveExpand = buttonProps.allowInteractiveExpand,
11
- expanded = buttonProps.expanded,
12
- intl = buttonProps.intl;
13
-
14
- // Update existing button attributes
15
- var label = intl.formatMessage(expanded ? expandMessages.collapseNode : expandMessages.expandNode);
16
- var existingButton = container.querySelector(".".concat(expandClassNames.iconButton));
17
- if (existingButton) {
18
- existingButton.setAttribute('aria-label', label);
19
- existingButton.setAttribute('aria-expanded', String(expanded));
20
- if (allowInteractiveExpand) {
21
- existingButton.setAttribute('title', label);
22
- existingButton.removeAttribute('disabled');
23
- } else {
24
- existingButton.removeAttribute('title');
25
- existingButton.setAttribute('disabled', 'true');
26
- }
27
- } else {
28
- var doc = container.ownerDocument;
29
- if (!doc) {
30
- return;
31
- }
32
- var button = doc.createElement('button');
33
- button.className = expandClassNames.iconButton;
34
- button.setAttribute('aria-label', label);
35
- button.setAttribute('aria-expanded', String(expanded));
36
- if (allowInteractiveExpand) {
37
- button.setAttribute('title', label);
38
- } else {
39
- button.setAttribute('disabled', 'true');
40
- }
41
- container.appendChild(button);
42
- var svgIcon = doc.createElementNS('http://www.w3.org/2000/svg', 'svg');
43
- svgIcon.setAttribute('class', expandClassNames.iconSvg);
44
- svgIcon.setAttribute('width', '12');
45
- svgIcon.setAttribute('height', '12');
46
- svgIcon.setAttribute('viewBox', '0 0 16 16');
47
- svgIcon.setAttribute('role', 'presentation');
48
- var path = doc.createElementNS('http://www.w3.org/2000/svg', 'path');
49
- path.setAttribute('fill', 'currentcolor');
50
- 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');
51
- svgIcon.appendChild(path);
52
- button.appendChild(svgIcon);
53
- }
54
- }
@@ -1,17 +0,0 @@
1
- import type { IntlShape } from 'react-intl';
2
- interface ButtonProps {
3
- /** Indicates whether interactive expand is allowed */
4
- allowInteractiveExpand: boolean;
5
- /** Indicates whether the expand is currently expanded */
6
- expanded: boolean;
7
- /** Internationalization object for formatting messages */
8
- intl: IntlShape;
9
- }
10
- /**
11
- * Renders or updates the expand/collapse button inside the provided container element.
12
- *
13
- * @param container - The HTML element that will contain the expand/collapse button.
14
- * @param buttonProps - Properties for configuring the button's behavior and appearance.
15
- */
16
- export declare function renderExpandButton(container: HTMLElement, buttonProps: ButtonProps): void;
17
- export {};