@atlaskit/editor-plugin-code-block 4.4.2 → 4.4.4
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 +3 -1
- package/dist/types/pm-plugins/language-list.d.ts +12 -0
- 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 +3 -1
- package/dist/types-ts4.5/pm-plugins/language-list.d.ts +21 -0
- 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.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#156585](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/156585)
|
|
8
|
+
[`a63da8fac528b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a63da8fac528b) -
|
|
9
|
+
[ux] [ED-27962] Code block will now trigger interaction state
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 4.4.3
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 4.4.2
|
|
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,6 +5,7 @@ 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
10
|
import type { CodeBlockOptions } from './types';
|
|
10
11
|
type CodeBlockDependencies = [
|
|
@@ -12,7 +13,8 @@ type CodeBlockDependencies = [
|
|
|
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
20
|
pluginConfiguration: CodeBlockOptions | undefined;
|
|
@@ -322,6 +322,10 @@ export declare const DEFAULT_LANGUAGES: ({
|
|
|
322
322
|
readonly name: "Handlebars";
|
|
323
323
|
readonly alias: readonly ["handlebars", "mustache"];
|
|
324
324
|
readonly value: "handlebars";
|
|
325
|
+
} | {
|
|
326
|
+
readonly name: "Gherkin";
|
|
327
|
+
readonly alias: readonly ["gherkin", "cucumber"];
|
|
328
|
+
readonly value: "gherkin";
|
|
325
329
|
} | {
|
|
326
330
|
readonly name: "ABAP";
|
|
327
331
|
readonly alias: readonly ["abap"];
|
|
@@ -656,6 +660,10 @@ export declare function findMatchedLanguage(supportedLanguages: Language[], lang
|
|
|
656
660
|
readonly name: "Handlebars";
|
|
657
661
|
readonly alias: readonly ["handlebars", "mustache"];
|
|
658
662
|
readonly value: "handlebars";
|
|
663
|
+
} | {
|
|
664
|
+
readonly name: "Gherkin";
|
|
665
|
+
readonly alias: readonly ["gherkin", "cucumber"];
|
|
666
|
+
readonly value: "gherkin";
|
|
659
667
|
} | {
|
|
660
668
|
readonly name: "ABAP";
|
|
661
669
|
readonly alias: readonly ["abap"];
|
|
@@ -991,6 +999,10 @@ export declare function createLanguageList(supportedLanguages: Language[]): ({
|
|
|
991
999
|
readonly name: "Handlebars";
|
|
992
1000
|
readonly alias: readonly ["handlebars", "mustache"];
|
|
993
1001
|
readonly value: "handlebars";
|
|
1002
|
+
} | {
|
|
1003
|
+
readonly name: "Gherkin";
|
|
1004
|
+
readonly alias: readonly ["gherkin", "cucumber"];
|
|
1005
|
+
readonly value: "gherkin";
|
|
994
1006
|
} | {
|
|
995
1007
|
readonly name: "ABAP";
|
|
996
1008
|
readonly alias: readonly ["abap"];
|
|
@@ -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").InteractionState;
|
|
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,6 +5,7 @@ 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
10
|
import type { CodeBlockOptions } from './types';
|
|
10
11
|
type CodeBlockDependencies = [
|
|
@@ -12,7 +13,8 @@ type CodeBlockDependencies = [
|
|
|
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
20
|
pluginConfiguration: CodeBlockOptions | undefined;
|
|
@@ -567,6 +567,13 @@ export declare const DEFAULT_LANGUAGES: ({
|
|
|
567
567
|
"mustache"
|
|
568
568
|
];
|
|
569
569
|
readonly value: "handlebars";
|
|
570
|
+
} | {
|
|
571
|
+
readonly name: "Gherkin";
|
|
572
|
+
readonly alias: readonly [
|
|
573
|
+
"gherkin",
|
|
574
|
+
"cucumber"
|
|
575
|
+
];
|
|
576
|
+
readonly value: "gherkin";
|
|
570
577
|
} | {
|
|
571
578
|
readonly name: "ABAP";
|
|
572
579
|
readonly alias: readonly [
|
|
@@ -1148,6 +1155,13 @@ export declare function findMatchedLanguage(supportedLanguages: Language[], lang
|
|
|
1148
1155
|
"mustache"
|
|
1149
1156
|
];
|
|
1150
1157
|
readonly value: "handlebars";
|
|
1158
|
+
} | {
|
|
1159
|
+
readonly name: "Gherkin";
|
|
1160
|
+
readonly alias: readonly [
|
|
1161
|
+
"gherkin",
|
|
1162
|
+
"cucumber"
|
|
1163
|
+
];
|
|
1164
|
+
readonly value: "gherkin";
|
|
1151
1165
|
} | {
|
|
1152
1166
|
readonly name: "ABAP";
|
|
1153
1167
|
readonly alias: readonly [
|
|
@@ -1730,6 +1744,13 @@ export declare function createLanguageList(supportedLanguages: Language[]): ({
|
|
|
1730
1744
|
"mustache"
|
|
1731
1745
|
];
|
|
1732
1746
|
readonly value: "handlebars";
|
|
1747
|
+
} | {
|
|
1748
|
+
readonly name: "Gherkin";
|
|
1749
|
+
readonly alias: readonly [
|
|
1750
|
+
"gherkin",
|
|
1751
|
+
"cucumber"
|
|
1752
|
+
];
|
|
1753
|
+
readonly value: "gherkin";
|
|
1733
1754
|
} | {
|
|
1734
1755
|
readonly name: "ABAP";
|
|
1735
1756
|
readonly alias: readonly [
|
|
@@ -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").InteractionState;
|
|
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.4",
|
|
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": "^
|
|
37
|
-
"@atlaskit/editor-plugin-analytics": "^2.
|
|
35
|
+
"@atlaskit/code": "^17.2.0",
|
|
36
|
+
"@atlaskit/editor-common": "^105.6.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.1.0",
|
|
43
44
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
44
45
|
"@atlaskit/prosemirror-input-rules": "^3.3.0",
|
|
45
|
-
"@atlaskit/tmp-editor-statsig": "^4.
|
|
46
|
+
"@atlaskit/tmp-editor-statsig": "^4.22.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
|
}
|