@atlaskit/editor-plugin-card 1.0.3 → 1.0.4
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 +7 -0
- package/dist/cjs/pm-plugins/doc.js +13 -14
- package/dist/es2019/pm-plugins/doc.js +13 -14
- package/dist/esm/pm-plugins/doc.js +13 -14
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 1.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#75549](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/75549) [`cdb2d5721cce`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/cdb2d5721cce) - Fix an issue where view switching from toolbar was causing js error.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
3
10
|
## 1.0.3
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -251,19 +251,14 @@ var convertHyperlinkToSmartCard = exports.convertHyperlinkToSmartCard = function
|
|
|
251
251
|
};
|
|
252
252
|
var changeSelectedCardToLink = exports.changeSelectedCardToLink = function changeSelectedCardToLink(text, href, sendAnalytics, node, pos, editorAnalyticsApi) {
|
|
253
253
|
return function (state, dispatch) {
|
|
254
|
+
var selectedNode = state.selection instanceof _state.NodeSelection ? state.selection.node : undefined;
|
|
254
255
|
var tr;
|
|
255
256
|
if (node && pos) {
|
|
256
257
|
tr = cardNodeToLinkWithTransaction(state, text, href, node, pos);
|
|
257
258
|
} else {
|
|
258
259
|
tr = cardToLinkWithTransaction(state, text, href);
|
|
259
260
|
}
|
|
260
|
-
|
|
261
|
-
if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.enable-datasource-appearance-toolbar') && selectedNode && !(0, _utils2.isDatasourceConfigEditable)(selectedNode.attrs.datasource.id)) {
|
|
262
|
-
(0, _actions.setDatasourceStash)(tr, {
|
|
263
|
-
url: selectedNode.attrs.url,
|
|
264
|
-
views: selectedNode.attrs.datasource.views
|
|
265
|
-
});
|
|
266
|
-
}
|
|
261
|
+
updateDatasourceStash(tr, selectedNode);
|
|
267
262
|
if (sendAnalytics) {
|
|
268
263
|
if (selectedNode) {
|
|
269
264
|
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
@@ -362,7 +357,7 @@ var changeSelectedCardToText = exports.changeSelectedCardToText = function chang
|
|
|
362
357
|
var setSelectedCardAppearance = exports.setSelectedCardAppearance = function setSelectedCardAppearance(appearance, editorAnalyticsApi) {
|
|
363
358
|
return function (state, dispatch) {
|
|
364
359
|
var _previousNode$type;
|
|
365
|
-
var selectedNode = state.selection instanceof _state.NodeSelection
|
|
360
|
+
var selectedNode = state.selection instanceof _state.NodeSelection ? state.selection.node : undefined;
|
|
366
361
|
if (!selectedNode) {
|
|
367
362
|
// When there is no selected node, we insert a new one
|
|
368
363
|
// and replace the existing blue link
|
|
@@ -395,12 +390,7 @@ var setSelectedCardAppearance = exports.setSelectedCardAppearance = function set
|
|
|
395
390
|
to = _state$selection.to;
|
|
396
391
|
var nodeType = getLinkNodeType(appearance, state.schema.nodes);
|
|
397
392
|
var tr = state.tr.setNodeMarkup(from, nodeType, attrs, selectedNode.marks);
|
|
398
|
-
|
|
399
|
-
(0, _actions.setDatasourceStash)(tr, {
|
|
400
|
-
url: selectedNode.attrs.url,
|
|
401
|
-
views: selectedNode.attrs.datasource.views
|
|
402
|
-
});
|
|
403
|
-
}
|
|
393
|
+
updateDatasourceStash(tr, selectedNode);
|
|
404
394
|
|
|
405
395
|
// When the selected card is the last element in the doc we add a new paragraph after it for consistent replacement
|
|
406
396
|
if (tr.doc.nodeSize - 2 === to) {
|
|
@@ -521,4 +511,13 @@ var getAttrsForAppearance = exports.getAttrsForAppearance = function getAttrsFor
|
|
|
521
511
|
};
|
|
522
512
|
}
|
|
523
513
|
return selectedNode.attrs;
|
|
514
|
+
};
|
|
515
|
+
var updateDatasourceStash = function updateDatasourceStash(tr, selectedNode) {
|
|
516
|
+
var _selectedNode$attrs;
|
|
517
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.enable-datasource-appearance-toolbar') && selectedNode !== null && selectedNode !== void 0 && (_selectedNode$attrs = selectedNode.attrs) !== null && _selectedNode$attrs !== void 0 && _selectedNode$attrs.datasource && !(0, _utils2.isDatasourceConfigEditable)(selectedNode.attrs.datasource.id)) {
|
|
518
|
+
(0, _actions.setDatasourceStash)(tr, {
|
|
519
|
+
url: selectedNode.attrs.url,
|
|
520
|
+
views: selectedNode.attrs.datasource.views
|
|
521
|
+
});
|
|
522
|
+
}
|
|
524
523
|
};
|
|
@@ -228,19 +228,14 @@ export const convertHyperlinkToSmartCard = (state, source, appearance, normalize
|
|
|
228
228
|
return queueCards(requests)(state.tr);
|
|
229
229
|
};
|
|
230
230
|
export const changeSelectedCardToLink = (text, href, sendAnalytics, node, pos, editorAnalyticsApi) => (state, dispatch) => {
|
|
231
|
+
const selectedNode = state.selection instanceof NodeSelection ? state.selection.node : undefined;
|
|
231
232
|
let tr;
|
|
232
233
|
if (node && pos) {
|
|
233
234
|
tr = cardNodeToLinkWithTransaction(state, text, href, node, pos);
|
|
234
235
|
} else {
|
|
235
236
|
tr = cardToLinkWithTransaction(state, text, href);
|
|
236
237
|
}
|
|
237
|
-
|
|
238
|
-
if (getBooleanFF('platform.linking-platform.enable-datasource-appearance-toolbar') && selectedNode && !isDatasourceConfigEditable(selectedNode.attrs.datasource.id)) {
|
|
239
|
-
setDatasourceStash(tr, {
|
|
240
|
-
url: selectedNode.attrs.url,
|
|
241
|
-
views: selectedNode.attrs.datasource.views
|
|
242
|
-
});
|
|
243
|
-
}
|
|
238
|
+
updateDatasourceStash(tr, selectedNode);
|
|
244
239
|
if (sendAnalytics) {
|
|
245
240
|
if (selectedNode) {
|
|
246
241
|
editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
|
|
@@ -335,7 +330,7 @@ export const changeSelectedCardToText = (text, editorAnalyticsApi) => (state, di
|
|
|
335
330
|
};
|
|
336
331
|
export const setSelectedCardAppearance = (appearance, editorAnalyticsApi) => (state, dispatch) => {
|
|
337
332
|
var _previousNode$type;
|
|
338
|
-
const selectedNode = state.selection instanceof NodeSelection
|
|
333
|
+
const selectedNode = state.selection instanceof NodeSelection ? state.selection.node : undefined;
|
|
339
334
|
if (!selectedNode) {
|
|
340
335
|
// When there is no selected node, we insert a new one
|
|
341
336
|
// and replace the existing blue link
|
|
@@ -370,12 +365,7 @@ export const setSelectedCardAppearance = (appearance, editorAnalyticsApi) => (st
|
|
|
370
365
|
} = state.selection;
|
|
371
366
|
const nodeType = getLinkNodeType(appearance, state.schema.nodes);
|
|
372
367
|
const tr = state.tr.setNodeMarkup(from, nodeType, attrs, selectedNode.marks);
|
|
373
|
-
|
|
374
|
-
setDatasourceStash(tr, {
|
|
375
|
-
url: selectedNode.attrs.url,
|
|
376
|
-
views: selectedNode.attrs.datasource.views
|
|
377
|
-
});
|
|
378
|
-
}
|
|
368
|
+
updateDatasourceStash(tr, selectedNode);
|
|
379
369
|
|
|
380
370
|
// When the selected card is the last element in the doc we add a new paragraph after it for consistent replacement
|
|
381
371
|
if (tr.doc.nodeSize - 2 === to) {
|
|
@@ -505,4 +495,13 @@ export const getAttrsForAppearance = (appearance, selectedNode) => {
|
|
|
505
495
|
};
|
|
506
496
|
}
|
|
507
497
|
return selectedNode.attrs;
|
|
498
|
+
};
|
|
499
|
+
const updateDatasourceStash = (tr, selectedNode) => {
|
|
500
|
+
var _selectedNode$attrs;
|
|
501
|
+
if (getBooleanFF('platform.linking-platform.enable-datasource-appearance-toolbar') && selectedNode !== null && selectedNode !== void 0 && (_selectedNode$attrs = selectedNode.attrs) !== null && _selectedNode$attrs !== void 0 && _selectedNode$attrs.datasource && !isDatasourceConfigEditable(selectedNode.attrs.datasource.id)) {
|
|
502
|
+
setDatasourceStash(tr, {
|
|
503
|
+
url: selectedNode.attrs.url,
|
|
504
|
+
views: selectedNode.attrs.datasource.views
|
|
505
|
+
});
|
|
506
|
+
}
|
|
508
507
|
};
|
|
@@ -244,19 +244,14 @@ export var convertHyperlinkToSmartCard = function convertHyperlinkToSmartCard(st
|
|
|
244
244
|
};
|
|
245
245
|
export var changeSelectedCardToLink = function changeSelectedCardToLink(text, href, sendAnalytics, node, pos, editorAnalyticsApi) {
|
|
246
246
|
return function (state, dispatch) {
|
|
247
|
+
var selectedNode = state.selection instanceof NodeSelection ? state.selection.node : undefined;
|
|
247
248
|
var tr;
|
|
248
249
|
if (node && pos) {
|
|
249
250
|
tr = cardNodeToLinkWithTransaction(state, text, href, node, pos);
|
|
250
251
|
} else {
|
|
251
252
|
tr = cardToLinkWithTransaction(state, text, href);
|
|
252
253
|
}
|
|
253
|
-
|
|
254
|
-
if (getBooleanFF('platform.linking-platform.enable-datasource-appearance-toolbar') && selectedNode && !isDatasourceConfigEditable(selectedNode.attrs.datasource.id)) {
|
|
255
|
-
setDatasourceStash(tr, {
|
|
256
|
-
url: selectedNode.attrs.url,
|
|
257
|
-
views: selectedNode.attrs.datasource.views
|
|
258
|
-
});
|
|
259
|
-
}
|
|
254
|
+
updateDatasourceStash(tr, selectedNode);
|
|
260
255
|
if (sendAnalytics) {
|
|
261
256
|
if (selectedNode) {
|
|
262
257
|
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
@@ -355,7 +350,7 @@ export var changeSelectedCardToText = function changeSelectedCardToText(text, ed
|
|
|
355
350
|
export var setSelectedCardAppearance = function setSelectedCardAppearance(appearance, editorAnalyticsApi) {
|
|
356
351
|
return function (state, dispatch) {
|
|
357
352
|
var _previousNode$type;
|
|
358
|
-
var selectedNode = state.selection instanceof NodeSelection
|
|
353
|
+
var selectedNode = state.selection instanceof NodeSelection ? state.selection.node : undefined;
|
|
359
354
|
if (!selectedNode) {
|
|
360
355
|
// When there is no selected node, we insert a new one
|
|
361
356
|
// and replace the existing blue link
|
|
@@ -388,12 +383,7 @@ export var setSelectedCardAppearance = function setSelectedCardAppearance(appear
|
|
|
388
383
|
to = _state$selection.to;
|
|
389
384
|
var nodeType = getLinkNodeType(appearance, state.schema.nodes);
|
|
390
385
|
var tr = state.tr.setNodeMarkup(from, nodeType, attrs, selectedNode.marks);
|
|
391
|
-
|
|
392
|
-
setDatasourceStash(tr, {
|
|
393
|
-
url: selectedNode.attrs.url,
|
|
394
|
-
views: selectedNode.attrs.datasource.views
|
|
395
|
-
});
|
|
396
|
-
}
|
|
386
|
+
updateDatasourceStash(tr, selectedNode);
|
|
397
387
|
|
|
398
388
|
// When the selected card is the last element in the doc we add a new paragraph after it for consistent replacement
|
|
399
389
|
if (tr.doc.nodeSize - 2 === to) {
|
|
@@ -514,4 +504,13 @@ export var getAttrsForAppearance = function getAttrsForAppearance(appearance, se
|
|
|
514
504
|
};
|
|
515
505
|
}
|
|
516
506
|
return selectedNode.attrs;
|
|
507
|
+
};
|
|
508
|
+
var updateDatasourceStash = function updateDatasourceStash(tr, selectedNode) {
|
|
509
|
+
var _selectedNode$attrs;
|
|
510
|
+
if (getBooleanFF('platform.linking-platform.enable-datasource-appearance-toolbar') && selectedNode !== null && selectedNode !== void 0 && (_selectedNode$attrs = selectedNode.attrs) !== null && _selectedNode$attrs !== void 0 && _selectedNode$attrs.datasource && !isDatasourceConfigEditable(selectedNode.attrs.datasource.id)) {
|
|
511
|
+
setDatasourceStash(tr, {
|
|
512
|
+
url: selectedNode.attrs.url,
|
|
513
|
+
views: selectedNode.attrs.datasource.views
|
|
514
|
+
});
|
|
515
|
+
}
|
|
517
516
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -35,28 +35,28 @@
|
|
|
35
35
|
"@atlaskit/adf-schema": "^35.5.1",
|
|
36
36
|
"@atlaskit/analytics-next": "^9.2.0",
|
|
37
37
|
"@atlaskit/custom-steps": "^0.0.13",
|
|
38
|
-
"@atlaskit/editor-common": "^78.
|
|
38
|
+
"@atlaskit/editor-common": "^78.4.0",
|
|
39
39
|
"@atlaskit/editor-plugin-analytics": "^1.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-decorations": "^1.0.0",
|
|
41
41
|
"@atlaskit/editor-plugin-feature-flags": "^1.0.0",
|
|
42
|
-
"@atlaskit/editor-plugin-floating-toolbar": "^1.
|
|
42
|
+
"@atlaskit/editor-plugin-floating-toolbar": "^1.2.0",
|
|
43
43
|
"@atlaskit/editor-plugin-grid": "^1.0.0",
|
|
44
44
|
"@atlaskit/editor-plugin-hyperlink": "^1.0.0",
|
|
45
45
|
"@atlaskit/editor-plugin-width": "^1.0.0",
|
|
46
46
|
"@atlaskit/editor-prosemirror": "3.0.0",
|
|
47
47
|
"@atlaskit/editor-shared-styles": "^2.9.0",
|
|
48
48
|
"@atlaskit/frontend-utilities": "^2.7.0",
|
|
49
|
-
"@atlaskit/icon": "^22.
|
|
49
|
+
"@atlaskit/icon": "^22.1.0",
|
|
50
50
|
"@atlaskit/link-analytics": "^8.3.0",
|
|
51
51
|
"@atlaskit/link-client-extension": "^1.8.0",
|
|
52
52
|
"@atlaskit/link-datasource": "^1.22.0",
|
|
53
53
|
"@atlaskit/linking-common": "^5.3.0",
|
|
54
54
|
"@atlaskit/linking-types": "^8.6.0",
|
|
55
55
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
56
|
-
"@atlaskit/primitives": "^2.
|
|
56
|
+
"@atlaskit/primitives": "^2.1.0",
|
|
57
57
|
"@atlaskit/smart-card": "^26.47.0",
|
|
58
58
|
"@atlaskit/theme": "^12.6.0",
|
|
59
|
-
"@atlaskit/tokens": "^1.
|
|
59
|
+
"@atlaskit/tokens": "^1.38.0",
|
|
60
60
|
"@babel/runtime": "^7.0.0",
|
|
61
61
|
"@emotion/react": "^11.7.1",
|
|
62
62
|
"lodash": "^4.17.21",
|