@atlaskit/editor-plugin-code-block 34.0.0 → 35.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 +16 -0
- package/dist/cjs/pm-plugins/toolbar.js +32 -53
- package/dist/es2019/pm-plugins/toolbar.js +32 -53
- package/dist/esm/pm-plugins/toolbar.js +32 -53
- package/package.json +17 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-code-block
|
|
2
2
|
|
|
3
|
+
## 35.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 35.0.0
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`cabf3c7e59b8d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cabf3c7e59b8d) -
|
|
14
|
+
Remove internal uses of the always-true `areToolbarFlagsEnabled` helper and delete legacy toolbar
|
|
15
|
+
code that only rendered when it returned false (`ScrollButtons`, `LinkToolbarAppearance`,
|
|
16
|
+
`HyperlinkToolbarAppearance` and the media `LayoutGroup`).
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 34.0.0
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -11,7 +11,6 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
11
11
|
var _codeBlock = require("@atlaskit/editor-common/code-block");
|
|
12
12
|
var _messages = _interopRequireDefault(require("@atlaskit/editor-common/messages"));
|
|
13
13
|
var _codeBlockButton = require("@atlaskit/editor-common/messages/codeBlockButton");
|
|
14
|
-
var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
|
|
15
14
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
16
15
|
var _angleBrackets = _interopRequireDefault(require("@atlaskit/icon/core/angle-brackets"));
|
|
17
16
|
var _copy = _interopRequireDefault(require("@atlaskit/icon/core/copy"));
|
|
@@ -146,7 +145,6 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig() {
|
|
|
146
145
|
options: languageSelectOptions,
|
|
147
146
|
filterOption: languageListFilter
|
|
148
147
|
};
|
|
149
|
-
var areAnyNewToolbarFlagsEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
|
|
150
148
|
var isQ4LovabilityEnabled = (0, _expValEquals.expValEquals)('platform_editor_code_block_q4_lovability', 'isEnabled', true);
|
|
151
149
|
var languagePicker;
|
|
152
150
|
if (isQ4LovabilityEnabled) {
|
|
@@ -170,8 +168,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig() {
|
|
|
170
168
|
editorView: view,
|
|
171
169
|
filterOption: languageListFilter,
|
|
172
170
|
formatMessage: formatMessage,
|
|
173
|
-
languagePickerOptions: languagePickerOptions
|
|
174
|
-
triggerSpacing: !areAnyNewToolbarFlagsEnabled ? 'compact' : 'default'
|
|
171
|
+
languagePickerOptions: languagePickerOptions
|
|
175
172
|
});
|
|
176
173
|
}
|
|
177
174
|
};
|
|
@@ -201,57 +198,39 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig() {
|
|
|
201
198
|
tabIndex: null
|
|
202
199
|
}, separator];
|
|
203
200
|
var copyAndDeleteButtonMenuItems = [];
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
201
|
+
var overflowMenuOptions = [{
|
|
202
|
+
title: formatMessage(_messages.default.delete),
|
|
203
|
+
icon: (0, _delete.default)({
|
|
204
|
+
label: ''
|
|
205
|
+
}),
|
|
206
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
207
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
208
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
209
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
210
|
+
onClick: (0, _editorCommands.removeCodeBlockWithAnalytics)(editorAnalyticsAPI)
|
|
211
|
+
}];
|
|
212
|
+
if (allowCopyToClipboard) {
|
|
213
|
+
overflowMenuOptions.unshift({
|
|
214
|
+
title: formatMessage(_codeBlockButton.codeBlockButtonMessages.copyCodeSnippetToClipboard),
|
|
215
|
+
onClick: (0, _editorCommands.copyContentToClipboardWithAnalytics)(editorAnalyticsAPI),
|
|
216
|
+
icon: (0, _copy.default)({
|
|
208
217
|
label: ''
|
|
209
218
|
}),
|
|
210
|
-
onMouseEnter:
|
|
211
|
-
onMouseLeave:
|
|
212
|
-
onFocus:
|
|
213
|
-
onBlur:
|
|
214
|
-
|
|
215
|
-
}
|
|
216
|
-
if (allowCopyToClipboard) {
|
|
217
|
-
overflowMenuOptions.unshift({
|
|
218
|
-
title: formatMessage(_codeBlockButton.codeBlockButtonMessages.copyCodeSnippetToClipboard),
|
|
219
|
-
onClick: (0, _editorCommands.copyContentToClipboardWithAnalytics)(editorAnalyticsAPI),
|
|
220
|
-
icon: (0, _copy.default)({
|
|
221
|
-
label: ''
|
|
222
|
-
}),
|
|
223
|
-
onMouseEnter: _codeBlockCopySelectionPlugin.provideVisualFeedbackForCopyButton,
|
|
224
|
-
onMouseLeave: _editorCommands.resetCopiedState,
|
|
225
|
-
onFocus: _codeBlockCopySelectionPlugin.provideVisualFeedbackForCopyButton,
|
|
226
|
-
onBlur: _codeBlockCopySelectionPlugin.removeVisualFeedbackForCopyButton,
|
|
227
|
-
disabled: codeBlockState.isNodeSelected
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
copyAndDeleteButtonMenuItems = isViewMode ? [].concat(copyToClipboardItems) : [{
|
|
231
|
-
type: 'separator',
|
|
232
|
-
fullHeight: true
|
|
233
|
-
}, {
|
|
234
|
-
type: 'overflow-dropdown',
|
|
235
|
-
testId: 'code-block-overflow-dropdown-trigger',
|
|
236
|
-
options: overflowMenuOptions
|
|
237
|
-
}];
|
|
238
|
-
} else {
|
|
239
|
-
var deleteButton = {
|
|
240
|
-
id: 'editor.codeBlock.delete',
|
|
241
|
-
type: 'button',
|
|
242
|
-
appearance: 'danger',
|
|
243
|
-
icon: _delete.default,
|
|
244
|
-
iconFallback: _delete.default,
|
|
245
|
-
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
246
|
-
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
247
|
-
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
248
|
-
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
249
|
-
onClick: (0, _editorCommands.removeCodeBlockWithAnalytics)(editorAnalyticsAPI),
|
|
250
|
-
title: formatMessage(_messages.default.remove),
|
|
251
|
-
tabIndex: null
|
|
252
|
-
};
|
|
253
|
-
copyAndDeleteButtonMenuItems = [separator].concat(copyToClipboardItems, [deleteButton]);
|
|
219
|
+
onMouseEnter: _codeBlockCopySelectionPlugin.provideVisualFeedbackForCopyButton,
|
|
220
|
+
onMouseLeave: _editorCommands.resetCopiedState,
|
|
221
|
+
onFocus: _codeBlockCopySelectionPlugin.provideVisualFeedbackForCopyButton,
|
|
222
|
+
onBlur: _codeBlockCopySelectionPlugin.removeVisualFeedbackForCopyButton,
|
|
223
|
+
disabled: codeBlockState.isNodeSelected
|
|
224
|
+
});
|
|
254
225
|
}
|
|
226
|
+
copyAndDeleteButtonMenuItems = isViewMode ? [].concat(copyToClipboardItems) : [{
|
|
227
|
+
type: 'separator',
|
|
228
|
+
fullHeight: true
|
|
229
|
+
}, {
|
|
230
|
+
type: 'overflow-dropdown',
|
|
231
|
+
testId: 'code-block-overflow-dropdown-trigger',
|
|
232
|
+
options: overflowMenuOptions
|
|
233
|
+
}];
|
|
255
234
|
var codeBlockWrapButtonTitle = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_code_block_q4_lovability', 'isEnabled', true) ? formatMessage(isWrapped ? _codeBlockButton.codeBlockButtonMessages.unwrapCodeLabel : _codeBlockButton.codeBlockButtonMessages.wrapCodeLabel) : formatMessage(_codeBlockButton.codeBlockButtonMessages.wrapCode);
|
|
256
235
|
var codeBlockWrapButton = {
|
|
257
236
|
id: 'editor.codeBlock.wrap',
|
|
@@ -300,7 +279,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig() {
|
|
|
300
279
|
return (0, _utils.findDomRefAtPos)(pos, view.domAtPos.bind(view));
|
|
301
280
|
},
|
|
302
281
|
nodeType: nodeType,
|
|
303
|
-
items: [languagePicker !== null && languagePicker !== void 0 ? languagePicker : languageSelect].concat((0, _toConsumableArray2.default)(
|
|
282
|
+
items: [languagePicker !== null && languagePicker !== void 0 ? languagePicker : languageSelect, codeBlockWrapButton].concat((0, _toConsumableArray2.default)(isQ4LovabilityEnabled ? [codeBlockLineNumbersButton].concat((0, _toConsumableArray2.default)(formatCodeProvider ? [formatCodeButton] : [])) : []), (0, _toConsumableArray2.default)(copyAndDeleteButtonMenuItems)),
|
|
304
283
|
scrollable: true
|
|
305
284
|
};
|
|
306
285
|
};
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { areCodeBlockLineNumbersVisible, isCodeBlockWordWrapEnabled } from '@atlaskit/editor-common/code-block';
|
|
3
3
|
import commonMessages from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { codeBlockButtonMessages } from '@atlaskit/editor-common/messages/codeBlockButton';
|
|
5
|
-
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
6
5
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
7
6
|
import AngleBracketsIcon from '@atlaskit/icon/core/angle-brackets';
|
|
8
7
|
import CopyIcon from '@atlaskit/icon/core/copy';
|
|
@@ -118,7 +117,6 @@ export const getToolbarConfig = (allowCopyToClipboard = false, api, overrideLang
|
|
|
118
117
|
options: languageSelectOptions,
|
|
119
118
|
filterOption: languageListFilter
|
|
120
119
|
};
|
|
121
|
-
const areAnyNewToolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
|
|
122
120
|
const isQ4LovabilityEnabled = expValEquals('platform_editor_code_block_q4_lovability', 'isEnabled', true);
|
|
123
121
|
let languagePicker;
|
|
124
122
|
if (isQ4LovabilityEnabled) {
|
|
@@ -142,8 +140,7 @@ export const getToolbarConfig = (allowCopyToClipboard = false, api, overrideLang
|
|
|
142
140
|
editorView: view,
|
|
143
141
|
filterOption: languageListFilter,
|
|
144
142
|
formatMessage: formatMessage,
|
|
145
|
-
languagePickerOptions: languagePickerOptions
|
|
146
|
-
triggerSpacing: !areAnyNewToolbarFlagsEnabled ? 'compact' : 'default'
|
|
143
|
+
languagePickerOptions: languagePickerOptions
|
|
147
144
|
});
|
|
148
145
|
}
|
|
149
146
|
};
|
|
@@ -173,57 +170,39 @@ export const getToolbarConfig = (allowCopyToClipboard = false, api, overrideLang
|
|
|
173
170
|
tabIndex: null
|
|
174
171
|
}, separator];
|
|
175
172
|
let copyAndDeleteButtonMenuItems = [];
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
173
|
+
const overflowMenuOptions = [{
|
|
174
|
+
title: formatMessage(commonMessages.delete),
|
|
175
|
+
icon: DeleteIcon({
|
|
176
|
+
label: ''
|
|
177
|
+
}),
|
|
178
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
179
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
180
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
181
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
182
|
+
onClick: removeCodeBlockWithAnalytics(editorAnalyticsAPI)
|
|
183
|
+
}];
|
|
184
|
+
if (allowCopyToClipboard) {
|
|
185
|
+
overflowMenuOptions.unshift({
|
|
186
|
+
title: formatMessage(codeBlockButtonMessages.copyCodeSnippetToClipboard),
|
|
187
|
+
onClick: copyContentToClipboardWithAnalytics(editorAnalyticsAPI),
|
|
188
|
+
icon: CopyIcon({
|
|
180
189
|
label: ''
|
|
181
190
|
}),
|
|
182
|
-
onMouseEnter:
|
|
183
|
-
onMouseLeave:
|
|
184
|
-
onFocus:
|
|
185
|
-
onBlur:
|
|
186
|
-
|
|
187
|
-
}
|
|
188
|
-
if (allowCopyToClipboard) {
|
|
189
|
-
overflowMenuOptions.unshift({
|
|
190
|
-
title: formatMessage(codeBlockButtonMessages.copyCodeSnippetToClipboard),
|
|
191
|
-
onClick: copyContentToClipboardWithAnalytics(editorAnalyticsAPI),
|
|
192
|
-
icon: CopyIcon({
|
|
193
|
-
label: ''
|
|
194
|
-
}),
|
|
195
|
-
onMouseEnter: provideVisualFeedbackForCopyButton,
|
|
196
|
-
onMouseLeave: resetCopiedState,
|
|
197
|
-
onFocus: provideVisualFeedbackForCopyButton,
|
|
198
|
-
onBlur: removeVisualFeedbackForCopyButton,
|
|
199
|
-
disabled: codeBlockState.isNodeSelected
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
copyAndDeleteButtonMenuItems = isViewMode ? [...copyToClipboardItems] : [{
|
|
203
|
-
type: 'separator',
|
|
204
|
-
fullHeight: true
|
|
205
|
-
}, {
|
|
206
|
-
type: 'overflow-dropdown',
|
|
207
|
-
testId: 'code-block-overflow-dropdown-trigger',
|
|
208
|
-
options: overflowMenuOptions
|
|
209
|
-
}];
|
|
210
|
-
} else {
|
|
211
|
-
const deleteButton = {
|
|
212
|
-
id: 'editor.codeBlock.delete',
|
|
213
|
-
type: 'button',
|
|
214
|
-
appearance: 'danger',
|
|
215
|
-
icon: DeleteIcon,
|
|
216
|
-
iconFallback: DeleteIcon,
|
|
217
|
-
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
218
|
-
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
219
|
-
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
220
|
-
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
221
|
-
onClick: removeCodeBlockWithAnalytics(editorAnalyticsAPI),
|
|
222
|
-
title: formatMessage(commonMessages.remove),
|
|
223
|
-
tabIndex: null
|
|
224
|
-
};
|
|
225
|
-
copyAndDeleteButtonMenuItems = [separator, ...copyToClipboardItems, deleteButton];
|
|
191
|
+
onMouseEnter: provideVisualFeedbackForCopyButton,
|
|
192
|
+
onMouseLeave: resetCopiedState,
|
|
193
|
+
onFocus: provideVisualFeedbackForCopyButton,
|
|
194
|
+
onBlur: removeVisualFeedbackForCopyButton,
|
|
195
|
+
disabled: codeBlockState.isNodeSelected
|
|
196
|
+
});
|
|
226
197
|
}
|
|
198
|
+
copyAndDeleteButtonMenuItems = isViewMode ? [...copyToClipboardItems] : [{
|
|
199
|
+
type: 'separator',
|
|
200
|
+
fullHeight: true
|
|
201
|
+
}, {
|
|
202
|
+
type: 'overflow-dropdown',
|
|
203
|
+
testId: 'code-block-overflow-dropdown-trigger',
|
|
204
|
+
options: overflowMenuOptions
|
|
205
|
+
}];
|
|
227
206
|
const codeBlockWrapButtonTitle = expValEqualsNoExposure('platform_editor_code_block_q4_lovability', 'isEnabled', true) ? formatMessage(isWrapped ? codeBlockButtonMessages.unwrapCodeLabel : codeBlockButtonMessages.wrapCodeLabel) : formatMessage(codeBlockButtonMessages.wrapCode);
|
|
228
207
|
const codeBlockWrapButton = {
|
|
229
208
|
id: 'editor.codeBlock.wrap',
|
|
@@ -270,7 +249,7 @@ export const getToolbarConfig = (allowCopyToClipboard = false, api, overrideLang
|
|
|
270
249
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
271
250
|
getDomRef: view => findDomRefAtPos(pos, view.domAtPos.bind(view)),
|
|
272
251
|
nodeType,
|
|
273
|
-
items: [(_languagePicker = languagePicker) !== null && _languagePicker !== void 0 ? _languagePicker : languageSelect,
|
|
252
|
+
items: [(_languagePicker = languagePicker) !== null && _languagePicker !== void 0 ? _languagePicker : languageSelect, codeBlockWrapButton, ...(isQ4LovabilityEnabled ? [codeBlockLineNumbersButton, ...(formatCodeProvider ? [formatCodeButton] : [])] : []), ...copyAndDeleteButtonMenuItems],
|
|
274
253
|
scrollable: true
|
|
275
254
|
};
|
|
276
255
|
};
|
|
@@ -6,7 +6,6 @@ import React from 'react';
|
|
|
6
6
|
import { areCodeBlockLineNumbersVisible, isCodeBlockWordWrapEnabled } from '@atlaskit/editor-common/code-block';
|
|
7
7
|
import commonMessages from '@atlaskit/editor-common/messages';
|
|
8
8
|
import { codeBlockButtonMessages } from '@atlaskit/editor-common/messages/codeBlockButton';
|
|
9
|
-
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
10
9
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
11
10
|
import AngleBracketsIcon from '@atlaskit/icon/core/angle-brackets';
|
|
12
11
|
import CopyIcon from '@atlaskit/icon/core/copy';
|
|
@@ -139,7 +138,6 @@ export var getToolbarConfig = function getToolbarConfig() {
|
|
|
139
138
|
options: languageSelectOptions,
|
|
140
139
|
filterOption: languageListFilter
|
|
141
140
|
};
|
|
142
|
-
var areAnyNewToolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
|
|
143
141
|
var isQ4LovabilityEnabled = expValEquals('platform_editor_code_block_q4_lovability', 'isEnabled', true);
|
|
144
142
|
var languagePicker;
|
|
145
143
|
if (isQ4LovabilityEnabled) {
|
|
@@ -163,8 +161,7 @@ export var getToolbarConfig = function getToolbarConfig() {
|
|
|
163
161
|
editorView: view,
|
|
164
162
|
filterOption: languageListFilter,
|
|
165
163
|
formatMessage: formatMessage,
|
|
166
|
-
languagePickerOptions: languagePickerOptions
|
|
167
|
-
triggerSpacing: !areAnyNewToolbarFlagsEnabled ? 'compact' : 'default'
|
|
164
|
+
languagePickerOptions: languagePickerOptions
|
|
168
165
|
});
|
|
169
166
|
}
|
|
170
167
|
};
|
|
@@ -194,57 +191,39 @@ export var getToolbarConfig = function getToolbarConfig() {
|
|
|
194
191
|
tabIndex: null
|
|
195
192
|
}, separator];
|
|
196
193
|
var copyAndDeleteButtonMenuItems = [];
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
194
|
+
var overflowMenuOptions = [{
|
|
195
|
+
title: formatMessage(commonMessages.delete),
|
|
196
|
+
icon: DeleteIcon({
|
|
197
|
+
label: ''
|
|
198
|
+
}),
|
|
199
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
200
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
201
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
202
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
203
|
+
onClick: removeCodeBlockWithAnalytics(editorAnalyticsAPI)
|
|
204
|
+
}];
|
|
205
|
+
if (allowCopyToClipboard) {
|
|
206
|
+
overflowMenuOptions.unshift({
|
|
207
|
+
title: formatMessage(codeBlockButtonMessages.copyCodeSnippetToClipboard),
|
|
208
|
+
onClick: copyContentToClipboardWithAnalytics(editorAnalyticsAPI),
|
|
209
|
+
icon: CopyIcon({
|
|
201
210
|
label: ''
|
|
202
211
|
}),
|
|
203
|
-
onMouseEnter:
|
|
204
|
-
onMouseLeave:
|
|
205
|
-
onFocus:
|
|
206
|
-
onBlur:
|
|
207
|
-
|
|
208
|
-
}
|
|
209
|
-
if (allowCopyToClipboard) {
|
|
210
|
-
overflowMenuOptions.unshift({
|
|
211
|
-
title: formatMessage(codeBlockButtonMessages.copyCodeSnippetToClipboard),
|
|
212
|
-
onClick: copyContentToClipboardWithAnalytics(editorAnalyticsAPI),
|
|
213
|
-
icon: CopyIcon({
|
|
214
|
-
label: ''
|
|
215
|
-
}),
|
|
216
|
-
onMouseEnter: provideVisualFeedbackForCopyButton,
|
|
217
|
-
onMouseLeave: resetCopiedState,
|
|
218
|
-
onFocus: provideVisualFeedbackForCopyButton,
|
|
219
|
-
onBlur: removeVisualFeedbackForCopyButton,
|
|
220
|
-
disabled: codeBlockState.isNodeSelected
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
copyAndDeleteButtonMenuItems = isViewMode ? [].concat(copyToClipboardItems) : [{
|
|
224
|
-
type: 'separator',
|
|
225
|
-
fullHeight: true
|
|
226
|
-
}, {
|
|
227
|
-
type: 'overflow-dropdown',
|
|
228
|
-
testId: 'code-block-overflow-dropdown-trigger',
|
|
229
|
-
options: overflowMenuOptions
|
|
230
|
-
}];
|
|
231
|
-
} else {
|
|
232
|
-
var deleteButton = {
|
|
233
|
-
id: 'editor.codeBlock.delete',
|
|
234
|
-
type: 'button',
|
|
235
|
-
appearance: 'danger',
|
|
236
|
-
icon: DeleteIcon,
|
|
237
|
-
iconFallback: DeleteIcon,
|
|
238
|
-
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
239
|
-
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
240
|
-
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
241
|
-
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
242
|
-
onClick: removeCodeBlockWithAnalytics(editorAnalyticsAPI),
|
|
243
|
-
title: formatMessage(commonMessages.remove),
|
|
244
|
-
tabIndex: null
|
|
245
|
-
};
|
|
246
|
-
copyAndDeleteButtonMenuItems = [separator].concat(copyToClipboardItems, [deleteButton]);
|
|
212
|
+
onMouseEnter: provideVisualFeedbackForCopyButton,
|
|
213
|
+
onMouseLeave: resetCopiedState,
|
|
214
|
+
onFocus: provideVisualFeedbackForCopyButton,
|
|
215
|
+
onBlur: removeVisualFeedbackForCopyButton,
|
|
216
|
+
disabled: codeBlockState.isNodeSelected
|
|
217
|
+
});
|
|
247
218
|
}
|
|
219
|
+
copyAndDeleteButtonMenuItems = isViewMode ? [].concat(copyToClipboardItems) : [{
|
|
220
|
+
type: 'separator',
|
|
221
|
+
fullHeight: true
|
|
222
|
+
}, {
|
|
223
|
+
type: 'overflow-dropdown',
|
|
224
|
+
testId: 'code-block-overflow-dropdown-trigger',
|
|
225
|
+
options: overflowMenuOptions
|
|
226
|
+
}];
|
|
248
227
|
var codeBlockWrapButtonTitle = expValEqualsNoExposure('platform_editor_code_block_q4_lovability', 'isEnabled', true) ? formatMessage(isWrapped ? codeBlockButtonMessages.unwrapCodeLabel : codeBlockButtonMessages.wrapCodeLabel) : formatMessage(codeBlockButtonMessages.wrapCode);
|
|
249
228
|
var codeBlockWrapButton = {
|
|
250
229
|
id: 'editor.codeBlock.wrap',
|
|
@@ -293,7 +272,7 @@ export var getToolbarConfig = function getToolbarConfig() {
|
|
|
293
272
|
return findDomRefAtPos(pos, view.domAtPos.bind(view));
|
|
294
273
|
},
|
|
295
274
|
nodeType: nodeType,
|
|
296
|
-
items: [languagePicker !== null && languagePicker !== void 0 ? languagePicker : languageSelect].concat(_toConsumableArray(
|
|
275
|
+
items: [languagePicker !== null && languagePicker !== void 0 ? languagePicker : languageSelect, codeBlockWrapButton].concat(_toConsumableArray(isQ4LovabilityEnabled ? [codeBlockLineNumbersButton].concat(_toConsumableArray(formatCodeProvider ? [formatCodeButton] : [])) : []), _toConsumableArray(copyAndDeleteButtonMenuItems)),
|
|
297
276
|
scrollable: true
|
|
298
277
|
};
|
|
299
278
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-code-block",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "35.0.1",
|
|
4
4
|
"description": "Code block plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -22,17 +22,17 @@
|
|
|
22
22
|
"@atlaskit/adf-schema": "^57.7.0",
|
|
23
23
|
"@atlaskit/button": "^25.8.0",
|
|
24
24
|
"@atlaskit/code": "^20.0.0",
|
|
25
|
-
"@atlaskit/editor-plugin-analytics": "^
|
|
26
|
-
"@atlaskit/editor-plugin-block-menu": "^
|
|
27
|
-
"@atlaskit/editor-plugin-composition": "^
|
|
28
|
-
"@atlaskit/editor-plugin-decorations": "^
|
|
29
|
-
"@atlaskit/editor-plugin-editor-disabled": "^
|
|
30
|
-
"@atlaskit/editor-plugin-editor-viewmode": "^
|
|
31
|
-
"@atlaskit/editor-plugin-feature-flags": "^
|
|
32
|
-
"@atlaskit/editor-plugin-interaction": "^
|
|
33
|
-
"@atlaskit/editor-plugin-selection": "^
|
|
34
|
-
"@atlaskit/editor-plugin-toolbar": "^
|
|
35
|
-
"@atlaskit/editor-plugin-ui-control-registry": "^
|
|
25
|
+
"@atlaskit/editor-plugin-analytics": "^33.0.0",
|
|
26
|
+
"@atlaskit/editor-plugin-block-menu": "^32.0.0",
|
|
27
|
+
"@atlaskit/editor-plugin-composition": "^32.0.0",
|
|
28
|
+
"@atlaskit/editor-plugin-decorations": "^33.0.0",
|
|
29
|
+
"@atlaskit/editor-plugin-editor-disabled": "^33.0.0",
|
|
30
|
+
"@atlaskit/editor-plugin-editor-viewmode": "^35.0.0",
|
|
31
|
+
"@atlaskit/editor-plugin-feature-flags": "^32.0.0",
|
|
32
|
+
"@atlaskit/editor-plugin-interaction": "^47.0.0",
|
|
33
|
+
"@atlaskit/editor-plugin-selection": "^33.0.0",
|
|
34
|
+
"@atlaskit/editor-plugin-toolbar": "^30.0.0",
|
|
35
|
+
"@atlaskit/editor-plugin-ui-control-registry": "^27.0.0",
|
|
36
36
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
37
37
|
"@atlaskit/editor-shared-styles": "^5.2.0",
|
|
38
38
|
"@atlaskit/editor-toolbar": "^2.11.0",
|
|
@@ -46,13 +46,13 @@
|
|
|
46
46
|
"@atlaskit/prosemirror-input-rules": "^4.1.0",
|
|
47
47
|
"@atlaskit/react-select": "^4.12.0",
|
|
48
48
|
"@atlaskit/select": "^23.2.0",
|
|
49
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
50
|
-
"@atlaskit/tokens": "^20.
|
|
49
|
+
"@atlaskit/tmp-editor-statsig": "^265.0.0",
|
|
50
|
+
"@atlaskit/tokens": "^20.13.0",
|
|
51
51
|
"@babel/runtime": "^7.0.0",
|
|
52
52
|
"@compiled/react": "^1.0.2"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@atlaskit/editor-common": "^
|
|
55
|
+
"@atlaskit/editor-common": "^137.1.0",
|
|
56
56
|
"react": "^18.2.0 || ^19.2.0",
|
|
57
57
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
58
58
|
},
|
|
@@ -68,7 +68,8 @@
|
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@atlaskit/
|
|
71
|
+
"@atlaskit/docs": "^12.3.0",
|
|
72
|
+
"@atlaskit/editor-common": "^137.1.0",
|
|
72
73
|
"react": "^19.2.0",
|
|
73
74
|
"react-intl": "^7.0.0"
|
|
74
75
|
}
|