@atlaskit/editor-plugin-code-block 19.0.10 → 19.0.11
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 +8 -0
- package/dist/cjs/codeBlockPlugin.js +1 -1
- package/dist/cjs/editor-commands/index.js +1 -2
- package/dist/cjs/pm-plugins/toolbar.js +1 -1
- package/dist/cjs/ui/language-picker-options.js +1 -2
- package/dist/es2019/codeBlockPlugin.js +1 -1
- package/dist/es2019/editor-commands/index.js +1 -2
- package/dist/es2019/pm-plugins/toolbar.js +1 -1
- package/dist/es2019/ui/language-picker-options.js +1 -2
- package/dist/esm/codeBlockPlugin.js +1 -1
- package/dist/esm/editor-commands/index.js +1 -2
- package/dist/esm/pm-plugins/toolbar.js +1 -1
- package/dist/esm/ui/language-picker-options.js +1 -2
- package/package.json +1 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-code-block
|
|
2
2
|
|
|
3
|
+
## 19.0.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`4603ff962783f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4603ff962783f) -
|
|
8
|
+
Clean up feature gate `platform_editor_code_block_language_detection_flow`
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 19.0.10
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -98,7 +98,7 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
|
|
|
98
98
|
var schema = _ref3.schema;
|
|
99
99
|
return (0, _inputRule.createCodeBlockInputRule)(schema, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
100
100
|
}
|
|
101
|
-
}].concat((0, _toConsumableArray2.default)((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_code_block_q4_lovability', 'isEnabled', true)
|
|
101
|
+
}].concat((0, _toConsumableArray2.default)((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_code_block_q4_lovability', 'isEnabled', true) ? [{
|
|
102
102
|
name: 'codeBlockAutoDetect',
|
|
103
103
|
plugin: function plugin() {
|
|
104
104
|
return (0, _autoDetect.createAutoDetectPlugin)(api);
|
|
@@ -20,7 +20,6 @@ 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 _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
24
23
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
25
24
|
var _actions = require("../pm-plugins/actions");
|
|
26
25
|
var _autoDetectState = require("../pm-plugins/auto-detect-state");
|
|
@@ -65,7 +64,7 @@ var changeLanguage = exports.changeLanguage = function changeLanguage(editorAnal
|
|
|
65
64
|
}
|
|
66
65
|
var node = state.doc.nodeAt(pos);
|
|
67
66
|
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)
|
|
67
|
+
var shouldIncludeAutoDetectionContext = (0, _expValEquals.expValEquals)('platform_editor_code_block_q4_lovability', 'isEnabled', true);
|
|
69
68
|
var previousAutoDetectEntry = shouldIncludeAutoDetectionContext ? (_autoDetectPluginKey$ = _autoDetectState.autoDetectPluginKey.getState(state)) === null || _autoDetectPluginKey$ === void 0 ? void 0 : _autoDetectPluginKey$.languageDetectionMap[localId] : undefined;
|
|
70
69
|
var tr = state.tr.setNodeMarkup(pos, codeBlock, _objectSpread(_objectSpread({}, node === null || node === void 0 ? void 0 : node.attrs), {}, {
|
|
71
70
|
language: language
|
|
@@ -150,7 +150,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig() {
|
|
|
150
150
|
var areAnyNewToolbarFlagsEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
|
|
151
151
|
var languagePicker;
|
|
152
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'
|
|
153
|
+
var autoDetectEntry = typeof localId === 'string' ? autoDetectState === null || autoDetectState === void 0 ? void 0 : autoDetectState.languageDetectionMap[localId] : undefined;
|
|
154
154
|
var autoDetectPickerValue = getAutoDetectPickerValue({
|
|
155
155
|
autoDetectEntry: autoDetectEntry,
|
|
156
156
|
formatMessage: formatMessage,
|
|
@@ -8,7 +8,6 @@ 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 _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
12
11
|
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
12
|
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
13
|
var NONE_LANGUAGE_VALUE = exports.NONE_LANGUAGE_VALUE = 'none';
|
|
@@ -36,7 +35,7 @@ var createGroupedLanguageOptions = exports.createGroupedLanguageOptions = functi
|
|
|
36
35
|
var plainTextOption = languages.find(function (language) {
|
|
37
36
|
return language.value === PLAIN_TEXT_LANGUAGE_VALUE;
|
|
38
37
|
});
|
|
39
|
-
var pinnedOptions =
|
|
38
|
+
var pinnedOptions = [getDetectLanguageOption(formatMessage)];
|
|
40
39
|
if (plainTextOption) {
|
|
41
40
|
pinnedOptions.push(_objectSpread(_objectSpread({}, plainTextOption), {}, {
|
|
42
41
|
selectionSource: 'pinned'
|
|
@@ -89,7 +89,7 @@ const codeBlockPlugin = ({
|
|
|
89
89
|
var _api$analytics;
|
|
90
90
|
return createCodeBlockInputRule(schema, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
91
91
|
}
|
|
92
|
-
}, ...(expValEqualsNoExposure('platform_editor_code_block_q4_lovability', 'isEnabled', true)
|
|
92
|
+
}, ...(expValEqualsNoExposure('platform_editor_code_block_q4_lovability', 'isEnabled', true) ? [{
|
|
93
93
|
name: 'codeBlockAutoDetect',
|
|
94
94
|
plugin: () => createAutoDetectPlugin(api)
|
|
95
95
|
}] : []), {
|
|
@@ -7,7 +7,6 @@ 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/fg';
|
|
11
10
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
11
|
import { ACTIONS } from '../pm-plugins/actions';
|
|
13
12
|
import { autoDetectPluginKey } from '../pm-plugins/auto-detect-state';
|
|
@@ -54,7 +53,7 @@ export const changeLanguage = editorAnalyticsAPI => (language, selectionSource)
|
|
|
54
53
|
}
|
|
55
54
|
const node = state.doc.nodeAt(pos);
|
|
56
55
|
const localId = node === null || node === void 0 ? void 0 : node.attrs.localId;
|
|
57
|
-
const shouldIncludeAutoDetectionContext = expValEquals('platform_editor_code_block_q4_lovability', 'isEnabled', true)
|
|
56
|
+
const shouldIncludeAutoDetectionContext = expValEquals('platform_editor_code_block_q4_lovability', 'isEnabled', true);
|
|
58
57
|
const previousAutoDetectEntry = shouldIncludeAutoDetectionContext ? (_autoDetectPluginKey$ = autoDetectPluginKey.getState(state)) === null || _autoDetectPluginKey$ === void 0 ? void 0 : _autoDetectPluginKey$.languageDetectionMap[localId] : undefined;
|
|
59
58
|
const tr = state.tr.setNodeMarkup(pos, codeBlock, {
|
|
60
59
|
...(node === null || node === void 0 ? void 0 : node.attrs),
|
|
@@ -120,7 +120,7 @@ export const getToolbarConfig = (allowCopyToClipboard = false, api, overrideLang
|
|
|
120
120
|
const areAnyNewToolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
|
|
121
121
|
let languagePicker;
|
|
122
122
|
if (expValEquals('platform_editor_code_block_q4_lovability', 'isEnabled', true) && fg('platform_editor_code_block_add_line_number_button')) {
|
|
123
|
-
const autoDetectEntry = typeof localId === 'string'
|
|
123
|
+
const autoDetectEntry = typeof localId === 'string' ? autoDetectState === null || autoDetectState === void 0 ? void 0 : autoDetectState.languageDetectionMap[localId] : undefined;
|
|
124
124
|
const autoDetectPickerValue = getAutoDetectPickerValue({
|
|
125
125
|
autoDetectEntry,
|
|
126
126
|
formatMessage,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { codeBlockButtonMessages } from '@atlaskit/editor-common/messages';
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
3
2
|
export const NONE_LANGUAGE_VALUE = 'none';
|
|
4
3
|
export const DETECT_LANGUAGE_VALUE = 'autodetect';
|
|
5
4
|
export const PLAIN_TEXT_LANGUAGE_VALUE = 'text';
|
|
@@ -17,7 +16,7 @@ export const createGroupedLanguageOptions = ({
|
|
|
17
16
|
const recentlyUsedLanguageValues = new Set(recentlyUsedLanguages.map(language => language.value));
|
|
18
17
|
const allLanguages = languages.filter(language => language.value !== NONE_LANGUAGE_VALUE && language.value !== PLAIN_TEXT_LANGUAGE_VALUE && !recentlyUsedLanguageValues.has(language.value));
|
|
19
18
|
const plainTextOption = languages.find(language => language.value === PLAIN_TEXT_LANGUAGE_VALUE);
|
|
20
|
-
const pinnedOptions =
|
|
19
|
+
const pinnedOptions = [getDetectLanguageOption(formatMessage)];
|
|
21
20
|
if (plainTextOption) {
|
|
22
21
|
pinnedOptions.push({
|
|
23
22
|
...plainTextOption,
|
|
@@ -91,7 +91,7 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
|
|
|
91
91
|
var schema = _ref3.schema;
|
|
92
92
|
return createCodeBlockInputRule(schema, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
93
93
|
}
|
|
94
|
-
}].concat(_toConsumableArray(expValEqualsNoExposure('platform_editor_code_block_q4_lovability', 'isEnabled', true)
|
|
94
|
+
}].concat(_toConsumableArray(expValEqualsNoExposure('platform_editor_code_block_q4_lovability', 'isEnabled', true) ? [{
|
|
95
95
|
name: 'codeBlockAutoDetect',
|
|
96
96
|
plugin: function plugin() {
|
|
97
97
|
return createAutoDetectPlugin(api);
|
|
@@ -10,7 +10,6 @@ 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/fg';
|
|
14
13
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
15
14
|
import { ACTIONS } from '../pm-plugins/actions';
|
|
16
15
|
import { autoDetectPluginKey } from '../pm-plugins/auto-detect-state';
|
|
@@ -53,7 +52,7 @@ export var changeLanguage = function changeLanguage(editorAnalyticsAPI) {
|
|
|
53
52
|
}
|
|
54
53
|
var node = state.doc.nodeAt(pos);
|
|
55
54
|
var localId = node === null || node === void 0 ? void 0 : node.attrs.localId;
|
|
56
|
-
var shouldIncludeAutoDetectionContext = expValEquals('platform_editor_code_block_q4_lovability', 'isEnabled', true)
|
|
55
|
+
var shouldIncludeAutoDetectionContext = expValEquals('platform_editor_code_block_q4_lovability', 'isEnabled', true);
|
|
57
56
|
var previousAutoDetectEntry = shouldIncludeAutoDetectionContext ? (_autoDetectPluginKey$ = autoDetectPluginKey.getState(state)) === null || _autoDetectPluginKey$ === void 0 ? void 0 : _autoDetectPluginKey$.languageDetectionMap[localId] : undefined;
|
|
58
57
|
var tr = state.tr.setNodeMarkup(pos, codeBlock, _objectSpread(_objectSpread({}, node === null || node === void 0 ? void 0 : node.attrs), {}, {
|
|
59
58
|
language: language
|
|
@@ -141,7 +141,7 @@ export var getToolbarConfig = function getToolbarConfig() {
|
|
|
141
141
|
var areAnyNewToolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
|
|
142
142
|
var languagePicker;
|
|
143
143
|
if (expValEquals('platform_editor_code_block_q4_lovability', 'isEnabled', true) && fg('platform_editor_code_block_add_line_number_button')) {
|
|
144
|
-
var autoDetectEntry = typeof localId === 'string'
|
|
144
|
+
var autoDetectEntry = typeof localId === 'string' ? autoDetectState === null || autoDetectState === void 0 ? void 0 : autoDetectState.languageDetectionMap[localId] : undefined;
|
|
145
145
|
var autoDetectPickerValue = getAutoDetectPickerValue({
|
|
146
146
|
autoDetectEntry: autoDetectEntry,
|
|
147
147
|
formatMessage: formatMessage,
|
|
@@ -3,7 +3,6 @@ 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/fg';
|
|
7
6
|
export var NONE_LANGUAGE_VALUE = 'none';
|
|
8
7
|
export var DETECT_LANGUAGE_VALUE = 'autodetect';
|
|
9
8
|
export var PLAIN_TEXT_LANGUAGE_VALUE = 'text';
|
|
@@ -29,7 +28,7 @@ export var createGroupedLanguageOptions = function createGroupedLanguageOptions(
|
|
|
29
28
|
var plainTextOption = languages.find(function (language) {
|
|
30
29
|
return language.value === PLAIN_TEXT_LANGUAGE_VALUE;
|
|
31
30
|
});
|
|
32
|
-
var pinnedOptions =
|
|
31
|
+
var pinnedOptions = [getDetectLanguageOption(formatMessage)];
|
|
33
32
|
if (plainTextOption) {
|
|
34
33
|
pinnedOptions.push(_objectSpread(_objectSpread({}, plainTextOption), {}, {
|
|
35
34
|
selectionSource: 'pinned'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-code-block",
|
|
3
|
-
"version": "19.0.
|
|
3
|
+
"version": "19.0.11",
|
|
4
4
|
"description": "Code block plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -65,9 +65,6 @@
|
|
|
65
65
|
"platform_editor_code_block_add_line_number_button": {
|
|
66
66
|
"type": "boolean"
|
|
67
67
|
},
|
|
68
|
-
"platform_editor_code_block_language_detection_flow": {
|
|
69
|
-
"type": "boolean"
|
|
70
|
-
},
|
|
71
68
|
"platform_editor_code_block_mermaid_language": {
|
|
72
69
|
"type": "boolean"
|
|
73
70
|
}
|