@atlaskit/editor-plugin-code-block 5.0.8 → 5.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 +2 -1
- package/dist/cjs/pm-plugins/decorators.js +1 -2
- package/dist/es2019/codeBlockPlugin.js +3 -2
- package/dist/es2019/pm-plugins/decorators.js +1 -2
- package/dist/esm/codeBlockPlugin.js +3 -2
- package/dist/esm/pm-plugins/decorators.js +1 -2
- package/dist/types/pm-plugins/language-list.d.ts +12 -0
- package/dist/types-ts4.5/pm-plugins/language-list.d.ts +18 -0
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-code-block
|
|
2
2
|
|
|
3
|
+
## 5.0.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`25ec3e3638f52`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/25ec3e3638f52) -
|
|
8
|
+
Cleanup advanced code block experiment
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 5.0.9
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 5.0.8
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -11,6 +11,7 @@ var _adfSchema = require("@atlaskit/adf-schema");
|
|
|
11
11
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
12
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
13
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
14
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
15
|
var _editorCommands = require("./editor-commands");
|
|
15
16
|
var _codeBlockAutoFullStopTransformPlugin = require("./pm-plugins/codeBlockAutoFullStopTransformPlugin");
|
|
16
17
|
var _codeBlockCopySelectionPlugin = require("./pm-plugins/codeBlockCopySelectionPlugin");
|
|
@@ -30,7 +31,7 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
|
|
|
30
31
|
nodes: function nodes() {
|
|
31
32
|
return [{
|
|
32
33
|
name: 'codeBlock',
|
|
33
|
-
node: _adfSchema.codeBlock
|
|
34
|
+
node: (0, _platformFeatureFlags.fg)('platform_editor_adf_with_localid') ? _adfSchema.codeBlockWithLocalId : _adfSchema.codeBlock
|
|
34
35
|
}];
|
|
35
36
|
},
|
|
36
37
|
getSharedState: function getSharedState(state) {
|
|
@@ -9,7 +9,6 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
9
9
|
var _codeBlock = require("@atlaskit/editor-common/code-block");
|
|
10
10
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
11
11
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
13
12
|
var _classNames = require("../ui/class-names");
|
|
14
13
|
var _utils = require("./utils");
|
|
15
14
|
/* eslint-disable @atlaskit/platform/ensure-feature-flag-prefix */
|
|
@@ -170,7 +169,7 @@ var updateDecorationSetWithWordWrappedDecorator = exports.updateDecorationSetWit
|
|
|
170
169
|
// likely changed the breakout width with the toggle ON - we add an empty decoration to force
|
|
171
170
|
// prosemirror to recognise the change so we can update in our node view. This gets filtered
|
|
172
171
|
// out on the next toggle.
|
|
173
|
-
if (currentWrappedBlockDecorationSet.length === 0 &&
|
|
172
|
+
if (currentWrappedBlockDecorationSet.length === 0 && pos + innerNode.nodeSize <= tr.doc.content.size) {
|
|
174
173
|
var wrappedBlock = _view.Decoration.node(pos, pos + innerNode.nodeSize, {}, {
|
|
175
174
|
type: DECORATION_WRAPPED_BLOCK_NODE_TYPE
|
|
176
175
|
} // Allows for quick filtering of decorations while using `find`
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { codeBlock } from '@atlaskit/adf-schema';
|
|
2
|
+
import { codeBlock, codeBlockWithLocalId } from '@atlaskit/adf-schema';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { blockTypeMessages } from '@atlaskit/editor-common/messages';
|
|
5
5
|
import { IconCode } from '@atlaskit/editor-common/quick-insert';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { createInsertCodeBlockTransaction, insertCodeBlockWithAnalytics } from './editor-commands';
|
|
7
8
|
import { codeBlockAutoFullStopTransformPlugin } from './pm-plugins/codeBlockAutoFullStopTransformPlugin';
|
|
8
9
|
import { codeBlockCopySelectionPlugin, copySelectionPluginKey } from './pm-plugins/codeBlockCopySelectionPlugin';
|
|
@@ -21,7 +22,7 @@ const codeBlockPlugin = ({
|
|
|
21
22
|
nodes() {
|
|
22
23
|
return [{
|
|
23
24
|
name: 'codeBlock',
|
|
24
|
-
node: codeBlock
|
|
25
|
+
node: fg('platform_editor_adf_with_localid') ? codeBlockWithLocalId : codeBlock
|
|
25
26
|
}];
|
|
26
27
|
},
|
|
27
28
|
getSharedState(state) {
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import { isCodeBlockWordWrapEnabled } from '@atlaskit/editor-common/code-block';
|
|
4
4
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
6
|
import { codeBlockClassNames } from '../ui/class-names';
|
|
8
7
|
import { getAllCodeBlockNodesInDoc } from './utils';
|
|
9
8
|
export const DECORATION_WIDGET_TYPE = 'decorationWidgetType';
|
|
@@ -162,7 +161,7 @@ export const updateDecorationSetWithWordWrappedDecorator = (decorationSet, tr, n
|
|
|
162
161
|
// likely changed the breakout width with the toggle ON - we add an empty decoration to force
|
|
163
162
|
// prosemirror to recognise the change so we can update in our node view. This gets filtered
|
|
164
163
|
// out on the next toggle.
|
|
165
|
-
if (currentWrappedBlockDecorationSet.length === 0 &&
|
|
164
|
+
if (currentWrappedBlockDecorationSet.length === 0 && pos + innerNode.nodeSize <= tr.doc.content.size) {
|
|
166
165
|
const wrappedBlock = Decoration.node(pos, pos + innerNode.nodeSize, {}, {
|
|
167
166
|
type: DECORATION_WRAPPED_BLOCK_NODE_TYPE
|
|
168
167
|
} // Allows for quick filtering of decorations while using `find`
|
|
@@ -2,10 +2,11 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import { codeBlock } from '@atlaskit/adf-schema';
|
|
5
|
+
import { codeBlock, codeBlockWithLocalId } from '@atlaskit/adf-schema';
|
|
6
6
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
7
7
|
import { blockTypeMessages } from '@atlaskit/editor-common/messages';
|
|
8
8
|
import { IconCode } from '@atlaskit/editor-common/quick-insert';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
10
|
import { createInsertCodeBlockTransaction, insertCodeBlockWithAnalytics } from './editor-commands';
|
|
10
11
|
import { codeBlockAutoFullStopTransformPlugin } from './pm-plugins/codeBlockAutoFullStopTransformPlugin';
|
|
11
12
|
import { codeBlockCopySelectionPlugin, copySelectionPluginKey } from './pm-plugins/codeBlockCopySelectionPlugin';
|
|
@@ -23,7 +24,7 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
|
|
|
23
24
|
nodes: function nodes() {
|
|
24
25
|
return [{
|
|
25
26
|
name: 'codeBlock',
|
|
26
|
-
node: codeBlock
|
|
27
|
+
node: fg('platform_editor_adf_with_localid') ? codeBlockWithLocalId : codeBlock
|
|
27
28
|
}];
|
|
28
29
|
},
|
|
29
30
|
getSharedState: function getSharedState(state) {
|
|
@@ -4,7 +4,6 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
4
4
|
import { isCodeBlockWordWrapEnabled } from '@atlaskit/editor-common/code-block';
|
|
5
5
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
8
7
|
import { codeBlockClassNames } from '../ui/class-names';
|
|
9
8
|
import { getAllCodeBlockNodesInDoc } from './utils';
|
|
10
9
|
export var DECORATION_WIDGET_TYPE = 'decorationWidgetType';
|
|
@@ -163,7 +162,7 @@ export var updateDecorationSetWithWordWrappedDecorator = function updateDecorati
|
|
|
163
162
|
// likely changed the breakout width with the toggle ON - we add an empty decoration to force
|
|
164
163
|
// prosemirror to recognise the change so we can update in our node view. This gets filtered
|
|
165
164
|
// out on the next toggle.
|
|
166
|
-
if (currentWrappedBlockDecorationSet.length === 0 &&
|
|
165
|
+
if (currentWrappedBlockDecorationSet.length === 0 && pos + innerNode.nodeSize <= tr.doc.content.size) {
|
|
167
166
|
var wrappedBlock = Decoration.node(pos, pos + innerNode.nodeSize, {}, {
|
|
168
167
|
type: DECORATION_WRAPPED_BLOCK_NODE_TYPE
|
|
169
168
|
} // Allows for quick filtering of decorations while using `find`
|
|
@@ -318,6 +318,10 @@ export declare const DEFAULT_LANGUAGES: ({
|
|
|
318
318
|
readonly name: "Protocol Buffers";
|
|
319
319
|
readonly alias: readonly ["protobuf", "proto"];
|
|
320
320
|
readonly value: "protobuf";
|
|
321
|
+
} | {
|
|
322
|
+
readonly name: "TOML";
|
|
323
|
+
readonly alias: readonly ["toml"];
|
|
324
|
+
readonly value: "toml";
|
|
321
325
|
} | {
|
|
322
326
|
readonly name: "Handlebars";
|
|
323
327
|
readonly alias: readonly ["handlebars", "mustache"];
|
|
@@ -656,6 +660,10 @@ export declare function findMatchedLanguage(supportedLanguages: Language[], lang
|
|
|
656
660
|
readonly name: "Protocol Buffers";
|
|
657
661
|
readonly alias: readonly ["protobuf", "proto"];
|
|
658
662
|
readonly value: "protobuf";
|
|
663
|
+
} | {
|
|
664
|
+
readonly name: "TOML";
|
|
665
|
+
readonly alias: readonly ["toml"];
|
|
666
|
+
readonly value: "toml";
|
|
659
667
|
} | {
|
|
660
668
|
readonly name: "Handlebars";
|
|
661
669
|
readonly alias: readonly ["handlebars", "mustache"];
|
|
@@ -995,6 +1003,10 @@ export declare function createLanguageList(supportedLanguages: Language[]): ({
|
|
|
995
1003
|
readonly name: "Protocol Buffers";
|
|
996
1004
|
readonly alias: readonly ["protobuf", "proto"];
|
|
997
1005
|
readonly value: "protobuf";
|
|
1006
|
+
} | {
|
|
1007
|
+
readonly name: "TOML";
|
|
1008
|
+
readonly alias: readonly ["toml"];
|
|
1009
|
+
readonly value: "toml";
|
|
998
1010
|
} | {
|
|
999
1011
|
readonly name: "Handlebars";
|
|
1000
1012
|
readonly alias: readonly ["handlebars", "mustache"];
|
|
@@ -560,6 +560,12 @@ export declare const DEFAULT_LANGUAGES: ({
|
|
|
560
560
|
"proto"
|
|
561
561
|
];
|
|
562
562
|
readonly value: "protobuf";
|
|
563
|
+
} | {
|
|
564
|
+
readonly name: "TOML";
|
|
565
|
+
readonly alias: readonly [
|
|
566
|
+
"toml"
|
|
567
|
+
];
|
|
568
|
+
readonly value: "toml";
|
|
563
569
|
} | {
|
|
564
570
|
readonly name: "Handlebars";
|
|
565
571
|
readonly alias: readonly [
|
|
@@ -1148,6 +1154,12 @@ export declare function findMatchedLanguage(supportedLanguages: Language[], lang
|
|
|
1148
1154
|
"proto"
|
|
1149
1155
|
];
|
|
1150
1156
|
readonly value: "protobuf";
|
|
1157
|
+
} | {
|
|
1158
|
+
readonly name: "TOML";
|
|
1159
|
+
readonly alias: readonly [
|
|
1160
|
+
"toml"
|
|
1161
|
+
];
|
|
1162
|
+
readonly value: "toml";
|
|
1151
1163
|
} | {
|
|
1152
1164
|
readonly name: "Handlebars";
|
|
1153
1165
|
readonly alias: readonly [
|
|
@@ -1737,6 +1749,12 @@ export declare function createLanguageList(supportedLanguages: Language[]): ({
|
|
|
1737
1749
|
"proto"
|
|
1738
1750
|
];
|
|
1739
1751
|
readonly value: "protobuf";
|
|
1752
|
+
} | {
|
|
1753
|
+
readonly name: "TOML";
|
|
1754
|
+
readonly alias: readonly [
|
|
1755
|
+
"toml"
|
|
1756
|
+
];
|
|
1757
|
+
readonly value: "toml";
|
|
1740
1758
|
} | {
|
|
1741
1759
|
readonly name: "Handlebars";
|
|
1742
1760
|
readonly alias: readonly [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-code-block",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.10",
|
|
4
4
|
"description": "Code block plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
"@atlaskit/editor-plugin-editor-viewmode": "^5.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-interaction": "^5.0.0",
|
|
41
41
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
42
|
-
"@atlaskit/icon": "^27.
|
|
42
|
+
"@atlaskit/icon": "^27.12.0",
|
|
43
43
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
44
44
|
"@atlaskit/prosemirror-input-rules": "^3.4.0",
|
|
45
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
45
|
+
"@atlaskit/tmp-editor-statsig": "^11.0.0",
|
|
46
46
|
"@babel/runtime": "^7.0.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@atlaskit/editor-common": "^107.
|
|
49
|
+
"@atlaskit/editor-common": "^107.25.0",
|
|
50
50
|
"react": "^18.2.0",
|
|
51
51
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
52
52
|
},
|
|
@@ -100,6 +100,9 @@
|
|
|
100
100
|
},
|
|
101
101
|
"editor_a11y_remove_unwrap_button": {
|
|
102
102
|
"type": "boolean"
|
|
103
|
+
},
|
|
104
|
+
"platform_editor_adf_with_localid": {
|
|
105
|
+
"type": "boolean"
|
|
103
106
|
}
|
|
104
107
|
}
|
|
105
108
|
}
|