@atlaskit/editor-plugin-synced-block 20.1.5 → 21.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 +14 -0
- package/dist/cjs/editor-commands/index.js +1 -4
- package/dist/cjs/pm-plugins/main.js +6 -11
- package/dist/cjs/syncedBlockPlugin.js +1 -2
- package/dist/cjs/ui/CreateSyncedBlockDropdownItem.js +1 -3
- package/dist/cjs/ui/Flag.js +1 -2
- package/dist/cjs/ui/SyncBlockLabel.js +2 -3
- package/dist/cjs/ui/SyncBlockRendererWrapper.js +2 -7
- package/dist/cjs/ui/SyncedLocationDropdown.js +3 -22
- package/dist/cjs/ui/floating-toolbar.js +36 -82
- package/dist/cjs/ui/quick-insert.js +2 -4
- package/dist/es2019/editor-commands/index.js +1 -4
- package/dist/es2019/pm-plugins/main.js +6 -11
- package/dist/es2019/syncedBlockPlugin.js +1 -2
- package/dist/es2019/ui/CreateSyncedBlockDropdownItem.js +1 -3
- package/dist/es2019/ui/Flag.js +1 -2
- package/dist/es2019/ui/SyncBlockLabel.js +2 -3
- package/dist/es2019/ui/SyncBlockRendererWrapper.js +2 -7
- package/dist/es2019/ui/SyncedLocationDropdown.js +3 -22
- package/dist/es2019/ui/floating-toolbar.js +36 -83
- package/dist/es2019/ui/quick-insert.js +2 -4
- package/dist/esm/editor-commands/index.js +1 -4
- package/dist/esm/pm-plugins/main.js +6 -11
- package/dist/esm/syncedBlockPlugin.js +1 -2
- package/dist/esm/ui/CreateSyncedBlockDropdownItem.js +1 -3
- package/dist/esm/ui/Flag.js +1 -2
- package/dist/esm/ui/SyncBlockLabel.js +2 -3
- package/dist/esm/ui/SyncBlockRendererWrapper.js +2 -7
- package/dist/esm/ui/SyncedLocationDropdown.js +3 -22
- package/dist/esm/ui/floating-toolbar.js +37 -83
- package/dist/esm/ui/quick-insert.js +2 -4
- package/package.json +22 -22
|
@@ -15,11 +15,10 @@ import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
|
15
15
|
import EditIcon from '@atlaskit/icon/core/edit';
|
|
16
16
|
import LinkBrokenIcon from '@atlaskit/icon/core/link-broken';
|
|
17
17
|
import MegaphoneIcon from '@atlaskit/icon/core/megaphone';
|
|
18
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
19
18
|
import { copySyncedBlockReferenceToClipboard, editSyncedBlockSource, removeSyncedBlock, unsync } from '../editor-commands';
|
|
20
19
|
import { findSyncBlockOrBodiedSyncBlock, isBodiedSyncBlockNode } from '../pm-plugins/utils/utils';
|
|
21
20
|
import { SYNCED_BLOCK_BUTTON_TEST_ID } from '../types';
|
|
22
|
-
import {
|
|
21
|
+
import { SyncedLocationDropdownWithCount } from './SyncedLocationDropdown';
|
|
23
22
|
export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBlockStore, isLivePage, onGiveFeedback) {
|
|
24
23
|
var _syncBlockInstance$er, _api$decorations, _api$connectivity;
|
|
25
24
|
var syncBlockObject = findSyncBlockOrBodiedSyncBlock(state.schema, state.selection);
|
|
@@ -29,7 +28,6 @@ export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBl
|
|
|
29
28
|
if (syncBlockStore.sourceManager.isPendingCreation(syncBlockObject.node.attrs.resourceId)) {
|
|
30
29
|
return;
|
|
31
30
|
}
|
|
32
|
-
var isSyncBlockActivationEnabled = expValEquals('platform_editor_sync_block_activation', 'isEnabled', true);
|
|
33
31
|
var syncBlockInstance = syncBlockStore.referenceManager.getFromCache(syncBlockObject.node.attrs.resourceId);
|
|
34
32
|
var isUnsyncedBlock = (syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$er = syncBlockInstance.error) === null || _syncBlockInstance$er === void 0 ? void 0 : _syncBlockInstance$er.type) === SyncBlockError.NotFound;
|
|
35
33
|
var isErroredBlock = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error;
|
|
@@ -60,45 +58,24 @@ export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBl
|
|
|
60
58
|
}, hoverDecorationProps(nodeType, akEditorSelectedNodeClassName));
|
|
61
59
|
items.push(deleteButton);
|
|
62
60
|
} else {
|
|
63
|
-
// When the synced block activation experiment is enabled, the copy action is
|
|
64
|
-
// re-framed as the primary "Copy to sync" action: it shows a visible label and
|
|
65
|
-
// is moved to the first toolbar position (before the synced-location info). See
|
|
66
|
-
// EDITOR-8060.
|
|
67
61
|
var copyButton = _objectSpread({
|
|
68
62
|
id: 'editor.syncedBlock.copy',
|
|
69
63
|
type: 'button',
|
|
70
64
|
appearance: 'subtle',
|
|
71
65
|
icon: CopyIcon,
|
|
72
|
-
title:
|
|
73
|
-
showTitle:
|
|
74
|
-
|
|
75
|
-
testId: isSyncBlockActivationEnabled ? SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarCopy : undefined,
|
|
66
|
+
title: formatMessage(messages.copyToSyncLabel),
|
|
67
|
+
showTitle: true,
|
|
68
|
+
testId: SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarCopy,
|
|
76
69
|
onClick: copySyncedBlockReferenceToClipboard(syncBlockStore, INPUT_METHOD.SYNCED_BLOCK_TB, api, isLivePage)
|
|
77
70
|
}, hoverDecorationProps(nodeType, akEditorSelectedNodeClassName));
|
|
78
|
-
|
|
79
|
-
// In the activation experience the primary "Copy to sync" action leads the
|
|
80
|
-
// toolbar, ahead of the informational synced-location dropdown.
|
|
81
|
-
if (isSyncBlockActivationEnabled) {
|
|
82
|
-
items.push(copyButton);
|
|
83
|
-
}
|
|
71
|
+
items.push(copyButton);
|
|
84
72
|
if (!isErroredBlock) {
|
|
85
73
|
var syncedLocation = {
|
|
86
74
|
type: 'custom',
|
|
87
75
|
fallback: [],
|
|
88
76
|
render: function render(_view, _idx, _dispatchAnalyticsEvent, floatingToolbarRenderContext) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
key: "".concat(resourceId, ":").concat(localId, ":").concat(isBodiedSyncBlock),
|
|
92
|
-
syncBlockStore: syncBlockStore,
|
|
93
|
-
resourceId: resourceId,
|
|
94
|
-
localId: localId,
|
|
95
|
-
intl: intl,
|
|
96
|
-
isSource: isBodiedSyncBlock,
|
|
97
|
-
api: api,
|
|
98
|
-
floatingToolbarRenderContext: floatingToolbarRenderContext
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
return /*#__PURE__*/React.createElement(SyncedLocationDropdown, {
|
|
77
|
+
return /*#__PURE__*/React.createElement(SyncedLocationDropdownWithCount, {
|
|
78
|
+
key: "".concat(resourceId, ":").concat(localId, ":").concat(isBodiedSyncBlock),
|
|
102
79
|
syncBlockStore: syncBlockStore,
|
|
103
80
|
resourceId: resourceId,
|
|
104
81
|
localId: localId,
|
|
@@ -132,12 +109,6 @@ export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBl
|
|
|
132
109
|
};
|
|
133
110
|
items.push(syncedLocation, unsyncButton);
|
|
134
111
|
}
|
|
135
|
-
|
|
136
|
-
// Outside the activation experience the copy button keeps its original
|
|
137
|
-
// (icon-only, secondary) position after the synced-location info.
|
|
138
|
-
if (!isSyncBlockActivationEnabled) {
|
|
139
|
-
items.push(copyButton);
|
|
140
|
-
}
|
|
141
112
|
var disabled = !syncBlockStore.referenceManager.getSyncBlockURL(syncBlockObject.node.attrs.resourceId);
|
|
142
113
|
if (!isBodiedSyncBlock) {
|
|
143
114
|
var editSourceButton = _objectSpread({
|
|
@@ -153,56 +124,39 @@ export var getToolbarConfig = function getToolbarConfig(state, intl, api, syncBl
|
|
|
153
124
|
}, hoverDecorationProps(nodeType, akEditorSelectedNodeClassName));
|
|
154
125
|
items.push(editSourceButton);
|
|
155
126
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
127
|
+
|
|
128
|
+
// testId is required to show focus on trigger button on ESC key press
|
|
129
|
+
// see hideOnEsc in platform/packages/editor/editor-plugin-floating-toolbar/src/ui/Dropdown.tsx
|
|
130
|
+
var testId = isBodiedSyncBlock ? SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarSourceOverflowTrigger : SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarReferenceOverflowTrigger;
|
|
131
|
+
var overflowMenuConfig = [{
|
|
132
|
+
type: 'overflow-dropdown',
|
|
133
|
+
testId: testId,
|
|
134
|
+
options: [].concat(_toConsumableArray(onGiveFeedback ? [{
|
|
135
|
+
title: formatMessage(toolbarInsertBlockMessages.feedbackDialog),
|
|
136
|
+
icon: /*#__PURE__*/React.createElement(MegaphoneIcon, {
|
|
137
|
+
label: ""
|
|
138
|
+
}),
|
|
139
|
+
onClick: function onClick() {
|
|
140
|
+
api === null || api === void 0 || api.core.actions.execute(function (_ref) {
|
|
141
|
+
var tr = _ref.tr;
|
|
142
|
+
return tr.setSelection(new GapCursorSelection(tr.doc.resolve(syncBlockObject.pos + syncBlockObject.node.nodeSize), Side.RIGHT));
|
|
143
|
+
});
|
|
144
|
+
onGiveFeedback({
|
|
145
|
+
blockType: isBodiedSyncBlock ? 'source' : 'reference',
|
|
146
|
+
entryPoint: 'overflow-menu'
|
|
147
|
+
});
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
}] : []), [_objectSpread({
|
|
164
151
|
title: formatMessage(commonMessages.delete),
|
|
165
|
-
showTitle: false,
|
|
166
|
-
tooltipContent: formatMessage(commonMessages.delete),
|
|
167
152
|
onClick: removeSyncedBlock(api),
|
|
168
|
-
icon: DeleteIcon,
|
|
153
|
+
icon: /*#__PURE__*/React.createElement(DeleteIcon, {
|
|
154
|
+
label: ""
|
|
155
|
+
}),
|
|
169
156
|
testId: isBodiedSyncBlock ? SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarSourceDelete : SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarReferenceDelete
|
|
170
|
-
}, hoverDecorationProps(nodeType))
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
// testId is required to show focus on trigger button on ESC key press
|
|
174
|
-
// see hideOnEsc in platform/packages/editor/editor-plugin-floating-toolbar/src/ui/Dropdown.tsx
|
|
175
|
-
var testId = isBodiedSyncBlock ? SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarSourceOverflowTrigger : SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarReferenceOverflowTrigger;
|
|
176
|
-
var overflowMenuConfig = [{
|
|
177
|
-
type: 'overflow-dropdown',
|
|
178
|
-
testId: testId,
|
|
179
|
-
options: [].concat(_toConsumableArray(isSyncBlockActivationEnabled && onGiveFeedback ? [{
|
|
180
|
-
title: formatMessage(toolbarInsertBlockMessages.feedbackDialog),
|
|
181
|
-
icon: /*#__PURE__*/React.createElement(MegaphoneIcon, {
|
|
182
|
-
label: ""
|
|
183
|
-
}),
|
|
184
|
-
onClick: function onClick() {
|
|
185
|
-
api === null || api === void 0 || api.core.actions.execute(function (_ref) {
|
|
186
|
-
var tr = _ref.tr;
|
|
187
|
-
return tr.setSelection(new GapCursorSelection(tr.doc.resolve(syncBlockObject.pos + syncBlockObject.node.nodeSize), Side.RIGHT));
|
|
188
|
-
});
|
|
189
|
-
onGiveFeedback({
|
|
190
|
-
blockType: isBodiedSyncBlock ? 'source' : 'reference',
|
|
191
|
-
entryPoint: 'overflow-menu'
|
|
192
|
-
});
|
|
193
|
-
return true;
|
|
194
|
-
}
|
|
195
|
-
}] : []), [_objectSpread({
|
|
196
|
-
title: formatMessage(commonMessages.delete),
|
|
197
|
-
onClick: removeSyncedBlock(api),
|
|
198
|
-
icon: /*#__PURE__*/React.createElement(DeleteIcon, {
|
|
199
|
-
label: ""
|
|
200
|
-
}),
|
|
201
|
-
testId: isBodiedSyncBlock ? SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarSourceDelete : SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarReferenceDelete
|
|
202
|
-
}, hoverDecorationProps(nodeType))])
|
|
203
|
-
}];
|
|
204
|
-
items.push.apply(items, overflowMenuConfig);
|
|
205
|
-
}
|
|
157
|
+
}, hoverDecorationProps(nodeType))])
|
|
158
|
+
}];
|
|
159
|
+
items.push.apply(items, overflowMenuConfig);
|
|
206
160
|
}
|
|
207
161
|
var getDomRef = function getDomRef(editorView) {
|
|
208
162
|
var domAtPos = editorView.domAtPos.bind(editorView);
|
|
@@ -7,7 +7,6 @@ import { blockTypeMessages } from '@atlaskit/editor-common/messages';
|
|
|
7
7
|
import { IconSyncBlock } from '@atlaskit/editor-common/quick-insert';
|
|
8
8
|
import Lozenge from '@atlaskit/lozenge/lozenge';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
10
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
10
|
import { createSyncedBlock } from '../editor-commands';
|
|
12
11
|
import { SYNCED_BLOCK_BUTTON_TEST_ID } from '../types';
|
|
13
12
|
var lozengeWrapperStyles = null;
|
|
@@ -17,10 +16,9 @@ export var getQuickInsertConfig = function getQuickInsertConfig(config, api, syn
|
|
|
17
16
|
if (!(config !== null && config !== void 0 && config.enableSourceCreation)) {
|
|
18
17
|
return [];
|
|
19
18
|
}
|
|
20
|
-
var syncBlockTitle = expValEquals('platform_editor_sync_block_activation', 'isEnabled', true) ? blockTypeMessages.syncedBlockQuickInsertTitle : blockTypeMessages.syncBlock;
|
|
21
19
|
return [{
|
|
22
20
|
id: 'syncBlock',
|
|
23
|
-
title: formatMessage(
|
|
21
|
+
title: formatMessage(blockTypeMessages.syncedBlockQuickInsertTitle),
|
|
24
22
|
description: formatMessage(blockTypeMessages.syncedBlockDescription),
|
|
25
23
|
priority: 400,
|
|
26
24
|
keywords: ['synced', 'block', 'synced-block', 'sync', 'sync-block', 'auto', 'update', 'excerpt', 'connect', 'create'],
|
|
@@ -33,7 +31,7 @@ export var getQuickInsertConfig = function getQuickInsertConfig(config, api, syn
|
|
|
33
31
|
}, formatMessage(blockTypeMessages.newLozenge))),
|
|
34
32
|
icon: function icon() {
|
|
35
33
|
return /*#__PURE__*/React.createElement(IconSyncBlock, {
|
|
36
|
-
label: formatMessage(
|
|
34
|
+
label: formatMessage(blockTypeMessages.syncedBlockQuickInsertTitle)
|
|
37
35
|
});
|
|
38
36
|
},
|
|
39
37
|
action: function action(insert, state) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-synced-block",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "21.0.1",
|
|
4
4
|
"description": "SyncedBlock plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -21,27 +21,27 @@
|
|
|
21
21
|
"atlaskit:src": "src/index.ts",
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@atlaskit/adf-schema": "^57.6.0",
|
|
24
|
-
"@atlaskit/button": "25.4.
|
|
25
|
-
"@atlaskit/dropdown-menu": "
|
|
24
|
+
"@atlaskit/button": "25.4.4",
|
|
25
|
+
"@atlaskit/dropdown-menu": "21.0.0",
|
|
26
26
|
"@atlaskit/editor-json-transformer": "^10.0.0",
|
|
27
|
-
"@atlaskit/editor-plugin-analytics": "^
|
|
28
|
-
"@atlaskit/editor-plugin-block-controls": "^
|
|
29
|
-
"@atlaskit/editor-plugin-block-menu": "^
|
|
30
|
-
"@atlaskit/editor-plugin-connectivity": "
|
|
31
|
-
"@atlaskit/editor-plugin-content-format": "^
|
|
32
|
-
"@atlaskit/editor-plugin-decorations": "^
|
|
33
|
-
"@atlaskit/editor-plugin-editor-disabled": "^
|
|
34
|
-
"@atlaskit/editor-plugin-editor-viewmode": "^
|
|
35
|
-
"@atlaskit/editor-plugin-floating-toolbar": "^
|
|
36
|
-
"@atlaskit/editor-plugin-focus": "^
|
|
37
|
-
"@atlaskit/editor-plugin-history": "^
|
|
38
|
-
"@atlaskit/editor-plugin-selection": "^
|
|
39
|
-
"@atlaskit/editor-plugin-toolbar": "^
|
|
40
|
-
"@atlaskit/editor-plugin-ui-control-registry": "^
|
|
41
|
-
"@atlaskit/editor-plugin-user-intent": "^
|
|
27
|
+
"@atlaskit/editor-plugin-analytics": "^23.0.0",
|
|
28
|
+
"@atlaskit/editor-plugin-block-controls": "^24.0.0",
|
|
29
|
+
"@atlaskit/editor-plugin-block-menu": "^22.0.0",
|
|
30
|
+
"@atlaskit/editor-plugin-connectivity": "23.0.0",
|
|
31
|
+
"@atlaskit/editor-plugin-content-format": "^17.0.0",
|
|
32
|
+
"@atlaskit/editor-plugin-decorations": "^23.0.0",
|
|
33
|
+
"@atlaskit/editor-plugin-editor-disabled": "^23.0.0",
|
|
34
|
+
"@atlaskit/editor-plugin-editor-viewmode": "^25.0.0",
|
|
35
|
+
"@atlaskit/editor-plugin-floating-toolbar": "^25.0.0",
|
|
36
|
+
"@atlaskit/editor-plugin-focus": "^22.0.0",
|
|
37
|
+
"@atlaskit/editor-plugin-history": "^23.0.0",
|
|
38
|
+
"@atlaskit/editor-plugin-selection": "^23.0.0",
|
|
39
|
+
"@atlaskit/editor-plugin-toolbar": "^20.0.0",
|
|
40
|
+
"@atlaskit/editor-plugin-ui-control-registry": "^17.0.0",
|
|
41
|
+
"@atlaskit/editor-plugin-user-intent": "^21.0.0",
|
|
42
42
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
43
43
|
"@atlaskit/editor-shared-styles": "^4.3.0",
|
|
44
|
-
"@atlaskit/editor-synced-block-provider": "^
|
|
44
|
+
"@atlaskit/editor-synced-block-provider": "^19.0.0",
|
|
45
45
|
"@atlaskit/editor-toolbar": "^2.8.0",
|
|
46
46
|
"@atlaskit/flag": "^19.0.0",
|
|
47
47
|
"@atlaskit/icon": "38.0.2",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
54
54
|
"@atlaskit/primitives": "^22.5.0",
|
|
55
55
|
"@atlaskit/spinner": "20.4.4",
|
|
56
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
56
|
+
"@atlaskit/tmp-editor-statsig": "^219.0.0",
|
|
57
57
|
"@atlaskit/tokens": "20.1.0",
|
|
58
|
-
"@atlaskit/tooltip": "^24.
|
|
58
|
+
"@atlaskit/tooltip": "^24.4.0",
|
|
59
59
|
"@atlaskit/visually-hidden": "^4.4.0",
|
|
60
60
|
"@babel/runtime": "^7.0.0",
|
|
61
61
|
"@compiled/react": "^1.0.2",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"memoize-one": "^6.0.0"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"@atlaskit/editor-common": "^
|
|
68
|
+
"@atlaskit/editor-common": "^127.1.0",
|
|
69
69
|
"react": "^18.2.0 || ^19.2.0",
|
|
70
70
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
71
71
|
},
|