@atlaskit/editor-plugin-card 37.0.1 → 38.0.0
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 +8 -0
- package/dist/cjs/nodeviews/blockCard.js +4 -8
- package/dist/cjs/nodeviews/inlineCardBase.js +4 -8
- package/dist/cjs/nodeviews/inlineCardWithAwareness.js +2 -6
- package/dist/cjs/pm-plugins/main.js +3 -5
- package/dist/cjs/pm-plugins/reducers.js +6 -13
- package/dist/es2019/nodeviews/blockCard.js +4 -8
- package/dist/es2019/nodeviews/inlineCardBase.js +4 -8
- package/dist/es2019/nodeviews/inlineCardWithAwareness.js +2 -4
- package/dist/es2019/pm-plugins/main.js +3 -5
- package/dist/es2019/pm-plugins/reducers.js +5 -14
- package/dist/esm/nodeviews/blockCard.js +4 -8
- package/dist/esm/nodeviews/inlineCardBase.js +4 -8
- package/dist/esm/nodeviews/inlineCardWithAwareness.js +2 -6
- package/dist/esm/pm-plugins/main.js +3 -5
- package/dist/esm/pm-plugins/reducers.js +6 -13
- package/package.json +21 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 38.0.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`b2444e74978c4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b2444e74978c4) -
|
|
8
|
+
Make the shipped editor memory-leak reductions permanent and remove the experiment checks.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 37.0.1
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -79,9 +79,7 @@ var BlockCardComponent = exports.BlockCardComponent = /*#__PURE__*/function (_Re
|
|
|
79
79
|
})(view.state.tr));
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
|
-
|
|
83
|
-
_this.pendingRegisterCard = scheduleRegisterCard;
|
|
84
|
-
}
|
|
82
|
+
_this.pendingRegisterCard = scheduleRegisterCard;
|
|
85
83
|
scheduleRegisterCard();
|
|
86
84
|
});
|
|
87
85
|
(0, _defineProperty2.default)(_this, "removeCardDispatched", false);
|
|
@@ -114,11 +112,9 @@ var BlockCardComponent = exports.BlockCardComponent = /*#__PURE__*/function (_Re
|
|
|
114
112
|
return (0, _createClass2.default)(BlockCardComponent, [{
|
|
115
113
|
key: "componentWillUnmount",
|
|
116
114
|
value: function componentWillUnmount() {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
this.pendingRegisterCard = undefined;
|
|
121
|
-
}
|
|
115
|
+
var _this$pendingRegister;
|
|
116
|
+
(_this$pendingRegister = this.pendingRegisterCard) === null || _this$pendingRegister === void 0 || _this$pendingRegister.cancel();
|
|
117
|
+
this.pendingRegisterCard = undefined;
|
|
122
118
|
this.removeCard();
|
|
123
119
|
}
|
|
124
120
|
}, {
|
|
@@ -45,11 +45,9 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
|
|
|
45
45
|
var pendingRegisterCard = (0, _react.useRef)(null);
|
|
46
46
|
(0, _react.useEffect)(function () {
|
|
47
47
|
return function () {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
pendingRegisterCard.current = null;
|
|
52
|
-
}
|
|
48
|
+
var _pendingRegisterCard$;
|
|
49
|
+
(_pendingRegisterCard$ = pendingRegisterCard.current) === null || _pendingRegisterCard$ === void 0 || _pendingRegisterCard$.cancel();
|
|
50
|
+
pendingRegisterCard.current = null;
|
|
53
51
|
};
|
|
54
52
|
}, []);
|
|
55
53
|
var cardActions = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.card.actions;
|
|
@@ -120,9 +118,7 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
|
|
|
120
118
|
view.dispatch(tr);
|
|
121
119
|
}
|
|
122
120
|
});
|
|
123
|
-
|
|
124
|
-
pendingRegisterCard.current = scheduleRegisterCard;
|
|
125
|
-
}
|
|
121
|
+
pendingRegisterCard.current = scheduleRegisterCard;
|
|
126
122
|
scheduleRegisterCard();
|
|
127
123
|
}, [getPos, (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_forced_layout_2') ? undefined : view, onRes, (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_forced_layout_2') ? registerResolvedCard : undefined]);
|
|
128
124
|
var onError = (0, _react.useCallback)(function (data) {
|
|
@@ -66,9 +66,7 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
|
|
|
66
66
|
var setIsInsertedRef = (0, _react.useRef)(setIsInserted);
|
|
67
67
|
(0, _react.useEffect)(function () {
|
|
68
68
|
return function () {
|
|
69
|
-
|
|
70
|
-
setIsInsertedRef.current = undefined;
|
|
71
|
-
}
|
|
69
|
+
setIsInsertedRef.current = undefined;
|
|
72
70
|
};
|
|
73
71
|
}, []);
|
|
74
72
|
var _useState5 = (0, _react.useState)(false),
|
|
@@ -82,9 +80,7 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
|
|
|
82
80
|
var onResolve = (0, _react.useCallback)(function (tr, title) {
|
|
83
81
|
if (tr) {
|
|
84
82
|
var metadata = tr.getMeta(_pluginKey.pluginKey);
|
|
85
|
-
var removeOverlay =
|
|
86
|
-
return setIsInserted(false);
|
|
87
|
-
};
|
|
83
|
+
var removeOverlay = createRemoveOverlay(setIsInsertedRef);
|
|
88
84
|
if (metadata && metadata.type === 'REGISTER') {
|
|
89
85
|
(0, _actions.registerRemoveOverlay)(removeOverlay, metadata.info)(tr);
|
|
90
86
|
} else {
|
|
@@ -254,11 +254,9 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
|
|
|
254
254
|
*/
|
|
255
255
|
var invoke = (0, _rafSchd.default)(function () {
|
|
256
256
|
var _pluginInjectionApi$a, _pluginInjectionApi$a2, _pluginInjectionApi$a3, _currentState$embedCa;
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
rafCancellationCallbacks.splice(index, 1);
|
|
261
|
-
}
|
|
257
|
+
var index = rafCancellationCallbacks.indexOf(invoke.cancel);
|
|
258
|
+
if (index !== -1) {
|
|
259
|
+
rafCancellationCallbacks.splice(index, 1);
|
|
262
260
|
}
|
|
263
261
|
(0, _resolve.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);
|
|
264
262
|
});
|
|
@@ -8,7 +8,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
12
11
|
var _pastedInlineLink = require("./util/pasted-inline-link");
|
|
13
12
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
13
|
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); }
|
|
@@ -41,7 +40,7 @@ var removeCard = function removeCard(state, action) {
|
|
|
41
40
|
var cards = state.cards.filter(function (card) {
|
|
42
41
|
return card.id !== action.info.id;
|
|
43
42
|
});
|
|
44
|
-
if (
|
|
43
|
+
if (state.removeOverlayCardId !== undefined && state.removeOverlayCardId === action.info.id) {
|
|
45
44
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
46
45
|
cards: cards,
|
|
47
46
|
removeOverlay: undefined,
|
|
@@ -101,15 +100,10 @@ var hideDatasourceModal = function hideDatasourceModal(state) {
|
|
|
101
100
|
});
|
|
102
101
|
};
|
|
103
102
|
var clearOverlayCandidate = function clearOverlayCandidate(state) {
|
|
104
|
-
if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks')) {
|
|
105
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
106
|
-
overlayCandidatePosition: undefined,
|
|
107
|
-
removeOverlay: undefined,
|
|
108
|
-
removeOverlayCardId: undefined
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
103
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
112
|
-
overlayCandidatePosition: undefined
|
|
104
|
+
overlayCandidatePosition: undefined,
|
|
105
|
+
removeOverlay: undefined,
|
|
106
|
+
removeOverlayCardId: undefined
|
|
113
107
|
});
|
|
114
108
|
};
|
|
115
109
|
var registerRemoveOverlayOnInsertedLink = function registerRemoveOverlayOnInsertedLink(state, action) {
|
|
@@ -119,10 +113,9 @@ var registerRemoveOverlayOnInsertedLink = function registerRemoveOverlayOnInsert
|
|
|
119
113
|
var _action$info;
|
|
120
114
|
return card.pos !== ((_action$info = action.info) === null || _action$info === void 0 ? void 0 : _action$info.pos);
|
|
121
115
|
}).concat(action.info) : state.cards,
|
|
122
|
-
removeOverlay: action.callback
|
|
123
|
-
}, (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks') ? {
|
|
116
|
+
removeOverlay: action.callback,
|
|
124
117
|
removeOverlayCardId: (_action$info2 = action.info) === null || _action$info2 === void 0 ? void 0 : _action$info2.id
|
|
125
|
-
}
|
|
118
|
+
});
|
|
126
119
|
};
|
|
127
120
|
var setDatasourceStash = function setDatasourceStash(state, action) {
|
|
128
121
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
@@ -67,9 +67,7 @@ export class BlockCardComponent extends React.PureComponent {
|
|
|
67
67
|
})(view.state.tr));
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
|
-
|
|
71
|
-
this.pendingRegisterCard = scheduleRegisterCard;
|
|
72
|
-
}
|
|
70
|
+
this.pendingRegisterCard = scheduleRegisterCard;
|
|
73
71
|
scheduleRegisterCard();
|
|
74
72
|
});
|
|
75
73
|
_defineProperty(this, "removeCardDispatched", false);
|
|
@@ -99,11 +97,9 @@ export class BlockCardComponent extends React.PureComponent {
|
|
|
99
97
|
findOverflowScrollParent(props.view.dom) || undefined;
|
|
100
98
|
}
|
|
101
99
|
componentWillUnmount() {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
this.pendingRegisterCard = undefined;
|
|
106
|
-
}
|
|
100
|
+
var _this$pendingRegister;
|
|
101
|
+
(_this$pendingRegister = this.pendingRegisterCard) === null || _this$pendingRegister === void 0 ? void 0 : _this$pendingRegister.cancel();
|
|
102
|
+
this.pendingRegisterCard = undefined;
|
|
107
103
|
this.removeCard();
|
|
108
104
|
}
|
|
109
105
|
removeCard() {
|
|
@@ -37,11 +37,9 @@ export const InlineCard = /*#__PURE__*/memo(({
|
|
|
37
37
|
const pendingRegisterCard = useRef(null);
|
|
38
38
|
useEffect(() => {
|
|
39
39
|
return () => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
pendingRegisterCard.current = null;
|
|
44
|
-
}
|
|
40
|
+
var _pendingRegisterCard$;
|
|
41
|
+
(_pendingRegisterCard$ = pendingRegisterCard.current) === null || _pendingRegisterCard$ === void 0 ? void 0 : _pendingRegisterCard$.cancel();
|
|
42
|
+
pendingRegisterCard.current = null;
|
|
45
43
|
};
|
|
46
44
|
}, []);
|
|
47
45
|
const cardActions = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.card.actions;
|
|
@@ -115,9 +113,7 @@ export const InlineCard = /*#__PURE__*/memo(({
|
|
|
115
113
|
view.dispatch(tr);
|
|
116
114
|
}
|
|
117
115
|
});
|
|
118
|
-
|
|
119
|
-
pendingRegisterCard.current = scheduleRegisterCard;
|
|
120
|
-
}
|
|
116
|
+
pendingRegisterCard.current = scheduleRegisterCard;
|
|
121
117
|
scheduleRegisterCard();
|
|
122
118
|
}, [getPos, isExperimentEnabled('platform_editor_reduce_forced_layout_2') ? undefined : view, onRes, isExperimentEnabled('platform_editor_reduce_forced_layout_2') ? registerResolvedCard : undefined]);
|
|
123
119
|
const onError = useCallback(data => {
|
|
@@ -49,9 +49,7 @@ export const InlineCardWithAwareness = /*#__PURE__*/memo(({
|
|
|
49
49
|
const setIsInsertedRef = useRef(setIsInserted);
|
|
50
50
|
useEffect(() => {
|
|
51
51
|
return () => {
|
|
52
|
-
|
|
53
|
-
setIsInsertedRef.current = undefined;
|
|
54
|
-
}
|
|
52
|
+
setIsInsertedRef.current = undefined;
|
|
55
53
|
};
|
|
56
54
|
}, []);
|
|
57
55
|
const [isResolvedViewRendered, setIsResolvedViewRendered] = useState(false);
|
|
@@ -62,7 +60,7 @@ export const InlineCardWithAwareness = /*#__PURE__*/memo(({
|
|
|
62
60
|
const onResolve = useCallback((tr, title) => {
|
|
63
61
|
if (tr) {
|
|
64
62
|
const metadata = tr.getMeta(pluginKey);
|
|
65
|
-
const removeOverlay =
|
|
63
|
+
const removeOverlay = createRemoveOverlay(setIsInsertedRef);
|
|
66
64
|
if (metadata && metadata.type === 'REGISTER') {
|
|
67
65
|
registerRemoveOverlay(removeOverlay, metadata.info)(tr);
|
|
68
66
|
} else {
|
|
@@ -251,11 +251,9 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
251
251
|
*/
|
|
252
252
|
const invoke = rafSchedule(() => {
|
|
253
253
|
var _pluginInjectionApi$a, _pluginInjectionApi$a2, _pluginInjectionApi$a3, _pluginInjectionApi$a4, _currentState$embedCa;
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
rafCancellationCallbacks.splice(index, 1);
|
|
258
|
-
}
|
|
254
|
+
const index = rafCancellationCallbacks.indexOf(invoke.cancel);
|
|
255
|
+
if (index !== -1) {
|
|
256
|
+
rafCancellationCallbacks.splice(index, 1);
|
|
259
257
|
}
|
|
260
258
|
resolveWithProvider(view, provider, request, options, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions, (_pluginInjectionApi$a2 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : (_pluginInjectionApi$a4 = _pluginInjectionApi$a3.sharedState.currentState()) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.createAnalyticsEvent) !== null && _pluginInjectionApi$a2 !== void 0 ? _pluginInjectionApi$a2 : undefined, currentState === null || currentState === void 0 ? void 0 : (_currentState$embedCa = currentState.embedCardTransformers) === null || _currentState$embedCa === void 0 ? void 0 : _currentState$embedCa.embedCardNodeTransformer);
|
|
261
259
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
2
1
|
import { removePastedInlineLink } from './util/pasted-inline-link';
|
|
3
2
|
const queue = (state, action) => {
|
|
4
3
|
return {
|
|
@@ -26,7 +25,7 @@ const register = (state, action) => {
|
|
|
26
25
|
};
|
|
27
26
|
const removeCard = (state, action) => {
|
|
28
27
|
const cards = state.cards.filter(card => card.id !== action.info.id);
|
|
29
|
-
if (
|
|
28
|
+
if (state.removeOverlayCardId !== undefined && state.removeOverlayCardId === action.info.id) {
|
|
30
29
|
return {
|
|
31
30
|
...state,
|
|
32
31
|
cards,
|
|
@@ -100,17 +99,11 @@ const hideDatasourceModal = state => {
|
|
|
100
99
|
};
|
|
101
100
|
};
|
|
102
101
|
const clearOverlayCandidate = state => {
|
|
103
|
-
if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
104
|
-
return {
|
|
105
|
-
...state,
|
|
106
|
-
overlayCandidatePosition: undefined,
|
|
107
|
-
removeOverlay: undefined,
|
|
108
|
-
removeOverlayCardId: undefined
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
102
|
return {
|
|
112
103
|
...state,
|
|
113
|
-
overlayCandidatePosition: undefined
|
|
104
|
+
overlayCandidatePosition: undefined,
|
|
105
|
+
removeOverlay: undefined,
|
|
106
|
+
removeOverlayCardId: undefined
|
|
114
107
|
};
|
|
115
108
|
};
|
|
116
109
|
const registerRemoveOverlayOnInsertedLink = (state, action) => {
|
|
@@ -122,9 +115,7 @@ const registerRemoveOverlayOnInsertedLink = (state, action) => {
|
|
|
122
115
|
return card.pos !== ((_action$info = action.info) === null || _action$info === void 0 ? void 0 : _action$info.pos);
|
|
123
116
|
}).concat(action.info) : state.cards,
|
|
124
117
|
removeOverlay: action.callback,
|
|
125
|
-
|
|
126
|
-
removeOverlayCardId: (_action$info2 = action.info) === null || _action$info2 === void 0 ? void 0 : _action$info2.id
|
|
127
|
-
} : {})
|
|
118
|
+
removeOverlayCardId: (_action$info2 = action.info) === null || _action$info2 === void 0 ? void 0 : _action$info2.id
|
|
128
119
|
};
|
|
129
120
|
};
|
|
130
121
|
const setDatasourceStash = (state, action) => {
|
|
@@ -74,9 +74,7 @@ export var BlockCardComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
74
74
|
})(view.state.tr));
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
|
-
|
|
78
|
-
_this.pendingRegisterCard = scheduleRegisterCard;
|
|
79
|
-
}
|
|
77
|
+
_this.pendingRegisterCard = scheduleRegisterCard;
|
|
80
78
|
scheduleRegisterCard();
|
|
81
79
|
});
|
|
82
80
|
_defineProperty(_this, "removeCardDispatched", false);
|
|
@@ -109,11 +107,9 @@ export var BlockCardComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
109
107
|
return _createClass(BlockCardComponent, [{
|
|
110
108
|
key: "componentWillUnmount",
|
|
111
109
|
value: function componentWillUnmount() {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
this.pendingRegisterCard = undefined;
|
|
116
|
-
}
|
|
110
|
+
var _this$pendingRegister;
|
|
111
|
+
(_this$pendingRegister = this.pendingRegisterCard) === null || _this$pendingRegister === void 0 || _this$pendingRegister.cancel();
|
|
112
|
+
this.pendingRegisterCard = undefined;
|
|
117
113
|
this.removeCard();
|
|
118
114
|
}
|
|
119
115
|
}, {
|
|
@@ -35,11 +35,9 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
35
35
|
var pendingRegisterCard = useRef(null);
|
|
36
36
|
useEffect(function () {
|
|
37
37
|
return function () {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
pendingRegisterCard.current = null;
|
|
42
|
-
}
|
|
38
|
+
var _pendingRegisterCard$;
|
|
39
|
+
(_pendingRegisterCard$ = pendingRegisterCard.current) === null || _pendingRegisterCard$ === void 0 || _pendingRegisterCard$.cancel();
|
|
40
|
+
pendingRegisterCard.current = null;
|
|
43
41
|
};
|
|
44
42
|
}, []);
|
|
45
43
|
var cardActions = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.card.actions;
|
|
@@ -110,9 +108,7 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
110
108
|
view.dispatch(tr);
|
|
111
109
|
}
|
|
112
110
|
});
|
|
113
|
-
|
|
114
|
-
pendingRegisterCard.current = scheduleRegisterCard;
|
|
115
|
-
}
|
|
111
|
+
pendingRegisterCard.current = scheduleRegisterCard;
|
|
116
112
|
scheduleRegisterCard();
|
|
117
113
|
}, [getPos, isExperimentEnabled('platform_editor_reduce_forced_layout_2') ? undefined : view, onRes, isExperimentEnabled('platform_editor_reduce_forced_layout_2') ? registerResolvedCard : undefined]);
|
|
118
114
|
var onError = useCallback(function (data) {
|
|
@@ -57,9 +57,7 @@ export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
|
|
|
57
57
|
var setIsInsertedRef = useRef(setIsInserted);
|
|
58
58
|
useEffect(function () {
|
|
59
59
|
return function () {
|
|
60
|
-
|
|
61
|
-
setIsInsertedRef.current = undefined;
|
|
62
|
-
}
|
|
60
|
+
setIsInsertedRef.current = undefined;
|
|
63
61
|
};
|
|
64
62
|
}, []);
|
|
65
63
|
var _useState5 = useState(false),
|
|
@@ -73,9 +71,7 @@ export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
|
|
|
73
71
|
var onResolve = useCallback(function (tr, title) {
|
|
74
72
|
if (tr) {
|
|
75
73
|
var metadata = tr.getMeta(pluginKey);
|
|
76
|
-
var removeOverlay =
|
|
77
|
-
return setIsInserted(false);
|
|
78
|
-
};
|
|
74
|
+
var removeOverlay = createRemoveOverlay(setIsInsertedRef);
|
|
79
75
|
if (metadata && metadata.type === 'REGISTER') {
|
|
80
76
|
registerRemoveOverlay(removeOverlay, metadata.info)(tr);
|
|
81
77
|
} else {
|
|
@@ -247,11 +247,9 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
247
247
|
*/
|
|
248
248
|
var invoke = rafSchedule(function () {
|
|
249
249
|
var _pluginInjectionApi$a, _pluginInjectionApi$a2, _pluginInjectionApi$a3, _currentState$embedCa;
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
rafCancellationCallbacks.splice(index, 1);
|
|
254
|
-
}
|
|
250
|
+
var index = rafCancellationCallbacks.indexOf(invoke.cancel);
|
|
251
|
+
if (index !== -1) {
|
|
252
|
+
rafCancellationCallbacks.splice(index, 1);
|
|
255
253
|
}
|
|
256
254
|
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);
|
|
257
255
|
});
|
|
@@ -5,7 +5,6 @@ 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';
|
|
9
8
|
import { removePastedInlineLink } from './util/pasted-inline-link';
|
|
10
9
|
var queue = function queue(state, action) {
|
|
11
10
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
@@ -34,7 +33,7 @@ var removeCard = function removeCard(state, action) {
|
|
|
34
33
|
var cards = state.cards.filter(function (card) {
|
|
35
34
|
return card.id !== action.info.id;
|
|
36
35
|
});
|
|
37
|
-
if (
|
|
36
|
+
if (state.removeOverlayCardId !== undefined && state.removeOverlayCardId === action.info.id) {
|
|
38
37
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
39
38
|
cards: cards,
|
|
40
39
|
removeOverlay: undefined,
|
|
@@ -94,15 +93,10 @@ var hideDatasourceModal = function hideDatasourceModal(state) {
|
|
|
94
93
|
});
|
|
95
94
|
};
|
|
96
95
|
var clearOverlayCandidate = function clearOverlayCandidate(state) {
|
|
97
|
-
if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
98
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
99
|
-
overlayCandidatePosition: undefined,
|
|
100
|
-
removeOverlay: undefined,
|
|
101
|
-
removeOverlayCardId: undefined
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
96
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
105
|
-
overlayCandidatePosition: undefined
|
|
97
|
+
overlayCandidatePosition: undefined,
|
|
98
|
+
removeOverlay: undefined,
|
|
99
|
+
removeOverlayCardId: undefined
|
|
106
100
|
});
|
|
107
101
|
};
|
|
108
102
|
var registerRemoveOverlayOnInsertedLink = function registerRemoveOverlayOnInsertedLink(state, action) {
|
|
@@ -112,10 +106,9 @@ var registerRemoveOverlayOnInsertedLink = function registerRemoveOverlayOnInsert
|
|
|
112
106
|
var _action$info;
|
|
113
107
|
return card.pos !== ((_action$info = action.info) === null || _action$info === void 0 ? void 0 : _action$info.pos);
|
|
114
108
|
}).concat(action.info) : state.cards,
|
|
115
|
-
removeOverlay: action.callback
|
|
116
|
-
}, isExperimentEnabled('platform_editor_reduce_memory_leaks') ? {
|
|
109
|
+
removeOverlay: action.callback,
|
|
117
110
|
removeOverlayCardId: (_action$info2 = action.info) === null || _action$info2 === void 0 ? void 0 : _action$info2.id
|
|
118
|
-
}
|
|
111
|
+
});
|
|
119
112
|
};
|
|
120
113
|
var setDatasourceStash = function setDatasourceStash(state, action) {
|
|
121
114
|
return _objectSpread(_objectSpread({}, state), {}, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "38.0.0",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -26,23 +26,23 @@
|
|
|
26
26
|
"@atlaskit/css": "^1.1.0",
|
|
27
27
|
"@atlaskit/custom-steps": "^1.1.0",
|
|
28
28
|
"@atlaskit/editor-card-provider": "^8.2.0",
|
|
29
|
-
"@atlaskit/editor-plugin-analytics": "^
|
|
30
|
-
"@atlaskit/editor-plugin-annotation": "^
|
|
31
|
-
"@atlaskit/editor-plugin-base": "^
|
|
32
|
-
"@atlaskit/editor-plugin-connectivity": "^
|
|
33
|
-
"@atlaskit/editor-plugin-decorations": "^
|
|
34
|
-
"@atlaskit/editor-plugin-editor-disabled": "^
|
|
35
|
-
"@atlaskit/editor-plugin-editor-viewmode": "^
|
|
36
|
-
"@atlaskit/editor-plugin-feature-flags": "^
|
|
37
|
-
"@atlaskit/editor-plugin-floating-toolbar": "^
|
|
38
|
-
"@atlaskit/editor-plugin-grid": "^
|
|
39
|
-
"@atlaskit/editor-plugin-selection": "^
|
|
40
|
-
"@atlaskit/editor-plugin-toolbar": "^
|
|
41
|
-
"@atlaskit/editor-plugin-ui-control-registry": "^
|
|
42
|
-
"@atlaskit/editor-plugin-user-intent": "^
|
|
43
|
-
"@atlaskit/editor-plugin-width": "^
|
|
29
|
+
"@atlaskit/editor-plugin-analytics": "^32.0.0",
|
|
30
|
+
"@atlaskit/editor-plugin-annotation": "^32.0.0",
|
|
31
|
+
"@atlaskit/editor-plugin-base": "^33.0.0",
|
|
32
|
+
"@atlaskit/editor-plugin-connectivity": "^32.0.0",
|
|
33
|
+
"@atlaskit/editor-plugin-decorations": "^32.0.0",
|
|
34
|
+
"@atlaskit/editor-plugin-editor-disabled": "^32.0.0",
|
|
35
|
+
"@atlaskit/editor-plugin-editor-viewmode": "^34.0.0",
|
|
36
|
+
"@atlaskit/editor-plugin-feature-flags": "^31.0.0",
|
|
37
|
+
"@atlaskit/editor-plugin-floating-toolbar": "^34.0.0",
|
|
38
|
+
"@atlaskit/editor-plugin-grid": "^32.0.0",
|
|
39
|
+
"@atlaskit/editor-plugin-selection": "^32.0.0",
|
|
40
|
+
"@atlaskit/editor-plugin-toolbar": "^29.0.0",
|
|
41
|
+
"@atlaskit/editor-plugin-ui-control-registry": "^26.0.0",
|
|
42
|
+
"@atlaskit/editor-plugin-user-intent": "^30.0.0",
|
|
43
|
+
"@atlaskit/editor-plugin-width": "^33.0.0",
|
|
44
44
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
45
|
-
"@atlaskit/editor-shared-styles": "^5.
|
|
45
|
+
"@atlaskit/editor-shared-styles": "^5.2.0",
|
|
46
46
|
"@atlaskit/editor-smart-link-draggable": "^1.2.0",
|
|
47
47
|
"@atlaskit/editor-toolbar": "^2.11.0",
|
|
48
48
|
"@atlaskit/editor-ui-control-model": "^3.0.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@atlaskit/link": "^5.1.0",
|
|
53
53
|
"@atlaskit/link-analytics": "^13.0.0",
|
|
54
54
|
"@atlaskit/link-client-extension": "^8.0.0",
|
|
55
|
-
"@atlaskit/link-datasource": "^7.
|
|
55
|
+
"@atlaskit/link-datasource": "^7.15.0",
|
|
56
56
|
"@atlaskit/link-extractors": "^5.0.0",
|
|
57
57
|
"@atlaskit/linking-common": "^13.0.0",
|
|
58
58
|
"@atlaskit/linking-types": "^16.1.0",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@atlaskit/platform-feature-flags-react": "^1.2.0",
|
|
63
63
|
"@atlaskit/primitives": "^22.7.0",
|
|
64
64
|
"@atlaskit/prosemirror-history": "^1.3.0",
|
|
65
|
-
"@atlaskit/smart-card": "^46.
|
|
65
|
+
"@atlaskit/smart-card": "^46.18.0",
|
|
66
66
|
"@atlaskit/tmp-editor-statsig": "^264.0.0",
|
|
67
67
|
"@atlaskit/tokens": "^20.12.0",
|
|
68
68
|
"@atlaskit/tooltip": "^24.4.0",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"uuid": "^11.1.1"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
|
-
"@atlaskit/editor-common": "^
|
|
76
|
+
"@atlaskit/editor-common": "^136.0.0",
|
|
77
77
|
"@atlaskit/link-provider": "^6.2.0",
|
|
78
78
|
"react": "^18.2.0 || ^19.2.0",
|
|
79
79
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
},
|
|
108
108
|
"compassUnitTestMetricSourceId": "ari:cloud:compass:a436116f-02ce-4520-8fbb-7301462a1674:metric-source/c5751cc6-3513-4070-9deb-af31e86aed34/e6f3220b-0ca2-445a-a4c5-78cff6ca2a34",
|
|
109
109
|
"devDependencies": {
|
|
110
|
-
"@atlaskit/editor-common": "^
|
|
110
|
+
"@atlaskit/editor-common": "^136.0.0",
|
|
111
111
|
"@atlaskit/link-provider": "^6.2.0",
|
|
112
112
|
"react": "^19.2.0",
|
|
113
113
|
"react-intl": "^7.0.0"
|