@atlaskit/editor-plugin-card 33.0.5 → 34.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/cjs/nodeviews/blockCard.js +11 -2
- package/dist/cjs/nodeviews/inlineCardBase.js +16 -2
- package/dist/cjs/nodeviews/inlineCardWithAwareness.js +22 -6
- package/dist/cjs/pm-plugins/main.js +8 -1
- package/dist/cjs/pm-plugins/reducers.js +23 -4
- package/dist/cjs/ui/DatasourceAppearanceButton.js +2 -2
- package/dist/cjs/ui/EditToolbarButton/EditToolbarButtonPresentation.js +5 -5
- package/dist/cjs/ui/EditToolbarButton/index.js +5 -5
- package/dist/cjs/ui/HyperlinkToolbarAppearance.js +2 -2
- package/dist/cjs/ui/HyperlinkToolbarAppearanceDropdown.js +2 -2
- package/dist/cjs/ui/InlineCardOverlay/index.js +4 -0
- package/dist/cjs/ui/OpenPreviewButton/index.js +7 -5
- package/dist/cjs/ui/PasteDisplayAsMenu.js +6 -4
- package/dist/es2019/nodeviews/blockCard.js +11 -2
- package/dist/es2019/nodeviews/inlineCardBase.js +16 -2
- package/dist/es2019/nodeviews/inlineCardWithAwareness.js +19 -3
- package/dist/es2019/pm-plugins/main.js +8 -1
- package/dist/es2019/pm-plugins/reducers.js +24 -2
- package/dist/es2019/ui/DatasourceAppearanceButton.js +1 -1
- package/dist/es2019/ui/EditToolbarButton/EditToolbarButtonPresentation.js +1 -1
- package/dist/es2019/ui/EditToolbarButton/index.js +1 -1
- package/dist/es2019/ui/HyperlinkToolbarAppearance.js +1 -1
- package/dist/es2019/ui/HyperlinkToolbarAppearanceDropdown.js +1 -1
- package/dist/es2019/ui/InlineCardOverlay/index.js +4 -0
- package/dist/es2019/ui/OpenPreviewButton/index.js +3 -1
- package/dist/es2019/ui/PasteDisplayAsMenu.js +3 -1
- package/dist/esm/nodeviews/blockCard.js +11 -2
- package/dist/esm/nodeviews/inlineCardBase.js +16 -2
- package/dist/esm/nodeviews/inlineCardWithAwareness.js +23 -7
- package/dist/esm/pm-plugins/main.js +8 -1
- package/dist/esm/pm-plugins/reducers.js +23 -4
- package/dist/esm/ui/DatasourceAppearanceButton.js +1 -1
- package/dist/esm/ui/EditToolbarButton/EditToolbarButtonPresentation.js +1 -1
- package/dist/esm/ui/EditToolbarButton/index.js +1 -1
- package/dist/esm/ui/HyperlinkToolbarAppearance.js +1 -1
- package/dist/esm/ui/HyperlinkToolbarAppearanceDropdown.js +1 -1
- package/dist/esm/ui/InlineCardOverlay/index.js +4 -0
- package/dist/esm/ui/OpenPreviewButton/index.js +3 -1
- package/dist/esm/ui/PasteDisplayAsMenu.js +3 -1
- package/dist/types/nodeviews/blockCard.d.ts +1 -0
- package/dist/types/pm-plugins/util/state.d.ts +1 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/ui/PreAuthValuePropositionModal.d.ts +1 -1
- package/package.json +23 -23
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
1
2
|
const queue = (state, action) => {
|
|
2
3
|
return {
|
|
3
4
|
...state,
|
|
@@ -23,9 +24,18 @@ const register = (state, action) => {
|
|
|
23
24
|
};
|
|
24
25
|
};
|
|
25
26
|
const removeCard = (state, action) => {
|
|
27
|
+
const cards = state.cards.filter(card => card.id !== action.info.id);
|
|
28
|
+
if (isExperimentEnabled('platform_editor_reduce_memory_leaks') && state.removeOverlayCardId !== undefined && state.removeOverlayCardId === action.info.id) {
|
|
29
|
+
return {
|
|
30
|
+
...state,
|
|
31
|
+
cards,
|
|
32
|
+
removeOverlay: undefined,
|
|
33
|
+
removeOverlayCardId: undefined
|
|
34
|
+
};
|
|
35
|
+
}
|
|
26
36
|
return {
|
|
27
37
|
...state,
|
|
28
|
-
cards
|
|
38
|
+
cards
|
|
29
39
|
};
|
|
30
40
|
};
|
|
31
41
|
const setProvider = (state, action) => {
|
|
@@ -89,19 +99,31 @@ const hideDatasourceModal = state => {
|
|
|
89
99
|
};
|
|
90
100
|
};
|
|
91
101
|
const clearOverlayCandidate = state => {
|
|
102
|
+
if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
103
|
+
return {
|
|
104
|
+
...state,
|
|
105
|
+
overlayCandidatePosition: undefined,
|
|
106
|
+
removeOverlay: undefined,
|
|
107
|
+
removeOverlayCardId: undefined
|
|
108
|
+
};
|
|
109
|
+
}
|
|
92
110
|
return {
|
|
93
111
|
...state,
|
|
94
112
|
overlayCandidatePosition: undefined
|
|
95
113
|
};
|
|
96
114
|
};
|
|
97
115
|
const registerRemoveOverlayOnInsertedLink = (state, action) => {
|
|
116
|
+
var _action$info2;
|
|
98
117
|
return {
|
|
99
118
|
...state,
|
|
100
119
|
cards: action.info ? state.cards.filter(card => {
|
|
101
120
|
var _action$info;
|
|
102
121
|
return card.pos !== ((_action$info = action.info) === null || _action$info === void 0 ? void 0 : _action$info.pos);
|
|
103
122
|
}).concat(action.info) : state.cards,
|
|
104
|
-
removeOverlay: action.callback
|
|
123
|
+
removeOverlay: action.callback,
|
|
124
|
+
...(isExperimentEnabled('platform_editor_reduce_memory_leaks') ? {
|
|
125
|
+
removeOverlayCardId: (_action$info2 = action.info) === null || _action$info2 === void 0 ? void 0 : _action$info2.id
|
|
126
|
+
} : {})
|
|
105
127
|
};
|
|
106
128
|
};
|
|
107
129
|
const setDatasourceStash = (state, action) => {
|
|
@@ -12,7 +12,7 @@ import { canRenderDatasource } from '@atlaskit/editor-common/utils/datasource';
|
|
|
12
12
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
13
13
|
import { buildDatasourceAdf } from '@atlaskit/link-datasource/utils/schema';
|
|
14
14
|
import { useSmartLinkContext } from '@atlaskit/link-provider/use-smart-link-context';
|
|
15
|
-
import { Flex } from '@atlaskit/primitives/compiled';
|
|
15
|
+
import { Flex } from '@atlaskit/primitives/compiled/flex';
|
|
16
16
|
import { updateCardViaDatasource } from '../pm-plugins/doc';
|
|
17
17
|
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
18
18
|
import { DatasourceIcon } from './DatasourceIcon';
|
|
@@ -16,7 +16,7 @@ import { DropdownContainer as UiDropdown } from '@atlaskit/editor-common/ui-menu
|
|
|
16
16
|
import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
|
|
17
17
|
import EditIcon from '@atlaskit/icon/core/edit';
|
|
18
18
|
import ButtonItem from '@atlaskit/menu/button-item';
|
|
19
|
-
import { Flex } from '@atlaskit/primitives/compiled';
|
|
19
|
+
import { Flex } from '@atlaskit/primitives/compiled/flex';
|
|
20
20
|
import { focusEditorView } from '../../pm-plugins/utils';
|
|
21
21
|
import { editDatasource } from '../editDatasourceAction';
|
|
22
22
|
const dropdownExpandContainer = css({
|
|
@@ -16,7 +16,7 @@ import { DropdownContainer as UiDropdown } from '@atlaskit/editor-common/ui-menu
|
|
|
16
16
|
import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
|
|
17
17
|
import { useSmartLinkContext } from '@atlaskit/link-provider/use-smart-link-context';
|
|
18
18
|
import ButtonItem from '@atlaskit/menu/button-item';
|
|
19
|
-
import { Flex } from '@atlaskit/primitives/compiled';
|
|
19
|
+
import { Flex } from '@atlaskit/primitives/compiled/flex';
|
|
20
20
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
21
21
|
import { focusEditorView, isDatasourceConfigEditable } from '../../pm-plugins/utils';
|
|
22
22
|
import { editDatasource } from '../editDatasourceAction';
|
|
@@ -2,7 +2,7 @@ import React, { useEffect, useRef, useState } from 'react';
|
|
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics/types/enums';
|
|
3
3
|
import Separator from '@atlaskit/editor-common/FloatingToolbar/Separator';
|
|
4
4
|
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
5
|
-
import { Flex } from '@atlaskit/primitives/compiled';
|
|
5
|
+
import { Flex } from '@atlaskit/primitives/compiled/flex';
|
|
6
6
|
import { DatasourceAppearanceButton } from './DatasourceAppearanceButton';
|
|
7
7
|
import { LinkToolbarAppearance } from './LinkToolbarAppearance';
|
|
8
8
|
export function HyperlinkToolbarAppearance(props) {
|
|
@@ -6,7 +6,7 @@ import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-che
|
|
|
6
6
|
import { ArrowKeyNavigationType } from '@atlaskit/editor-common/ui-menu/ArrowKeyNavigationProvider/types';
|
|
7
7
|
import { DropdownContainer as UiDropdown } from '@atlaskit/editor-common/ui-menu/DropdownContainer';
|
|
8
8
|
import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
|
|
9
|
-
import { Flex } from '@atlaskit/primitives/compiled';
|
|
9
|
+
import { Flex } from '@atlaskit/primitives/compiled/flex';
|
|
10
10
|
import { LinkAppearanceMenu } from './LinkToolbarAppearanceDropdown';
|
|
11
11
|
const CustomHyperlinkDropdown = props => {
|
|
12
12
|
var _props$editorPluginAp, _props$cardOptions3, _props$editorPluginAp6, _props$editorPluginAp7;
|
|
@@ -15,6 +15,7 @@ import { useIntl } from 'react-intl';
|
|
|
15
15
|
import { messages } from '@atlaskit/editor-common/messages/card';
|
|
16
16
|
import { ZERO_WIDTH_JOINER } from '@atlaskit/editor-common/whitespace/whitespace';
|
|
17
17
|
import CustomizeIcon from '@atlaskit/icon/core/customize';
|
|
18
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
18
19
|
import { useSmartLinkDestinationUrl } from '@atlaskit/smart-card/hook/use-smart-link-destination-url';
|
|
19
20
|
import { getChildElement, getInlineCardAvailableWidth, getOverlayWidths, isOneLine } from './utils';
|
|
20
21
|
const DEBOUNCE_IN_MS = 5;
|
|
@@ -205,6 +206,9 @@ const InlineCardOverlay = ({
|
|
|
205
206
|
observer.observe(parent);
|
|
206
207
|
return () => {
|
|
207
208
|
observer.disconnect();
|
|
209
|
+
if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
210
|
+
updateOverlay.cancel();
|
|
211
|
+
}
|
|
208
212
|
};
|
|
209
213
|
}, [isVisible, setVisibility]);
|
|
210
214
|
const destinationUrl = (_useSmartLinkDestinat = useSmartLinkDestinationUrl(url)) !== null && _useSmartLinkDestinat !== void 0 ? _useSmartLinkDestinat : url;
|
|
@@ -5,7 +5,9 @@ import { linkMessages } from '@atlaskit/editor-common/messages/link';
|
|
|
5
5
|
import PanelRightIcon from '@atlaskit/icon/core/panel-right';
|
|
6
6
|
import { extractSmartLinkEmbed } from '@atlaskit/link-extractors/extract-smart-link-embed';
|
|
7
7
|
import { useSmartLinkContext } from '@atlaskit/link-provider/use-smart-link-context';
|
|
8
|
-
import {
|
|
8
|
+
import { Box } from '@atlaskit/primitives/compiled/box';
|
|
9
|
+
import { Flex } from '@atlaskit/primitives/compiled/flex';
|
|
10
|
+
import { Inline } from '@atlaskit/primitives/compiled/inline';
|
|
9
11
|
import { getObjectAri, getObjectIconUrl, getObjectName } from '@atlaskit/smart-card';
|
|
10
12
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
13
|
import { getResolvedAttributesFromStore } from '../../pm-plugins/utils';
|
|
@@ -20,7 +20,9 @@ import SmartLinkCardIcon from '@atlaskit/icon/core/smart-link-card';
|
|
|
20
20
|
import SmartLinkEmbedIcon from '@atlaskit/icon/core/smart-link-embed';
|
|
21
21
|
import SmartLinkInlineIcon from '@atlaskit/icon/core/smart-link-inline';
|
|
22
22
|
import { useSmartCardContext } from '@atlaskit/link-provider/use-smart-card-context';
|
|
23
|
-
import { Box
|
|
23
|
+
import { Box } from '@atlaskit/primitives/compiled/box';
|
|
24
|
+
import { Flex } from '@atlaskit/primitives/compiled/flex';
|
|
25
|
+
import { Pressable } from '@atlaskit/primitives/compiled/pressable';
|
|
24
26
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
25
27
|
import { changeSelectedCardToLink, setSelectedCardAppearance } from '../pm-plugins/doc';
|
|
26
28
|
import { getSingleSmartLinkUrlFromSlice } from './currentPastedSmartLink';
|
|
@@ -46,7 +46,7 @@ export var BlockCardComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
46
46
|
|
|
47
47
|
// don't dispatch immediately since we might be in the middle of
|
|
48
48
|
// rendering a nodeview
|
|
49
|
-
rafSchedule(function () {
|
|
49
|
+
var scheduleRegisterCard = rafSchedule(function () {
|
|
50
50
|
var pos = getPos();
|
|
51
51
|
if (typeof pos !== 'number') {
|
|
52
52
|
return;
|
|
@@ -57,7 +57,11 @@ export var BlockCardComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
57
57
|
pos: pos,
|
|
58
58
|
id: _this.props.id
|
|
59
59
|
})(view.state.tr));
|
|
60
|
-
})
|
|
60
|
+
});
|
|
61
|
+
if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
62
|
+
_this.pendingRegisterCard = scheduleRegisterCard;
|
|
63
|
+
}
|
|
64
|
+
scheduleRegisterCard();
|
|
61
65
|
});
|
|
62
66
|
_defineProperty(_this, "removeCardDispatched", false);
|
|
63
67
|
_defineProperty(_this, "gapCursorSpan", function () {
|
|
@@ -89,6 +93,11 @@ export var BlockCardComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
89
93
|
return _createClass(BlockCardComponent, [{
|
|
90
94
|
key: "componentWillUnmount",
|
|
91
95
|
value: function componentWillUnmount() {
|
|
96
|
+
if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
97
|
+
var _this$pendingRegister;
|
|
98
|
+
(_this$pendingRegister = this.pendingRegisterCard) === null || _this$pendingRegister === void 0 || _this$pendingRegister.cancel();
|
|
99
|
+
this.pendingRegisterCard = undefined;
|
|
100
|
+
}
|
|
92
101
|
this.removeCard();
|
|
93
102
|
}
|
|
94
103
|
}, {
|
|
@@ -33,6 +33,16 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
33
33
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
34
34
|
var refId = useRef(uuid());
|
|
35
35
|
var removeCardDispatched = useRef(false);
|
|
36
|
+
var pendingRegisterCard = useRef(null);
|
|
37
|
+
useEffect(function () {
|
|
38
|
+
return function () {
|
|
39
|
+
if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
40
|
+
var _pendingRegisterCard$;
|
|
41
|
+
(_pendingRegisterCard$ = pendingRegisterCard.current) === null || _pendingRegisterCard$ === void 0 || _pendingRegisterCard$.cancel();
|
|
42
|
+
pendingRegisterCard.current = null;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}, []);
|
|
36
46
|
var _ref2 = (cardContext === null || cardContext === void 0 || (_cardContext$value = cardContext.value) === null || _cardContext$value === void 0 ? void 0 : _cardContext$value.store) || {},
|
|
37
47
|
getSmartlinkState = _ref2.getState;
|
|
38
48
|
var cardState = getSmartlinkState === null || getSmartlinkState === void 0 ? void 0 : getSmartlinkState()[url || ''];
|
|
@@ -64,7 +74,7 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
64
74
|
url = data.url;
|
|
65
75
|
// don't dispatch immediately since we might be in the middle of
|
|
66
76
|
// rendering a nodeview
|
|
67
|
-
rafSchedule(function () {
|
|
77
|
+
var scheduleRegisterCard = rafSchedule(function () {
|
|
68
78
|
// prosemirror-bump-fix
|
|
69
79
|
var pos = getPos();
|
|
70
80
|
if (typeof pos !== 'number') {
|
|
@@ -79,7 +89,11 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
79
89
|
})(tr);
|
|
80
90
|
onRes === null || onRes === void 0 || onRes(tr, title);
|
|
81
91
|
view.dispatch(tr);
|
|
82
|
-
})
|
|
92
|
+
});
|
|
93
|
+
if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
94
|
+
pendingRegisterCard.current = scheduleRegisterCard;
|
|
95
|
+
}
|
|
96
|
+
scheduleRegisterCard();
|
|
83
97
|
}, [getPos, view, onRes]);
|
|
84
98
|
var onError = useCallback(function (data) {
|
|
85
99
|
var url = data.url,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import React, { memo, useCallback, useMemo, useState } from 'react';
|
|
2
|
+
import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { ACTION_SUBJECT_ID, EVENT_TYPE, ACTION, ACTION_SUBJECT } from '@atlaskit/editor-common/analytics/types/enums';
|
|
4
4
|
import HoverLinkOverlay from '@atlaskit/editor-common/HoverLinkOverlay';
|
|
5
5
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/useSharedPluginStateWithSelector';
|
|
6
6
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import { extractSmartLinkEmbed } from '@atlaskit/link-extractors/extract-smart-link-embed';
|
|
8
8
|
import { isWithinPreviewPanelIFrame } from '@atlaskit/linking-common/utils/is-within-preview-panel-iframe';
|
|
9
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
9
10
|
import { getObjectAri, getObjectName, getObjectIconUrl } from '@atlaskit/smart-card';
|
|
10
11
|
import { useSmartLinkDestinationUrl } from '@atlaskit/smart-card/hook/use-smart-link-destination-url';
|
|
11
12
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
@@ -14,6 +15,14 @@ import { pluginKey } from '../pm-plugins/plugin-key';
|
|
|
14
15
|
import { AwarenessWrapper } from '../ui/AwarenessWrapper';
|
|
15
16
|
import { PreviewInvoker } from '../ui/preview/PreviewInvoker';
|
|
16
17
|
import { InlineCard } from './inlineCardBase';
|
|
18
|
+
// Module scope so the stored callback's closure chain cannot reach the
|
|
19
|
+
// component scope (getPos, node, view) via V8 context sharing.
|
|
20
|
+
var createRemoveOverlay = function createRemoveOverlay(setIsInsertedRef) {
|
|
21
|
+
return function () {
|
|
22
|
+
var _setIsInsertedRef$cur;
|
|
23
|
+
return (_setIsInsertedRef$cur = setIsInsertedRef.current) === null || _setIsInsertedRef$cur === void 0 ? void 0 : _setIsInsertedRef$cur.call(setIsInsertedRef, false);
|
|
24
|
+
};
|
|
25
|
+
};
|
|
17
26
|
var selector = function selector(states) {
|
|
18
27
|
var _states$editorViewMod, _states$selectionStat;
|
|
19
28
|
return {
|
|
@@ -45,6 +54,14 @@ export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
|
|
|
45
54
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
46
55
|
isInserted = _useState4[0],
|
|
47
56
|
setIsInserted = _useState4[1];
|
|
57
|
+
var setIsInsertedRef = useRef(setIsInserted);
|
|
58
|
+
useEffect(function () {
|
|
59
|
+
return function () {
|
|
60
|
+
if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
61
|
+
setIsInsertedRef.current = undefined;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}, []);
|
|
48
65
|
var _useState5 = useState(false),
|
|
49
66
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
50
67
|
isResolvedViewRendered = _useState6[0],
|
|
@@ -53,14 +70,13 @@ export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
|
|
|
53
70
|
var destinationUrl = useSmartLinkDestinationUrl(node.attrs.url);
|
|
54
71
|
var onResolve = useCallback(function (tr, title) {
|
|
55
72
|
var metadata = tr.getMeta(pluginKey);
|
|
73
|
+
var removeOverlay = isExperimentEnabled('platform_editor_reduce_memory_leaks') ? createRemoveOverlay(setIsInsertedRef) : function () {
|
|
74
|
+
return setIsInserted(false);
|
|
75
|
+
};
|
|
56
76
|
if (metadata && metadata.type === 'REGISTER') {
|
|
57
|
-
registerRemoveOverlay(
|
|
58
|
-
return setIsInserted(false);
|
|
59
|
-
}, metadata.info)(tr);
|
|
77
|
+
registerRemoveOverlay(removeOverlay, metadata.info)(tr);
|
|
60
78
|
} else {
|
|
61
|
-
registerRemoveOverlay(
|
|
62
|
-
return setIsInserted(false);
|
|
63
|
-
})(tr);
|
|
79
|
+
registerRemoveOverlay(removeOverlay)(tr);
|
|
64
80
|
}
|
|
65
81
|
if (title) {
|
|
66
82
|
setIsResolvedViewRendered(true);
|
|
@@ -10,6 +10,7 @@ import { DATASOURCE_INNER_CONTAINER_CLASSNAME } from '@atlaskit/editor-common/st
|
|
|
10
10
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
11
11
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
12
12
|
import { DATASOURCE_DEFAULT_LAYOUT } from '@atlaskit/linking-common/constants';
|
|
13
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
13
14
|
import { blockCardNodeView } from '../nodeviews/blockCard';
|
|
14
15
|
import { embedCardNodeView } from '../nodeviews/embedCard';
|
|
15
16
|
import { InlineCardNodeView } from '../nodeviews/inlineCard';
|
|
@@ -232,7 +233,13 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
232
233
|
*/
|
|
233
234
|
var invoke = rafSchedule(function () {
|
|
234
235
|
var _pluginInjectionApi$a, _pluginInjectionApi$a2, _pluginInjectionApi$a3, _currentState$embedCa;
|
|
235
|
-
|
|
236
|
+
if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
237
|
+
var index = rafCancellationCallbacks.indexOf(invoke.cancel);
|
|
238
|
+
if (index !== -1) {
|
|
239
|
+
rafCancellationCallbacks.splice(index, 1);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
resolveWithProvider(view, _provider, request, options, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions, (_pluginInjectionApi$a2 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 || (_pluginInjectionApi$a3 = _pluginInjectionApi$a3.sharedState.currentState()) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.createAnalyticsEvent) !== null && _pluginInjectionApi$a2 !== void 0 ? _pluginInjectionApi$a2 : undefined, currentState === null || currentState === void 0 || (_currentState$embedCa = currentState.embedCardTransformers) === null || _currentState$embedCa === void 0 ? void 0 : _currentState$embedCa.embedCardNodeTransformer);
|
|
236
243
|
});
|
|
237
244
|
rafCancellationCallbacks.push(invoke.cancel);
|
|
238
245
|
invoke();
|
|
@@ -5,6 +5,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
5
5
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
6
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
7
|
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) { _defineProperty(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; }
|
|
8
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
8
9
|
var queue = function queue(state, action) {
|
|
9
10
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
10
11
|
requests: state.requests.concat(action.requests)
|
|
@@ -29,10 +30,18 @@ var register = function register(state, action) {
|
|
|
29
30
|
});
|
|
30
31
|
};
|
|
31
32
|
var removeCard = function removeCard(state, action) {
|
|
33
|
+
var cards = state.cards.filter(function (card) {
|
|
34
|
+
return card.id !== action.info.id;
|
|
35
|
+
});
|
|
36
|
+
if (isExperimentEnabled('platform_editor_reduce_memory_leaks') && state.removeOverlayCardId !== undefined && state.removeOverlayCardId === action.info.id) {
|
|
37
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
38
|
+
cards: cards,
|
|
39
|
+
removeOverlay: undefined,
|
|
40
|
+
removeOverlayCardId: undefined
|
|
41
|
+
});
|
|
42
|
+
}
|
|
32
43
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
33
|
-
cards:
|
|
34
|
-
return card.id !== action.info.id;
|
|
35
|
-
})
|
|
44
|
+
cards: cards
|
|
36
45
|
});
|
|
37
46
|
};
|
|
38
47
|
var setProvider = function setProvider(state, action) {
|
|
@@ -84,18 +93,28 @@ var hideDatasourceModal = function hideDatasourceModal(state) {
|
|
|
84
93
|
});
|
|
85
94
|
};
|
|
86
95
|
var clearOverlayCandidate = function clearOverlayCandidate(state) {
|
|
96
|
+
if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
97
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
98
|
+
overlayCandidatePosition: undefined,
|
|
99
|
+
removeOverlay: undefined,
|
|
100
|
+
removeOverlayCardId: undefined
|
|
101
|
+
});
|
|
102
|
+
}
|
|
87
103
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
88
104
|
overlayCandidatePosition: undefined
|
|
89
105
|
});
|
|
90
106
|
};
|
|
91
107
|
var registerRemoveOverlayOnInsertedLink = function registerRemoveOverlayOnInsertedLink(state, action) {
|
|
108
|
+
var _action$info2;
|
|
92
109
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
93
110
|
cards: action.info ? state.cards.filter(function (card) {
|
|
94
111
|
var _action$info;
|
|
95
112
|
return card.pos !== ((_action$info = action.info) === null || _action$info === void 0 ? void 0 : _action$info.pos);
|
|
96
113
|
}).concat(action.info) : state.cards,
|
|
97
114
|
removeOverlay: action.callback
|
|
98
|
-
})
|
|
115
|
+
}, isExperimentEnabled('platform_editor_reduce_memory_leaks') ? {
|
|
116
|
+
removeOverlayCardId: (_action$info2 = action.info) === null || _action$info2 === void 0 ? void 0 : _action$info2.id
|
|
117
|
+
} : {});
|
|
99
118
|
};
|
|
100
119
|
var setDatasourceStash = function setDatasourceStash(state, action) {
|
|
101
120
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
@@ -12,7 +12,7 @@ import { canRenderDatasource } from '@atlaskit/editor-common/utils/datasource';
|
|
|
12
12
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
13
13
|
import { buildDatasourceAdf } from '@atlaskit/link-datasource/utils/schema';
|
|
14
14
|
import { useSmartLinkContext } from '@atlaskit/link-provider/use-smart-link-context';
|
|
15
|
-
import { Flex } from '@atlaskit/primitives/compiled';
|
|
15
|
+
import { Flex } from '@atlaskit/primitives/compiled/flex';
|
|
16
16
|
import { updateCardViaDatasource } from '../pm-plugins/doc';
|
|
17
17
|
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
18
18
|
import { DatasourceIcon } from './DatasourceIcon';
|
|
@@ -17,7 +17,7 @@ import { DropdownContainer as UiDropdown } from '@atlaskit/editor-common/ui-menu
|
|
|
17
17
|
import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
|
|
18
18
|
import EditIcon from '@atlaskit/icon/core/edit';
|
|
19
19
|
import ButtonItem from '@atlaskit/menu/button-item';
|
|
20
|
-
import { Flex } from '@atlaskit/primitives/compiled';
|
|
20
|
+
import { Flex } from '@atlaskit/primitives/compiled/flex';
|
|
21
21
|
import { focusEditorView } from '../../pm-plugins/utils';
|
|
22
22
|
import { editDatasource } from '../editDatasourceAction';
|
|
23
23
|
var dropdownExpandContainer = css({
|
|
@@ -19,7 +19,7 @@ import { DropdownContainer as UiDropdown } from '@atlaskit/editor-common/ui-menu
|
|
|
19
19
|
import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
|
|
20
20
|
import { useSmartLinkContext } from '@atlaskit/link-provider/use-smart-link-context';
|
|
21
21
|
import ButtonItem from '@atlaskit/menu/button-item';
|
|
22
|
-
import { Flex } from '@atlaskit/primitives/compiled';
|
|
22
|
+
import { Flex } from '@atlaskit/primitives/compiled/flex';
|
|
23
23
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
24
24
|
import { focusEditorView, isDatasourceConfigEditable } from '../../pm-plugins/utils';
|
|
25
25
|
import { editDatasource } from '../editDatasourceAction';
|
|
@@ -5,7 +5,7 @@ import React, { useEffect, useRef, useState } from 'react';
|
|
|
5
5
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics/types/enums';
|
|
6
6
|
import Separator from '@atlaskit/editor-common/FloatingToolbar/Separator';
|
|
7
7
|
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
8
|
-
import { Flex } from '@atlaskit/primitives/compiled';
|
|
8
|
+
import { Flex } from '@atlaskit/primitives/compiled/flex';
|
|
9
9
|
import { DatasourceAppearanceButton } from './DatasourceAppearanceButton';
|
|
10
10
|
import { LinkToolbarAppearance } from './LinkToolbarAppearance';
|
|
11
11
|
export function HyperlinkToolbarAppearance(props) {
|
|
@@ -9,7 +9,7 @@ import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-che
|
|
|
9
9
|
import { ArrowKeyNavigationType } from '@atlaskit/editor-common/ui-menu/ArrowKeyNavigationProvider/types';
|
|
10
10
|
import { DropdownContainer as UiDropdown } from '@atlaskit/editor-common/ui-menu/DropdownContainer';
|
|
11
11
|
import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
|
|
12
|
-
import { Flex } from '@atlaskit/primitives/compiled';
|
|
12
|
+
import { Flex } from '@atlaskit/primitives/compiled/flex';
|
|
13
13
|
import { LinkAppearanceMenu } from './LinkToolbarAppearanceDropdown';
|
|
14
14
|
var CustomHyperlinkDropdown = function CustomHyperlinkDropdown(props) {
|
|
15
15
|
var _props$editorPluginAp, _props$cardOptions3, _props$editorPluginAp3, _props$editorPluginAp4;
|
|
@@ -19,6 +19,7 @@ import { useIntl } from 'react-intl';
|
|
|
19
19
|
import { messages } from '@atlaskit/editor-common/messages/card';
|
|
20
20
|
import { ZERO_WIDTH_JOINER } from '@atlaskit/editor-common/whitespace/whitespace';
|
|
21
21
|
import CustomizeIcon from '@atlaskit/icon/core/customize';
|
|
22
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
22
23
|
import { useSmartLinkDestinationUrl } from '@atlaskit/smart-card/hook/use-smart-link-destination-url';
|
|
23
24
|
import { getChildElement, getInlineCardAvailableWidth, getOverlayWidths, isOneLine } from './utils';
|
|
24
25
|
var DEBOUNCE_IN_MS = 5;
|
|
@@ -214,6 +215,9 @@ var InlineCardOverlay = function InlineCardOverlay(_ref) {
|
|
|
214
215
|
observer.observe(parent);
|
|
215
216
|
return function () {
|
|
216
217
|
observer.disconnect();
|
|
218
|
+
if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
219
|
+
updateOverlay.cancel();
|
|
220
|
+
}
|
|
217
221
|
};
|
|
218
222
|
}, [isVisible, setVisibility]);
|
|
219
223
|
var destinationUrl = (_useSmartLinkDestinat = useSmartLinkDestinationUrl(url)) !== null && _useSmartLinkDestinat !== void 0 ? _useSmartLinkDestinat : url;
|
|
@@ -8,7 +8,9 @@ import { linkMessages } from '@atlaskit/editor-common/messages/link';
|
|
|
8
8
|
import PanelRightIcon from '@atlaskit/icon/core/panel-right';
|
|
9
9
|
import { extractSmartLinkEmbed } from '@atlaskit/link-extractors/extract-smart-link-embed';
|
|
10
10
|
import { useSmartLinkContext } from '@atlaskit/link-provider/use-smart-link-context';
|
|
11
|
-
import {
|
|
11
|
+
import { Box } from '@atlaskit/primitives/compiled/box';
|
|
12
|
+
import { Flex } from '@atlaskit/primitives/compiled/flex';
|
|
13
|
+
import { Inline } from '@atlaskit/primitives/compiled/inline';
|
|
12
14
|
import { getObjectAri, getObjectIconUrl, getObjectName } from '@atlaskit/smart-card';
|
|
13
15
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
16
|
import { getResolvedAttributesFromStore } from '../../pm-plugins/utils';
|
|
@@ -22,7 +22,9 @@ import SmartLinkCardIcon from '@atlaskit/icon/core/smart-link-card';
|
|
|
22
22
|
import SmartLinkEmbedIcon from '@atlaskit/icon/core/smart-link-embed';
|
|
23
23
|
import SmartLinkInlineIcon from '@atlaskit/icon/core/smart-link-inline';
|
|
24
24
|
import { useSmartCardContext } from '@atlaskit/link-provider/use-smart-card-context';
|
|
25
|
-
import { Box
|
|
25
|
+
import { Box } from '@atlaskit/primitives/compiled/box';
|
|
26
|
+
import { Flex } from '@atlaskit/primitives/compiled/flex';
|
|
27
|
+
import { Pressable } from '@atlaskit/primitives/compiled/pressable';
|
|
26
28
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
27
29
|
import { changeSelectedCardToLink, setSelectedCardAppearance } from '../pm-plugins/doc';
|
|
28
30
|
import { getSingleSmartLinkUrlFromSlice } from './currentPastedSmartLink';
|
|
@@ -32,6 +32,7 @@ export declare const getPluginStateWithUpdatedPos: (pluginState: CardPluginState
|
|
|
32
32
|
overlayCandidatePosition?: number;
|
|
33
33
|
provider: CardProvider | null;
|
|
34
34
|
removeOverlay?: () => void;
|
|
35
|
+
removeOverlayCardId?: string;
|
|
35
36
|
requests: {
|
|
36
37
|
analyticsAction?: ACTION;
|
|
37
38
|
appearance: CardAppearance;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types/next-editor-plugin';
|
|
3
3
|
import type { CardPlugin } from '../cardPluginType';
|
|
4
4
|
import type { EditorCardPluginEvents } from './analytics/create-events-queue';
|
|
5
5
|
import type { CardPluginEvent } from './analytics/types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "34.0.1",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -27,33 +27,33 @@
|
|
|
27
27
|
"@atlaskit/css": "^1.1.0",
|
|
28
28
|
"@atlaskit/custom-steps": "^1.1.0",
|
|
29
29
|
"@atlaskit/editor-card-provider": "^8.1.0",
|
|
30
|
-
"@atlaskit/editor-plugin-analytics": "^
|
|
31
|
-
"@atlaskit/editor-plugin-annotation": "^
|
|
32
|
-
"@atlaskit/editor-plugin-base": "^
|
|
33
|
-
"@atlaskit/editor-plugin-connectivity": "^
|
|
34
|
-
"@atlaskit/editor-plugin-decorations": "^
|
|
35
|
-
"@atlaskit/editor-plugin-editor-disabled": "^
|
|
36
|
-
"@atlaskit/editor-plugin-editor-viewmode": "^
|
|
37
|
-
"@atlaskit/editor-plugin-feature-flags": "^
|
|
38
|
-
"@atlaskit/editor-plugin-floating-toolbar": "^
|
|
39
|
-
"@atlaskit/editor-plugin-grid": "^
|
|
40
|
-
"@atlaskit/editor-plugin-selection": "^
|
|
41
|
-
"@atlaskit/editor-plugin-toolbar": "^
|
|
42
|
-
"@atlaskit/editor-plugin-ui-control-registry": "^
|
|
43
|
-
"@atlaskit/editor-plugin-user-intent": "^
|
|
44
|
-
"@atlaskit/editor-plugin-width": "^
|
|
30
|
+
"@atlaskit/editor-plugin-analytics": "^28.0.0",
|
|
31
|
+
"@atlaskit/editor-plugin-annotation": "^28.1.0",
|
|
32
|
+
"@atlaskit/editor-plugin-base": "^29.0.0",
|
|
33
|
+
"@atlaskit/editor-plugin-connectivity": "^28.0.0",
|
|
34
|
+
"@atlaskit/editor-plugin-decorations": "^28.0.0",
|
|
35
|
+
"@atlaskit/editor-plugin-editor-disabled": "^28.0.0",
|
|
36
|
+
"@atlaskit/editor-plugin-editor-viewmode": "^30.0.0",
|
|
37
|
+
"@atlaskit/editor-plugin-feature-flags": "^27.0.0",
|
|
38
|
+
"@atlaskit/editor-plugin-floating-toolbar": "^30.0.0",
|
|
39
|
+
"@atlaskit/editor-plugin-grid": "^28.0.0",
|
|
40
|
+
"@atlaskit/editor-plugin-selection": "^28.0.0",
|
|
41
|
+
"@atlaskit/editor-plugin-toolbar": "^25.0.0",
|
|
42
|
+
"@atlaskit/editor-plugin-ui-control-registry": "^22.0.0",
|
|
43
|
+
"@atlaskit/editor-plugin-user-intent": "^26.0.0",
|
|
44
|
+
"@atlaskit/editor-plugin-width": "^29.0.0",
|
|
45
45
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
46
|
-
"@atlaskit/editor-shared-styles": "^4.
|
|
46
|
+
"@atlaskit/editor-shared-styles": "^4.5.0",
|
|
47
47
|
"@atlaskit/editor-smart-link-draggable": "^1.2.0",
|
|
48
48
|
"@atlaskit/editor-toolbar": "^2.8.0",
|
|
49
49
|
"@atlaskit/editor-ui-control-model": "^2.10.0",
|
|
50
50
|
"@atlaskit/frontend-utilities": "^5.0.0",
|
|
51
51
|
"@atlaskit/icon": "^38.0.0",
|
|
52
|
-
"@atlaskit/json-ld-types": "^2.
|
|
52
|
+
"@atlaskit/json-ld-types": "^2.1.0",
|
|
53
53
|
"@atlaskit/link": "^5.1.0",
|
|
54
54
|
"@atlaskit/link-analytics": "^13.0.0",
|
|
55
55
|
"@atlaskit/link-client-extension": "^8.0.0",
|
|
56
|
-
"@atlaskit/link-datasource": "^7.
|
|
56
|
+
"@atlaskit/link-datasource": "^7.5.0",
|
|
57
57
|
"@atlaskit/link-extractors": "^5.0.0",
|
|
58
58
|
"@atlaskit/linking-common": "^13.0.0",
|
|
59
59
|
"@atlaskit/linking-types": "^16.0.0",
|
|
@@ -61,10 +61,10 @@
|
|
|
61
61
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
62
62
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
63
63
|
"@atlaskit/platform-feature-flags-react": "^1.2.0",
|
|
64
|
-
"@atlaskit/primitives": "^22.
|
|
64
|
+
"@atlaskit/primitives": "^22.6.0",
|
|
65
65
|
"@atlaskit/prosemirror-history": "^1.3.0",
|
|
66
|
-
"@atlaskit/smart-card": "^46.
|
|
67
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
66
|
+
"@atlaskit/smart-card": "^46.7.0",
|
|
67
|
+
"@atlaskit/tmp-editor-statsig": "^241.0.0",
|
|
68
68
|
"@atlaskit/tokens": "^20.6.0",
|
|
69
69
|
"@babel/runtime": "^7.0.0",
|
|
70
70
|
"@emotion/react": "^11.7.1",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"uuid": "^11.1.1"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"@atlaskit/editor-common": "^
|
|
77
|
+
"@atlaskit/editor-common": "^132.0.0",
|
|
78
78
|
"@atlaskit/link-provider": "^6.0.0",
|
|
79
79
|
"react": "^18.2.0 || ^19.2.0",
|
|
80
80
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|