@atlaskit/editor-plugin-card 6.0.0 → 6.0.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 +18 -0
- package/dist/cjs/nodeviews/embedCard.js +25 -6
- package/dist/cjs/nodeviews/genericCard.js +16 -3
- package/dist/cjs/nodeviews/inlineCard.js +23 -6
- package/dist/cjs/nodeviews/inlineCardWithAwareness.js +17 -4
- package/dist/cjs/ui/DatasourceModal/ModalWithState.js +24 -5
- package/dist/cjs/ui/HyperlinkToolbarAppearanceDropdown.js +2 -1
- package/dist/cjs/ui/LayoutButton/index.js +20 -9
- package/dist/cjs/ui/toolbar.js +25 -10
- package/dist/es2019/nodeviews/embedCard.js +27 -7
- package/dist/es2019/nodeviews/genericCard.js +18 -4
- package/dist/es2019/nodeviews/inlineCard.js +25 -7
- package/dist/es2019/nodeviews/inlineCardWithAwareness.js +19 -5
- package/dist/es2019/ui/DatasourceModal/ModalWithState.js +26 -8
- package/dist/es2019/ui/HyperlinkToolbarAppearanceDropdown.js +2 -1
- package/dist/es2019/ui/LayoutButton/index.js +22 -11
- package/dist/es2019/ui/toolbar.js +23 -10
- package/dist/esm/nodeviews/embedCard.js +26 -7
- package/dist/esm/nodeviews/genericCard.js +17 -4
- package/dist/esm/nodeviews/inlineCard.js +24 -7
- package/dist/esm/nodeviews/inlineCardWithAwareness.js +18 -5
- package/dist/esm/ui/DatasourceModal/ModalWithState.js +25 -6
- package/dist/esm/ui/HyperlinkToolbarAppearanceDropdown.js +2 -1
- package/dist/esm/ui/LayoutButton/index.js +21 -10
- package/dist/esm/ui/toolbar.js +25 -10
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 6.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#154277](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/154277)
|
|
8
|
+
[`84e1566863396`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/84e1566863396) -
|
|
9
|
+
[ux] ED-27809 Update edit button for datasource link toolbars so users can update search query
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 6.0.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#147070](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/147070)
|
|
17
|
+
[`9fec1cb4ec861`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9fec1cb4ec861) -
|
|
18
|
+
Migrate Card plugin to use useSharedPluginStateSelector
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 6.0.0
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -20,6 +20,7 @@ var _steps = require("@atlaskit/adf-schema/steps");
|
|
|
20
20
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
21
21
|
var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
|
|
22
22
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
23
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
23
24
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
24
25
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
25
26
|
var _smartCard = require("@atlaskit/smart-card");
|
|
@@ -31,6 +32,25 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
31
32
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
32
33
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
33
34
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
35
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
|
|
36
|
+
var lineLength = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'width.lineLength');
|
|
37
|
+
var width = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'width.width');
|
|
38
|
+
var editorDisabled = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'editorDisabled.editorDisabled');
|
|
39
|
+
return {
|
|
40
|
+
widthStateLineLength: lineLength || 0,
|
|
41
|
+
widthStateWidth: width || 0,
|
|
42
|
+
editorDisabled: editorDisabled
|
|
43
|
+
};
|
|
44
|
+
}, function (pluginInjectionApi) {
|
|
45
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['width', 'editorDisabled']),
|
|
46
|
+
widthState = _useSharedPluginState.widthState,
|
|
47
|
+
editorDisabledState = _useSharedPluginState.editorDisabledState;
|
|
48
|
+
return {
|
|
49
|
+
widthStateLineLength: (widthState === null || widthState === void 0 ? void 0 : widthState.lineLength) || 0,
|
|
50
|
+
widthStateWidth: (widthState === null || widthState === void 0 ? void 0 : widthState.width) || 0,
|
|
51
|
+
editorDisabled: editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled
|
|
52
|
+
};
|
|
53
|
+
});
|
|
34
54
|
var CardInner = function CardInner(_ref) {
|
|
35
55
|
var pluginInjectionApi = _ref.pluginInjectionApi,
|
|
36
56
|
getPosSafely = _ref.getPosSafely,
|
|
@@ -46,11 +66,10 @@ var CardInner = function CardInner(_ref) {
|
|
|
46
66
|
heightAlone = _ref.heightAlone,
|
|
47
67
|
cardProps = _ref.cardProps,
|
|
48
68
|
dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
|
|
49
|
-
var
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
var widthStateWidth = (widthState === null || widthState === void 0 ? void 0 : widthState.width) || 0;
|
|
69
|
+
var _useSharedState = useSharedState(pluginInjectionApi),
|
|
70
|
+
widthStateLineLength = _useSharedState.widthStateLineLength,
|
|
71
|
+
widthStateWidth = _useSharedState.widthStateWidth,
|
|
72
|
+
editorDisabled = _useSharedState.editorDisabled;
|
|
54
73
|
var pos = getPosSafely();
|
|
55
74
|
if (pos === undefined) {
|
|
56
75
|
return null;
|
|
@@ -103,7 +122,7 @@ var CardInner = function CardInner(_ref) {
|
|
|
103
122
|
displayGrid: displayGrid,
|
|
104
123
|
updateSize: updateSize,
|
|
105
124
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
106
|
-
isResizeDisabled:
|
|
125
|
+
isResizeDisabled: editorDisabled
|
|
107
126
|
}), smartCard);
|
|
108
127
|
};
|
|
109
128
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
@@ -17,6 +17,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
17
17
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
18
18
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
19
19
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
20
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
20
21
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
21
22
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
22
23
|
var _doc = require("../pm-plugins/doc");
|
|
@@ -27,14 +28,26 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
27
28
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
28
29
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
29
30
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
31
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
|
|
32
|
+
var mode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'editorViewMode.mode');
|
|
33
|
+
return {
|
|
34
|
+
mode: mode
|
|
35
|
+
};
|
|
36
|
+
}, function (pluginInjectionApi) {
|
|
37
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['editorViewMode']),
|
|
38
|
+
editorViewModeState = _useSharedPluginState.editorViewModeState;
|
|
39
|
+
return {
|
|
40
|
+
mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
|
|
41
|
+
};
|
|
42
|
+
});
|
|
30
43
|
var WithClickHandler = function WithClickHandler(_ref) {
|
|
31
44
|
var pluginInjectionApi = _ref.pluginInjectionApi,
|
|
32
45
|
url = _ref.url,
|
|
33
46
|
onClickCallback = _ref.onClickCallback,
|
|
34
47
|
children = _ref.children,
|
|
35
48
|
__livePage = _ref.__livePage;
|
|
36
|
-
var
|
|
37
|
-
|
|
49
|
+
var _useSharedState = useSharedState(pluginInjectionApi),
|
|
50
|
+
mode = _useSharedState.mode;
|
|
38
51
|
var onClick = (0, _react.useCallback)(function (event) {
|
|
39
52
|
if (typeof onClickCallback === 'function') {
|
|
40
53
|
try {
|
|
@@ -63,7 +76,7 @@ var WithClickHandler = function WithClickHandler(_ref) {
|
|
|
63
76
|
|
|
64
77
|
// Setting `onClick` to `undefined` ensures clicks on smartcards navigate to the URL.
|
|
65
78
|
// If in view mode and not overriding with onClickCallback option, then allow smartlinks to navigate on click.
|
|
66
|
-
var allowNavigation =
|
|
79
|
+
var allowNavigation = mode === 'view' && !onClickCallback;
|
|
67
80
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children({
|
|
68
81
|
onClick: allowNavigation ? undefined : onClick
|
|
69
82
|
}));
|
|
@@ -16,6 +16,7 @@ var _v = _interopRequireDefault(require("uuid/v4"));
|
|
|
16
16
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
17
17
|
var _link = require("@atlaskit/editor-common/link");
|
|
18
18
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
19
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
19
20
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
20
21
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
21
22
|
var _smartCard = require("@atlaskit/smart-card");
|
|
@@ -137,6 +138,22 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
|
|
|
137
138
|
});
|
|
138
139
|
var WrappedInlineCardWithAwareness = (0, _genericCard.Card)(_inlineCardWithAwareness.InlineCardWithAwareness, _ui.UnsupportedInline);
|
|
139
140
|
var WrappedInlineCard = (0, _genericCard.Card)(InlineCard, _ui.UnsupportedInline);
|
|
141
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
|
|
142
|
+
var mode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'editorViewMode.mode');
|
|
143
|
+
var selection = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'selection.selection');
|
|
144
|
+
return {
|
|
145
|
+
mode: mode,
|
|
146
|
+
selection: selection
|
|
147
|
+
};
|
|
148
|
+
}, function (pluginInjectionApi) {
|
|
149
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['selection', 'editorViewMode']),
|
|
150
|
+
selectionState = _useSharedPluginState.selectionState,
|
|
151
|
+
editorViewModeState = _useSharedPluginState.editorViewModeState;
|
|
152
|
+
return {
|
|
153
|
+
mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
|
|
154
|
+
selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
|
|
155
|
+
};
|
|
156
|
+
});
|
|
140
157
|
function InlineCardNodeView(props) {
|
|
141
158
|
var useAlternativePreloader = props.useAlternativePreloader,
|
|
142
159
|
node = props.node,
|
|
@@ -154,10 +171,10 @@ function InlineCardNodeView(props) {
|
|
|
154
171
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
155
172
|
isOverlayHovered = _useState2[0],
|
|
156
173
|
setIsOverlayHovered = _useState2[1];
|
|
157
|
-
var
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
var floatingToolbarNode =
|
|
174
|
+
var _useSharedState = useSharedState(pluginInjectionApi),
|
|
175
|
+
mode = _useSharedState.mode,
|
|
176
|
+
selection = _useSharedState.selection;
|
|
177
|
+
var floatingToolbarNode = selection instanceof _state.NodeSelection && selection.node;
|
|
161
178
|
if (__livePage && (0, _platformFeatureFlags.fg)('linking_platform_smart_links_in_live_pages')) {
|
|
162
179
|
var showHoverPreview = floatingToolbarNode !== node;
|
|
163
180
|
var livePagesHoverCardFadeInDelay = 800;
|
|
@@ -175,7 +192,7 @@ function InlineCardNodeView(props) {
|
|
|
175
192
|
},
|
|
176
193
|
isPageSSRed: isPageSSRed
|
|
177
194
|
});
|
|
178
|
-
return
|
|
195
|
+
return mode === 'view' ? inlineCard : /*#__PURE__*/_react.default.createElement(_ConfigureOverlay.default, {
|
|
179
196
|
targetElementPos: getPos(),
|
|
180
197
|
view: view,
|
|
181
198
|
isHoveredCallback: setIsOverlayHovered,
|
|
@@ -202,7 +219,7 @@ function InlineCardNodeView(props) {
|
|
|
202
219
|
appearance: "inline"
|
|
203
220
|
// Ignored via go/ees005
|
|
204
221
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
205
|
-
}, enableInlineUpgradeFeatures && (0, _utils.getAwarenessProps)(view.state, getPos, allowEmbeds, allowBlockCards, !(0, _experiments.editorExperiment)('live_pages_graceful_edit', 'control') ? true :
|
|
222
|
+
}, enableInlineUpgradeFeatures && (0, _utils.getAwarenessProps)(view.state, getPos, allowEmbeds, allowBlockCards, !(0, _experiments.editorExperiment)('live_pages_graceful_edit', 'control') ? true : mode === 'view')));
|
|
206
223
|
}
|
|
207
224
|
var inlineCardNodeView = exports.inlineCardNodeView = function inlineCardNodeView(_ref2) {
|
|
208
225
|
var inlineCardViewProducer = _ref2.inlineCardViewProducer;
|
|
@@ -9,6 +9,7 @@ exports.InlineCardWithAwareness = void 0;
|
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
12
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
12
13
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
14
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
14
15
|
var _actions = require("../pm-plugins/actions");
|
|
@@ -18,6 +19,18 @@ var _OpenButtonOverlay = _interopRequireDefault(require("../ui/OpenButtonOverlay
|
|
|
18
19
|
var _inlineCard = require("./inlineCard");
|
|
19
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
20
21
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
22
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
|
|
23
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['editorViewMode']),
|
|
24
|
+
editorViewModeState = _useSharedPluginState.editorViewModeState;
|
|
25
|
+
return {
|
|
26
|
+
mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
|
|
27
|
+
};
|
|
28
|
+
}, function (pluginInjectionApi) {
|
|
29
|
+
var mode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'editorViewMode.mode');
|
|
30
|
+
return {
|
|
31
|
+
mode: mode
|
|
32
|
+
};
|
|
33
|
+
});
|
|
21
34
|
var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
22
35
|
var _pluginInjectionApi$c, _pluginInjectionApi$a;
|
|
23
36
|
var node = _ref.node,
|
|
@@ -73,8 +86,8 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
|
|
|
73
86
|
setIsHovered(isHovered);
|
|
74
87
|
}
|
|
75
88
|
}, [isOverlayEnabled]);
|
|
76
|
-
var
|
|
77
|
-
|
|
89
|
+
var _useSharedState = useSharedState(pluginInjectionApi),
|
|
90
|
+
mode = _useSharedState.mode;
|
|
78
91
|
var innerCardWithOpenButtonOverlay = (0, _react.useMemo)(function () {
|
|
79
92
|
return /*#__PURE__*/_react.default.createElement(_OpenButtonOverlay.default, {
|
|
80
93
|
isVisible: isResolvedViewRendered,
|
|
@@ -111,8 +124,8 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
|
|
|
111
124
|
}, [actionOptions, cardContext, getPos, isHovered, node, onClick, onResolve, useAlternativePreloader, view, isPageSSRed]);
|
|
112
125
|
var shouldShowOpenButtonOverlay = (0, _react.useMemo)(function () {
|
|
113
126
|
var shouldShowOpenButtonOverlayInChomeless = editorAppearance === 'chromeless' && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_8');
|
|
114
|
-
return (
|
|
115
|
-
}, [
|
|
127
|
+
return (mode === 'edit' || editorAppearance === 'comment' && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_6') || shouldShowOpenButtonOverlayInChomeless) && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1');
|
|
128
|
+
}, [mode, editorAppearance]);
|
|
116
129
|
var innerCard = shouldShowOpenButtonOverlay ? innerCardWithOpenButtonOverlay : innerCardOriginal;
|
|
117
130
|
var getPosFunction = typeof getPos === 'function' ? getPos : undefined;
|
|
118
131
|
var placeholderUniqId = (getPosFunction === null || getPosFunction === void 0 ? void 0 : getPosFunction()) || 0;
|
|
@@ -7,21 +7,40 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.modalTypeToComponentMap = exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
10
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
10
11
|
var _linkDatasource = require("@atlaskit/link-datasource");
|
|
11
12
|
var _linkProvider = require("@atlaskit/link-provider");
|
|
13
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
12
14
|
var _datasourceErrorBoundary = require("../datasourceErrorBoundary");
|
|
13
15
|
var _index = require("./index");
|
|
16
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
|
|
17
|
+
var showDatasourceModal = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'card.showDatasourceModal');
|
|
18
|
+
var datasourceModalType = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'card.datasourceModalType');
|
|
19
|
+
return {
|
|
20
|
+
cardState: undefined,
|
|
21
|
+
showDatasourceModal: showDatasourceModal,
|
|
22
|
+
datasourceModalType: datasourceModalType
|
|
23
|
+
};
|
|
24
|
+
}, function (pluginInjectionApi) {
|
|
25
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['card']),
|
|
26
|
+
cardState = _useSharedPluginState.cardState;
|
|
27
|
+
return {
|
|
28
|
+
cardState: cardState,
|
|
29
|
+
showDatasourceModal: cardState === null || cardState === void 0 ? void 0 : cardState.showDatasourceModal,
|
|
30
|
+
datasourceModalType: cardState === null || cardState === void 0 ? void 0 : cardState.datasourceModalType
|
|
31
|
+
};
|
|
32
|
+
});
|
|
14
33
|
var ModalWithState = function ModalWithState(_ref) {
|
|
15
34
|
var api = _ref.api,
|
|
16
35
|
editorView = _ref.editorView;
|
|
17
36
|
var cardContext = (0, _linkProvider.useSmartLinkContext)();
|
|
18
|
-
var
|
|
19
|
-
cardState =
|
|
20
|
-
|
|
37
|
+
var _useSharedState = useSharedState(api),
|
|
38
|
+
cardState = _useSharedState.cardState,
|
|
39
|
+
showDatasourceModal = _useSharedState.showDatasourceModal,
|
|
40
|
+
datasourceModalType = _useSharedState.datasourceModalType;
|
|
41
|
+
if (!cardState && (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)) {
|
|
21
42
|
return null;
|
|
22
43
|
}
|
|
23
|
-
var showDatasourceModal = cardState.showDatasourceModal,
|
|
24
|
-
datasourceModalType = cardState.datasourceModalType;
|
|
25
44
|
if (!showDatasourceModal || !datasourceModalType) {
|
|
26
45
|
return null;
|
|
27
46
|
}
|
|
@@ -14,6 +14,7 @@ var _card = require("@atlaskit/editor-common/card");
|
|
|
14
14
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
15
15
|
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
16
16
|
var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/utility/migration/chevron-down"));
|
|
17
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
18
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
18
19
|
var _LinkToolbarAppearanceDropdown = require("./LinkToolbarAppearanceDropdown");
|
|
19
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
@@ -148,7 +149,7 @@ var CustomHyperlinkDropdown = function CustomHyperlinkDropdown(props) {
|
|
|
148
149
|
return null;
|
|
149
150
|
}
|
|
150
151
|
var dispatchCommand = function dispatchCommand(fn) {
|
|
151
|
-
fn && fn(editorView && editorView.state, editorView && editorView.dispatch);
|
|
152
|
+
fn && fn(editorView && editorView.state, editorView && editorView.dispatch, (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_9') ? editorView : undefined);
|
|
152
153
|
// Refocus the view to ensure the editor has focus
|
|
153
154
|
if (editorView && !editorView.hasFocus()) {
|
|
154
155
|
editorView.focus();
|
|
@@ -12,6 +12,7 @@ var _reactIntlNext = require("react-intl-next");
|
|
|
12
12
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
13
13
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
14
14
|
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
15
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
15
16
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
16
17
|
var _growHorizontalEditorExpand = _interopRequireDefault(require("@atlaskit/icon/core/migration/grow-horizontal--editor-expand"));
|
|
17
18
|
var _shrinkHorizontalEditorCollapse = _interopRequireDefault(require("@atlaskit/icon/core/migration/shrink-horizontal--editor-collapse"));
|
|
@@ -77,6 +78,21 @@ var LayoutButton = exports.LayoutButton = function LayoutButton(_ref) {
|
|
|
77
78
|
})
|
|
78
79
|
}));
|
|
79
80
|
};
|
|
81
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
|
|
82
|
+
var layout = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'card.layout');
|
|
83
|
+
var datasourceTableRef = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'card.datasourceTableRef');
|
|
84
|
+
return {
|
|
85
|
+
layout: layout,
|
|
86
|
+
datasourceTableRef: datasourceTableRef
|
|
87
|
+
};
|
|
88
|
+
}, function (pluginInjectionApi) {
|
|
89
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['card']),
|
|
90
|
+
cardState = _useSharedPluginState.cardState;
|
|
91
|
+
return {
|
|
92
|
+
layout: cardState === null || cardState === void 0 ? void 0 : cardState.layout,
|
|
93
|
+
datasourceTableRef: cardState === null || cardState === void 0 ? void 0 : cardState.datasourceTableRef
|
|
94
|
+
};
|
|
95
|
+
});
|
|
80
96
|
var LayoutButtonWrapper = function LayoutButtonWrapper(_ref2) {
|
|
81
97
|
var _node$attrs;
|
|
82
98
|
var editorView = _ref2.editorView,
|
|
@@ -85,22 +101,17 @@ var LayoutButtonWrapper = function LayoutButtonWrapper(_ref2) {
|
|
|
85
101
|
boundariesElement = _ref2.boundariesElement,
|
|
86
102
|
intl = _ref2.intl,
|
|
87
103
|
api = _ref2.api;
|
|
88
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['card']),
|
|
89
|
-
cardState = _useSharedPluginState.cardState;
|
|
90
104
|
var _getDatasource = (0, _utils3.getDatasource)(editorView),
|
|
91
105
|
node = _getDatasource.node,
|
|
92
106
|
pos = _getDatasource.pos;
|
|
107
|
+
var _useSharedState = useSharedState(api),
|
|
108
|
+
_useSharedState$layou = _useSharedState.layout,
|
|
109
|
+
layout = _useSharedState$layou === void 0 ? (node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.layout) || undefined : _useSharedState$layou,
|
|
110
|
+
datasourceTableRef = _useSharedState.datasourceTableRef;
|
|
93
111
|
var isDatasource = (0, _utils2.isDatasourceNode)(node);
|
|
94
112
|
if (!isDatasource) {
|
|
95
113
|
return null;
|
|
96
114
|
}
|
|
97
|
-
|
|
98
|
-
// If layout doesn't exist in ADF it returns null, we want to change to undefined
|
|
99
|
-
// which results in default parameter value being used in LayoutButton.
|
|
100
|
-
var _ref3 = cardState !== null && cardState !== void 0 ? cardState : {},
|
|
101
|
-
datasourceTableRef = _ref3.datasourceTableRef,
|
|
102
|
-
_ref3$layout = _ref3.layout,
|
|
103
|
-
layout = _ref3$layout === void 0 ? (node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.layout) || undefined : _ref3$layout;
|
|
104
115
|
var onLayoutChange = function onLayoutChange(layout) {
|
|
105
116
|
var _getDatasource$node;
|
|
106
117
|
if (pos === undefined) {
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -325,6 +325,30 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
325
325
|
type: 'separator'
|
|
326
326
|
}] : [];
|
|
327
327
|
var openLinkInputMethod = (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_analytics') ? _analytics.INPUT_METHOD.FLOATING_TB : _analytics.INPUT_METHOD.TOOLBAR;
|
|
328
|
+
var editButtonItems = cardOptions.allowDatasource && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_9') ? [{
|
|
329
|
+
type: 'custom',
|
|
330
|
+
fallback: [],
|
|
331
|
+
render: function render(editorView) {
|
|
332
|
+
return /*#__PURE__*/_react.default.createElement(_EditToolbarButton.EditToolbarButton, {
|
|
333
|
+
key: "edit-toolbar-item",
|
|
334
|
+
url: url,
|
|
335
|
+
intl: intl,
|
|
336
|
+
editorAnalyticsApi: editorAnalyticsApi,
|
|
337
|
+
editorView: editorView,
|
|
338
|
+
onLinkEditClick: (0, _EditLinkToolbar.getEditLinkCallback)(editorAnalyticsApi, true),
|
|
339
|
+
currentAppearance: currentAppearance
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
}] : [{
|
|
343
|
+
id: 'editor.link.edit',
|
|
344
|
+
type: 'button',
|
|
345
|
+
selected: false,
|
|
346
|
+
metadata: metadata,
|
|
347
|
+
title: intl.formatMessage(_messages.linkToolbarMessages.editLink),
|
|
348
|
+
icon: _edit.default,
|
|
349
|
+
testId: 'link-toolbar-edit-link-button',
|
|
350
|
+
onClick: (0, _EditLinkToolbar.getEditLinkCallback)(editorAnalyticsApi, true)
|
|
351
|
+
}];
|
|
328
352
|
var toolbarItems = (0, _experiments.editorExperiment)('platform_editor_controls', 'control') ? [].concat(editItems, commentItems, [_objectSpread({
|
|
329
353
|
id: 'editor.link.openLink',
|
|
330
354
|
type: 'button',
|
|
@@ -363,16 +387,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
363
387
|
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
364
388
|
title: intl.formatMessage(_messages.default.remove),
|
|
365
389
|
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
|
|
366
|
-
}]) : [{
|
|
367
|
-
id: 'editor.link.edit',
|
|
368
|
-
type: 'button',
|
|
369
|
-
selected: false,
|
|
370
|
-
metadata: metadata,
|
|
371
|
-
title: intl.formatMessage(_messages.linkToolbarMessages.editLink),
|
|
372
|
-
icon: _edit.default,
|
|
373
|
-
testId: 'link-toolbar-edit-link-button',
|
|
374
|
-
onClick: (0, _EditLinkToolbar.getEditLinkCallback)(editorAnalyticsApi, true)
|
|
375
|
-
}].concat((0, _toConsumableArray2.default)((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_6') ? [] : [{
|
|
390
|
+
}]) : [].concat(editButtonItems, (0, _toConsumableArray2.default)((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_6') ? [] : [{
|
|
376
391
|
type: 'separator'
|
|
377
392
|
}]), (0, _toConsumableArray2.default)(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [_objectSpread({
|
|
378
393
|
id: 'editor.link.openLink',
|
|
@@ -4,15 +4,36 @@ import React from 'react';
|
|
|
4
4
|
import rafSchedule from 'raf-schd';
|
|
5
5
|
import uuid from 'uuid/v4';
|
|
6
6
|
import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
7
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
7
|
+
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
8
8
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
9
9
|
import { findOverflowScrollParent, MediaSingle as RichMediaWrapper, UnsupportedBlock } from '@atlaskit/editor-common/ui';
|
|
10
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
10
11
|
import { floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-common/utils';
|
|
11
12
|
import { DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
12
13
|
import { EmbedResizeMessageListener, Card as SmartCard } from '@atlaskit/smart-card';
|
|
13
14
|
import { registerCard, removeCard } from '../pm-plugins/actions';
|
|
14
15
|
import ResizableEmbedCard from '../ui/ResizableEmbedCard';
|
|
15
16
|
import { Card } from './genericCard';
|
|
17
|
+
const useSharedState = sharedPluginStateHookMigratorFactory(pluginInjectionApi => {
|
|
18
|
+
const lineLength = useSharedPluginStateSelector(pluginInjectionApi, 'width.lineLength');
|
|
19
|
+
const width = useSharedPluginStateSelector(pluginInjectionApi, 'width.width');
|
|
20
|
+
const editorDisabled = useSharedPluginStateSelector(pluginInjectionApi, 'editorDisabled.editorDisabled');
|
|
21
|
+
return {
|
|
22
|
+
widthStateLineLength: lineLength || 0,
|
|
23
|
+
widthStateWidth: width || 0,
|
|
24
|
+
editorDisabled
|
|
25
|
+
};
|
|
26
|
+
}, pluginInjectionApi => {
|
|
27
|
+
const {
|
|
28
|
+
widthState,
|
|
29
|
+
editorDisabledState
|
|
30
|
+
} = useSharedPluginState(pluginInjectionApi, ['width', 'editorDisabled']);
|
|
31
|
+
return {
|
|
32
|
+
widthStateLineLength: (widthState === null || widthState === void 0 ? void 0 : widthState.lineLength) || 0,
|
|
33
|
+
widthStateWidth: (widthState === null || widthState === void 0 ? void 0 : widthState.width) || 0,
|
|
34
|
+
editorDisabled: editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled
|
|
35
|
+
};
|
|
36
|
+
});
|
|
16
37
|
const CardInner = ({
|
|
17
38
|
pluginInjectionApi,
|
|
18
39
|
getPosSafely,
|
|
@@ -30,11 +51,10 @@ const CardInner = ({
|
|
|
30
51
|
dispatchAnalyticsEvent
|
|
31
52
|
}) => {
|
|
32
53
|
const {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const widthStateWidth = (widthState === null || widthState === void 0 ? void 0 : widthState.width) || 0;
|
|
54
|
+
widthStateLineLength,
|
|
55
|
+
widthStateWidth,
|
|
56
|
+
editorDisabled
|
|
57
|
+
} = useSharedState(pluginInjectionApi);
|
|
38
58
|
const pos = getPosSafely();
|
|
39
59
|
if (pos === undefined) {
|
|
40
60
|
return null;
|
|
@@ -87,7 +107,7 @@ const CardInner = ({
|
|
|
87
107
|
displayGrid: displayGrid,
|
|
88
108
|
updateSize: updateSize,
|
|
89
109
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
90
|
-
isResizeDisabled:
|
|
110
|
+
isResizeDisabled: editorDisabled
|
|
91
111
|
}), smartCard);
|
|
92
112
|
};
|
|
93
113
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
@@ -3,13 +3,27 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
3
3
|
import React, { useCallback } from 'react';
|
|
4
4
|
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
5
5
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
6
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
6
|
+
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
7
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
7
8
|
import { getAnalyticsEditorAppearance } from '@atlaskit/editor-common/utils';
|
|
8
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
10
|
import { changeSelectedCardToLinkFallback } from '../pm-plugins/doc';
|
|
10
11
|
import { getPluginState } from '../pm-plugins/util/state';
|
|
11
12
|
import { titleUrlPairFromNode } from '../pm-plugins/utils';
|
|
12
13
|
import { WithCardContext } from '../ui/WithCardContext';
|
|
14
|
+
const useSharedState = sharedPluginStateHookMigratorFactory(pluginInjectionApi => {
|
|
15
|
+
const mode = useSharedPluginStateSelector(pluginInjectionApi, 'editorViewMode.mode');
|
|
16
|
+
return {
|
|
17
|
+
mode
|
|
18
|
+
};
|
|
19
|
+
}, pluginInjectionApi => {
|
|
20
|
+
const {
|
|
21
|
+
editorViewModeState
|
|
22
|
+
} = useSharedPluginState(pluginInjectionApi, ['editorViewMode']);
|
|
23
|
+
return {
|
|
24
|
+
mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
|
|
25
|
+
};
|
|
26
|
+
});
|
|
13
27
|
const WithClickHandler = ({
|
|
14
28
|
pluginInjectionApi,
|
|
15
29
|
url,
|
|
@@ -18,8 +32,8 @@ const WithClickHandler = ({
|
|
|
18
32
|
__livePage
|
|
19
33
|
}) => {
|
|
20
34
|
const {
|
|
21
|
-
|
|
22
|
-
} =
|
|
35
|
+
mode
|
|
36
|
+
} = useSharedState(pluginInjectionApi);
|
|
23
37
|
const onClick = useCallback(event => {
|
|
24
38
|
if (typeof onClickCallback === 'function') {
|
|
25
39
|
try {
|
|
@@ -48,7 +62,7 @@ const WithClickHandler = ({
|
|
|
48
62
|
|
|
49
63
|
// Setting `onClick` to `undefined` ensures clicks on smartcards navigate to the URL.
|
|
50
64
|
// If in view mode and not overriding with onClickCallback option, then allow smartlinks to navigate on click.
|
|
51
|
-
const allowNavigation =
|
|
65
|
+
const allowNavigation = mode === 'view' && !onClickCallback;
|
|
52
66
|
return /*#__PURE__*/React.createElement(React.Fragment, null, children({
|
|
53
67
|
onClick: allowNavigation ? undefined : onClick
|
|
54
68
|
}));
|
|
@@ -2,9 +2,10 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import rafSchedule from 'raf-schd';
|
|
4
4
|
import uuid from 'uuid/v4';
|
|
5
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
5
|
+
import { sharedPluginStateHookMigratorFactory, 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 { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
8
9
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
9
10
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
11
|
import { Card as SmartCard } from '@atlaskit/smart-card';
|
|
@@ -130,6 +131,23 @@ export const InlineCard = /*#__PURE__*/memo(({
|
|
|
130
131
|
});
|
|
131
132
|
const WrappedInlineCardWithAwareness = Card(InlineCardWithAwareness, UnsupportedInline);
|
|
132
133
|
const WrappedInlineCard = Card(InlineCard, UnsupportedInline);
|
|
134
|
+
const useSharedState = sharedPluginStateHookMigratorFactory(pluginInjectionApi => {
|
|
135
|
+
const mode = useSharedPluginStateSelector(pluginInjectionApi, 'editorViewMode.mode');
|
|
136
|
+
const selection = useSharedPluginStateSelector(pluginInjectionApi, 'selection.selection');
|
|
137
|
+
return {
|
|
138
|
+
mode,
|
|
139
|
+
selection
|
|
140
|
+
};
|
|
141
|
+
}, pluginInjectionApi => {
|
|
142
|
+
const {
|
|
143
|
+
selectionState,
|
|
144
|
+
editorViewModeState
|
|
145
|
+
} = useSharedPluginState(pluginInjectionApi, ['selection', 'editorViewMode']);
|
|
146
|
+
return {
|
|
147
|
+
mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
|
|
148
|
+
selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
|
|
149
|
+
};
|
|
150
|
+
});
|
|
133
151
|
export function InlineCardNodeView(props) {
|
|
134
152
|
const {
|
|
135
153
|
useAlternativePreloader,
|
|
@@ -147,10 +165,10 @@ export function InlineCardNodeView(props) {
|
|
|
147
165
|
} = props;
|
|
148
166
|
const [isOverlayHovered, setIsOverlayHovered] = useState(false);
|
|
149
167
|
const {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
} =
|
|
153
|
-
const floatingToolbarNode =
|
|
168
|
+
mode,
|
|
169
|
+
selection
|
|
170
|
+
} = useSharedState(pluginInjectionApi);
|
|
171
|
+
const floatingToolbarNode = selection instanceof NodeSelection && selection.node;
|
|
154
172
|
if (__livePage && fg('linking_platform_smart_links_in_live_pages')) {
|
|
155
173
|
const showHoverPreview = floatingToolbarNode !== node;
|
|
156
174
|
const livePagesHoverCardFadeInDelay = 800;
|
|
@@ -168,7 +186,7 @@ export function InlineCardNodeView(props) {
|
|
|
168
186
|
},
|
|
169
187
|
isPageSSRed: isPageSSRed
|
|
170
188
|
});
|
|
171
|
-
return
|
|
189
|
+
return mode === 'view' ? inlineCard : /*#__PURE__*/React.createElement(OverlayWrapper, {
|
|
172
190
|
targetElementPos: getPos(),
|
|
173
191
|
view: view,
|
|
174
192
|
isHoveredCallback: setIsOverlayHovered,
|
|
@@ -195,7 +213,7 @@ export function InlineCardNodeView(props) {
|
|
|
195
213
|
appearance: "inline"
|
|
196
214
|
// Ignored via go/ees005
|
|
197
215
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
198
|
-
}, enableInlineUpgradeFeatures && getAwarenessProps(view.state, getPos, allowEmbeds, allowBlockCards, !editorExperiment('live_pages_graceful_edit', 'control') ? true :
|
|
216
|
+
}, enableInlineUpgradeFeatures && getAwarenessProps(view.state, getPos, allowEmbeds, allowBlockCards, !editorExperiment('live_pages_graceful_edit', 'control') ? true : mode === 'view')));
|
|
199
217
|
}
|
|
200
218
|
export const inlineCardNodeView = ({
|
|
201
219
|
inlineCardViewProducer
|