@atlaskit/editor-plugin-code-block 17.0.14 → 17.0.15
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/editor-commands/index.js +2 -2
- package/dist/cjs/nodeviews/code-block.js +2 -2
- package/dist/cjs/pm-plugins/codeBlockAutoFullStopTransformPlugin.js +2 -2
- package/dist/cjs/pm-plugins/toolbar.js +5 -5
- package/dist/cjs/ui/CodeBlockLanguagePicker.js +4 -4
- package/dist/cjs/ui/FormatCodeErrorFlag.js +3 -2
- package/dist/cjs/ui/LanguagePicker.js +16 -15
- package/dist/cjs/ui/language-picker-options.js +2 -2
- package/dist/es2019/editor-commands/index.js +1 -1
- package/dist/es2019/nodeviews/code-block.js +1 -1
- package/dist/es2019/pm-plugins/codeBlockAutoFullStopTransformPlugin.js +1 -1
- package/dist/es2019/pm-plugins/toolbar.js +1 -1
- package/dist/es2019/ui/CodeBlockLanguagePicker.js +1 -1
- package/dist/es2019/ui/FormatCodeErrorFlag.js +2 -1
- package/dist/es2019/ui/LanguagePicker.js +4 -3
- package/dist/es2019/ui/language-picker-options.js +1 -1
- package/dist/esm/editor-commands/index.js +1 -1
- package/dist/esm/nodeviews/code-block.js +1 -1
- package/dist/esm/pm-plugins/codeBlockAutoFullStopTransformPlugin.js +1 -1
- package/dist/esm/pm-plugins/toolbar.js +1 -1
- package/dist/esm/ui/CodeBlockLanguagePicker.js +1 -1
- package/dist/esm/ui/FormatCodeErrorFlag.js +2 -1
- package/dist/esm/ui/LanguagePicker.js +4 -3
- package/dist/esm/ui/language-picker-options.js +1 -1
- package/dist/types/pm-plugins/ide-ux/line-handling.d.ts +7 -7
- package/dist/types/ui/language-picker-options.d.ts +1 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-code-block
|
|
2
2
|
|
|
3
|
+
## 17.0.15
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`656801b9e097c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/656801b9e097c) -
|
|
8
|
+
VOLTC-331 - Migrate updated package usage in platform/editor: rewrite barrel imports of
|
|
9
|
+
voltCompliant provider packages to deep/subpath imports (consumer-side debarrel). No public API
|
|
10
|
+
changes.
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 17.0.14
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -20,7 +20,7 @@ var _preset = require("@atlaskit/editor-common/preset");
|
|
|
20
20
|
var _transforms = require("@atlaskit/editor-common/transforms");
|
|
21
21
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
22
22
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
23
|
-
var
|
|
23
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
24
24
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
25
25
|
var _actions = require("../pm-plugins/actions");
|
|
26
26
|
var _autoDetectState = require("../pm-plugins/auto-detect-state");
|
|
@@ -65,7 +65,7 @@ var changeLanguage = exports.changeLanguage = function changeLanguage(editorAnal
|
|
|
65
65
|
}
|
|
66
66
|
var node = state.doc.nodeAt(pos);
|
|
67
67
|
var localId = node === null || node === void 0 ? void 0 : node.attrs.localId;
|
|
68
|
-
var shouldIncludeAutoDetectionContext = (0, _expValEquals.expValEquals)('platform_editor_code_block_q4_lovability', 'isEnabled', true) && (0,
|
|
68
|
+
var shouldIncludeAutoDetectionContext = (0, _expValEquals.expValEquals)('platform_editor_code_block_q4_lovability', 'isEnabled', true) && (0, _fg.fg)('platform_editor_code_block_language_detection_flow');
|
|
69
69
|
var previousAutoDetectEntry = shouldIncludeAutoDetectionContext ? (_autoDetectPluginKey$ = _autoDetectState.autoDetectPluginKey.getState(state)) === null || _autoDetectPluginKey$ === void 0 ? void 0 : _autoDetectPluginKey$.languageDetectionMap[localId] : undefined;
|
|
70
70
|
var tr = state.tr.setNodeMarkup(pos, codeBlock, _objectSpread(_objectSpread({}, node === null || node === void 0 ? void 0 : node.attrs), {}, {
|
|
71
71
|
language: language
|
|
@@ -11,7 +11,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
11
11
|
var _browser = require("@atlaskit/editor-common/browser");
|
|
12
12
|
var _codeBlock = require("@atlaskit/editor-common/code-block");
|
|
13
13
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
14
|
-
var
|
|
14
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
15
15
|
var _editorCommands = require("../editor-commands");
|
|
16
16
|
var _mainState = require("../pm-plugins/main-state");
|
|
17
17
|
var _classNames = require("../ui/class-names");
|
|
@@ -39,7 +39,7 @@ var toDOM = function toDOM(node, contentEditable, formattedAriaLabel) {
|
|
|
39
39
|
contenteditable: contentEditable ? 'true' : 'false',
|
|
40
40
|
'data-testid': 'code-block--code',
|
|
41
41
|
'aria-label': formattedAriaLabel
|
|
42
|
-
}, (0,
|
|
42
|
+
}, (0, _fg.fg)('platform_editor_adf_with_localid') && {
|
|
43
43
|
'data-local-id': node.attrs.localId
|
|
44
44
|
}), 0]]], ['div', {
|
|
45
45
|
class: _classNames.codeBlockClassNames.end,
|
|
@@ -9,13 +9,13 @@ var _browser = require("@atlaskit/editor-common/browser");
|
|
|
9
9
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
10
10
|
var _transforms = require("@atlaskit/editor-common/transforms");
|
|
11
11
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
12
|
-
var
|
|
12
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
13
13
|
var codeBlockAutoFullStopTransformPluginKey = exports.codeBlockAutoFullStopTransformPluginKey = new _state.PluginKey('codeBlockAutoFullStopTransformPluginKey');
|
|
14
14
|
function codeBlockAutoFullStopTransformPlugin() {
|
|
15
15
|
return new _safePlugin.SafePlugin({
|
|
16
16
|
key: codeBlockAutoFullStopTransformPluginKey,
|
|
17
17
|
appendTransaction: function appendTransaction(_transactions, oldState, newState) {
|
|
18
|
-
if (!(0,
|
|
18
|
+
if (!(0, _fg.fg)('code_block_auto_insertion_bug_fix')) {
|
|
19
19
|
return undefined;
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -18,7 +18,7 @@ var _copy = _interopRequireDefault(require("@atlaskit/icon/core/copy"));
|
|
|
18
18
|
var _delete = _interopRequireDefault(require("@atlaskit/icon/core/delete"));
|
|
19
19
|
var _listNumbered = _interopRequireDefault(require("@atlaskit/icon/core/list-numbered"));
|
|
20
20
|
var _textWrap = _interopRequireDefault(require("@atlaskit/icon/core/text-wrap"));
|
|
21
|
-
var
|
|
21
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
22
22
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
23
23
|
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
24
24
|
var _editorCommands = require("../editor-commands");
|
|
@@ -88,7 +88,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig() {
|
|
|
88
88
|
var formatCodeProvider = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
|
|
89
89
|
// Append gated languages (e.g. Mermaid) at runtime. Build a fresh array since
|
|
90
90
|
// createLanguageList sorts in place and would otherwise mutate DEFAULT_LANGUAGES.
|
|
91
|
-
var supportedLanguages = (0,
|
|
91
|
+
var supportedLanguages = (0, _fg.fg)('platform_editor_code_block_mermaid_language') ? [].concat((0, _toConsumableArray2.default)(_languageList.DEFAULT_LANGUAGES), [_languageList.MERMAID_LANGUAGE]) : _languageList.DEFAULT_LANGUAGES;
|
|
92
92
|
var languageList = (0, _languageList.createLanguageList)(overrideLanguageName ? supportedLanguages.map(function (languageOption) {
|
|
93
93
|
return _objectSpread(_objectSpread({}, languageOption), {}, {
|
|
94
94
|
name: overrideLanguageName(languageOption.name)
|
|
@@ -149,8 +149,8 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig() {
|
|
|
149
149
|
};
|
|
150
150
|
var areAnyNewToolbarFlagsEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
|
|
151
151
|
var languagePicker;
|
|
152
|
-
if ((0, _expValEquals.expValEquals)('platform_editor_code_block_q4_lovability', 'isEnabled', true) && (0,
|
|
153
|
-
var autoDetectEntry = typeof localId === 'string' && (0,
|
|
152
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_code_block_q4_lovability', 'isEnabled', true) && (0, _fg.fg)('platform_editor_code_block_add_line_number_button')) {
|
|
153
|
+
var autoDetectEntry = typeof localId === 'string' && (0, _fg.fg)('platform_editor_code_block_language_detection_flow') ? autoDetectState === null || autoDetectState === void 0 ? void 0 : autoDetectState.languageDetectionMap[localId] : undefined;
|
|
154
154
|
var autoDetectPickerValue = getAutoDetectPickerValue({
|
|
155
155
|
autoDetectEntry: autoDetectEntry,
|
|
156
156
|
formatMessage: formatMessage,
|
|
@@ -299,7 +299,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig() {
|
|
|
299
299
|
return (0, _utils.findDomRefAtPos)(pos, view.domAtPos.bind(view));
|
|
300
300
|
},
|
|
301
301
|
nodeType: nodeType,
|
|
302
|
-
items: [languagePicker !== null && languagePicker !== void 0 ? languagePicker : languageSelect].concat((0, _toConsumableArray2.default)(areAnyNewToolbarFlagsEnabled ? [] : [separator]), [codeBlockWrapButton], (0, _toConsumableArray2.default)((0, _expValEquals.expValEquals)('platform_editor_code_block_q4_lovability', 'isEnabled', true) && (0,
|
|
302
|
+
items: [languagePicker !== null && languagePicker !== void 0 ? languagePicker : languageSelect].concat((0, _toConsumableArray2.default)(areAnyNewToolbarFlagsEnabled ? [] : [separator]), [codeBlockWrapButton], (0, _toConsumableArray2.default)((0, _expValEquals.expValEquals)('platform_editor_code_block_q4_lovability', 'isEnabled', true) && (0, _fg.fg)('platform_editor_code_block_add_line_number_button') ? [codeBlockLineNumbersButton].concat((0, _toConsumableArray2.default)(formatCodeProvider ? [formatCodeButton] : [])) : []), (0, _toConsumableArray2.default)(copyAndDeleteButtonMenuItems)),
|
|
303
303
|
scrollable: true
|
|
304
304
|
};
|
|
305
305
|
};
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.CodeBlockLanguagePicker = void 0;
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var
|
|
11
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
12
12
|
var _editorCommands = require("../editor-commands");
|
|
13
13
|
var _languagePickerOptions = require("./language-picker-options");
|
|
14
14
|
var _LanguagePicker = require("./LanguagePicker");
|
|
@@ -35,9 +35,9 @@ var CodeBlockLanguagePicker = exports.CodeBlockLanguagePicker = function CodeBlo
|
|
|
35
35
|
var handleSelection = (0, _react.useCallback)(function (option, selectionSource, interactionMethod) {
|
|
36
36
|
var _api$analytics;
|
|
37
37
|
var isDetectLanguageSelected = option.value === _languagePickerOptions.DETECT_LANGUAGE_VALUE;
|
|
38
|
-
var command = isDetectLanguageSelected && ((0,
|
|
38
|
+
var command = isDetectLanguageSelected && ((0, _fg.fg)('platform_editor_code_block_ga_patch_1') || (0, _fg.fg)('platform_editor_code_block_language_detection_flow')) ? (0, _editorCommands.detectLanguage)() : (0, _editorCommands.changeLanguage)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(option.value, selectionSource);
|
|
39
39
|
var commandSucceeded = command(editorView.state, editorView.dispatch);
|
|
40
|
-
if ((0,
|
|
40
|
+
if ((0, _fg.fg)('platform_editor_code_block_ga_patch_1')) {
|
|
41
41
|
if (interactionMethod === 'mouse') {
|
|
42
42
|
requestAnimationFrame(function () {
|
|
43
43
|
// Mouse-opened picker should return editing focus to the code block. Keyboard-opened
|
|
@@ -55,7 +55,7 @@ var CodeBlockLanguagePicker = exports.CodeBlockLanguagePicker = function CodeBlo
|
|
|
55
55
|
});
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
-
if (commandSucceeded && (option.value !== _languagePickerOptions.DETECT_LANGUAGE_VALUE || (0,
|
|
58
|
+
if (commandSucceeded && (option.value !== _languagePickerOptions.DETECT_LANGUAGE_VALUE || (0, _fg.fg)('platform_editor_code_block_ga_patch_1'))) {
|
|
59
59
|
(0, _recentLanguages.saveRecentLanguage)(option.value);
|
|
60
60
|
setRecentLanguageValues((0, _recentLanguages.getRecentLanguages)());
|
|
61
61
|
}
|
|
@@ -10,7 +10,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
var _reactIntl = require("react-intl");
|
|
11
11
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
12
12
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
|
-
var _flag =
|
|
13
|
+
var _flag = _interopRequireDefault(require("@atlaskit/flag/flag"));
|
|
14
|
+
var _flagGroup = require("@atlaskit/flag/flag-group");
|
|
14
15
|
var _statusError = _interopRequireDefault(require("@atlaskit/icon/core/status-error"));
|
|
15
16
|
var _actions = require("../pm-plugins/actions");
|
|
16
17
|
var _pluginKey = require("../pm-plugins/plugin-key");
|
|
@@ -59,7 +60,7 @@ var FormatCodeErrorFlag = exports.FormatCodeErrorFlag = function FormatCodeError
|
|
|
59
60
|
if (activeFormatCodeErrors.length === 0) {
|
|
60
61
|
return null;
|
|
61
62
|
}
|
|
62
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
63
|
+
return /*#__PURE__*/_react.default.createElement(_flagGroup.FlagGroup, {
|
|
63
64
|
onDismissed: onFlagGroupDismissed
|
|
64
65
|
}, activeFormatCodeErrors.map(function (formatCodeError) {
|
|
65
66
|
return /*#__PURE__*/_react.default.createElement(FormatCodeErrorFlagItem, {
|
|
@@ -12,13 +12,14 @@ var _runtime = require("@compiled/react/runtime");
|
|
|
12
12
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
13
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
14
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
-
var
|
|
15
|
+
var _button = _interopRequireDefault(require("@atlaskit/button/default/button"));
|
|
16
16
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
17
17
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
18
18
|
var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/core/chevron-down"));
|
|
19
|
-
var
|
|
19
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
20
20
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
21
|
-
var
|
|
21
|
+
var _popupSelect = require("@atlaskit/select/popup-select");
|
|
22
|
+
var _components = require("@atlaskit/react-select/components");
|
|
22
23
|
var _languagePickerOptions = require("./language-picker-options");
|
|
23
24
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
24
25
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
@@ -37,13 +38,13 @@ var CustomGroup = function CustomGroup(props) {
|
|
|
37
38
|
as: "hr",
|
|
38
39
|
xcss: styles.divider,
|
|
39
40
|
role: "presentation"
|
|
40
|
-
}), /*#__PURE__*/_react.default.createElement(
|
|
41
|
+
}), /*#__PURE__*/_react.default.createElement(_components.components.Group, props));
|
|
41
42
|
};
|
|
42
43
|
var CustomOption = function CustomOption(props) {
|
|
43
44
|
return (
|
|
44
45
|
/*#__PURE__*/
|
|
45
46
|
// eslint-disable-next-line react/jsx-props-no-spreading -- react-select custom components must forward all props to the default Option.
|
|
46
|
-
_react.default.createElement(
|
|
47
|
+
_react.default.createElement(_components.components.Option, props, /*#__PURE__*/_react.default.createElement("span", {
|
|
47
48
|
className: (0, _runtime.ax)(["_vwz478tn"])
|
|
48
49
|
}, props.children))
|
|
49
50
|
);
|
|
@@ -153,7 +154,7 @@ var LanguagePicker = exports.LanguagePicker = function LanguagePicker(_ref) {
|
|
|
153
154
|
}
|
|
154
155
|
var isSearchSelection = inputValueRef.current.trim().length > 0;
|
|
155
156
|
var selectionSource = isSearchSelection ? 'search' : (_option$selectionSour = option.selectionSource) !== null && _option$selectionSour !== void 0 ? _option$selectionSour : 'all';
|
|
156
|
-
if ((0,
|
|
157
|
+
if ((0, _fg.fg)('platform_editor_code_block_ga_patch_1')) {
|
|
157
158
|
onSelection(option, selectionSource, interactionMethodRef.current);
|
|
158
159
|
} else {
|
|
159
160
|
onSelection(option, selectionSource);
|
|
@@ -185,7 +186,7 @@ var LanguagePicker = exports.LanguagePicker = function LanguagePicker(_ref) {
|
|
|
185
186
|
focusWithoutScrolling(event.currentTarget);
|
|
186
187
|
}, []);
|
|
187
188
|
var handleTriggerMouseUp = (0, _react.useCallback)(function (event) {
|
|
188
|
-
if ((0,
|
|
189
|
+
if ((0, _fg.fg)('platform_editor_code_block_ga_patch_1')) {
|
|
189
190
|
interactionMethodRef.current = 'mouse';
|
|
190
191
|
// Focus the trigger before PopupSelect opens so FocusLock restores focus to the
|
|
191
192
|
// trigger after a mouse selection. Relying on the button's default mouse focus is too
|
|
@@ -204,25 +205,25 @@ var LanguagePicker = exports.LanguagePicker = function LanguagePicker(_ref) {
|
|
|
204
205
|
ariaExpanded = _ref3['aria-expanded'],
|
|
205
206
|
ariaHasPopup = _ref3['aria-haspopup'];
|
|
206
207
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
207
|
-
className: (0, _runtime.ax)([styles.trigger, !(0,
|
|
208
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
208
|
+
className: (0, _runtime.ax)([styles.trigger, !(0, _fg.fg)('platform_editor_code_block_ga_patch_1') && styles.legacyTriggerTextOverflow])
|
|
209
|
+
}, /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
209
210
|
spacing: triggerSpacing,
|
|
210
211
|
shouldFitContainer: true,
|
|
211
|
-
onMouseDown: (0,
|
|
212
|
-
onMouseUp: (0,
|
|
213
|
-
onKeyDownCapture: (0,
|
|
212
|
+
onMouseDown: (0, _fg.fg)('platform_editor_code_block_ga_patch_1') ? undefined : handleTriggerMouseDown,
|
|
213
|
+
onMouseUp: (0, _fg.fg)('platform_editor_code_block_ga_patch_1') ? handleTriggerMouseUp : undefined,
|
|
214
|
+
onKeyDownCapture: (0, _fg.fg)('platform_editor_code_block_ga_patch_1') ? handleTriggerKeyDownCapture : undefined,
|
|
214
215
|
onKeyDown: onKeyDown,
|
|
215
216
|
ref: ref,
|
|
216
217
|
iconAfter: _chevronDown.default,
|
|
217
218
|
appearance: "subtle",
|
|
218
219
|
isSelected: isOpen,
|
|
219
220
|
"aria-controls": ariaControls,
|
|
220
|
-
"aria-expanded": (0,
|
|
221
|
-
"aria-haspopup": (0,
|
|
221
|
+
"aria-expanded": (0, _fg.fg)('platform_editor_code_block_ga_patch_1') ? ariaExpanded : undefined,
|
|
222
|
+
"aria-haspopup": (0, _fg.fg)('platform_editor_code_block_ga_patch_1') ? ariaHasPopup : undefined,
|
|
222
223
|
testId: "code-block-language-picker-trigger"
|
|
223
224
|
}, label));
|
|
224
225
|
}, [label, triggerSpacing, handleTriggerMouseDown, handleTriggerMouseUp, handleTriggerKeyDownCapture]);
|
|
225
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
226
|
+
return /*#__PURE__*/_react.default.createElement(_popupSelect.PopupSelect, {
|
|
226
227
|
components: popupSelectComponents,
|
|
227
228
|
filterOption: filterOption,
|
|
228
229
|
label: selectLanguageLabel,
|
|
@@ -8,7 +8,7 @@ exports.getDetectLanguageOption = exports.createGroupedLanguageOptions = exports
|
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
11
|
-
var
|
|
11
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
12
12
|
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; }
|
|
13
13
|
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) { (0, _defineProperty2.default)(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; }
|
|
14
14
|
var NONE_LANGUAGE_VALUE = exports.NONE_LANGUAGE_VALUE = 'none';
|
|
@@ -36,7 +36,7 @@ var createGroupedLanguageOptions = exports.createGroupedLanguageOptions = functi
|
|
|
36
36
|
var plainTextOption = languages.find(function (language) {
|
|
37
37
|
return language.value === PLAIN_TEXT_LANGUAGE_VALUE;
|
|
38
38
|
});
|
|
39
|
-
var pinnedOptions = (0,
|
|
39
|
+
var pinnedOptions = (0, _fg.fg)('platform_editor_code_block_language_detection_flow') ? [getDetectLanguageOption(formatMessage)] : [];
|
|
40
40
|
if (plainTextOption) {
|
|
41
41
|
pinnedOptions.push(_objectSpread(_objectSpread({}, plainTextOption), {}, {
|
|
42
42
|
selectionSource: 'pinned'
|
|
@@ -7,7 +7,7 @@ import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
|
|
|
7
7
|
import { findCodeBlock } from '@atlaskit/editor-common/transforms';
|
|
8
8
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
9
9
|
import { findParentNodeOfType, findSelectedNodeOfType, isNodeSelection, removeParentNodeOfType, removeSelectedNode, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
10
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
11
11
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
12
|
import { ACTIONS } from '../pm-plugins/actions';
|
|
13
13
|
import { autoDetectPluginKey } from '../pm-plugins/auto-detect-state';
|
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import { getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
3
3
|
import { codeBlockWrappedStates, defaultWordWrapState } from '@atlaskit/editor-common/code-block';
|
|
4
4
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
6
6
|
import { resetShouldIgnoreFollowingMutations } from '../editor-commands';
|
|
7
7
|
import { getPluginState } from '../pm-plugins/main-state';
|
|
8
8
|
import { codeBlockClassNames } from '../ui/class-names';
|
|
@@ -2,7 +2,7 @@ import { getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
3
|
import { findCodeBlock } from '@atlaskit/editor-common/transforms';
|
|
4
4
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
6
6
|
export const codeBlockAutoFullStopTransformPluginKey = new PluginKey('codeBlockAutoFullStopTransformPluginKey');
|
|
7
7
|
export function codeBlockAutoFullStopTransformPlugin() {
|
|
8
8
|
return new SafePlugin({
|
|
@@ -8,7 +8,7 @@ import CopyIcon from '@atlaskit/icon/core/copy';
|
|
|
8
8
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
9
9
|
import ListNumberedIcon from '@atlaskit/icon/core/list-numbered';
|
|
10
10
|
import TextWrapIcon from '@atlaskit/icon/core/text-wrap';
|
|
11
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
12
12
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
13
13
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
14
14
|
import { changeLanguage, copyContentToClipboardWithAnalytics, createFormatCodeOnClick, removeCodeBlockWithAnalytics, resetCopiedState, toggleLineNumbersForCodeBlockNode, toggleWordWrapStateForCodeBlockNode } from '../editor-commands';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useState } from 'react';
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
3
3
|
import { changeLanguage, detectLanguage } from '../editor-commands';
|
|
4
4
|
import { DETECT_LANGUAGE_VALUE } from './language-picker-options';
|
|
5
5
|
import { LanguagePicker } from './LanguagePicker';
|
|
@@ -2,7 +2,8 @@ import React, { useCallback } from 'react';
|
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import { codeBlockButtonMessages } from '@atlaskit/editor-common/messages';
|
|
5
|
-
import AkFlag
|
|
5
|
+
import AkFlag from '@atlaskit/flag/flag';
|
|
6
|
+
import { FlagGroup } from '@atlaskit/flag/flag-group';
|
|
6
7
|
import StatusErrorIcon from '@atlaskit/icon/core/status-error';
|
|
7
8
|
import { ACTIONS } from '../pm-plugins/actions';
|
|
8
9
|
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
import "./LanguagePicker.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React, { Fragment, useCallback, useMemo, useRef, useState } from 'react';
|
|
5
|
-
import Button from '@atlaskit/button/
|
|
5
|
+
import Button from '@atlaskit/button/default/button';
|
|
6
6
|
import { codeBlockButtonMessages } from '@atlaskit/editor-common/messages';
|
|
7
7
|
import { akEditorLineHeight } from '@atlaskit/editor-shared-styles';
|
|
8
8
|
import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
|
|
9
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
10
10
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
11
|
-
import { PopupSelect
|
|
11
|
+
import { PopupSelect } from '@atlaskit/select/popup-select';
|
|
12
|
+
import { components } from '@atlaskit/react-select/components';
|
|
12
13
|
import { createGroupedLanguageOptions } from './language-picker-options';
|
|
13
14
|
const pickerOptionStyles = null;
|
|
14
15
|
const styles = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { codeBlockButtonMessages } from '@atlaskit/editor-common/messages';
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
3
3
|
export const NONE_LANGUAGE_VALUE = 'none';
|
|
4
4
|
export const DETECT_LANGUAGE_VALUE = 'autodetect';
|
|
5
5
|
export const PLAIN_TEXT_LANGUAGE_VALUE = 'text';
|
|
@@ -10,7 +10,7 @@ import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
|
|
|
10
10
|
import { findCodeBlock } from '@atlaskit/editor-common/transforms';
|
|
11
11
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
12
12
|
import { findParentNodeOfType, findSelectedNodeOfType, isNodeSelection, removeParentNodeOfType, removeSelectedNode, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
13
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
14
14
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
15
15
|
import { ACTIONS } from '../pm-plugins/actions';
|
|
16
16
|
import { autoDetectPluginKey } from '../pm-plugins/auto-detect-state';
|
|
@@ -6,7 +6,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
6
6
|
import { getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
7
7
|
import { codeBlockWrappedStates, defaultWordWrapState } from '@atlaskit/editor-common/code-block';
|
|
8
8
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
9
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
10
10
|
import { resetShouldIgnoreFollowingMutations } from '../editor-commands';
|
|
11
11
|
import { getPluginState } from '../pm-plugins/main-state';
|
|
12
12
|
import { codeBlockClassNames } from '../ui/class-names';
|
|
@@ -2,7 +2,7 @@ import { getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
3
|
import { findCodeBlock } from '@atlaskit/editor-common/transforms';
|
|
4
4
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
6
6
|
export var codeBlockAutoFullStopTransformPluginKey = new PluginKey('codeBlockAutoFullStopTransformPluginKey');
|
|
7
7
|
export function codeBlockAutoFullStopTransformPlugin() {
|
|
8
8
|
return new SafePlugin({
|
|
@@ -12,7 +12,7 @@ import CopyIcon from '@atlaskit/icon/core/copy';
|
|
|
12
12
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
13
13
|
import ListNumberedIcon from '@atlaskit/icon/core/list-numbered';
|
|
14
14
|
import TextWrapIcon from '@atlaskit/icon/core/text-wrap';
|
|
15
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
16
16
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
17
17
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
18
18
|
import { changeLanguage, copyContentToClipboardWithAnalytics, createFormatCodeOnClick, removeCodeBlockWithAnalytics, resetCopiedState, toggleLineNumbersForCodeBlockNode, toggleWordWrapStateForCodeBlockNode } from '../editor-commands';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import React, { useCallback, useState } from 'react';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
4
4
|
import { changeLanguage, detectLanguage } from '../editor-commands';
|
|
5
5
|
import { DETECT_LANGUAGE_VALUE } from './language-picker-options';
|
|
6
6
|
import { LanguagePicker } from './LanguagePicker';
|
|
@@ -2,7 +2,8 @@ import React, { useCallback } from 'react';
|
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import { codeBlockButtonMessages } from '@atlaskit/editor-common/messages';
|
|
5
|
-
import AkFlag
|
|
5
|
+
import AkFlag from '@atlaskit/flag/flag';
|
|
6
|
+
import { FlagGroup } from '@atlaskit/flag/flag-group';
|
|
6
7
|
import StatusErrorIcon from '@atlaskit/icon/core/status-error';
|
|
7
8
|
import { ACTIONS } from '../pm-plugins/actions';
|
|
8
9
|
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
@@ -7,13 +7,14 @@ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol
|
|
|
7
7
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
8
8
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
9
9
|
import React, { Fragment, useCallback, useMemo, useRef, useState } from 'react';
|
|
10
|
-
import Button from '@atlaskit/button/
|
|
10
|
+
import Button from '@atlaskit/button/default/button';
|
|
11
11
|
import { codeBlockButtonMessages } from '@atlaskit/editor-common/messages';
|
|
12
12
|
import { akEditorLineHeight } from '@atlaskit/editor-shared-styles';
|
|
13
13
|
import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
|
|
14
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
15
15
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
16
|
-
import { PopupSelect
|
|
16
|
+
import { PopupSelect } from '@atlaskit/select/popup-select';
|
|
17
|
+
import { components } from '@atlaskit/react-select/components';
|
|
17
18
|
import { createGroupedLanguageOptions } from './language-picker-options';
|
|
18
19
|
var pickerOptionStyles = null;
|
|
19
20
|
var styles = {
|
|
@@ -3,7 +3,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
3
3
|
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; }
|
|
4
4
|
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; }
|
|
5
5
|
import { codeBlockButtonMessages } from '@atlaskit/editor-common/messages';
|
|
6
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
7
7
|
export var NONE_LANGUAGE_VALUE = 'none';
|
|
8
8
|
export var DETECT_LANGUAGE_VALUE = 'autodetect';
|
|
9
9
|
export var PLAIN_TEXT_LANGUAGE_VALUE = 'text';
|
|
@@ -2,24 +2,24 @@ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
|
2
2
|
export declare const isSelectionEntirelyInsideCodeBlock: (state: EditorState) => boolean;
|
|
3
3
|
export declare const isCursorInsideCodeBlock: (state: EditorState) => boolean;
|
|
4
4
|
export declare const getStartOfCurrentLine: (state: EditorState) => {
|
|
5
|
-
text: string;
|
|
6
5
|
pos: number;
|
|
6
|
+
text: string;
|
|
7
7
|
};
|
|
8
8
|
export declare const getEndOfCurrentLine: (state: EditorState) => {
|
|
9
|
-
text: string;
|
|
10
9
|
pos: number;
|
|
10
|
+
text: string;
|
|
11
11
|
};
|
|
12
12
|
export declare function getLinesFromSelection(state: EditorState): {
|
|
13
|
-
text: string;
|
|
14
|
-
start: number;
|
|
15
13
|
end: number;
|
|
14
|
+
start: number;
|
|
15
|
+
text: string;
|
|
16
16
|
};
|
|
17
17
|
export declare const forEachLine: (text: string, callback: (line: string, offset: number) => void) => void;
|
|
18
18
|
export declare const getLineInfo: (line: string) => {
|
|
19
|
+
indentText: string;
|
|
19
20
|
indentToken: {
|
|
20
|
-
token: string;
|
|
21
|
-
size: number;
|
|
22
21
|
regex: RegExp;
|
|
22
|
+
size: number;
|
|
23
|
+
token: string;
|
|
23
24
|
};
|
|
24
|
-
indentText: string;
|
|
25
25
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl';
|
|
2
|
-
import type { GroupType } from '@atlaskit/select';
|
|
2
|
+
import type { GroupType } from '@atlaskit/select/types';
|
|
3
3
|
export declare const NONE_LANGUAGE_VALUE = "none";
|
|
4
4
|
export declare const DETECT_LANGUAGE_VALUE = "autodetect";
|
|
5
5
|
export declare const PLAIN_TEXT_LANGUAGE_VALUE = "text";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-code-block",
|
|
3
|
-
"version": "17.0.
|
|
3
|
+
"version": "17.0.15",
|
|
4
4
|
"description": "Code block plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"@atlaskit/platform-feature-flags": "^2.1.0",
|
|
44
44
|
"@atlaskit/primitives": "^22.4.0",
|
|
45
45
|
"@atlaskit/prosemirror-input-rules": "^4.0.0",
|
|
46
|
+
"@atlaskit/react-select": "^4.8.0",
|
|
46
47
|
"@atlaskit/select": "^22.8.0",
|
|
47
48
|
"@atlaskit/tmp-editor-statsig": "^159.0.0",
|
|
48
49
|
"@atlaskit/tokens": "^16.8.0",
|