@atlaskit/editor-plugin-code-block 8.0.8 → 8.0.10
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/codeBlockPlugin.js +20 -1
- package/dist/es2019/codeBlockPlugin.js +42 -23
- package/dist/esm/codeBlockPlugin.js +20 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-code-block
|
|
2
2
|
|
|
3
|
+
## 8.0.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 8.0.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`a4db0a2351f7d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a4db0a2351f7d) -
|
|
14
|
+
[ux] ED-29502 Add plain text quick insert option to codeBlockPlugin
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 8.0.8
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -13,6 +13,7 @@ var _blockMenu = require("@atlaskit/editor-common/block-menu");
|
|
|
13
13
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
14
14
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
15
15
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
16
17
|
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
17
18
|
var _editorCommands = require("./editor-commands");
|
|
18
19
|
var _codeBlockAutoFullStopTransformPlugin = require("./pm-plugins/codeBlockAutoFullStopTransformPlugin");
|
|
@@ -115,7 +116,7 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
|
|
|
115
116
|
pluginsOptions: {
|
|
116
117
|
quickInsert: function quickInsert(_ref5) {
|
|
117
118
|
var formatMessage = _ref5.formatMessage;
|
|
118
|
-
|
|
119
|
+
var quickInsertItems = [{
|
|
119
120
|
id: 'codeblock',
|
|
120
121
|
title: formatMessage(_messages.blockTypeMessages.codeblock),
|
|
121
122
|
description: formatMessage(_messages.blockTypeMessages.codeblockDescription),
|
|
@@ -142,6 +143,24 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
|
|
|
142
143
|
return tr;
|
|
143
144
|
}
|
|
144
145
|
}];
|
|
146
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_plain_text_support', 'isEnabled', true)) {
|
|
147
|
+
quickInsertItems.push({
|
|
148
|
+
id: 'plainText',
|
|
149
|
+
title: formatMessage(_messages.blockTypeMessages.plainTextCodeblock),
|
|
150
|
+
description: formatMessage(_messages.blockTypeMessages.plainTextCodeblockDescription),
|
|
151
|
+
keywords: ['plain text'],
|
|
152
|
+
icon: function icon() {
|
|
153
|
+
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconCode, null);
|
|
154
|
+
},
|
|
155
|
+
action: function action(_insert, state) {
|
|
156
|
+
var tr = (0, _editorCommands.createInsertCodeBlockTransaction)({
|
|
157
|
+
state: state
|
|
158
|
+
});
|
|
159
|
+
return tr;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
return quickInsertItems;
|
|
145
164
|
},
|
|
146
165
|
floatingToolbar: (0, _toolbar.getToolbarConfig)(options === null || options === void 0 ? void 0 : options.allowCopyToClipboard, api, options === null || options === void 0 ? void 0 : options.overrideLanguageName)
|
|
147
166
|
}
|
|
@@ -5,6 +5,7 @@ import { FORMAT_MENU_ITEM, FORMAT_CODE_BLOCK_MENU_ITEM, FORMAT_NESTED_MENU_RANK,
|
|
|
5
5
|
import { blockTypeMessages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { IconCode } from '@atlaskit/editor-common/quick-insert';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
9
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
9
10
|
import { createInsertCodeBlockTransaction, insertCodeBlockWithAnalytics } from './editor-commands';
|
|
10
11
|
import { codeBlockAutoFullStopTransformPlugin } from './pm-plugins/codeBlockAutoFullStopTransformPlugin';
|
|
@@ -100,31 +101,49 @@ const codeBlockPlugin = ({
|
|
|
100
101
|
pluginsOptions: {
|
|
101
102
|
quickInsert: ({
|
|
102
103
|
formatMessage
|
|
103
|
-
}) =>
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
104
|
+
}) => {
|
|
105
|
+
const quickInsertItems = [{
|
|
106
|
+
id: 'codeblock',
|
|
107
|
+
title: formatMessage(blockTypeMessages.codeblock),
|
|
108
|
+
description: formatMessage(blockTypeMessages.codeblockDescription),
|
|
109
|
+
keywords: ['code block'],
|
|
110
|
+
priority: 700,
|
|
111
|
+
keyshortcut: '```',
|
|
112
|
+
icon: () => /*#__PURE__*/React.createElement(IconCode, null),
|
|
113
|
+
action(_insert, state) {
|
|
114
|
+
var _api$analytics3;
|
|
115
|
+
const tr = createInsertCodeBlockTransaction({
|
|
116
|
+
state
|
|
117
|
+
});
|
|
118
|
+
api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions.attachAnalyticsEvent({
|
|
119
|
+
action: ACTION.INSERTED,
|
|
120
|
+
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
121
|
+
actionSubjectId: ACTION_SUBJECT_ID.CODE_BLOCK,
|
|
122
|
+
attributes: {
|
|
123
|
+
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
124
|
+
},
|
|
125
|
+
eventType: EVENT_TYPE.TRACK
|
|
126
|
+
})(tr);
|
|
127
|
+
return tr;
|
|
128
|
+
}
|
|
129
|
+
}];
|
|
130
|
+
if (expValEquals('platform_editor_plain_text_support', 'isEnabled', true)) {
|
|
131
|
+
quickInsertItems.push({
|
|
132
|
+
id: 'plainText',
|
|
133
|
+
title: formatMessage(blockTypeMessages.plainTextCodeblock),
|
|
134
|
+
description: formatMessage(blockTypeMessages.plainTextCodeblockDescription),
|
|
135
|
+
keywords: ['plain text'],
|
|
136
|
+
icon: () => /*#__PURE__*/React.createElement(IconCode, null),
|
|
137
|
+
action(_insert, state) {
|
|
138
|
+
const tr = createInsertCodeBlockTransaction({
|
|
139
|
+
state
|
|
140
|
+
});
|
|
141
|
+
return tr;
|
|
142
|
+
}
|
|
115
143
|
});
|
|
116
|
-
api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions.attachAnalyticsEvent({
|
|
117
|
-
action: ACTION.INSERTED,
|
|
118
|
-
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
119
|
-
actionSubjectId: ACTION_SUBJECT_ID.CODE_BLOCK,
|
|
120
|
-
attributes: {
|
|
121
|
-
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
122
|
-
},
|
|
123
|
-
eventType: EVENT_TYPE.TRACK
|
|
124
|
-
})(tr);
|
|
125
|
-
return tr;
|
|
126
144
|
}
|
|
127
|
-
|
|
145
|
+
return quickInsertItems;
|
|
146
|
+
},
|
|
128
147
|
floatingToolbar: getToolbarConfig(options === null || options === void 0 ? void 0 : options.allowCopyToClipboard, api, options === null || options === void 0 ? void 0 : options.overrideLanguageName)
|
|
129
148
|
}
|
|
130
149
|
};
|
|
@@ -8,6 +8,7 @@ import { FORMAT_MENU_ITEM, FORMAT_CODE_BLOCK_MENU_ITEM, FORMAT_NESTED_MENU_RANK,
|
|
|
8
8
|
import { blockTypeMessages } from '@atlaskit/editor-common/messages';
|
|
9
9
|
import { IconCode } from '@atlaskit/editor-common/quick-insert';
|
|
10
10
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
12
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
12
13
|
import { createInsertCodeBlockTransaction, insertCodeBlockWithAnalytics } from './editor-commands';
|
|
13
14
|
import { codeBlockAutoFullStopTransformPlugin } from './pm-plugins/codeBlockAutoFullStopTransformPlugin';
|
|
@@ -108,7 +109,7 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
|
|
|
108
109
|
pluginsOptions: {
|
|
109
110
|
quickInsert: function quickInsert(_ref5) {
|
|
110
111
|
var formatMessage = _ref5.formatMessage;
|
|
111
|
-
|
|
112
|
+
var quickInsertItems = [{
|
|
112
113
|
id: 'codeblock',
|
|
113
114
|
title: formatMessage(blockTypeMessages.codeblock),
|
|
114
115
|
description: formatMessage(blockTypeMessages.codeblockDescription),
|
|
@@ -135,6 +136,24 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
|
|
|
135
136
|
return tr;
|
|
136
137
|
}
|
|
137
138
|
}];
|
|
139
|
+
if (expValEquals('platform_editor_plain_text_support', 'isEnabled', true)) {
|
|
140
|
+
quickInsertItems.push({
|
|
141
|
+
id: 'plainText',
|
|
142
|
+
title: formatMessage(blockTypeMessages.plainTextCodeblock),
|
|
143
|
+
description: formatMessage(blockTypeMessages.plainTextCodeblockDescription),
|
|
144
|
+
keywords: ['plain text'],
|
|
145
|
+
icon: function icon() {
|
|
146
|
+
return /*#__PURE__*/React.createElement(IconCode, null);
|
|
147
|
+
},
|
|
148
|
+
action: function action(_insert, state) {
|
|
149
|
+
var tr = createInsertCodeBlockTransaction({
|
|
150
|
+
state: state
|
|
151
|
+
});
|
|
152
|
+
return tr;
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
return quickInsertItems;
|
|
138
157
|
},
|
|
139
158
|
floatingToolbar: getToolbarConfig(options === null || options === void 0 ? void 0 : options.allowCopyToClipboard, api, options === null || options === void 0 ? void 0 : options.overrideLanguageName)
|
|
140
159
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-code-block",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.10",
|
|
4
4
|
"description": "Code block plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,21 +33,21 @@
|
|
|
33
33
|
"@atlaskit/editor-plugin-block-menu": "^4.0.0",
|
|
34
34
|
"@atlaskit/editor-plugin-composition": "^5.0.0",
|
|
35
35
|
"@atlaskit/editor-plugin-decorations": "^6.1.0",
|
|
36
|
-
"@atlaskit/editor-plugin-editor-disabled": "^6.
|
|
36
|
+
"@atlaskit/editor-plugin-editor-disabled": "^6.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-editor-viewmode": "^8.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-interaction": "^8.0.0",
|
|
39
39
|
"@atlaskit/editor-plugin-selection": "^6.1.0",
|
|
40
|
-
"@atlaskit/editor-plugin-toolbar": "^3.
|
|
40
|
+
"@atlaskit/editor-plugin-toolbar": "^3.2.0",
|
|
41
41
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
42
|
-
"@atlaskit/editor-toolbar": "^0.
|
|
43
|
-
"@atlaskit/icon": "^28.
|
|
42
|
+
"@atlaskit/editor-toolbar": "^0.15.0",
|
|
43
|
+
"@atlaskit/icon": "^28.5.0",
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
45
|
-
"@atlaskit/prosemirror-input-rules": "^3.
|
|
46
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
45
|
+
"@atlaskit/prosemirror-input-rules": "^3.5.0",
|
|
46
|
+
"@atlaskit/tmp-editor-statsig": "^13.8.0",
|
|
47
47
|
"@babel/runtime": "^7.0.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@atlaskit/editor-common": "^110.
|
|
50
|
+
"@atlaskit/editor-common": "^110.10.0",
|
|
51
51
|
"react": "^18.2.0",
|
|
52
52
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
53
53
|
},
|