@atlaskit/editor-plugin-card 7.0.0 → 7.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 +15 -0
- package/dist/cjs/nodeviews/embedCard.js +8 -8
- package/dist/cjs/nodeviews/genericCard.js +6 -4
- package/dist/cjs/nodeviews/inlineCard.js +7 -6
- package/dist/cjs/nodeviews/inlineCardWithAwareness.js +8 -6
- package/dist/cjs/ui/DatasourceModal/ModalWithState.js +7 -6
- package/dist/cjs/ui/LayoutButton/index.js +7 -6
- package/dist/es2019/nodeviews/embedCard.js +9 -9
- package/dist/es2019/nodeviews/genericCard.js +7 -5
- package/dist/es2019/nodeviews/inlineCard.js +8 -7
- package/dist/es2019/nodeviews/inlineCardWithAwareness.js +9 -7
- package/dist/es2019/ui/DatasourceModal/ModalWithState.js +8 -7
- package/dist/es2019/ui/LayoutButton/index.js +8 -7
- package/dist/esm/nodeviews/embedCard.js +9 -9
- package/dist/esm/nodeviews/genericCard.js +7 -5
- package/dist/esm/nodeviews/inlineCard.js +8 -7
- package/dist/esm/nodeviews/inlineCardWithAwareness.js +9 -7
- package/dist/esm/ui/DatasourceModal/ModalWithState.js +8 -7
- package/dist/esm/ui/LayoutButton/index.js +8 -7
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 7.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#182839](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/182839)
|
|
8
|
+
[`81f1c3383bdab`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/81f1c3383bdab) -
|
|
9
|
+
refactor: use useSharedPluginStateWithSelector instead of useSharedPluginStateSelector
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 7.0.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 7.0.0
|
|
4
19
|
|
|
5
20
|
### Major Changes
|
|
@@ -20,7 +20,6 @@ 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");
|
|
24
23
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
25
24
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
26
25
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
@@ -33,15 +32,16 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
33
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; }
|
|
34
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)); }
|
|
35
34
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
36
|
-
var
|
|
37
|
-
var
|
|
38
|
-
var width = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'width.width');
|
|
39
|
-
var editorDisabled = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'editorDisabled.editorDisabled');
|
|
35
|
+
var selector = function selector(states) {
|
|
36
|
+
var _states$widthState, _states$widthState2, _states$editorDisable;
|
|
40
37
|
return {
|
|
41
|
-
widthStateLineLength: lineLength || 0,
|
|
42
|
-
widthStateWidth: width || 0,
|
|
43
|
-
editorDisabled: editorDisabled
|
|
38
|
+
widthStateLineLength: ((_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.lineLength) || 0,
|
|
39
|
+
widthStateWidth: ((_states$widthState2 = states.widthState) === null || _states$widthState2 === void 0 ? void 0 : _states$widthState2.width) || 0,
|
|
40
|
+
editorDisabled: (_states$editorDisable = states.editorDisabledState) === null || _states$editorDisable === void 0 ? void 0 : _states$editorDisable.editorDisabled
|
|
44
41
|
};
|
|
42
|
+
};
|
|
43
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
|
|
44
|
+
return (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['width', 'editorDisabled'], selector);
|
|
45
45
|
}, function (pluginInjectionApi) {
|
|
46
46
|
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['width', 'editorDisabled']),
|
|
47
47
|
widthState = _useSharedPluginState.widthState,
|
|
@@ -17,7 +17,6 @@ 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");
|
|
21
20
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
22
21
|
var _link = _interopRequireDefault(require("@atlaskit/link"));
|
|
23
22
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
@@ -28,11 +27,14 @@ var _WithCardContext = require("../ui/WithCardContext");
|
|
|
28
27
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
29
28
|
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)); }
|
|
30
29
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
31
|
-
var
|
|
32
|
-
var
|
|
30
|
+
var selector = function selector(states) {
|
|
31
|
+
var _states$editorViewMod;
|
|
33
32
|
return {
|
|
34
|
-
mode: mode
|
|
33
|
+
mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
|
|
35
34
|
};
|
|
35
|
+
};
|
|
36
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
|
|
37
|
+
return (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['editorViewMode'], selector);
|
|
36
38
|
}, function (pluginInjectionApi) {
|
|
37
39
|
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['editorViewMode']),
|
|
38
40
|
editorViewModeState = _useSharedPluginState.editorViewModeState;
|
|
@@ -17,7 +17,6 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
17
17
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
18
18
|
var _link = require("@atlaskit/editor-common/link");
|
|
19
19
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
20
|
-
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
21
20
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
22
21
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
23
22
|
var _smartCard = require("@atlaskit/smart-card");
|
|
@@ -155,13 +154,15 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
|
|
|
155
154
|
});
|
|
156
155
|
var WrappedInlineCardWithAwareness = (0, _genericCard.Card)(_inlineCardWithAwareness.InlineCardWithAwareness, _ui.UnsupportedInline);
|
|
157
156
|
var WrappedInlineCard = (0, _genericCard.Card)(InlineCard, _ui.UnsupportedInline);
|
|
158
|
-
var
|
|
159
|
-
var
|
|
160
|
-
var selection = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'selection.selection');
|
|
157
|
+
var selector = function selector(states) {
|
|
158
|
+
var _states$editorViewMod, _states$selectionStat;
|
|
161
159
|
return {
|
|
162
|
-
mode: mode,
|
|
163
|
-
selection: selection
|
|
160
|
+
mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode,
|
|
161
|
+
selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
|
|
164
162
|
};
|
|
163
|
+
};
|
|
164
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
|
|
165
|
+
return (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['selection', 'editorViewMode'], selector);
|
|
165
166
|
}, function (pluginInjectionApi) {
|
|
166
167
|
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['selection', 'editorViewMode']),
|
|
167
168
|
selectionState = _useSharedPluginState.selectionState,
|
|
@@ -9,7 +9,6 @@ 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");
|
|
13
12
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
14
13
|
var _actions = require("../pm-plugins/actions");
|
|
15
14
|
var _pluginKey = require("../pm-plugins/plugin-key");
|
|
@@ -17,17 +16,20 @@ var _AwarenessWrapper = require("../ui/AwarenessWrapper");
|
|
|
17
16
|
var _OpenButtonOverlay = _interopRequireDefault(require("../ui/OpenButtonOverlay"));
|
|
18
17
|
var _inlineCard = require("./inlineCard");
|
|
19
18
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
19
|
+
var selector = function selector(states) {
|
|
20
|
+
var _states$editorViewMod;
|
|
21
|
+
return {
|
|
22
|
+
mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
|
|
23
|
+
};
|
|
24
|
+
};
|
|
20
25
|
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
|
|
26
|
+
return (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['editorViewMode'], selector);
|
|
27
|
+
}, function (pluginInjectionApi) {
|
|
21
28
|
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['editorViewMode']),
|
|
22
29
|
editorViewModeState = _useSharedPluginState.editorViewModeState;
|
|
23
30
|
return {
|
|
24
31
|
mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
|
|
25
32
|
};
|
|
26
|
-
}, function (pluginInjectionApi) {
|
|
27
|
-
var mode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'editorViewMode.mode');
|
|
28
|
-
return {
|
|
29
|
-
mode: mode
|
|
30
|
-
};
|
|
31
33
|
});
|
|
32
34
|
var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
33
35
|
var _pluginInjectionApi$c;
|
|
@@ -7,20 +7,21 @@ 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");
|
|
11
10
|
var _linkDatasource = require("@atlaskit/link-datasource");
|
|
12
11
|
var _linkProvider = require("@atlaskit/link-provider");
|
|
13
12
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
14
13
|
var _datasourceErrorBoundary = require("../datasourceErrorBoundary");
|
|
15
14
|
var _index = require("./index");
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var datasourceModalType = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'card.datasourceModalType');
|
|
15
|
+
var selector = function selector(states) {
|
|
16
|
+
var _states$cardState, _states$cardState2;
|
|
19
17
|
return {
|
|
20
18
|
cardState: undefined,
|
|
21
|
-
showDatasourceModal: showDatasourceModal,
|
|
22
|
-
datasourceModalType: datasourceModalType
|
|
19
|
+
showDatasourceModal: (_states$cardState = states.cardState) === null || _states$cardState === void 0 ? void 0 : _states$cardState.showDatasourceModal,
|
|
20
|
+
datasourceModalType: (_states$cardState2 = states.cardState) === null || _states$cardState2 === void 0 ? void 0 : _states$cardState2.datasourceModalType
|
|
23
21
|
};
|
|
22
|
+
};
|
|
23
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
|
|
24
|
+
return (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['card'], selector);
|
|
24
25
|
}, function (pluginInjectionApi) {
|
|
25
26
|
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['card']),
|
|
26
27
|
cardState = _useSharedPluginState.cardState;
|
|
@@ -12,7 +12,6 @@ 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");
|
|
16
15
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
17
16
|
var _growHorizontalEditorExpand = _interopRequireDefault(require("@atlaskit/icon/core/migration/grow-horizontal--editor-expand"));
|
|
18
17
|
var _shrinkHorizontalEditorCollapse = _interopRequireDefault(require("@atlaskit/icon/core/migration/shrink-horizontal--editor-collapse"));
|
|
@@ -78,13 +77,15 @@ var LayoutButton = exports.LayoutButton = function LayoutButton(_ref) {
|
|
|
78
77
|
})
|
|
79
78
|
}));
|
|
80
79
|
};
|
|
81
|
-
var
|
|
82
|
-
var
|
|
83
|
-
var datasourceTableRef = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'card.datasourceTableRef');
|
|
80
|
+
var selector = function selector(states) {
|
|
81
|
+
var _states$cardState, _states$cardState2;
|
|
84
82
|
return {
|
|
85
|
-
layout: layout,
|
|
86
|
-
datasourceTableRef: datasourceTableRef
|
|
83
|
+
layout: (_states$cardState = states.cardState) === null || _states$cardState === void 0 ? void 0 : _states$cardState.layout,
|
|
84
|
+
datasourceTableRef: (_states$cardState2 = states.cardState) === null || _states$cardState2 === void 0 ? void 0 : _states$cardState2.datasourceTableRef
|
|
87
85
|
};
|
|
86
|
+
};
|
|
87
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
|
|
88
|
+
return (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['card'], selector);
|
|
88
89
|
}, function (pluginInjectionApi) {
|
|
89
90
|
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['card']),
|
|
90
91
|
cardState = _useSharedPluginState.cardState;
|
|
@@ -4,10 +4,9 @@ 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 { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
7
|
+
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } 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';
|
|
11
10
|
import { floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-common/utils';
|
|
12
11
|
import { DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
13
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -15,15 +14,16 @@ import { EmbedResizeMessageListener, Card as SmartCard } from '@atlaskit/smart-c
|
|
|
15
14
|
import { registerCard, removeCard } from '../pm-plugins/actions';
|
|
16
15
|
import ResizableEmbedCard from '../ui/ResizableEmbedCard';
|
|
17
16
|
import { Card } from './genericCard';
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const width = useSharedPluginStateSelector(pluginInjectionApi, 'width.width');
|
|
21
|
-
const editorDisabled = useSharedPluginStateSelector(pluginInjectionApi, 'editorDisabled.editorDisabled');
|
|
17
|
+
const selector = states => {
|
|
18
|
+
var _states$widthState, _states$widthState2, _states$editorDisable;
|
|
22
19
|
return {
|
|
23
|
-
widthStateLineLength: lineLength || 0,
|
|
24
|
-
widthStateWidth: width || 0,
|
|
25
|
-
editorDisabled
|
|
20
|
+
widthStateLineLength: ((_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.lineLength) || 0,
|
|
21
|
+
widthStateWidth: ((_states$widthState2 = states.widthState) === null || _states$widthState2 === void 0 ? void 0 : _states$widthState2.width) || 0,
|
|
22
|
+
editorDisabled: (_states$editorDisable = states.editorDisabledState) === null || _states$editorDisable === void 0 ? void 0 : _states$editorDisable.editorDisabled
|
|
26
23
|
};
|
|
24
|
+
};
|
|
25
|
+
const useSharedState = sharedPluginStateHookMigratorFactory(pluginInjectionApi => {
|
|
26
|
+
return useSharedPluginStateWithSelector(pluginInjectionApi, ['width', 'editorDisabled'], selector);
|
|
27
27
|
}, pluginInjectionApi => {
|
|
28
28
|
const {
|
|
29
29
|
widthState,
|
|
@@ -3,8 +3,7 @@ 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 { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
7
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
6
|
+
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
8
7
|
import { getAnalyticsEditorAppearance } from '@atlaskit/editor-common/utils';
|
|
9
8
|
import Link from '@atlaskit/link';
|
|
10
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -12,11 +11,14 @@ import { changeSelectedCardToLinkFallback } from '../pm-plugins/doc';
|
|
|
12
11
|
import { getPluginState } from '../pm-plugins/util/state';
|
|
13
12
|
import { titleUrlPairFromNode } from '../pm-plugins/utils';
|
|
14
13
|
import { WithCardContext } from '../ui/WithCardContext';
|
|
15
|
-
const
|
|
16
|
-
|
|
14
|
+
const selector = states => {
|
|
15
|
+
var _states$editorViewMod;
|
|
17
16
|
return {
|
|
18
|
-
mode
|
|
17
|
+
mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
|
|
19
18
|
};
|
|
19
|
+
};
|
|
20
|
+
const useSharedState = sharedPluginStateHookMigratorFactory(pluginInjectionApi => {
|
|
21
|
+
return useSharedPluginStateWithSelector(pluginInjectionApi, ['editorViewMode'], selector);
|
|
20
22
|
}, pluginInjectionApi => {
|
|
21
23
|
const {
|
|
22
24
|
editorViewModeState
|
|
@@ -3,10 +3,9 @@ import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from '
|
|
|
3
3
|
import rafSchedule from 'raf-schd';
|
|
4
4
|
import uuid from 'uuid/v4';
|
|
5
5
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
|
-
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
6
|
+
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
7
7
|
import { handleNavigation } from '@atlaskit/editor-common/link';
|
|
8
8
|
import { UnsupportedInline, findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
9
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
10
9
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
11
10
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
11
|
import { Card as SmartCard } from '@atlaskit/smart-card';
|
|
@@ -150,13 +149,15 @@ export const InlineCard = /*#__PURE__*/memo(({
|
|
|
150
149
|
});
|
|
151
150
|
const WrappedInlineCardWithAwareness = Card(InlineCardWithAwareness, UnsupportedInline);
|
|
152
151
|
const WrappedInlineCard = Card(InlineCard, UnsupportedInline);
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
const selection = useSharedPluginStateSelector(pluginInjectionApi, 'selection.selection');
|
|
152
|
+
const selector = states => {
|
|
153
|
+
var _states$editorViewMod, _states$selectionStat;
|
|
156
154
|
return {
|
|
157
|
-
mode,
|
|
158
|
-
selection
|
|
155
|
+
mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode,
|
|
156
|
+
selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
|
|
159
157
|
};
|
|
158
|
+
};
|
|
159
|
+
const useSharedState = sharedPluginStateHookMigratorFactory(pluginInjectionApi => {
|
|
160
|
+
return useSharedPluginStateWithSelector(pluginInjectionApi, ['selection', 'editorViewMode'], selector);
|
|
160
161
|
}, pluginInjectionApi => {
|
|
161
162
|
const {
|
|
162
163
|
selectionState,
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import React, { memo, useCallback, useMemo, useState } from 'react';
|
|
2
|
-
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
3
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
2
|
+
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
3
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
4
|
import { registerRemoveOverlay } from '../pm-plugins/actions';
|
|
6
5
|
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
7
6
|
import { AwarenessWrapper } from '../ui/AwarenessWrapper';
|
|
8
7
|
import OpenButtonOverlay from '../ui/OpenButtonOverlay';
|
|
9
8
|
import { InlineCard } from './inlineCard';
|
|
9
|
+
const selector = states => {
|
|
10
|
+
var _states$editorViewMod;
|
|
11
|
+
return {
|
|
12
|
+
mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
|
|
13
|
+
};
|
|
14
|
+
};
|
|
10
15
|
const useSharedState = sharedPluginStateHookMigratorFactory(pluginInjectionApi => {
|
|
16
|
+
return useSharedPluginStateWithSelector(pluginInjectionApi, ['editorViewMode'], selector);
|
|
17
|
+
}, pluginInjectionApi => {
|
|
11
18
|
const {
|
|
12
19
|
editorViewModeState
|
|
13
20
|
} = useSharedPluginState(pluginInjectionApi, ['editorViewMode']);
|
|
14
21
|
return {
|
|
15
22
|
mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
|
|
16
23
|
};
|
|
17
|
-
}, pluginInjectionApi => {
|
|
18
|
-
const mode = useSharedPluginStateSelector(pluginInjectionApi, 'editorViewMode.mode');
|
|
19
|
-
return {
|
|
20
|
-
mode
|
|
21
|
-
};
|
|
22
24
|
});
|
|
23
25
|
export const InlineCardWithAwareness = /*#__PURE__*/memo(({
|
|
24
26
|
node,
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
3
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
2
|
+
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
3
|
import { ASSETS_LIST_OF_LINKS_DATASOURCE_ID, AssetsConfigModal, CONFLUENCE_SEARCH_DATASOURCE_ID, ConfluenceSearchConfigModal, JIRA_LIST_OF_LINKS_DATASOURCE_ID, JiraIssuesConfigModal } from '@atlaskit/link-datasource';
|
|
5
4
|
import { EditorSmartCardProviderValueGuard, useSmartLinkContext } from '@atlaskit/link-provider';
|
|
6
5
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
6
|
import { DatasourceErrorBoundary } from '../datasourceErrorBoundary';
|
|
8
7
|
import { DatasourceModal } from './index';
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
const datasourceModalType = useSharedPluginStateSelector(pluginInjectionApi, 'card.datasourceModalType');
|
|
8
|
+
const selector = states => {
|
|
9
|
+
var _states$cardState, _states$cardState2;
|
|
12
10
|
return {
|
|
13
11
|
cardState: undefined,
|
|
14
|
-
showDatasourceModal,
|
|
15
|
-
datasourceModalType
|
|
12
|
+
showDatasourceModal: (_states$cardState = states.cardState) === null || _states$cardState === void 0 ? void 0 : _states$cardState.showDatasourceModal,
|
|
13
|
+
datasourceModalType: (_states$cardState2 = states.cardState) === null || _states$cardState2 === void 0 ? void 0 : _states$cardState2.datasourceModalType
|
|
16
14
|
};
|
|
15
|
+
};
|
|
16
|
+
const useSharedState = sharedPluginStateHookMigratorFactory(pluginInjectionApi => {
|
|
17
|
+
return useSharedPluginStateWithSelector(pluginInjectionApi, ['card'], selector);
|
|
17
18
|
}, pluginInjectionApi => {
|
|
18
19
|
const {
|
|
19
20
|
cardState
|
|
@@ -7,10 +7,9 @@ import { useCallback, useMemo } from 'react';
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
9
|
import { injectIntl } from 'react-intl-next';
|
|
10
|
-
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
10
|
+
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
11
11
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
12
12
|
import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
13
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
14
13
|
import { getNextBreakoutMode, getTitle } from '@atlaskit/editor-common/utils';
|
|
15
14
|
import GrowHorizontalIcon from '@atlaskit/icon/core/migration/grow-horizontal--editor-expand';
|
|
16
15
|
import ShrinkHorizontalIcon from '@atlaskit/icon/core/migration/shrink-horizontal--editor-collapse';
|
|
@@ -72,13 +71,15 @@ export const LayoutButton = ({
|
|
|
72
71
|
})
|
|
73
72
|
}));
|
|
74
73
|
};
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
const datasourceTableRef = useSharedPluginStateSelector(pluginInjectionApi, 'card.datasourceTableRef');
|
|
74
|
+
const selector = states => {
|
|
75
|
+
var _states$cardState, _states$cardState2;
|
|
78
76
|
return {
|
|
79
|
-
layout,
|
|
80
|
-
datasourceTableRef
|
|
77
|
+
layout: (_states$cardState = states.cardState) === null || _states$cardState === void 0 ? void 0 : _states$cardState.layout,
|
|
78
|
+
datasourceTableRef: (_states$cardState2 = states.cardState) === null || _states$cardState2 === void 0 ? void 0 : _states$cardState2.datasourceTableRef
|
|
81
79
|
};
|
|
80
|
+
};
|
|
81
|
+
const useSharedState = sharedPluginStateHookMigratorFactory(pluginInjectionApi => {
|
|
82
|
+
return useSharedPluginStateWithSelector(pluginInjectionApi, ['card'], selector);
|
|
82
83
|
}, pluginInjectionApi => {
|
|
83
84
|
const {
|
|
84
85
|
cardState
|
|
@@ -15,10 +15,9 @@ import React from 'react';
|
|
|
15
15
|
import rafSchedule from 'raf-schd';
|
|
16
16
|
import uuid from 'uuid/v4';
|
|
17
17
|
import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
18
|
-
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
18
|
+
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
19
19
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
20
20
|
import { findOverflowScrollParent, MediaSingle as RichMediaWrapper, UnsupportedBlock } from '@atlaskit/editor-common/ui';
|
|
21
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
22
21
|
import { floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-common/utils';
|
|
23
22
|
import { DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
24
23
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -26,15 +25,16 @@ import { EmbedResizeMessageListener, Card as SmartCard } from '@atlaskit/smart-c
|
|
|
26
25
|
import { registerCard, removeCard as _removeCard } from '../pm-plugins/actions';
|
|
27
26
|
import ResizableEmbedCard from '../ui/ResizableEmbedCard';
|
|
28
27
|
import { Card } from './genericCard';
|
|
29
|
-
var
|
|
30
|
-
var
|
|
31
|
-
var width = useSharedPluginStateSelector(pluginInjectionApi, 'width.width');
|
|
32
|
-
var editorDisabled = useSharedPluginStateSelector(pluginInjectionApi, 'editorDisabled.editorDisabled');
|
|
28
|
+
var selector = function selector(states) {
|
|
29
|
+
var _states$widthState, _states$widthState2, _states$editorDisable;
|
|
33
30
|
return {
|
|
34
|
-
widthStateLineLength: lineLength || 0,
|
|
35
|
-
widthStateWidth: width || 0,
|
|
36
|
-
editorDisabled: editorDisabled
|
|
31
|
+
widthStateLineLength: ((_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.lineLength) || 0,
|
|
32
|
+
widthStateWidth: ((_states$widthState2 = states.widthState) === null || _states$widthState2 === void 0 ? void 0 : _states$widthState2.width) || 0,
|
|
33
|
+
editorDisabled: (_states$editorDisable = states.editorDisabledState) === null || _states$editorDisable === void 0 ? void 0 : _states$editorDisable.editorDisabled
|
|
37
34
|
};
|
|
35
|
+
};
|
|
36
|
+
var useSharedState = sharedPluginStateHookMigratorFactory(function (pluginInjectionApi) {
|
|
37
|
+
return useSharedPluginStateWithSelector(pluginInjectionApi, ['width', 'editorDisabled'], selector);
|
|
38
38
|
}, function (pluginInjectionApi) {
|
|
39
39
|
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['width', 'editorDisabled']),
|
|
40
40
|
widthState = _useSharedPluginState.widthState,
|
|
@@ -10,8 +10,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
10
10
|
import React, { useCallback } from 'react';
|
|
11
11
|
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
12
12
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
13
|
-
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
14
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
13
|
+
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
15
14
|
import { getAnalyticsEditorAppearance } from '@atlaskit/editor-common/utils';
|
|
16
15
|
import Link from '@atlaskit/link';
|
|
17
16
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -19,11 +18,14 @@ import { changeSelectedCardToLinkFallback } from '../pm-plugins/doc';
|
|
|
19
18
|
import { getPluginState } from '../pm-plugins/util/state';
|
|
20
19
|
import { titleUrlPairFromNode } from '../pm-plugins/utils';
|
|
21
20
|
import { WithCardContext } from '../ui/WithCardContext';
|
|
22
|
-
var
|
|
23
|
-
var
|
|
21
|
+
var selector = function selector(states) {
|
|
22
|
+
var _states$editorViewMod;
|
|
24
23
|
return {
|
|
25
|
-
mode: mode
|
|
24
|
+
mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
|
|
26
25
|
};
|
|
26
|
+
};
|
|
27
|
+
var useSharedState = sharedPluginStateHookMigratorFactory(function (pluginInjectionApi) {
|
|
28
|
+
return useSharedPluginStateWithSelector(pluginInjectionApi, ['editorViewMode'], selector);
|
|
27
29
|
}, function (pluginInjectionApi) {
|
|
28
30
|
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['editorViewMode']),
|
|
29
31
|
editorViewModeState = _useSharedPluginState.editorViewModeState;
|
|
@@ -4,10 +4,9 @@ import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from '
|
|
|
4
4
|
import rafSchedule from 'raf-schd';
|
|
5
5
|
import uuid from 'uuid/v4';
|
|
6
6
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
7
|
-
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
7
|
+
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
8
8
|
import { handleNavigation } from '@atlaskit/editor-common/link';
|
|
9
9
|
import { UnsupportedInline, findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
10
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
11
10
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
12
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
12
|
import { Card as SmartCard } from '@atlaskit/smart-card';
|
|
@@ -144,13 +143,15 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
144
143
|
});
|
|
145
144
|
var WrappedInlineCardWithAwareness = Card(InlineCardWithAwareness, UnsupportedInline);
|
|
146
145
|
var WrappedInlineCard = Card(InlineCard, UnsupportedInline);
|
|
147
|
-
var
|
|
148
|
-
var
|
|
149
|
-
var selection = useSharedPluginStateSelector(pluginInjectionApi, 'selection.selection');
|
|
146
|
+
var selector = function selector(states) {
|
|
147
|
+
var _states$editorViewMod, _states$selectionStat;
|
|
150
148
|
return {
|
|
151
|
-
mode: mode,
|
|
152
|
-
selection: selection
|
|
149
|
+
mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode,
|
|
150
|
+
selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
|
|
153
151
|
};
|
|
152
|
+
};
|
|
153
|
+
var useSharedState = sharedPluginStateHookMigratorFactory(function (pluginInjectionApi) {
|
|
154
|
+
return useSharedPluginStateWithSelector(pluginInjectionApi, ['selection', 'editorViewMode'], selector);
|
|
154
155
|
}, function (pluginInjectionApi) {
|
|
155
156
|
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['selection', 'editorViewMode']),
|
|
156
157
|
selectionState = _useSharedPluginState.selectionState,
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import React, { memo, useCallback, useMemo, useState } from 'react';
|
|
3
|
-
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
4
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
3
|
+
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
4
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
6
5
|
import { registerRemoveOverlay } from '../pm-plugins/actions';
|
|
7
6
|
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
8
7
|
import { AwarenessWrapper } from '../ui/AwarenessWrapper';
|
|
9
8
|
import OpenButtonOverlay from '../ui/OpenButtonOverlay';
|
|
10
9
|
import { InlineCard } from './inlineCard';
|
|
10
|
+
var selector = function selector(states) {
|
|
11
|
+
var _states$editorViewMod;
|
|
12
|
+
return {
|
|
13
|
+
mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
|
|
14
|
+
};
|
|
15
|
+
};
|
|
11
16
|
var useSharedState = sharedPluginStateHookMigratorFactory(function (pluginInjectionApi) {
|
|
17
|
+
return useSharedPluginStateWithSelector(pluginInjectionApi, ['editorViewMode'], selector);
|
|
18
|
+
}, function (pluginInjectionApi) {
|
|
12
19
|
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['editorViewMode']),
|
|
13
20
|
editorViewModeState = _useSharedPluginState.editorViewModeState;
|
|
14
21
|
return {
|
|
15
22
|
mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
|
|
16
23
|
};
|
|
17
|
-
}, function (pluginInjectionApi) {
|
|
18
|
-
var mode = useSharedPluginStateSelector(pluginInjectionApi, 'editorViewMode.mode');
|
|
19
|
-
return {
|
|
20
|
-
mode: mode
|
|
21
|
-
};
|
|
22
24
|
});
|
|
23
25
|
export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
|
|
24
26
|
var _pluginInjectionApi$c;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
3
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
2
|
+
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
3
|
import { ASSETS_LIST_OF_LINKS_DATASOURCE_ID, AssetsConfigModal, CONFLUENCE_SEARCH_DATASOURCE_ID, ConfluenceSearchConfigModal, JIRA_LIST_OF_LINKS_DATASOURCE_ID, JiraIssuesConfigModal } from '@atlaskit/link-datasource';
|
|
5
4
|
import { EditorSmartCardProviderValueGuard, useSmartLinkContext } from '@atlaskit/link-provider';
|
|
6
5
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
6
|
import { DatasourceErrorBoundary } from '../datasourceErrorBoundary';
|
|
8
7
|
import { DatasourceModal } from './index';
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var datasourceModalType = useSharedPluginStateSelector(pluginInjectionApi, 'card.datasourceModalType');
|
|
8
|
+
var selector = function selector(states) {
|
|
9
|
+
var _states$cardState, _states$cardState2;
|
|
12
10
|
return {
|
|
13
11
|
cardState: undefined,
|
|
14
|
-
showDatasourceModal: showDatasourceModal,
|
|
15
|
-
datasourceModalType: datasourceModalType
|
|
12
|
+
showDatasourceModal: (_states$cardState = states.cardState) === null || _states$cardState === void 0 ? void 0 : _states$cardState.showDatasourceModal,
|
|
13
|
+
datasourceModalType: (_states$cardState2 = states.cardState) === null || _states$cardState2 === void 0 ? void 0 : _states$cardState2.datasourceModalType
|
|
16
14
|
};
|
|
15
|
+
};
|
|
16
|
+
var useSharedState = sharedPluginStateHookMigratorFactory(function (pluginInjectionApi) {
|
|
17
|
+
return useSharedPluginStateWithSelector(pluginInjectionApi, ['card'], selector);
|
|
17
18
|
}, function (pluginInjectionApi) {
|
|
18
19
|
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['card']),
|
|
19
20
|
cardState = _useSharedPluginState.cardState;
|
|
@@ -10,10 +10,9 @@ import { useCallback, useMemo } from 'react';
|
|
|
10
10
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
11
11
|
import { css, jsx } from '@emotion/react';
|
|
12
12
|
import { injectIntl } from 'react-intl-next';
|
|
13
|
-
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
13
|
+
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
14
14
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
15
15
|
import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
16
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
17
16
|
import { getNextBreakoutMode, getTitle } from '@atlaskit/editor-common/utils';
|
|
18
17
|
import GrowHorizontalIcon from '@atlaskit/icon/core/migration/grow-horizontal--editor-expand';
|
|
19
18
|
import ShrinkHorizontalIcon from '@atlaskit/icon/core/migration/shrink-horizontal--editor-collapse';
|
|
@@ -74,13 +73,15 @@ export var LayoutButton = function LayoutButton(_ref) {
|
|
|
74
73
|
})
|
|
75
74
|
}));
|
|
76
75
|
};
|
|
77
|
-
var
|
|
78
|
-
var
|
|
79
|
-
var datasourceTableRef = useSharedPluginStateSelector(pluginInjectionApi, 'card.datasourceTableRef');
|
|
76
|
+
var selector = function selector(states) {
|
|
77
|
+
var _states$cardState, _states$cardState2;
|
|
80
78
|
return {
|
|
81
|
-
layout: layout,
|
|
82
|
-
datasourceTableRef: datasourceTableRef
|
|
79
|
+
layout: (_states$cardState = states.cardState) === null || _states$cardState === void 0 ? void 0 : _states$cardState.layout,
|
|
80
|
+
datasourceTableRef: (_states$cardState2 = states.cardState) === null || _states$cardState2 === void 0 ? void 0 : _states$cardState2.datasourceTableRef
|
|
83
81
|
};
|
|
82
|
+
};
|
|
83
|
+
var useSharedState = sharedPluginStateHookMigratorFactory(function (pluginInjectionApi) {
|
|
84
|
+
return useSharedPluginStateWithSelector(pluginInjectionApi, ['card'], selector);
|
|
84
85
|
}, function (pluginInjectionApi) {
|
|
85
86
|
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['card']),
|
|
86
87
|
cardState = _useSharedPluginState.cardState;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.2",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -48,20 +48,20 @@
|
|
|
48
48
|
"@atlaskit/editor-plugin-width": "^4.0.0",
|
|
49
49
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
50
50
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
51
|
-
"@atlaskit/frontend-utilities": "^3.
|
|
52
|
-
"@atlaskit/icon": "^27.
|
|
51
|
+
"@atlaskit/frontend-utilities": "^3.1.0",
|
|
52
|
+
"@atlaskit/icon": "^27.3.0",
|
|
53
53
|
"@atlaskit/link": "^3.2.0",
|
|
54
54
|
"@atlaskit/link-analytics": "^10.0.0",
|
|
55
55
|
"@atlaskit/link-client-extension": "^5.0.0",
|
|
56
|
-
"@atlaskit/link-datasource": "^4.
|
|
56
|
+
"@atlaskit/link-datasource": "^4.13.0",
|
|
57
57
|
"@atlaskit/linking-common": "^9.1.0",
|
|
58
58
|
"@atlaskit/linking-types": "^13.0.0",
|
|
59
59
|
"@atlaskit/menu": "^8.0.0",
|
|
60
60
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
61
61
|
"@atlaskit/primitives": "^14.10.0",
|
|
62
|
-
"@atlaskit/smart-card": "^39.
|
|
62
|
+
"@atlaskit/smart-card": "^39.2.0",
|
|
63
63
|
"@atlaskit/theme": "^18.0.0",
|
|
64
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
64
|
+
"@atlaskit/tmp-editor-statsig": "^9.0.0",
|
|
65
65
|
"@atlaskit/tokens": "^5.4.0",
|
|
66
66
|
"@babel/runtime": "^7.0.0",
|
|
67
67
|
"@emotion/react": "^11.7.1",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"uuid": "^3.1.0"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
|
-
"@atlaskit/editor-common": "^107.
|
|
74
|
+
"@atlaskit/editor-common": "^107.7.0",
|
|
75
75
|
"@atlaskit/link-provider": "^3.4.0",
|
|
76
76
|
"react": "^18.2.0",
|
|
77
77
|
"react-intl-next": "npm:react-intl@^5.18.1"
|