@atlaskit/editor-plugin-loom 6.0.4 → 6.0.6

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,23 @@
1
1
  # @atlaskit/editor-plugin-loom
2
2
 
3
+ ## 6.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`c0113eeccb2df`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c0113eeccb2df) -
8
+ [ux] ED-29120 add a new config option for default editor preset
9
+ (`toolbar.enableNewToolbarExperience`) which allows the new toolbar to be disabled. This is needed
10
+ for editors that can't be excluded at the experiment level.
11
+ - Updated dependencies
12
+
13
+ ## 6.0.5
14
+
15
+ ### Patch Changes
16
+
17
+ - [`0812ff5bd7bd1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0812ff5bd7bd1) -
18
+ Dont render menu sections in live view
19
+ - Updated dependencies
20
+
3
21
  ## 6.0.4
4
22
 
5
23
  ### Patch Changes
@@ -17,7 +17,7 @@ var loomPlugin = exports.loomPlugin = function loomPlugin(_ref) {
17
17
  var config = _ref.config,
18
18
  api = _ref.api;
19
19
  var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
20
- var isNewToolbarEnabled = (0, _experiments.editorExperiment)('platform_editor_toolbar_aifc', true, {
20
+ var isNewToolbarEnabled = Boolean(api === null || api === void 0 ? void 0 : api.toolbar) && (0, _experiments.editorExperiment)('platform_editor_toolbar_aifc', true, {
21
21
  exposure: true
22
22
  }) && (0, _expValEquals.expValEquals)('platform_editor_toolbar_migrate_loom', 'isEnabled', true);
23
23
 
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.MenuSection = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
10
+ var _editorToolbar = require("@atlaskit/editor-toolbar");
11
+ var MenuSection = exports.MenuSection = function MenuSection(_ref) {
12
+ var children = _ref.children,
13
+ api = _ref.api;
14
+ var viewMode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'editorViewMode.mode');
15
+ var isEdit = viewMode === 'edit';
16
+ return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, {
17
+ hasSeparator: isEdit
18
+ }, children);
19
+ };
@@ -8,7 +8,9 @@ exports.getToolbarComponents = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _toolbar = require("@atlaskit/editor-common/toolbar");
10
10
  var _editorToolbar = require("@atlaskit/editor-toolbar");
11
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
11
12
  var _LoomMenuItem = require("./LoomMenuItem");
13
+ var _MenuSection = require("./MenuSection");
12
14
  var getToolbarComponents = exports.getToolbarComponents = function getToolbarComponents(config, api) {
13
15
  return [{
14
16
  type: _toolbar.LOOM_MENU_SECTION.type,
@@ -24,6 +26,11 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
24
26
  }],
25
27
  component: function component(_ref) {
26
28
  var children = _ref.children;
29
+ if ((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true)) {
30
+ return /*#__PURE__*/_react.default.createElement(_MenuSection.MenuSection, {
31
+ api: api
32
+ }, children);
33
+ }
27
34
  return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, {
28
35
  hasSeparator: true
29
36
  }, children);
@@ -12,7 +12,7 @@ export const loomPlugin = ({
12
12
  }) => {
13
13
  var _api$analytics;
14
14
  const editorAnalyticsAPI = api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
15
- const isNewToolbarEnabled = editorExperiment('platform_editor_toolbar_aifc', true, {
15
+ const isNewToolbarEnabled = Boolean(api === null || api === void 0 ? void 0 : api.toolbar) && editorExperiment('platform_editor_toolbar_aifc', true, {
16
16
  exposure: true
17
17
  }) && expValEquals('platform_editor_toolbar_migrate_loom', 'isEnabled', true);
18
18
 
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
3
+ import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
4
+ export const MenuSection = ({
5
+ children,
6
+ api
7
+ }) => {
8
+ const viewMode = useSharedPluginStateSelector(api, 'editorViewMode.mode');
9
+ const isEdit = viewMode === 'edit';
10
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
11
+ hasSeparator: isEdit
12
+ }, children);
13
+ };
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import { LOOM_MENU_SECTION, OVERFLOW_MENU_RANK, OVERFLOW_MENU, LOOM_MENU_ITEM, LOOM_MENU_SECTION_RANK, OVERFLOW_MENU_PRIMARY_TOOLBAR_RANK, OVERFLOW_MENU_PRIMARY_TOOLBAR } from '@atlaskit/editor-common/toolbar';
3
3
  import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
4
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
5
  import { LoomMenuItem } from './LoomMenuItem';
6
+ import { MenuSection } from './MenuSection';
5
7
  export const getToolbarComponents = (config, api) => {
6
8
  return [{
7
9
  type: LOOM_MENU_SECTION.type,
@@ -18,6 +20,11 @@ export const getToolbarComponents = (config, api) => {
18
20
  component: ({
19
21
  children
20
22
  }) => {
23
+ if (expValEquals('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true)) {
24
+ return /*#__PURE__*/React.createElement(MenuSection, {
25
+ api: api
26
+ }, children);
27
+ }
21
28
  return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
22
29
  hasSeparator: true
23
30
  }, children);
@@ -11,7 +11,7 @@ export var loomPlugin = function loomPlugin(_ref) {
11
11
  var config = _ref.config,
12
12
  api = _ref.api;
13
13
  var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
14
- var isNewToolbarEnabled = editorExperiment('platform_editor_toolbar_aifc', true, {
14
+ var isNewToolbarEnabled = Boolean(api === null || api === void 0 ? void 0 : api.toolbar) && editorExperiment('platform_editor_toolbar_aifc', true, {
15
15
  exposure: true
16
16
  }) && expValEquals('platform_editor_toolbar_migrate_loom', 'isEnabled', true);
17
17
 
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
3
+ import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
4
+ export var MenuSection = function MenuSection(_ref) {
5
+ var children = _ref.children,
6
+ api = _ref.api;
7
+ var viewMode = useSharedPluginStateSelector(api, 'editorViewMode.mode');
8
+ var isEdit = viewMode === 'edit';
9
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
10
+ hasSeparator: isEdit
11
+ }, children);
12
+ };
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import { LOOM_MENU_SECTION, OVERFLOW_MENU_RANK, OVERFLOW_MENU, LOOM_MENU_ITEM, LOOM_MENU_SECTION_RANK, OVERFLOW_MENU_PRIMARY_TOOLBAR_RANK, OVERFLOW_MENU_PRIMARY_TOOLBAR } from '@atlaskit/editor-common/toolbar';
3
3
  import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
4
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
5
  import { LoomMenuItem } from './LoomMenuItem';
6
+ import { MenuSection } from './MenuSection';
5
7
  export var getToolbarComponents = function getToolbarComponents(config, api) {
6
8
  return [{
7
9
  type: LOOM_MENU_SECTION.type,
@@ -17,6 +19,11 @@ export var getToolbarComponents = function getToolbarComponents(config, api) {
17
19
  }],
18
20
  component: function component(_ref) {
19
21
  var children = _ref.children;
22
+ if (expValEquals('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true)) {
23
+ return /*#__PURE__*/React.createElement(MenuSection, {
24
+ api: api
25
+ }, children);
26
+ }
20
27
  return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
21
28
  hasSeparator: true
22
29
  }, children);
@@ -3,6 +3,7 @@ import { type INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
3
  import type { EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
4
4
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
5
5
  import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
6
+ import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
6
7
  import type { HyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
7
8
  import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
8
9
  import { type QuickInsertPlugin } from '@atlaskit/editor-plugin-quick-insert';
@@ -41,7 +42,8 @@ export type LoomPlugin = NextEditorPlugin<'loom', {
41
42
  OptionalPlugin<PrimaryToolbarPlugin>,
42
43
  OptionalPlugin<QuickInsertPlugin>,
43
44
  OptionalPlugin<ConnectivityPlugin>,
44
- OptionalPlugin<ToolbarPlugin>
45
+ OptionalPlugin<ToolbarPlugin>,
46
+ OptionalPlugin<EditorViewModePlugin>
45
47
  ];
46
48
  pluginConfiguration: LoomPluginOptions;
47
49
  sharedState: LoomPluginState | undefined;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
+ import type { LoomPlugin } from '../loomPluginType';
4
+ type MenuSectionProps = {
5
+ api: ExtractInjectionAPI<LoomPlugin> | undefined;
6
+ children: React.ReactNode;
7
+ };
8
+ export declare const MenuSection: ({ children, api }: MenuSectionProps) => React.JSX.Element;
9
+ export {};
@@ -3,6 +3,7 @@ import { type INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
3
  import type { EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
4
4
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
5
5
  import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
6
+ import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
6
7
  import type { HyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
7
8
  import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
8
9
  import { type QuickInsertPlugin } from '@atlaskit/editor-plugin-quick-insert';
@@ -41,7 +42,8 @@ export type LoomPlugin = NextEditorPlugin<'loom', {
41
42
  OptionalPlugin<PrimaryToolbarPlugin>,
42
43
  OptionalPlugin<QuickInsertPlugin>,
43
44
  OptionalPlugin<ConnectivityPlugin>,
44
- OptionalPlugin<ToolbarPlugin>
45
+ OptionalPlugin<ToolbarPlugin>,
46
+ OptionalPlugin<EditorViewModePlugin>
45
47
  ];
46
48
  pluginConfiguration: LoomPluginOptions;
47
49
  sharedState: LoomPluginState | undefined;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
+ import type { LoomPlugin } from '../loomPluginType';
4
+ type MenuSectionProps = {
5
+ api: ExtractInjectionAPI<LoomPlugin> | undefined;
6
+ children: React.ReactNode;
7
+ };
8
+ export declare const MenuSection: ({ children, api }: MenuSectionProps) => React.JSX.Element;
9
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-loom",
3
- "version": "6.0.4",
3
+ "version": "6.0.6",
4
4
  "description": "Loom plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,35 +34,36 @@
34
34
  "dependencies": {
35
35
  "@atlaskit/button": "^23.4.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^4.0.0",
37
+ "@atlaskit/editor-plugin-editor-viewmode": "^6.0.0",
37
38
  "@atlaskit/editor-plugin-hyperlink": "^6.0.0",
38
39
  "@atlaskit/editor-plugin-primary-toolbar": "^5.0.0",
39
40
  "@atlaskit/editor-plugin-quick-insert": "^4.0.0",
40
- "@atlaskit/editor-plugin-toolbar": "^1.1.0",
41
+ "@atlaskit/editor-plugin-toolbar": "^1.2.0",
41
42
  "@atlaskit/editor-plugin-width": "^5.0.0",
42
43
  "@atlaskit/editor-prosemirror": "7.0.0",
43
44
  "@atlaskit/editor-toolbar": "^0.8.0",
44
45
  "@atlaskit/icon": "^28.1.0",
45
46
  "@atlaskit/platform-feature-flags": "^1.1.0",
46
- "@atlaskit/tmp-editor-statsig": "^12.5.0",
47
- "@atlaskit/tokens": "^6.2.0",
47
+ "@atlaskit/tmp-editor-statsig": "^12.8.0",
48
+ "@atlaskit/tokens": "^6.3.0",
48
49
  "@babel/runtime": "^7.0.0",
49
50
  "@emotion/react": "^11.7.1",
50
51
  "@loomhq/record-sdk": "^2.36.18"
51
52
  },
52
53
  "peerDependencies": {
53
- "@atlaskit/editor-common": "^108.5.0",
54
+ "@atlaskit/editor-common": "^108.6.0",
54
55
  "react": "^18.2.0",
55
56
  "react-dom": "^18.2.0",
56
57
  "react-intl-next": "npm:react-intl@^5.18.1"
57
58
  },
58
59
  "devDependencies": {
59
60
  "@atlaskit/editor-plugin-base": "^5.0.0",
60
- "@atlaskit/editor-plugin-card": "^8.0.0",
61
+ "@atlaskit/editor-plugin-card": "^8.1.0",
61
62
  "@atlaskit/editor-plugin-copy-button": "^4.0.0",
62
63
  "@atlaskit/editor-plugin-decorations": "^4.0.0",
63
64
  "@atlaskit/editor-plugin-editor-disabled": "^4.0.0",
64
65
  "@atlaskit/editor-plugin-feature-flags": "^3.0.0",
65
- "@atlaskit/editor-plugin-floating-toolbar": "^6.0.0",
66
+ "@atlaskit/editor-plugin-floating-toolbar": "^6.1.0",
66
67
  "@atlaskit/editor-plugin-grid": "^4.0.0",
67
68
  "@testing-library/react": "^13.4.0",
68
69
  "@testing-library/user-event": "^14.4.3",