@atlaskit/editor-plugin-expand 3.3.5 → 4.0.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,58 @@
1
1
  # @atlaskit/editor-plugin-expand
2
2
 
3
+ ## 4.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#181024](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/181024)
8
+ [`8e80c487ca307`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8e80c487ca307) - ##
9
+ Make `@atlaskit/editor-common` a peer dependency
10
+
11
+ **WHAT:** `@atlaskit/editor-common` has been moved from `dependencies` to `peerDependencies` in
12
+ all editor plugin packages.
13
+
14
+ **WHY:** This change ensures that only a single version of `@atlaskit/editor-common` is used in
15
+ consuming applications, preventing issues caused by multiple versions of singleton libraries (such
16
+ as context mismatches or duplicated state). This is especially important for packages that rely on
17
+ shared context or singletons.
18
+
19
+ **HOW TO ADJUST:**
20
+
21
+ - Consumers must now explicitly install `@atlaskit/editor-common` in their own project if they use
22
+ any of these editor plugins.
23
+ - Ensure the version you install matches the version required by the plugins.
24
+ - You can use the
25
+ [`check-peer-dependencies`](https://www.npmjs.com/package/check-peer-dependencies) package to
26
+ verify that all required peer dependencies are installed and compatible.
27
+ - Example install command:
28
+ ```
29
+ npm install @atlaskit/editor-common
30
+ ```
31
+ or
32
+ ```
33
+ yarn add @atlaskit/editor-common
34
+ ```
35
+
36
+ **Note:** This is a breaking change. If `@atlaskit/editor-common` is not installed at the
37
+ application level, you may see errors or unexpected behavior.
38
+
39
+ ### Patch Changes
40
+
41
+ - Updated dependencies
42
+
43
+ ## 3.4.0
44
+
45
+ ### Minor Changes
46
+
47
+ - [#175370](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/175370)
48
+ [`fb5f9531ef9d8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/fb5f9531ef9d8) -
49
+ [ux] [ED-27956] this PR is adding support for Find with expand titles and updating the search
50
+ match styles behind the experiment `platform_editor_find_and_replace_improvements`
51
+
52
+ ### Patch Changes
53
+
54
+ - Updated dependencies
55
+
3
56
  ## 3.3.5
4
57
 
5
58
  ### 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.5",
3
+ "version": "4.0.0",
4
4
  "description": "Expand plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -9,8 +9,7 @@
9
9
  },
10
10
  "atlassian": {
11
11
  "team": "Editor: Jenga",
12
- "singleton": true,
13
- "runReact18": true
12
+ "singleton": true
14
13
  },
15
14
  "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
16
15
  "main": "dist/cjs/index.js",
@@ -35,20 +34,20 @@
35
34
  "dependencies": {
36
35
  "@atlaskit/adf-schema": "^47.6.0",
37
36
  "@atlaskit/button": "^23.2.0",
38
- "@atlaskit/editor-common": "^107.0.0",
39
- "@atlaskit/editor-plugin-analytics": "^2.3.0",
40
- "@atlaskit/editor-plugin-decorations": "^2.0.0",
41
- "@atlaskit/editor-plugin-editor-disabled": "^2.1.0",
42
- "@atlaskit/editor-plugin-editor-viewmode": "^4.0.0",
43
- "@atlaskit/editor-plugin-selection": "^2.2.0",
44
- "@atlaskit/editor-plugin-selection-marker": "^2.5.0",
37
+ "@atlaskit/editor-plugin-analytics": "^3.0.0",
38
+ "@atlaskit/editor-plugin-decorations": "^3.0.0",
39
+ "@atlaskit/editor-plugin-editor-disabled": "^3.0.0",
40
+ "@atlaskit/editor-plugin-editor-viewmode": "^5.0.0",
41
+ "@atlaskit/editor-plugin-find-replace": "^3.0.0",
42
+ "@atlaskit/editor-plugin-selection": "^3.0.0",
43
+ "@atlaskit/editor-plugin-selection-marker": "^3.0.0",
45
44
  "@atlaskit/editor-prosemirror": "7.0.0",
46
45
  "@atlaskit/editor-shared-styles": "^3.4.0",
47
46
  "@atlaskit/editor-tables": "^2.9.0",
48
- "@atlaskit/icon": "^27.0.0",
47
+ "@atlaskit/icon": "^27.2.0",
49
48
  "@atlaskit/platform-feature-flags": "^1.1.0",
50
- "@atlaskit/tmp-editor-statsig": "^8.0.0",
51
- "@atlaskit/tokens": "^5.3.0",
49
+ "@atlaskit/tmp-editor-statsig": "^8.7.0",
50
+ "@atlaskit/tokens": "^5.4.0",
52
51
  "@atlaskit/tooltip": "^20.3.0",
53
52
  "@babel/runtime": "^7.0.0",
54
53
  "@emotion/react": "^11.7.1",
@@ -56,18 +55,19 @@
56
55
  "w3c-keyname": "^2.1.8"
57
56
  },
58
57
  "peerDependencies": {
58
+ "@atlaskit/editor-common": "^107.6.0",
59
59
  "react": "^18.2.0",
60
60
  "react-dom": "^18.2.0",
61
61
  "react-intl-next": "npm:react-intl@^5.18.1"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@atlaskit/analytics-next": "^11.1.0",
65
- "@atlaskit/editor-plugin-content-insertion": "^2.1.0",
66
- "@atlaskit/editor-plugin-guideline": "^2.0.0",
67
- "@atlaskit/editor-plugin-quick-insert": "^2.6.0",
68
- "@atlaskit/editor-plugin-table": "^10.12.0",
69
- "@atlaskit/editor-plugin-type-ahead": "^2.7.0",
70
- "@atlaskit/editor-plugin-width": "^3.0.0",
65
+ "@atlaskit/editor-plugin-content-insertion": "^3.0.0",
66
+ "@atlaskit/editor-plugin-guideline": "^3.0.0",
67
+ "@atlaskit/editor-plugin-quick-insert": "^3.0.0",
68
+ "@atlaskit/editor-plugin-table": "^11.0.0",
69
+ "@atlaskit/editor-plugin-type-ahead": "^3.0.0",
70
+ "@atlaskit/editor-plugin-width": "^4.0.0",
71
71
  "@testing-library/react": "^13.4.0",
72
72
  "react-test-renderer": "^18.2.0",
73
73
  "typescript": "~5.4.2"