@atlaskit/editor-plugin-code-block 1.5.2 → 3.0.0

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,33 @@
1
1
  # @atlaskit/editor-plugin-code-block
2
2
 
3
+ ## 3.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#117111](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/117111)
8
+ [`6f06e433f9724`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6f06e433f9724) -
9
+ Remove option for "appearance" from `editor-plugin-code-block`. This configuration is completely
10
+ unused and has no effect. It is safe to remove if you are currently using this prop for
11
+ configuration.
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
17
+ ## 2.0.0
18
+
19
+ ### Major Changes
20
+
21
+ - [`d9b562bd66f8e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d9b562bd66f8e) -
22
+ [ux] [ED-23947] restoring the original order of the typeahead menu so that actions, media,
23
+ mentions and emojis are above the fold (in the top 5 results). this change is a major because it
24
+ removes the `getEditorFeatureFlags prop` for plugins. if any consumers who have adopted these
25
+ changes to the public API, they should remove them on their side too.
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies
30
+
3
31
  ## 1.5.2
4
32
 
5
33
  ### Patch Changes
@@ -36,11 +36,9 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
36
36
  return [{
37
37
  name: 'codeBlock',
38
38
  plugin: function plugin(_ref2) {
39
- var _options$appearance;
40
39
  var getIntl = _ref2.getIntl;
41
40
  return (0, _main.createPlugin)(_objectSpread(_objectSpread({}, options), {}, {
42
41
  getIntl: getIntl,
43
- appearance: (_options$appearance = options === null || options === void 0 ? void 0 : options.appearance) !== null && _options$appearance !== void 0 ? _options$appearance : 'comment',
44
42
  api: api
45
43
  }));
46
44
  }
@@ -85,14 +83,13 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
85
83
  },
86
84
  pluginsOptions: {
87
85
  quickInsert: function quickInsert(_ref5) {
88
- var _options$getEditorFea;
89
86
  var formatMessage = _ref5.formatMessage;
90
87
  return [{
91
88
  id: 'codeblock',
92
89
  title: formatMessage(_messages.blockTypeMessages.codeblock),
93
90
  description: formatMessage(_messages.blockTypeMessages.codeblockDescription),
94
91
  keywords: ['code block'],
95
- priority: options !== null && options !== void 0 && (_options$getEditorFea = options.getEditorFeatureFlags) !== null && _options$getEditorFea !== void 0 && _options$getEditorFea.call(options).platformEditorTypeaheadImprovedRelevancy ? 400 : 700,
92
+ priority: 700,
96
93
  keyshortcut: '```',
97
94
  icon: function icon() {
98
95
  return /*#__PURE__*/_react.default.createElement(_quickInsert.IconCode, null);
@@ -22,7 +22,6 @@ var createPlugin = exports.createPlugin = function createPlugin(_ref) {
22
22
  var _ref$useLongPressSele = _ref.useLongPressSelection,
23
23
  useLongPressSelection = _ref$useLongPressSele === void 0 ? false : _ref$useLongPressSele,
24
24
  getIntl = _ref.getIntl,
25
- appearance = _ref.appearance,
26
25
  _ref$allowComposition = _ref.allowCompositionInputOverride,
27
26
  allowCompositionInputOverride = _ref$allowComposition === void 0 ? false : _ref$allowComposition,
28
27
  api = _ref.api;
@@ -27,15 +27,11 @@ const codeBlockPlugin = ({
27
27
  name: 'codeBlock',
28
28
  plugin: ({
29
29
  getIntl
30
- }) => {
31
- var _options$appearance;
32
- return createPlugin({
33
- ...options,
34
- getIntl,
35
- appearance: (_options$appearance = options === null || options === void 0 ? void 0 : options.appearance) !== null && _options$appearance !== void 0 ? _options$appearance : 'comment',
36
- api
37
- });
38
- }
30
+ }) => createPlugin({
31
+ ...options,
32
+ getIntl,
33
+ api
34
+ })
39
35
  }, {
40
36
  name: 'codeBlockInputRule',
41
37
  plugin: ({
@@ -74,34 +70,31 @@ const codeBlockPlugin = ({
74
70
  pluginsOptions: {
75
71
  quickInsert: ({
76
72
  formatMessage
77
- }) => {
78
- var _options$getEditorFea;
79
- return [{
80
- id: 'codeblock',
81
- title: formatMessage(blockTypeMessages.codeblock),
82
- description: formatMessage(blockTypeMessages.codeblockDescription),
83
- keywords: ['code block'],
84
- priority: options !== null && options !== void 0 && (_options$getEditorFea = options.getEditorFeatureFlags) !== null && _options$getEditorFea !== void 0 && _options$getEditorFea.call(options).platformEditorTypeaheadImprovedRelevancy ? 400 : 700,
85
- keyshortcut: '```',
86
- icon: () => /*#__PURE__*/React.createElement(IconCode, null),
87
- action(_insert, state) {
88
- var _api$analytics3;
89
- const tr = createInsertCodeBlockTransaction({
90
- state
91
- });
92
- api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions.attachAnalyticsEvent({
93
- action: ACTION.INSERTED,
94
- actionSubject: ACTION_SUBJECT.DOCUMENT,
95
- actionSubjectId: ACTION_SUBJECT_ID.CODE_BLOCK,
96
- attributes: {
97
- inputMethod: INPUT_METHOD.QUICK_INSERT
98
- },
99
- eventType: EVENT_TYPE.TRACK
100
- })(tr);
101
- return tr;
102
- }
103
- }];
104
- },
73
+ }) => [{
74
+ id: 'codeblock',
75
+ title: formatMessage(blockTypeMessages.codeblock),
76
+ description: formatMessage(blockTypeMessages.codeblockDescription),
77
+ keywords: ['code block'],
78
+ priority: 700,
79
+ keyshortcut: '```',
80
+ icon: () => /*#__PURE__*/React.createElement(IconCode, null),
81
+ action(_insert, state) {
82
+ var _api$analytics3;
83
+ const tr = createInsertCodeBlockTransaction({
84
+ state
85
+ });
86
+ api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions.attachAnalyticsEvent({
87
+ action: ACTION.INSERTED,
88
+ actionSubject: ACTION_SUBJECT.DOCUMENT,
89
+ actionSubjectId: ACTION_SUBJECT_ID.CODE_BLOCK,
90
+ attributes: {
91
+ inputMethod: INPUT_METHOD.QUICK_INSERT
92
+ },
93
+ eventType: EVENT_TYPE.TRACK
94
+ })(tr);
95
+ return tr;
96
+ }
97
+ }],
105
98
  floatingToolbar: getToolbarConfig(options === null || options === void 0 ? void 0 : options.allowCopyToClipboard, api)
106
99
  }
107
100
  });
@@ -11,7 +11,6 @@ import { ACTIONS } from './actions';
11
11
  export const createPlugin = ({
12
12
  useLongPressSelection = false,
13
13
  getIntl,
14
- appearance,
15
14
  allowCompositionInputOverride = false,
16
15
  api
17
16
  }) => {
@@ -29,11 +29,9 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
29
29
  return [{
30
30
  name: 'codeBlock',
31
31
  plugin: function plugin(_ref2) {
32
- var _options$appearance;
33
32
  var getIntl = _ref2.getIntl;
34
33
  return createPlugin(_objectSpread(_objectSpread({}, options), {}, {
35
34
  getIntl: getIntl,
36
- appearance: (_options$appearance = options === null || options === void 0 ? void 0 : options.appearance) !== null && _options$appearance !== void 0 ? _options$appearance : 'comment',
37
35
  api: api
38
36
  }));
39
37
  }
@@ -78,14 +76,13 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
78
76
  },
79
77
  pluginsOptions: {
80
78
  quickInsert: function quickInsert(_ref5) {
81
- var _options$getEditorFea;
82
79
  var formatMessage = _ref5.formatMessage;
83
80
  return [{
84
81
  id: 'codeblock',
85
82
  title: formatMessage(blockTypeMessages.codeblock),
86
83
  description: formatMessage(blockTypeMessages.codeblockDescription),
87
84
  keywords: ['code block'],
88
- priority: options !== null && options !== void 0 && (_options$getEditorFea = options.getEditorFeatureFlags) !== null && _options$getEditorFea !== void 0 && _options$getEditorFea.call(options).platformEditorTypeaheadImprovedRelevancy ? 400 : 700,
85
+ priority: 700,
89
86
  keyshortcut: '```',
90
87
  icon: function icon() {
91
88
  return /*#__PURE__*/React.createElement(IconCode, null);
@@ -15,7 +15,6 @@ export var createPlugin = function createPlugin(_ref) {
15
15
  var _ref$useLongPressSele = _ref.useLongPressSelection,
16
16
  useLongPressSelection = _ref$useLongPressSele === void 0 ? false : _ref$useLongPressSele,
17
17
  getIntl = _ref.getIntl,
18
- appearance = _ref.appearance,
19
18
  _ref$allowComposition = _ref.allowCompositionInputOverride,
20
19
  allowCompositionInputOverride = _ref$allowComposition === void 0 ? false : _ref$allowComposition,
21
20
  api = _ref.api;
@@ -1,12 +1,11 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- import type { EditorAppearance, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
4
  import type { CodeBlockPlugin } from '../index';
5
5
  import type { CodeBlockState } from './main-state';
6
- export declare const createPlugin: ({ useLongPressSelection, getIntl, appearance, allowCompositionInputOverride, api, }: {
6
+ export declare const createPlugin: ({ useLongPressSelection, getIntl, allowCompositionInputOverride, api, }: {
7
7
  useLongPressSelection?: boolean | undefined;
8
8
  getIntl: () => IntlShape;
9
- appearance: EditorAppearance;
10
9
  allowCompositionInputOverride?: boolean | undefined;
11
10
  api?: import("@atlaskit/editor-common/types").EditorInjectionAPI<"codeBlock", {
12
11
  pluginConfiguration: import("../types").CodeBlockOptions | undefined;
@@ -1,7 +1,5 @@
1
- import type { EditorAppearance, GetEditorFeatureFlags, LongPressSelectionPluginOptions } from '@atlaskit/editor-common/types';
1
+ import type { LongPressSelectionPluginOptions } from '@atlaskit/editor-common/types';
2
2
  export interface CodeBlockOptions extends LongPressSelectionPluginOptions {
3
3
  allowCopyToClipboard?: boolean;
4
4
  allowCompositionInputOverride?: boolean;
5
- appearance?: EditorAppearance | undefined;
6
- getEditorFeatureFlags?: GetEditorFeatureFlags;
7
5
  }
@@ -1,12 +1,11 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- import type { EditorAppearance, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
4
  import type { CodeBlockPlugin } from '../index';
5
5
  import type { CodeBlockState } from './main-state';
6
- export declare const createPlugin: ({ useLongPressSelection, getIntl, appearance, allowCompositionInputOverride, api, }: {
6
+ export declare const createPlugin: ({ useLongPressSelection, getIntl, allowCompositionInputOverride, api, }: {
7
7
  useLongPressSelection?: boolean | undefined;
8
8
  getIntl: () => IntlShape;
9
- appearance: EditorAppearance;
10
9
  allowCompositionInputOverride?: boolean | undefined;
11
10
  api?: import("@atlaskit/editor-common/types").EditorInjectionAPI<"codeBlock", {
12
11
  pluginConfiguration: import("../types").CodeBlockOptions | undefined;
@@ -1,7 +1,5 @@
1
- import type { EditorAppearance, GetEditorFeatureFlags, LongPressSelectionPluginOptions } from '@atlaskit/editor-common/types';
1
+ import type { LongPressSelectionPluginOptions } from '@atlaskit/editor-common/types';
2
2
  export interface CodeBlockOptions extends LongPressSelectionPluginOptions {
3
3
  allowCopyToClipboard?: boolean;
4
4
  allowCompositionInputOverride?: boolean;
5
- appearance?: EditorAppearance | undefined;
6
- getEditorFeatureFlags?: GetEditorFeatureFlags;
7
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-code-block",
3
- "version": "1.5.2",
3
+ "version": "3.0.0",
4
4
  "description": "Code block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -8,7 +8,7 @@
8
8
  "registry": "https://registry.npmjs.org/"
9
9
  },
10
10
  "atlassian": {
11
- "team": "Editor: Scarlet",
11
+ "team": "Editor: Core Experiences",
12
12
  "singleton": true,
13
13
  "inPublicMirror": false,
14
14
  "releaseModel": "continuous",
@@ -34,14 +34,14 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@atlaskit/adf-schema": "^39.0.3",
37
- "@atlaskit/code": "^15.3.0",
38
- "@atlaskit/editor-common": "^83.5.0",
37
+ "@atlaskit/code": "^15.4.0",
38
+ "@atlaskit/editor-common": "^84.1.0",
39
39
  "@atlaskit/editor-plugin-analytics": "^1.4.0",
40
40
  "@atlaskit/editor-plugin-composition": "^1.1.0",
41
41
  "@atlaskit/editor-plugin-decorations": "^1.1.0",
42
42
  "@atlaskit/editor-plugin-editor-disabled": "^1.1.0",
43
43
  "@atlaskit/editor-prosemirror": "4.0.1",
44
- "@atlaskit/icon": "^22.5.0",
44
+ "@atlaskit/icon": "^22.6.0",
45
45
  "@atlaskit/platform-feature-flags": "^0.3.0",
46
46
  "@atlaskit/prosemirror-input-rules": "^3.1.0",
47
47
  "@babel/runtime": "^7.0.0",