@atlaskit/editor-plugin-code-block 4.4.3 → 4.4.5
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 +15 -0
- package/dist/cjs/pm-plugins/main.js +8 -1
- package/dist/cjs/pm-plugins/toolbar.js +3 -0
- package/dist/es2019/pm-plugins/main.js +8 -1
- package/dist/es2019/pm-plugins/toolbar.js +3 -0
- package/dist/esm/pm-plugins/main.js +8 -1
- package/dist/esm/pm-plugins/toolbar.js +3 -0
- package/dist/types/codeBlockPluginType.d.ts +5 -3
- package/dist/types/pm-plugins/main.d.ts +6 -1
- package/dist/types/pm-plugins/toolbar.d.ts +4 -1
- package/dist/types-ts4.5/codeBlockPluginType.d.ts +5 -3
- package/dist/types-ts4.5/pm-plugins/main.d.ts +7 -1
- package/dist/types-ts4.5/pm-plugins/toolbar.d.ts +4 -1
- package/package.json +10 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-code-block
|
|
2
2
|
|
|
3
|
+
## 4.4.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 4.4.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#156585](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/156585)
|
|
14
|
+
[`a63da8fac528b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a63da8fac528b) -
|
|
15
|
+
[ux] [ED-27962] Code block will now trigger interaction state
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 4.4.3
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -31,7 +31,14 @@ var createPlugin = exports.createPlugin = function createPlugin(_ref) {
|
|
|
31
31
|
_ref$allowComposition = _ref.allowCompositionInputOverride,
|
|
32
32
|
allowCompositionInputOverride = _ref$allowComposition === void 0 ? false : _ref$allowComposition,
|
|
33
33
|
api = _ref.api;
|
|
34
|
-
var handleDOMEvents = {
|
|
34
|
+
var handleDOMEvents = (0, _platformFeatureFlags.fg)('platform_editor_interaction_on_code_blocks') ? {
|
|
35
|
+
click: function click() {
|
|
36
|
+
var _api$core, _api$interaction;
|
|
37
|
+
// Set hasHadInteraction to true on any click of code blocks, as clicks
|
|
38
|
+
// on code blocks to not propagate to editor-level click handlers
|
|
39
|
+
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$interaction = api.interaction) === null || _api$interaction === void 0 ? void 0 : _api$interaction.commands.handleInteraction);
|
|
40
|
+
}
|
|
41
|
+
} : {};
|
|
35
42
|
|
|
36
43
|
// ME-1599: Composition on mobile was causing the DOM observer to mutate the code block
|
|
37
44
|
// incorrecly and lose content when pressing enter in the middle of a code block line.
|
|
@@ -141,6 +141,9 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig() {
|
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
143
|
* Filters language list based on both name and alias properties.
|
|
144
|
+
* @param option
|
|
145
|
+
* @param rawInput
|
|
146
|
+
* @example
|
|
144
147
|
*/
|
|
145
148
|
var languageListFilter = exports.languageListFilter = function languageListFilter(option, rawInput) {
|
|
146
149
|
// Ignored via go/ees005
|
|
@@ -22,7 +22,14 @@ export const createPlugin = ({
|
|
|
22
22
|
allowCompositionInputOverride = false,
|
|
23
23
|
api
|
|
24
24
|
}) => {
|
|
25
|
-
const handleDOMEvents = {
|
|
25
|
+
const handleDOMEvents = fg('platform_editor_interaction_on_code_blocks') ? {
|
|
26
|
+
click: () => {
|
|
27
|
+
var _api$core, _api$interaction;
|
|
28
|
+
// Set hasHadInteraction to true on any click of code blocks, as clicks
|
|
29
|
+
// on code blocks to not propagate to editor-level click handlers
|
|
30
|
+
api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api === null || api === void 0 ? void 0 : (_api$interaction = api.interaction) === null || _api$interaction === void 0 ? void 0 : _api$interaction.commands.handleInteraction);
|
|
31
|
+
}
|
|
32
|
+
} : {};
|
|
26
33
|
|
|
27
34
|
// ME-1599: Composition on mobile was causing the DOM observer to mutate the code block
|
|
28
35
|
// incorrecly and lose content when pressing enter in the middle of a code block line.
|
|
@@ -114,6 +114,9 @@ export const getToolbarConfig = (allowCopyToClipboard = false, api, overrideLang
|
|
|
114
114
|
|
|
115
115
|
/**
|
|
116
116
|
* Filters language list based on both name and alias properties.
|
|
117
|
+
* @param option
|
|
118
|
+
* @param rawInput
|
|
119
|
+
* @example
|
|
117
120
|
*/
|
|
118
121
|
export const languageListFilter = (option, rawInput) => {
|
|
119
122
|
// Ignored via go/ees005
|
|
@@ -26,7 +26,14 @@ export var createPlugin = function createPlugin(_ref) {
|
|
|
26
26
|
_ref$allowComposition = _ref.allowCompositionInputOverride,
|
|
27
27
|
allowCompositionInputOverride = _ref$allowComposition === void 0 ? false : _ref$allowComposition,
|
|
28
28
|
api = _ref.api;
|
|
29
|
-
var handleDOMEvents = {
|
|
29
|
+
var handleDOMEvents = fg('platform_editor_interaction_on_code_blocks') ? {
|
|
30
|
+
click: function click() {
|
|
31
|
+
var _api$core, _api$interaction;
|
|
32
|
+
// Set hasHadInteraction to true on any click of code blocks, as clicks
|
|
33
|
+
// on code blocks to not propagate to editor-level click handlers
|
|
34
|
+
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$interaction = api.interaction) === null || _api$interaction === void 0 ? void 0 : _api$interaction.commands.handleInteraction);
|
|
35
|
+
}
|
|
36
|
+
} : {};
|
|
30
37
|
|
|
31
38
|
// ME-1599: Composition on mobile was causing the DOM observer to mutate the code block
|
|
32
39
|
// incorrecly and lose content when pressing enter in the middle of a code block line.
|
|
@@ -131,6 +131,9 @@ export var getToolbarConfig = function getToolbarConfig() {
|
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
133
|
* Filters language list based on both name and alias properties.
|
|
134
|
+
* @param option
|
|
135
|
+
* @param rawInput
|
|
136
|
+
* @example
|
|
134
137
|
*/
|
|
135
138
|
export var languageListFilter = function languageListFilter(option, rawInput) {
|
|
136
139
|
// Ignored via go/ees005
|
|
@@ -5,17 +5,19 @@ import type { CompositionPlugin } from '@atlaskit/editor-plugin-composition';
|
|
|
5
5
|
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
6
6
|
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
7
7
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
8
|
+
import type { InteractionPlugin } from '@atlaskit/editor-plugin-interaction';
|
|
8
9
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
9
|
-
import type {
|
|
10
|
+
import type { CodeBlockPluginOptions } from './types';
|
|
10
11
|
type CodeBlockDependencies = [
|
|
11
12
|
DecorationsPlugin,
|
|
12
13
|
CompositionPlugin,
|
|
13
14
|
OptionalPlugin<AnalyticsPlugin>,
|
|
14
15
|
OptionalPlugin<EditorDisabledPlugin>,
|
|
15
|
-
OptionalPlugin<FeatureFlagsPlugin
|
|
16
|
+
OptionalPlugin<FeatureFlagsPlugin>,
|
|
17
|
+
OptionalPlugin<InteractionPlugin>
|
|
16
18
|
];
|
|
17
19
|
export type CodeBlockPlugin = NextEditorPlugin<'codeBlock', {
|
|
18
|
-
pluginConfiguration:
|
|
20
|
+
pluginConfiguration: CodeBlockPluginOptions | undefined;
|
|
19
21
|
dependencies: CodeBlockDependencies;
|
|
20
22
|
sharedState: {
|
|
21
23
|
copyButtonHoverNode: PMNode;
|
|
@@ -36,7 +36,12 @@ export declare const createPlugin: ({ useLongPressSelection, getIntl, allowCompo
|
|
|
36
36
|
}, undefined>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
37
37
|
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
38
38
|
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
39
|
-
}, import("@atlaskit/editor-common/types").FeatureFlags
|
|
39
|
+
}, import("@atlaskit/editor-common/types").FeatureFlags>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"interaction", {
|
|
40
|
+
sharedState: import("@atlaskit/editor-plugin-interaction").SharedInteractionState;
|
|
41
|
+
commands: {
|
|
42
|
+
handleInteraction: import("@atlaskit/editor-common/types").EditorCommand;
|
|
43
|
+
};
|
|
44
|
+
}, undefined>>];
|
|
40
45
|
sharedState: {
|
|
41
46
|
copyButtonHoverNode: PMNode;
|
|
42
47
|
} | undefined;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type { ExtractInjectionAPI, FloatingToolbarHandler, SelectOption } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { CodeBlockPlugin } from '../index';
|
|
3
|
-
import { Language } from './language-list';
|
|
3
|
+
import { type Language } from './language-list';
|
|
4
4
|
export declare const getToolbarConfig: (allowCopyToClipboard: boolean | undefined, api: ExtractInjectionAPI<CodeBlockPlugin> | undefined, overrideLanguageName?: ((name: Language['name']) => string) | undefined) => FloatingToolbarHandler;
|
|
5
5
|
/**
|
|
6
6
|
* Filters language list based on both name and alias properties.
|
|
7
|
+
* @param option
|
|
8
|
+
* @param rawInput
|
|
9
|
+
* @example
|
|
7
10
|
*/
|
|
8
11
|
export declare const languageListFilter: (option: SelectOption, rawInput: string) => any;
|
|
@@ -5,17 +5,19 @@ import type { CompositionPlugin } from '@atlaskit/editor-plugin-composition';
|
|
|
5
5
|
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
6
6
|
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
7
7
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
8
|
+
import type { InteractionPlugin } from '@atlaskit/editor-plugin-interaction';
|
|
8
9
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
9
|
-
import type {
|
|
10
|
+
import type { CodeBlockPluginOptions } from './types';
|
|
10
11
|
type CodeBlockDependencies = [
|
|
11
12
|
DecorationsPlugin,
|
|
12
13
|
CompositionPlugin,
|
|
13
14
|
OptionalPlugin<AnalyticsPlugin>,
|
|
14
15
|
OptionalPlugin<EditorDisabledPlugin>,
|
|
15
|
-
OptionalPlugin<FeatureFlagsPlugin
|
|
16
|
+
OptionalPlugin<FeatureFlagsPlugin>,
|
|
17
|
+
OptionalPlugin<InteractionPlugin>
|
|
16
18
|
];
|
|
17
19
|
export type CodeBlockPlugin = NextEditorPlugin<'codeBlock', {
|
|
18
|
-
pluginConfiguration:
|
|
20
|
+
pluginConfiguration: CodeBlockPluginOptions | undefined;
|
|
19
21
|
dependencies: CodeBlockDependencies;
|
|
20
22
|
sharedState: {
|
|
21
23
|
copyButtonHoverNode: PMNode;
|
|
@@ -43,7 +43,13 @@ export declare const createPlugin: ({ useLongPressSelection, getIntl, allowCompo
|
|
|
43
43
|
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
44
44
|
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
45
45
|
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
46
|
-
}, import("@atlaskit/editor-common/types").FeatureFlags
|
|
46
|
+
}, import("@atlaskit/editor-common/types").FeatureFlags>>,
|
|
47
|
+
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"interaction", {
|
|
48
|
+
sharedState: import("@atlaskit/editor-plugin-interaction").SharedInteractionState;
|
|
49
|
+
commands: {
|
|
50
|
+
handleInteraction: import("@atlaskit/editor-common/types").EditorCommand;
|
|
51
|
+
};
|
|
52
|
+
}, undefined>>
|
|
47
53
|
];
|
|
48
54
|
sharedState: {
|
|
49
55
|
copyButtonHoverNode: PMNode;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type { ExtractInjectionAPI, FloatingToolbarHandler, SelectOption } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { CodeBlockPlugin } from '../index';
|
|
3
|
-
import { Language } from './language-list';
|
|
3
|
+
import { type Language } from './language-list';
|
|
4
4
|
export declare const getToolbarConfig: (allowCopyToClipboard: boolean | undefined, api: ExtractInjectionAPI<CodeBlockPlugin> | undefined, overrideLanguageName?: ((name: Language['name']) => string) | undefined) => FloatingToolbarHandler;
|
|
5
5
|
/**
|
|
6
6
|
* Filters language list based on both name and alias properties.
|
|
7
|
+
* @param option
|
|
8
|
+
* @param rawInput
|
|
9
|
+
* @example
|
|
7
10
|
*/
|
|
8
11
|
export declare const languageListFilter: (option: SelectOption, rawInput: string) => any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-code-block",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.5",
|
|
4
4
|
"description": "Code block plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,17 +32,18 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
35
|
-
"@atlaskit/code": "^17.
|
|
36
|
-
"@atlaskit/editor-common": "^105.
|
|
37
|
-
"@atlaskit/editor-plugin-analytics": "^2.
|
|
35
|
+
"@atlaskit/code": "^17.2.0",
|
|
36
|
+
"@atlaskit/editor-common": "^105.10.0",
|
|
37
|
+
"@atlaskit/editor-plugin-analytics": "^2.3.0",
|
|
38
38
|
"@atlaskit/editor-plugin-composition": "^1.3.0",
|
|
39
39
|
"@atlaskit/editor-plugin-decorations": "^2.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-editor-disabled": "^2.0.0",
|
|
41
|
+
"@atlaskit/editor-plugin-interaction": "^1.1.0",
|
|
41
42
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
42
|
-
"@atlaskit/icon": "^26.
|
|
43
|
+
"@atlaskit/icon": "^26.3.0",
|
|
43
44
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
44
45
|
"@atlaskit/prosemirror-input-rules": "^3.3.0",
|
|
45
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
46
|
+
"@atlaskit/tmp-editor-statsig": "^5.0.0",
|
|
46
47
|
"@babel/runtime": "^7.0.0"
|
|
47
48
|
},
|
|
48
49
|
"peerDependencies": {
|
|
@@ -105,6 +106,9 @@
|
|
|
105
106
|
},
|
|
106
107
|
"editor_a11y_remove_unwrap_button": {
|
|
107
108
|
"type": "boolean"
|
|
109
|
+
},
|
|
110
|
+
"platform_editor_interaction_on_code_blocks": {
|
|
111
|
+
"type": "boolean"
|
|
108
112
|
}
|
|
109
113
|
}
|
|
110
114
|
}
|