@atlaskit/editor-plugin-code-bidi-warning 2.2.0 → 3.0.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,51 @@
1
1
  # @atlaskit/editor-plugin-code-bidi-warning
2
2
 
3
+ ## 3.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 3.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - [#181024](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/181024)
14
+ [`8e80c487ca307`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8e80c487ca307) - ##
15
+ Make `@atlaskit/editor-common` a peer dependency
16
+
17
+ **WHAT:** `@atlaskit/editor-common` has been moved from `dependencies` to `peerDependencies` in
18
+ all editor plugin packages.
19
+
20
+ **WHY:** This change ensures that only a single version of `@atlaskit/editor-common` is used in
21
+ consuming applications, preventing issues caused by multiple versions of singleton libraries (such
22
+ as context mismatches or duplicated state). This is especially important for packages that rely on
23
+ shared context or singletons.
24
+
25
+ **HOW TO ADJUST:**
26
+
27
+ - Consumers must now explicitly install `@atlaskit/editor-common` in their own project if they use
28
+ any of these editor plugins.
29
+ - Ensure the version you install matches the version required by the plugins.
30
+ - You can use the
31
+ [`check-peer-dependencies`](https://www.npmjs.com/package/check-peer-dependencies) package to
32
+ verify that all required peer dependencies are installed and compatible.
33
+ - Example install command:
34
+ ```
35
+ npm install @atlaskit/editor-common
36
+ ```
37
+ or
38
+ ```
39
+ yarn add @atlaskit/editor-common
40
+ ```
41
+
42
+ **Note:** This is a breaking change. If `@atlaskit/editor-common` is not installed at the
43
+ application level, you may see errors or unexpected behavior.
44
+
45
+ ### Patch Changes
46
+
47
+ - Updated dependencies
48
+
3
49
  ## 2.2.0
4
50
 
5
51
  ### Minor Changes
@@ -6,14 +6,15 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.codeBidiWarningPlugin = void 0;
7
7
  var _main = require("./pm-plugins/main");
8
8
  var codeBidiWarningPlugin = exports.codeBidiWarningPlugin = function codeBidiWarningPlugin(_ref) {
9
- var config = _ref.config;
9
+ var config = _ref.config,
10
+ api = _ref.api;
10
11
  return {
11
12
  name: 'codeBidiWarning',
12
13
  pmPlugins: function pmPlugins() {
13
14
  return [{
14
15
  name: 'codeBidiWarning',
15
16
  plugin: function plugin(options) {
16
- return (0, _main.createPlugin)(options, config !== null && config !== void 0 ? config : {});
17
+ return (0, _main.createPlugin)(api, options, config !== null && config !== void 0 ? config : {});
17
18
  }
18
19
  }];
19
20
  }
@@ -6,11 +6,12 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.createPlugin = void 0;
7
7
  var _messages = require("@atlaskit/editor-common/messages");
8
8
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
9
+ var _view = require("@atlaskit/editor-prosemirror/view");
9
10
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
10
11
  var _pluginKey = require("./plugin-key");
11
12
  var _reactPluginFactory = require("./react-plugin-factory");
12
13
  var _vanillaPluginFactory = require("./vanilla-plugin-factory");
13
- var createPlugin = exports.createPlugin = function createPlugin(_ref, _ref2) {
14
+ var createPlugin = exports.createPlugin = function createPlugin(api, _ref, _ref2) {
14
15
  var dispatch = _ref.dispatch,
15
16
  getIntl = _ref.getIntl,
16
17
  nodeViewPortalProviderAPI = _ref.nodeViewPortalProviderAPI;
@@ -23,6 +24,14 @@ var createPlugin = exports.createPlugin = function createPlugin(_ref, _ref2) {
23
24
  return new _safePlugin.SafePlugin({
24
25
  key: _pluginKey.codeBidiWarningPluginKey,
25
26
  state: createPluginState(dispatch, function (state) {
27
+ var _api$limitedMode;
28
+ if (api !== null && api !== void 0 && (_api$limitedMode = api.limitedMode) !== null && _api$limitedMode !== void 0 && (_api$limitedMode = _api$limitedMode.sharedState.currentState()) !== null && _api$limitedMode !== void 0 && _api$limitedMode.enabled) {
29
+ return {
30
+ decorationSet: _view.DecorationSet.empty,
31
+ codeBidiWarningLabel: '',
32
+ tooltipEnabled: false
33
+ };
34
+ }
26
35
  return {
27
36
  decorationSet: (0, _platformFeatureFlags.fg)('platform_editor_vanilla_codebidi_warning') ? (0, _vanillaPluginFactory.createBidiWarningsDecorationSetFromDoc)({
28
37
  doc: state.doc,
@@ -1,13 +1,14 @@
1
1
  import { createPlugin } from './pm-plugins/main';
2
2
  export const codeBidiWarningPlugin = ({
3
- config
3
+ config,
4
+ api
4
5
  }) => ({
5
6
  name: 'codeBidiWarning',
6
7
  pmPlugins() {
7
8
  return [{
8
9
  name: 'codeBidiWarning',
9
10
  plugin: options => {
10
- return createPlugin(options, config !== null && config !== void 0 ? config : {});
11
+ return createPlugin(api, options, config !== null && config !== void 0 ? config : {});
11
12
  }
12
13
  }];
13
14
  }
@@ -1,10 +1,11 @@
1
1
  import { codeBidiWarningMessages } from '@atlaskit/editor-common/messages';
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
+ import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
3
4
  import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import { codeBidiWarningPluginKey } from './plugin-key';
5
6
  import { createBidiWarningsDecorationSetFromDoc as reactCreateBidiWarningsDecorationSetFromDoc, pluginFactoryCreator as reactPluginFactoryCreator } from './react-plugin-factory';
6
7
  import { createBidiWarningsDecorationSetFromDoc as vanillaCreateBidiWarningsDecorationSetFromDoc, pluginFactoryCreator as vanillaPluginFactoryCreator } from './vanilla-plugin-factory';
7
- export const createPlugin = ({
8
+ export const createPlugin = (api, {
8
9
  dispatch,
9
10
  getIntl,
10
11
  nodeViewPortalProviderAPI
@@ -20,6 +21,14 @@ export const createPlugin = ({
20
21
  return new SafePlugin({
21
22
  key: codeBidiWarningPluginKey,
22
23
  state: createPluginState(dispatch, state => {
24
+ var _api$limitedMode, _api$limitedMode$shar;
25
+ if (api !== null && api !== void 0 && (_api$limitedMode = api.limitedMode) !== null && _api$limitedMode !== void 0 && (_api$limitedMode$shar = _api$limitedMode.sharedState.currentState()) !== null && _api$limitedMode$shar !== void 0 && _api$limitedMode$shar.enabled) {
26
+ return {
27
+ decorationSet: DecorationSet.empty,
28
+ codeBidiWarningLabel: '',
29
+ tooltipEnabled: false
30
+ };
31
+ }
23
32
  return {
24
33
  decorationSet: fg('platform_editor_vanilla_codebidi_warning') ? vanillaCreateBidiWarningsDecorationSetFromDoc({
25
34
  doc: state.doc,
@@ -1,13 +1,14 @@
1
1
  import { createPlugin } from './pm-plugins/main';
2
2
  export var codeBidiWarningPlugin = function codeBidiWarningPlugin(_ref) {
3
- var config = _ref.config;
3
+ var config = _ref.config,
4
+ api = _ref.api;
4
5
  return {
5
6
  name: 'codeBidiWarning',
6
7
  pmPlugins: function pmPlugins() {
7
8
  return [{
8
9
  name: 'codeBidiWarning',
9
10
  plugin: function plugin(options) {
10
- return createPlugin(options, config !== null && config !== void 0 ? config : {});
11
+ return createPlugin(api, options, config !== null && config !== void 0 ? config : {});
11
12
  }
12
13
  }];
13
14
  }
@@ -1,10 +1,11 @@
1
1
  import { codeBidiWarningMessages } from '@atlaskit/editor-common/messages';
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
+ import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
3
4
  import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import { codeBidiWarningPluginKey } from './plugin-key';
5
6
  import { createBidiWarningsDecorationSetFromDoc as reactCreateBidiWarningsDecorationSetFromDoc, pluginFactoryCreator as reactPluginFactoryCreator } from './react-plugin-factory';
6
7
  import { createBidiWarningsDecorationSetFromDoc as vanillaCreateBidiWarningsDecorationSetFromDoc, pluginFactoryCreator as vanillaPluginFactoryCreator } from './vanilla-plugin-factory';
7
- export var createPlugin = function createPlugin(_ref, _ref2) {
8
+ export var createPlugin = function createPlugin(api, _ref, _ref2) {
8
9
  var dispatch = _ref.dispatch,
9
10
  getIntl = _ref.getIntl,
10
11
  nodeViewPortalProviderAPI = _ref.nodeViewPortalProviderAPI;
@@ -17,6 +18,14 @@ export var createPlugin = function createPlugin(_ref, _ref2) {
17
18
  return new SafePlugin({
18
19
  key: codeBidiWarningPluginKey,
19
20
  state: createPluginState(dispatch, function (state) {
21
+ var _api$limitedMode;
22
+ if (api !== null && api !== void 0 && (_api$limitedMode = api.limitedMode) !== null && _api$limitedMode !== void 0 && (_api$limitedMode = _api$limitedMode.sharedState.currentState()) !== null && _api$limitedMode !== void 0 && _api$limitedMode.enabled) {
23
+ return {
24
+ decorationSet: DecorationSet.empty,
25
+ codeBidiWarningLabel: '',
26
+ tooltipEnabled: false
27
+ };
28
+ }
20
29
  return {
21
30
  decorationSet: fg('platform_editor_vanilla_codebidi_warning') ? vanillaCreateBidiWarningsDecorationSetFromDoc({
22
31
  doc: state.doc,
@@ -1,7 +1,9 @@
1
- import type { EditorAppearance, NextEditorPlugin } from '@atlaskit/editor-common/types';
1
+ import type { EditorAppearance, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
+ import type { LimitedModePlugin } from '@atlaskit/editor-plugin-limited-mode';
2
3
  export type CodeBidiWarningPluginOptions = {
3
4
  appearance?: EditorAppearance;
4
5
  };
5
6
  export type CodeBidiWarningPlugin = NextEditorPlugin<'codeBidiWarning', {
7
+ dependencies: [OptionalPlugin<LimitedModePlugin>];
6
8
  pluginConfiguration: CodeBidiWarningPluginOptions | undefined;
7
9
  }>;
@@ -1,5 +1,6 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { EditorAppearance, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
3
- export declare const createPlugin: ({ dispatch, getIntl, nodeViewPortalProviderAPI }: PMPluginFactoryParams, { appearance }: {
4
- appearance?: EditorAppearance | undefined;
2
+ import type { EditorAppearance, ExtractInjectionAPI, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
3
+ import type { CodeBidiWarningPlugin } from '../codeBidiWarningPluginType';
4
+ export declare const createPlugin: (api: ExtractInjectionAPI<CodeBidiWarningPlugin> | undefined, { dispatch, getIntl, nodeViewPortalProviderAPI }: PMPluginFactoryParams, { appearance }: {
5
+ appearance?: EditorAppearance;
5
6
  }) => SafePlugin<import("./types").CodeBidiWarningPluginState>;
@@ -3,7 +3,7 @@ import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
3
3
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
4
  export declare const pluginFactoryCreator: (nodeViewPortalProviderAPI: PortalProviderAPI) => {
5
5
  createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: import("./types").CodeBidiWarningPluginState | ((state: import("prosemirror-state").EditorState) => import("./types").CodeBidiWarningPluginState)) => import("prosemirror-state").SafeStateField<import("./types").CodeBidiWarningPluginState>;
6
- createCommand: <A = unknown>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command;
6
+ createCommand: <A = unknown>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: (tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) => import("@atlaskit/editor-common/types").Command;
7
7
  getPluginState: (state: import("prosemirror-state").EditorState) => import("./types").CodeBidiWarningPluginState;
8
8
  };
9
9
  export declare function createBidiWarningsDecorationSetFromDoc({ doc, codeBidiWarningLabel, tooltipEnabled, nodeViewPortalProviderAPI, }: {
@@ -2,7 +2,7 @@ import { type Node as PmNode } from '@atlaskit/editor-prosemirror/model';
2
2
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
3
3
  export declare const pluginFactoryCreator: () => {
4
4
  createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: import("./types").CodeBidiWarningPluginState | ((state: import("prosemirror-state").EditorState) => import("./types").CodeBidiWarningPluginState)) => import("prosemirror-state").SafeStateField<import("./types").CodeBidiWarningPluginState>;
5
- createCommand: <A = unknown>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command;
5
+ createCommand: <A = unknown>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: (tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) => import("@atlaskit/editor-common/types").Command;
6
6
  getPluginState: (state: import("prosemirror-state").EditorState) => import("./types").CodeBidiWarningPluginState;
7
7
  };
8
8
  export declare function createBidiWarningsDecorationSetFromDoc({ doc, codeBidiWarningLabel, tooltipEnabled, }: {
@@ -1,7 +1,11 @@
1
- import type { EditorAppearance, NextEditorPlugin } from '@atlaskit/editor-common/types';
1
+ import type { EditorAppearance, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
+ import type { LimitedModePlugin } from '@atlaskit/editor-plugin-limited-mode';
2
3
  export type CodeBidiWarningPluginOptions = {
3
4
  appearance?: EditorAppearance;
4
5
  };
5
6
  export type CodeBidiWarningPlugin = NextEditorPlugin<'codeBidiWarning', {
7
+ dependencies: [
8
+ OptionalPlugin<LimitedModePlugin>
9
+ ];
6
10
  pluginConfiguration: CodeBidiWarningPluginOptions | undefined;
7
11
  }>;
@@ -1,5 +1,6 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { EditorAppearance, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
3
- export declare const createPlugin: ({ dispatch, getIntl, nodeViewPortalProviderAPI }: PMPluginFactoryParams, { appearance }: {
4
- appearance?: EditorAppearance | undefined;
2
+ import type { EditorAppearance, ExtractInjectionAPI, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
3
+ import type { CodeBidiWarningPlugin } from '../codeBidiWarningPluginType';
4
+ export declare const createPlugin: (api: ExtractInjectionAPI<CodeBidiWarningPlugin> | undefined, { dispatch, getIntl, nodeViewPortalProviderAPI }: PMPluginFactoryParams, { appearance }: {
5
+ appearance?: EditorAppearance;
5
6
  }) => SafePlugin<import("./types").CodeBidiWarningPluginState>;
@@ -3,7 +3,7 @@ import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
3
3
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
4
  export declare const pluginFactoryCreator: (nodeViewPortalProviderAPI: PortalProviderAPI) => {
5
5
  createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: import("./types").CodeBidiWarningPluginState | ((state: import("prosemirror-state").EditorState) => import("./types").CodeBidiWarningPluginState)) => import("prosemirror-state").SafeStateField<import("./types").CodeBidiWarningPluginState>;
6
- createCommand: <A = unknown>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command;
6
+ createCommand: <A = unknown>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: (tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) => import("@atlaskit/editor-common/types").Command;
7
7
  getPluginState: (state: import("prosemirror-state").EditorState) => import("./types").CodeBidiWarningPluginState;
8
8
  };
9
9
  export declare function createBidiWarningsDecorationSetFromDoc({ doc, codeBidiWarningLabel, tooltipEnabled, nodeViewPortalProviderAPI, }: {
@@ -2,7 +2,7 @@ import { type Node as PmNode } from '@atlaskit/editor-prosemirror/model';
2
2
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
3
3
  export declare const pluginFactoryCreator: () => {
4
4
  createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: import("./types").CodeBidiWarningPluginState | ((state: import("prosemirror-state").EditorState) => import("./types").CodeBidiWarningPluginState)) => import("prosemirror-state").SafeStateField<import("./types").CodeBidiWarningPluginState>;
5
- createCommand: <A = unknown>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command;
5
+ createCommand: <A = unknown>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: (tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) => import("@atlaskit/editor-common/types").Command;
6
6
  getPluginState: (state: import("prosemirror-state").EditorState) => import("./types").CodeBidiWarningPluginState;
7
7
  };
8
8
  export declare function createBidiWarningsDecorationSetFromDoc({ doc, codeBidiWarningLabel, tooltipEnabled, }: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-code-bidi-warning",
3
- "version": "2.2.0",
3
+ "version": "3.0.1",
4
4
  "description": "Code bidi warning plugin for @atlaskit/editor-core.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,13 +31,14 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@atlaskit/code": "^17.2.0",
34
- "@atlaskit/editor-common": "^107.5.0",
34
+ "@atlaskit/editor-plugin-limited-mode": "^0.0.1",
35
35
  "@atlaskit/editor-prosemirror": "7.0.0",
36
36
  "@atlaskit/platform-feature-flags": "^1.1.0",
37
37
  "@babel/runtime": "^7.0.0",
38
38
  "uuid": "^3.1.0"
39
39
  },
40
40
  "peerDependencies": {
41
+ "@atlaskit/editor-common": "^107.25.0",
41
42
  "react": "^18.2.0",
42
43
  "react-dom": "^18.2.0"
43
44
  },
@@ -47,7 +48,6 @@
47
48
  "@atlaskit/ssr": "workspace:^",
48
49
  "@atlaskit/visual-regression": "workspace:^",
49
50
  "@testing-library/react": "^13.4.0",
50
- "typescript": "~5.4.2",
51
51
  "wait-for-expect": "^1.2.0"
52
52
  },
53
53
  "techstack": {