@atlaskit/editor-plugin-card 4.3.1 → 4.3.2

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,17 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 4.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#152510](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/152510)
8
+ [`dcf9edde7ac7b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/dcf9edde7ac7b) -
9
+ bump adf-schema to 42.0.1
10
+ - [#152197](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/152197)
11
+ [`dddd3eca66a62`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/dddd3eca66a62) -
12
+ Optimise the re-renders for floating toolbar in live edit mode.
13
+ - Updated dependencies
14
+
3
15
  ## 4.3.1
4
16
 
5
17
  ### Patch Changes
@@ -15,6 +15,7 @@ var _rafSchd = _interopRequireDefault(require("raf-schd"));
15
15
  var _hooks = require("@atlaskit/editor-common/hooks");
16
16
  var _link = require("@atlaskit/editor-common/link");
17
17
  var _ui = require("@atlaskit/editor-common/ui");
18
+ var _state = require("@atlaskit/editor-prosemirror/state");
18
19
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
19
20
  var _smartCard = require("@atlaskit/smart-card");
20
21
  var _actions = require("../pm-plugins/actions");
@@ -103,7 +104,6 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
103
104
  var WrappedInlineCardWithAwareness = (0, _genericCard.Card)(_inlineCardWithAwareness.InlineCardWithAwareness, _ui.UnsupportedInline);
104
105
  var WrappedInlineCard = (0, _genericCard.Card)(InlineCard, _ui.UnsupportedInline);
105
106
  function InlineCardNodeView(props) {
106
- var _floatingToolbarState;
107
107
  var useAlternativePreloader = props.useAlternativePreloader,
108
108
  node = props.node,
109
109
  view = props.view,
@@ -119,10 +119,10 @@ function InlineCardNodeView(props) {
119
119
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
120
120
  isOverlayHovered = _useState2[0],
121
121
  setIsOverlayHovered = _useState2[1];
122
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['floatingToolbar', 'editorViewMode']),
122
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['selection', 'editorViewMode']),
123
123
  editorViewModeState = _useSharedPluginState.editorViewModeState,
124
- floatingToolbarState = _useSharedPluginState.floatingToolbarState;
125
- var floatingToolbarNode = floatingToolbarState === null || floatingToolbarState === void 0 || (_floatingToolbarState = floatingToolbarState.configWithNodeInfo) === null || _floatingToolbarState === void 0 ? void 0 : _floatingToolbarState.node;
124
+ selectionState = _useSharedPluginState.selectionState;
125
+ var floatingToolbarNode = (selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection) instanceof _state.NodeSelection && (selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection.node);
126
126
  if (__livePage && (0, _platformFeatureFlags.fg)('linking_platform_smart_links_in_live_pages')) {
127
127
  var showHoverPreview = floatingToolbarNode !== node;
128
128
  var livePagesHoverCardFadeInDelay = 800;
@@ -4,6 +4,7 @@ import rafSchedule from 'raf-schd';
4
4
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
5
5
  import { handleNavigation } from '@atlaskit/editor-common/link';
6
6
  import { findOverflowScrollParent, UnsupportedInline } from '@atlaskit/editor-common/ui';
7
+ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
7
8
  import { fg } from '@atlaskit/platform-feature-flags';
8
9
  import { Card as SmartCard } from '@atlaskit/smart-card';
9
10
  import { registerCard } from '../pm-plugins/actions';
@@ -92,7 +93,6 @@ export const InlineCard = /*#__PURE__*/memo(({
92
93
  const WrappedInlineCardWithAwareness = Card(InlineCardWithAwareness, UnsupportedInline);
93
94
  const WrappedInlineCard = Card(InlineCard, UnsupportedInline);
94
95
  export function InlineCardNodeView(props) {
95
- var _floatingToolbarState;
96
96
  const {
97
97
  useAlternativePreloader,
98
98
  node,
@@ -109,9 +109,9 @@ export function InlineCardNodeView(props) {
109
109
  const [isOverlayHovered, setIsOverlayHovered] = useState(false);
110
110
  const {
111
111
  editorViewModeState,
112
- floatingToolbarState
113
- } = useSharedPluginState(pluginInjectionApi, ['floatingToolbar', 'editorViewMode']);
114
- const floatingToolbarNode = floatingToolbarState === null || floatingToolbarState === void 0 ? void 0 : (_floatingToolbarState = floatingToolbarState.configWithNodeInfo) === null || _floatingToolbarState === void 0 ? void 0 : _floatingToolbarState.node;
112
+ selectionState
113
+ } = useSharedPluginState(pluginInjectionApi, ['selection', 'editorViewMode']);
114
+ const floatingToolbarNode = (selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection) instanceof NodeSelection && (selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection.node);
115
115
  if (__livePage && fg('linking_platform_smart_links_in_live_pages')) {
116
116
  const showHoverPreview = floatingToolbarNode !== node;
117
117
  const livePagesHoverCardFadeInDelay = 800;
@@ -5,6 +5,7 @@ import rafSchedule from 'raf-schd';
5
5
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
6
6
  import { handleNavigation } from '@atlaskit/editor-common/link';
7
7
  import { findOverflowScrollParent, UnsupportedInline } from '@atlaskit/editor-common/ui';
8
+ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
8
9
  import { fg } from '@atlaskit/platform-feature-flags';
9
10
  import { Card as SmartCard } from '@atlaskit/smart-card';
10
11
  import { registerCard } from '../pm-plugins/actions';
@@ -91,7 +92,6 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
91
92
  var WrappedInlineCardWithAwareness = Card(InlineCardWithAwareness, UnsupportedInline);
92
93
  var WrappedInlineCard = Card(InlineCard, UnsupportedInline);
93
94
  export function InlineCardNodeView(props) {
94
- var _floatingToolbarState;
95
95
  var useAlternativePreloader = props.useAlternativePreloader,
96
96
  node = props.node,
97
97
  view = props.view,
@@ -107,10 +107,10 @@ export function InlineCardNodeView(props) {
107
107
  _useState2 = _slicedToArray(_useState, 2),
108
108
  isOverlayHovered = _useState2[0],
109
109
  setIsOverlayHovered = _useState2[1];
110
- var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['floatingToolbar', 'editorViewMode']),
110
+ var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['selection', 'editorViewMode']),
111
111
  editorViewModeState = _useSharedPluginState.editorViewModeState,
112
- floatingToolbarState = _useSharedPluginState.floatingToolbarState;
113
- var floatingToolbarNode = floatingToolbarState === null || floatingToolbarState === void 0 || (_floatingToolbarState = floatingToolbarState.configWithNodeInfo) === null || _floatingToolbarState === void 0 ? void 0 : _floatingToolbarState.node;
112
+ selectionState = _useSharedPluginState.selectionState;
113
+ var floatingToolbarNode = (selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection) instanceof NodeSelection && (selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection.node);
114
114
  if (__livePage && fg('linking_platform_smart_links_in_live_pages')) {
115
115
  var showHoverPreview = floatingToolbarNode !== node;
116
116
  var livePagesHoverCardFadeInDelay = 800;
@@ -7,6 +7,7 @@ import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmo
7
7
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
8
8
  import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
9
9
  import type { GridPlugin } from '@atlaskit/editor-plugin-grid';
10
+ import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
10
11
  import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
11
12
  import type { CardPluginOptions, CardPluginState } from './types';
12
13
  export type CardPlugin = NextEditorPlugin<'card', {
@@ -19,7 +20,8 @@ export type CardPlugin = NextEditorPlugin<'card', {
19
20
  DecorationsPlugin,
20
21
  GridPlugin,
21
22
  FloatingToolbarPlugin,
22
- OptionalPlugin<EditorDisabledPlugin>
23
+ OptionalPlugin<EditorDisabledPlugin>,
24
+ OptionalPlugin<SelectionPlugin>
23
25
  ];
24
26
  sharedState: CardPluginState | null;
25
27
  actions: CardPluginActions;
@@ -7,6 +7,7 @@ import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmo
7
7
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
8
8
  import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
9
9
  import type { GridPlugin } from '@atlaskit/editor-plugin-grid';
10
+ import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
10
11
  import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
11
12
  import type { CardPluginOptions, CardPluginState } from './types';
12
13
  export type CardPlugin = NextEditorPlugin<'card', {
@@ -19,7 +20,8 @@ export type CardPlugin = NextEditorPlugin<'card', {
19
20
  DecorationsPlugin,
20
21
  GridPlugin,
21
22
  FloatingToolbarPlugin,
22
- OptionalPlugin<EditorDisabledPlugin>
23
+ OptionalPlugin<EditorDisabledPlugin>,
24
+ OptionalPlugin<SelectionPlugin>
23
25
  ];
24
26
  sharedState: CardPluginState | null;
25
27
  actions: CardPluginActions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "4.3.1",
3
+ "version": "4.3.2",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,10 +31,10 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/adf-schema": "^40.9.4",
34
+ "@atlaskit/adf-schema": "^42.0.2",
35
35
  "@atlaskit/analytics-next": "^10.1.0",
36
36
  "@atlaskit/custom-steps": "^0.8.0",
37
- "@atlaskit/editor-common": "^93.4.0",
37
+ "@atlaskit/editor-common": "^93.5.0",
38
38
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
39
39
  "@atlaskit/editor-plugin-decorations": "^1.3.0",
40
40
  "@atlaskit/editor-plugin-editor-disabled": "^1.3.0",
@@ -57,7 +57,7 @@
57
57
  "@atlaskit/primitives": "^12.2.0",
58
58
  "@atlaskit/smart-card": "^30.1.0",
59
59
  "@atlaskit/theme": "^13.1.0",
60
- "@atlaskit/tmp-editor-statsig": "^2.4.0",
60
+ "@atlaskit/tmp-editor-statsig": "^2.5.0",
61
61
  "@atlaskit/tokens": "^2.0.0",
62
62
  "@babel/runtime": "^7.0.0",
63
63
  "@emotion/react": "^11.7.1",