@atlaskit/editor-plugin-code-block 5.0.9 → 5.0.11

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,21 @@
1
1
  # @atlaskit/editor-plugin-code-block
2
2
 
3
+ ## 5.0.11
4
+
5
+ ### Patch Changes
6
+
7
+ - [`57b19274b9fdd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/57b19274b9fdd) -
8
+ EDITOR-1373 Bump adf-schema version
9
+ - Updated dependencies
10
+
11
+ ## 5.0.10
12
+
13
+ ### Patch Changes
14
+
15
+ - [`25ec3e3638f52`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/25ec3e3638f52) -
16
+ Cleanup advanced code block experiment
17
+ - Updated dependencies
18
+
3
19
  ## 5.0.9
4
20
 
5
21
  ### 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 && (0, _experiments.editorExperiment)('platform_editor_advanced_code_blocks', true)) {
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 && editorExperiment('platform_editor_advanced_code_blocks', true)) {
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 && editorExperiment('platform_editor_advanced_code_blocks', true)) {
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`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-code-block",
3
- "version": "5.0.9",
3
+ "version": "5.0.11",
4
4
  "description": "Code block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -30,7 +30,7 @@
30
30
  ".": "./src/index.ts"
31
31
  },
32
32
  "dependencies": {
33
- "@atlaskit/adf-schema": "^50.2.0",
33
+ "@atlaskit/adf-schema": "^50.2.1",
34
34
  "@atlaskit/code": "^17.2.0",
35
35
  "@atlaskit/editor-plugin-analytics": "^3.0.0",
36
36
  "@atlaskit/editor-plugin-composition": "^2.0.0",
@@ -42,11 +42,11 @@
42
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": "^10.0.0",
45
+ "@atlaskit/tmp-editor-statsig": "^11.3.0",
46
46
  "@babel/runtime": "^7.0.0"
47
47
  },
48
48
  "peerDependencies": {
49
- "@atlaskit/editor-common": "^107.25.0",
49
+ "@atlaskit/editor-common": "^107.26.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
  }