@atlaskit/editor-plugin-code-block 8.0.8 → 8.0.9

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-plugin-code-block
2
2
 
3
+ ## 8.0.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [`a4db0a2351f7d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a4db0a2351f7d) -
8
+ [ux] ED-29502 Add plain text quick insert option to codeBlockPlugin
9
+ - Updated dependencies
10
+
3
11
  ## 8.0.8
4
12
 
5
13
  ### 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
- return [{
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
- id: 'codeblock',
105
- title: formatMessage(blockTypeMessages.codeblock),
106
- description: formatMessage(blockTypeMessages.codeblockDescription),
107
- keywords: ['code block'],
108
- priority: 700,
109
- keyshortcut: '```',
110
- icon: () => /*#__PURE__*/React.createElement(IconCode, null),
111
- action(_insert, state) {
112
- var _api$analytics3;
113
- const tr = createInsertCodeBlockTransaction({
114
- state
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
- return [{
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.8",
3
+ "version": "8.0.9",
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.0.0",
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
40
  "@atlaskit/editor-plugin-toolbar": "^3.1.0",
41
41
  "@atlaskit/editor-prosemirror": "7.0.0",
42
42
  "@atlaskit/editor-toolbar": "^0.14.0",
43
- "@atlaskit/icon": "^28.4.0",
43
+ "@atlaskit/icon": "^28.5.0",
44
44
  "@atlaskit/platform-feature-flags": "^1.1.0",
45
- "@atlaskit/prosemirror-input-rules": "^3.4.0",
46
- "@atlaskit/tmp-editor-statsig": "^13.4.0",
45
+ "@atlaskit/prosemirror-input-rules": "^3.5.0",
46
+ "@atlaskit/tmp-editor-statsig": "^13.7.0",
47
47
  "@babel/runtime": "^7.0.0"
48
48
  },
49
49
  "peerDependencies": {
50
- "@atlaskit/editor-common": "^110.7.0",
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
  },