@atlaskit/editor-plugin-expand 3.3.4 → 3.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 CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/editor-plugin-expand
2
2
 
3
+ ## 3.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#175370](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/175370)
8
+ [`fb5f9531ef9d8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/fb5f9531ef9d8) -
9
+ [ux] [ED-27956] this PR is adding support for Find with expand titles and updating the search
10
+ match styles behind the experiment `platform_editor_find_and_replace_improvements`
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
16
+ ## 3.3.5
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies
21
+
3
22
  ## 3.3.4
4
23
 
5
24
  ### Patch Changes
@@ -24,6 +24,7 @@ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
24
24
  var _commands = require("../commands");
25
25
  var _ExpandButton = require("../ui/ExpandButton");
26
26
  var _NodeView = require("../ui/NodeView");
27
+ var _utils2 = require("../utils");
27
28
  var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
28
29
  function ExpandNodeView(_node, view, getPos, getIntl, isMobile, selectNearNode, api, nodeViewPortalProviderAPI) {
29
30
  var _this = this,
@@ -508,7 +509,16 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
508
509
  var expanded = _expand.expandedState.get(node) ? _expand.expandedState.get(node) : false;
509
510
  if (this.dom && expanded !== undefined) {
510
511
  var _expandedState$get;
511
- this.dom.className = (0, _NodeView.buildExpandClassName)(node.type.name, expanded);
512
+ if ((0, _expValEquals.expValEquals)('platform_editor_find_and_replace_improvements', 'isEnabled', true)) {
513
+ var classes = this.dom.className.split(' ');
514
+ // find & replace styles might be applied to the expand title and we need to keep them
515
+ var findReplaceDecorationsApplied = classes.filter(function (className) {
516
+ return _utils2.findReplaceExpandDecorations.includes(className);
517
+ }).join(' ');
518
+ this.dom.className = findReplaceDecorationsApplied ? (0, _NodeView.buildExpandClassName)(node.type.name, expanded) + " ".concat(findReplaceDecorationsApplied) : (0, _NodeView.buildExpandClassName)(node.type.name, expanded);
519
+ } else {
520
+ this.dom.className = (0, _NodeView.buildExpandClassName)(node.type.name, expanded);
521
+ }
512
522
  // Re-render the icon to update the aria-expanded attribute
513
523
  this.renderIcon(this.icon ? this.icon : null, (_expandedState$get = _expand.expandedState.get(node)) !== null && _expandedState$get !== void 0 ? _expandedState$get : false);
514
524
  }
@@ -3,8 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.findParentExpandNode = void 0;
6
+ exports.findReplaceExpandDecorations = exports.findParentExpandNode = void 0;
7
+ var _styles = require("@atlaskit/editor-plugin-find-replace/styles");
7
8
  var _utils = require("@atlaskit/editor-prosemirror/utils");
8
9
  var findParentExpandNode = exports.findParentExpandNode = function findParentExpandNode(state) {
9
10
  return (0, _utils.findParentNodeOfType)(state.schema.nodes.nestedExpand)(state.selection) || (0, _utils.findParentNodeOfType)(state.schema.nodes.expand)(state.selection);
10
- };
11
+ };
12
+ var findReplaceExpandDecorations = exports.findReplaceExpandDecorations = [_styles.darkModeSearchMatchClass, _styles.searchMatchExpandTitleClass, _styles.selectedSearchMatchClass];
@@ -14,6 +14,7 @@ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
14
14
  import { deleteExpand, setSelectionInsideExpand, toggleExpandExpanded, updateExpandTitle } from '../commands';
15
15
  import { ExpandButton } from '../ui/ExpandButton';
16
16
  import { buildExpandClassName, toDOM } from '../ui/NodeView';
17
+ import { findReplaceExpandDecorations } from '../utils';
17
18
  export class ExpandNodeView {
18
19
  constructor(_node, view, getPos, getIntl, isMobile, selectNearNode, api, nodeViewPortalProviderAPI, allowInteractiveExpand = true, __livePage = false, cleanUpEditorDisabledOnChange) {
19
20
  var _api$editorDisabled, _api$editorDisabled$s, _this$api6;
@@ -499,7 +500,14 @@ export class ExpandNodeView {
499
500
  const expanded = expandedState.get(node) ? expandedState.get(node) : false;
500
501
  if (this.dom && expanded !== undefined) {
501
502
  var _expandedState$get;
502
- this.dom.className = buildExpandClassName(node.type.name, expanded);
503
+ if (expValEquals('platform_editor_find_and_replace_improvements', 'isEnabled', true)) {
504
+ const classes = this.dom.className.split(' ');
505
+ // find & replace styles might be applied to the expand title and we need to keep them
506
+ const findReplaceDecorationsApplied = classes.filter(className => findReplaceExpandDecorations.includes(className)).join(' ');
507
+ this.dom.className = findReplaceDecorationsApplied ? buildExpandClassName(node.type.name, expanded) + ` ${findReplaceDecorationsApplied}` : buildExpandClassName(node.type.name, expanded);
508
+ } else {
509
+ this.dom.className = buildExpandClassName(node.type.name, expanded);
510
+ }
503
511
  // Re-render the icon to update the aria-expanded attribute
504
512
  this.renderIcon(this.icon ? this.icon : null, (_expandedState$get = expandedState.get(node)) !== null && _expandedState$get !== void 0 ? _expandedState$get : false);
505
513
  }
@@ -1,4 +1,6 @@
1
+ import { darkModeSearchMatchClass, searchMatchExpandTitleClass, selectedSearchMatchClass } from '@atlaskit/editor-plugin-find-replace/styles';
1
2
  import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
2
3
  export const findParentExpandNode = state => {
3
4
  return findParentNodeOfType(state.schema.nodes.nestedExpand)(state.selection) || findParentNodeOfType(state.schema.nodes.expand)(state.selection);
4
- };
5
+ };
6
+ export const findReplaceExpandDecorations = [darkModeSearchMatchClass, searchMatchExpandTitleClass, selectedSearchMatchClass];
@@ -16,6 +16,7 @@ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
16
16
  import { deleteExpand, setSelectionInsideExpand, toggleExpandExpanded, updateExpandTitle } from '../commands';
17
17
  import { ExpandButton } from '../ui/ExpandButton';
18
18
  import { buildExpandClassName, toDOM } from '../ui/NodeView';
19
+ import { findReplaceExpandDecorations } from '../utils';
19
20
  export var ExpandNodeView = /*#__PURE__*/function () {
20
21
  function ExpandNodeView(_node, view, getPos, getIntl, isMobile, selectNearNode, api, nodeViewPortalProviderAPI) {
21
22
  var _this = this,
@@ -500,7 +501,16 @@ export var ExpandNodeView = /*#__PURE__*/function () {
500
501
  var expanded = expandedState.get(node) ? expandedState.get(node) : false;
501
502
  if (this.dom && expanded !== undefined) {
502
503
  var _expandedState$get;
503
- this.dom.className = buildExpandClassName(node.type.name, expanded);
504
+ if (expValEquals('platform_editor_find_and_replace_improvements', 'isEnabled', true)) {
505
+ var classes = this.dom.className.split(' ');
506
+ // find & replace styles might be applied to the expand title and we need to keep them
507
+ var findReplaceDecorationsApplied = classes.filter(function (className) {
508
+ return findReplaceExpandDecorations.includes(className);
509
+ }).join(' ');
510
+ this.dom.className = findReplaceDecorationsApplied ? buildExpandClassName(node.type.name, expanded) + " ".concat(findReplaceDecorationsApplied) : buildExpandClassName(node.type.name, expanded);
511
+ } else {
512
+ this.dom.className = buildExpandClassName(node.type.name, expanded);
513
+ }
504
514
  // Re-render the icon to update the aria-expanded attribute
505
515
  this.renderIcon(this.icon ? this.icon : null, (_expandedState$get = expandedState.get(node)) !== null && _expandedState$get !== void 0 ? _expandedState$get : false);
506
516
  }
@@ -1,4 +1,6 @@
1
+ import { darkModeSearchMatchClass, searchMatchExpandTitleClass, selectedSearchMatchClass } from '@atlaskit/editor-plugin-find-replace/styles';
1
2
  import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
2
3
  export var findParentExpandNode = function findParentExpandNode(state) {
3
4
  return findParentNodeOfType(state.schema.nodes.nestedExpand)(state.selection) || findParentNodeOfType(state.schema.nodes.expand)(state.selection);
4
- };
5
+ };
6
+ export var findReplaceExpandDecorations = [darkModeSearchMatchClass, searchMatchExpandTitleClass, selectedSearchMatchClass];
@@ -1,3 +1,4 @@
1
1
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
2
  import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
3
3
  export declare const findParentExpandNode: (state: EditorState) => ReturnType<ReturnType<typeof findParentNodeOfType>>;
4
+ export declare const findReplaceExpandDecorations: string[];
@@ -1,3 +1,4 @@
1
1
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
2
  import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
3
3
  export declare const findParentExpandNode: (state: EditorState) => ReturnType<ReturnType<typeof findParentNodeOfType>>;
4
+ export declare const findReplaceExpandDecorations: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-expand",
3
- "version": "3.3.4",
3
+ "version": "3.4.0",
4
4
  "description": "Expand plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,20 +35,21 @@
35
35
  "dependencies": {
36
36
  "@atlaskit/adf-schema": "^47.6.0",
37
37
  "@atlaskit/button": "^23.2.0",
38
- "@atlaskit/editor-common": "^107.0.0",
38
+ "@atlaskit/editor-common": "^107.2.0",
39
39
  "@atlaskit/editor-plugin-analytics": "^2.3.0",
40
40
  "@atlaskit/editor-plugin-decorations": "^2.0.0",
41
41
  "@atlaskit/editor-plugin-editor-disabled": "^2.1.0",
42
42
  "@atlaskit/editor-plugin-editor-viewmode": "^4.0.0",
43
+ "@atlaskit/editor-plugin-find-replace": "^2.10.0",
43
44
  "@atlaskit/editor-plugin-selection": "^2.2.0",
44
45
  "@atlaskit/editor-plugin-selection-marker": "^2.5.0",
45
46
  "@atlaskit/editor-prosemirror": "7.0.0",
46
47
  "@atlaskit/editor-shared-styles": "^3.4.0",
47
48
  "@atlaskit/editor-tables": "^2.9.0",
48
- "@atlaskit/icon": "^27.0.0",
49
+ "@atlaskit/icon": "^27.2.0",
49
50
  "@atlaskit/platform-feature-flags": "^1.1.0",
50
- "@atlaskit/tmp-editor-statsig": "^7.1.0",
51
- "@atlaskit/tokens": "^5.2.0",
51
+ "@atlaskit/tmp-editor-statsig": "^8.3.0",
52
+ "@atlaskit/tokens": "^5.4.0",
52
53
  "@atlaskit/tooltip": "^20.3.0",
53
54
  "@babel/runtime": "^7.0.0",
54
55
  "@emotion/react": "^11.7.1",