@atlaskit/editor-plugin-card 5.0.1 → 5.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 +10 -0
- package/dist/cjs/ui/toolbar.js +43 -3
- package/dist/es2019/ui/toolbar.js +43 -3
- package/dist/esm/ui/toolbar.js +43 -3
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 5.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#117485](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/117485)
|
|
8
|
+
[`e9a8d9ba26963`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e9a8d9ba26963) -
|
|
9
|
+
Reorder icons, and remove some based on new editor controls. Changes under
|
|
10
|
+
`editor_plugin_controls` experiment.
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 5.0.1
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -29,6 +29,7 @@ var _settings2 = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/set
|
|
|
29
29
|
var _unlink = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/unlink"));
|
|
30
30
|
var _shortcut = _interopRequireDefault(require("@atlaskit/icon/glyph/shortcut"));
|
|
31
31
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
32
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
32
33
|
var _doc = require("../pm-plugins/doc");
|
|
33
34
|
var _pluginKey = require("../pm-plugins/plugin-key");
|
|
34
35
|
var _utils3 = require("../pm-plugins/utils");
|
|
@@ -288,12 +289,13 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
288
289
|
testId: 'inline-card-toolbar-comment-button',
|
|
289
290
|
iconFallback: _comment2.default,
|
|
290
291
|
title: intl.formatMessage(_messages.annotationMessages.createComment),
|
|
292
|
+
showTitle: (0, _experiments.editorExperiment)('platform_editor_controls', 'control') ? undefined : true,
|
|
291
293
|
onClick: onCommentButtonClick,
|
|
292
294
|
disabled: (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.connectivity) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.sharedState) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.currentState()) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.mode) === 'offline'
|
|
293
295
|
}, {
|
|
294
296
|
type: 'separator'
|
|
295
297
|
}] : [];
|
|
296
|
-
var toolbarItems = [].concat(editItems, commentItems, [{
|
|
298
|
+
var toolbarItems = (0, _experiments.editorExperiment)('platform_editor_controls', 'control') ? [].concat(editItems, commentItems, [{
|
|
297
299
|
id: 'editor.link.openLink',
|
|
298
300
|
type: 'button',
|
|
299
301
|
icon: _linkExternal.default,
|
|
@@ -328,7 +330,44 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
328
330
|
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
329
331
|
title: intl.formatMessage(_messages.default.remove),
|
|
330
332
|
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
|
|
331
|
-
}])
|
|
333
|
+
}]) : [].concat(editItems, (0, _toConsumableArray2.default)(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [getSettingsButton(intl, editorAnalyticsApi, cardOptions.userPreferencesLink), {
|
|
334
|
+
type: 'separator'
|
|
335
|
+
}, {
|
|
336
|
+
id: 'editor.link.delete',
|
|
337
|
+
focusEditoronEnter: true,
|
|
338
|
+
type: 'button',
|
|
339
|
+
appearance: 'danger',
|
|
340
|
+
icon: _delete.default,
|
|
341
|
+
iconFallback: _remove.default,
|
|
342
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
343
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
344
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
345
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
346
|
+
title: intl.formatMessage(_messages.default.remove),
|
|
347
|
+
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
|
|
348
|
+
}, {
|
|
349
|
+
type: 'separator'
|
|
350
|
+
}, {
|
|
351
|
+
id: 'editor.link.openLink',
|
|
352
|
+
type: 'button',
|
|
353
|
+
icon: _linkExternal.default,
|
|
354
|
+
iconFallback: _shortcut.default,
|
|
355
|
+
metadata: metadata,
|
|
356
|
+
className: 'hyperlink-open-link',
|
|
357
|
+
title: intl.formatMessage(_messages.linkMessages.openLink),
|
|
358
|
+
onClick: visitCardLink(editorAnalyticsApi)
|
|
359
|
+
}, {
|
|
360
|
+
type: 'separator'
|
|
361
|
+
}, {
|
|
362
|
+
type: 'copy-button',
|
|
363
|
+
items: [{
|
|
364
|
+
state: state,
|
|
365
|
+
formatMessage: intl.formatMessage,
|
|
366
|
+
nodeType: node.type
|
|
367
|
+
}]
|
|
368
|
+
}], (0, _toConsumableArray2.default)(commentItems.length > 1 ? [{
|
|
369
|
+
type: 'separator'
|
|
370
|
+
}, commentItems[0]] : commentItems));
|
|
332
371
|
if (currentAppearance === 'embed') {
|
|
333
372
|
var _pluginInjectionApi$a4;
|
|
334
373
|
var alignmentOptions = buildAlignmentOptions(state, intl, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.width, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions, cardOptions);
|
|
@@ -509,7 +548,8 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
509
548
|
focusEditoronEnter: true,
|
|
510
549
|
type: 'button',
|
|
511
550
|
appearance: 'danger',
|
|
512
|
-
icon:
|
|
551
|
+
icon: _delete.default,
|
|
552
|
+
iconFallback: _remove.default,
|
|
513
553
|
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
514
554
|
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
515
555
|
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
@@ -19,6 +19,7 @@ import CogIcon from '@atlaskit/icon/glyph/editor/settings';
|
|
|
19
19
|
import UnlinkIcon from '@atlaskit/icon/glyph/editor/unlink';
|
|
20
20
|
import OpenIcon from '@atlaskit/icon/glyph/shortcut';
|
|
21
21
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
22
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
22
23
|
import { changeSelectedCardToText } from '../pm-plugins/doc';
|
|
23
24
|
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
24
25
|
import { appearanceForNodeType, displayInfoForCard, findCardInfo, isDatasourceNode, titleUrlPairFromNode } from '../pm-plugins/utils';
|
|
@@ -280,12 +281,13 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
280
281
|
testId: 'inline-card-toolbar-comment-button',
|
|
281
282
|
iconFallback: LegacyCommentIcon,
|
|
282
283
|
title: intl.formatMessage(annotationMessages.createComment),
|
|
284
|
+
showTitle: editorExperiment('platform_editor_controls', 'control') ? undefined : true,
|
|
283
285
|
onClick: onCommentButtonClick,
|
|
284
286
|
disabled: (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.connectivity) === null || _pluginInjectionApi$c === void 0 ? void 0 : (_pluginInjectionApi$c2 = _pluginInjectionApi$c.sharedState) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : (_pluginInjectionApi$c3 = _pluginInjectionApi$c2.currentState()) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : _pluginInjectionApi$c3.mode) === 'offline'
|
|
285
287
|
}, {
|
|
286
288
|
type: 'separator'
|
|
287
289
|
}] : [];
|
|
288
|
-
const toolbarItems = [...editItems, ...commentItems, {
|
|
290
|
+
const toolbarItems = editorExperiment('platform_editor_controls', 'control') ? [...editItems, ...commentItems, {
|
|
289
291
|
id: 'editor.link.openLink',
|
|
290
292
|
type: 'button',
|
|
291
293
|
icon: LinkExternalIcon,
|
|
@@ -320,7 +322,44 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
320
322
|
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
321
323
|
title: intl.formatMessage(commonMessages.remove),
|
|
322
324
|
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
|
|
323
|
-
}]
|
|
325
|
+
}] : [...editItems, ...getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi), getSettingsButton(intl, editorAnalyticsApi, cardOptions.userPreferencesLink), {
|
|
326
|
+
type: 'separator'
|
|
327
|
+
}, {
|
|
328
|
+
id: 'editor.link.delete',
|
|
329
|
+
focusEditoronEnter: true,
|
|
330
|
+
type: 'button',
|
|
331
|
+
appearance: 'danger',
|
|
332
|
+
icon: DeleteIcon,
|
|
333
|
+
iconFallback: RemoveIcon,
|
|
334
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
335
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
336
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
337
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
338
|
+
title: intl.formatMessage(commonMessages.remove),
|
|
339
|
+
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
|
|
340
|
+
}, {
|
|
341
|
+
type: 'separator'
|
|
342
|
+
}, {
|
|
343
|
+
id: 'editor.link.openLink',
|
|
344
|
+
type: 'button',
|
|
345
|
+
icon: LinkExternalIcon,
|
|
346
|
+
iconFallback: OpenIcon,
|
|
347
|
+
metadata: metadata,
|
|
348
|
+
className: 'hyperlink-open-link',
|
|
349
|
+
title: intl.formatMessage(linkMessages.openLink),
|
|
350
|
+
onClick: visitCardLink(editorAnalyticsApi)
|
|
351
|
+
}, {
|
|
352
|
+
type: 'separator'
|
|
353
|
+
}, {
|
|
354
|
+
type: 'copy-button',
|
|
355
|
+
items: [{
|
|
356
|
+
state,
|
|
357
|
+
formatMessage: intl.formatMessage,
|
|
358
|
+
nodeType: node.type
|
|
359
|
+
}]
|
|
360
|
+
}, ...(commentItems.length > 1 ? [{
|
|
361
|
+
type: 'separator'
|
|
362
|
+
}, commentItems[0]] : commentItems)];
|
|
324
363
|
if (currentAppearance === 'embed') {
|
|
325
364
|
var _pluginInjectionApi$a5;
|
|
326
365
|
const alignmentOptions = buildAlignmentOptions(state, intl, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.width, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a5 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a5 === void 0 ? void 0 : _pluginInjectionApi$a5.actions, cardOptions);
|
|
@@ -498,7 +537,8 @@ const getDatasourceButtonGroup = (metadata, intl, editorAnalyticsApi, node, hove
|
|
|
498
537
|
focusEditoronEnter: true,
|
|
499
538
|
type: 'button',
|
|
500
539
|
appearance: 'danger',
|
|
501
|
-
icon:
|
|
540
|
+
icon: DeleteIcon,
|
|
541
|
+
iconFallback: RemoveIcon,
|
|
502
542
|
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
503
543
|
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
504
544
|
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
package/dist/esm/ui/toolbar.js
CHANGED
|
@@ -23,6 +23,7 @@ import CogIcon from '@atlaskit/icon/glyph/editor/settings';
|
|
|
23
23
|
import UnlinkIcon from '@atlaskit/icon/glyph/editor/unlink';
|
|
24
24
|
import OpenIcon from '@atlaskit/icon/glyph/shortcut';
|
|
25
25
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
26
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
26
27
|
import { changeSelectedCardToText } from '../pm-plugins/doc';
|
|
27
28
|
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
28
29
|
import { appearanceForNodeType, displayInfoForCard, findCardInfo, isDatasourceNode, titleUrlPairFromNode } from '../pm-plugins/utils';
|
|
@@ -278,12 +279,13 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
278
279
|
testId: 'inline-card-toolbar-comment-button',
|
|
279
280
|
iconFallback: LegacyCommentIcon,
|
|
280
281
|
title: intl.formatMessage(annotationMessages.createComment),
|
|
282
|
+
showTitle: editorExperiment('platform_editor_controls', 'control') ? undefined : true,
|
|
281
283
|
onClick: onCommentButtonClick,
|
|
282
284
|
disabled: (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.connectivity) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.sharedState) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.currentState()) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.mode) === 'offline'
|
|
283
285
|
}, {
|
|
284
286
|
type: 'separator'
|
|
285
287
|
}] : [];
|
|
286
|
-
var toolbarItems = [].concat(editItems, commentItems, [{
|
|
288
|
+
var toolbarItems = editorExperiment('platform_editor_controls', 'control') ? [].concat(editItems, commentItems, [{
|
|
287
289
|
id: 'editor.link.openLink',
|
|
288
290
|
type: 'button',
|
|
289
291
|
icon: LinkExternalIcon,
|
|
@@ -318,7 +320,44 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
318
320
|
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
319
321
|
title: intl.formatMessage(commonMessages.remove),
|
|
320
322
|
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
|
|
321
|
-
}])
|
|
323
|
+
}]) : [].concat(editItems, _toConsumableArray(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [getSettingsButton(intl, editorAnalyticsApi, cardOptions.userPreferencesLink), {
|
|
324
|
+
type: 'separator'
|
|
325
|
+
}, {
|
|
326
|
+
id: 'editor.link.delete',
|
|
327
|
+
focusEditoronEnter: true,
|
|
328
|
+
type: 'button',
|
|
329
|
+
appearance: 'danger',
|
|
330
|
+
icon: DeleteIcon,
|
|
331
|
+
iconFallback: RemoveIcon,
|
|
332
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
333
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
334
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
335
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
336
|
+
title: intl.formatMessage(commonMessages.remove),
|
|
337
|
+
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
|
|
338
|
+
}, {
|
|
339
|
+
type: 'separator'
|
|
340
|
+
}, {
|
|
341
|
+
id: 'editor.link.openLink',
|
|
342
|
+
type: 'button',
|
|
343
|
+
icon: LinkExternalIcon,
|
|
344
|
+
iconFallback: OpenIcon,
|
|
345
|
+
metadata: metadata,
|
|
346
|
+
className: 'hyperlink-open-link',
|
|
347
|
+
title: intl.formatMessage(linkMessages.openLink),
|
|
348
|
+
onClick: visitCardLink(editorAnalyticsApi)
|
|
349
|
+
}, {
|
|
350
|
+
type: 'separator'
|
|
351
|
+
}, {
|
|
352
|
+
type: 'copy-button',
|
|
353
|
+
items: [{
|
|
354
|
+
state: state,
|
|
355
|
+
formatMessage: intl.formatMessage,
|
|
356
|
+
nodeType: node.type
|
|
357
|
+
}]
|
|
358
|
+
}], _toConsumableArray(commentItems.length > 1 ? [{
|
|
359
|
+
type: 'separator'
|
|
360
|
+
}, commentItems[0]] : commentItems));
|
|
322
361
|
if (currentAppearance === 'embed') {
|
|
323
362
|
var _pluginInjectionApi$a4;
|
|
324
363
|
var alignmentOptions = buildAlignmentOptions(state, intl, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.width, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions, cardOptions);
|
|
@@ -499,7 +538,8 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
499
538
|
focusEditoronEnter: true,
|
|
500
539
|
type: 'button',
|
|
501
540
|
appearance: 'danger',
|
|
502
|
-
icon:
|
|
541
|
+
icon: DeleteIcon,
|
|
542
|
+
iconFallback: RemoveIcon,
|
|
503
543
|
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
504
544
|
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
505
545
|
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.2",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -48,19 +48,19 @@
|
|
|
48
48
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
49
49
|
"@atlaskit/editor-shared-styles": "^3.3.0",
|
|
50
50
|
"@atlaskit/frontend-utilities": "^3.0.0",
|
|
51
|
-
"@atlaskit/icon": "^24.
|
|
51
|
+
"@atlaskit/icon": "^24.1.0",
|
|
52
52
|
"@atlaskit/link-analytics": "^9.0.0",
|
|
53
53
|
"@atlaskit/link-client-extension": "^4.0.0",
|
|
54
54
|
"@atlaskit/link-datasource": "^3.21.0",
|
|
55
55
|
"@atlaskit/linking-common": "^8.0.0",
|
|
56
56
|
"@atlaskit/linking-types": "^9.6.0",
|
|
57
|
-
"@atlaskit/menu": "3.
|
|
57
|
+
"@atlaskit/menu": "3.1.0",
|
|
58
58
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
59
|
-
"@atlaskit/primitives": "^14.
|
|
59
|
+
"@atlaskit/primitives": "^14.1.0",
|
|
60
60
|
"@atlaskit/smart-card": "^35.0.0",
|
|
61
61
|
"@atlaskit/theme": "^17.0.0",
|
|
62
|
-
"@atlaskit/tmp-editor-statsig": "^3.
|
|
63
|
-
"@atlaskit/tokens": "^4.
|
|
62
|
+
"@atlaskit/tmp-editor-statsig": "^3.2.0",
|
|
63
|
+
"@atlaskit/tokens": "^4.2.0",
|
|
64
64
|
"@babel/runtime": "^7.0.0",
|
|
65
65
|
"@emotion/react": "^11.7.1",
|
|
66
66
|
"lodash": "^4.17.21",
|