@atlaskit/editor-plugin-code-block 8.0.14 → 8.1.1

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,23 @@
1
1
  # @atlaskit/editor-plugin-code-block
2
2
 
3
+ ## 8.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`2a658b46713fb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2a658b46713fb) -
8
+ upgrade use of browser util
9
+
10
+ ## 8.1.0
11
+
12
+ ### Minor Changes
13
+
14
+ - [`5167552fe1a93`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5167552fe1a93) -
15
+ [EDITOR-2339] Bump @atlaskit/adf-schema to 51.3.0
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
3
21
  ## 8.0.14
4
22
 
5
23
  ### Patch Changes
@@ -12,6 +12,7 @@ var _browser = require("@atlaskit/editor-common/browser");
12
12
  var _codeBlock = require("@atlaskit/editor-common/code-block");
13
13
  var _model = require("@atlaskit/editor-prosemirror/model");
14
14
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
15
16
  var _editorCommands = require("../editor-commands");
16
17
  var _mainState = require("../pm-plugins/main-state");
17
18
  var _classNames = require("../ui/class-names");
@@ -172,7 +173,8 @@ var CodeBlockView = exports.CodeBlockView = /*#__PURE__*/function () {
172
173
  }
173
174
  this.node = node;
174
175
  this.maintainDynamicGutterSize();
175
- if (_browser.browser.android) {
176
+ var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
177
+ if (browser.android) {
176
178
  this.coalesceDOMElements();
177
179
  (0, _editorCommands.resetShouldIgnoreFollowingMutations)(this.view.state, this.view.dispatch);
178
180
  }
@@ -5,11 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.codeBlockAutoFullStopTransformPlugin = codeBlockAutoFullStopTransformPlugin;
7
7
  exports.codeBlockAutoFullStopTransformPluginKey = void 0;
8
+ var _browser = require("@atlaskit/editor-common/browser");
8
9
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
9
10
  var _transforms = require("@atlaskit/editor-common/transforms");
10
- var _utils = require("@atlaskit/editor-common/utils");
11
11
  var _state = require("@atlaskit/editor-prosemirror/state");
12
12
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
13
14
  var codeBlockAutoFullStopTransformPluginKey = exports.codeBlockAutoFullStopTransformPluginKey = new _state.PluginKey('codeBlockAutoFullStopTransformPluginKey');
14
15
  function codeBlockAutoFullStopTransformPlugin() {
15
16
  return new _safePlugin.SafePlugin({
@@ -27,7 +28,7 @@ function codeBlockAutoFullStopTransformPlugin() {
27
28
  fromNew = _trNew$selection.from,
28
29
  toNew = _trNew$selection.to;
29
30
  var isCodeBlock = !!(0, _transforms.findCodeBlock)(oldState, trOld.selection) && !!(0, _transforms.findCodeBlock)(newState, trNew.selection);
30
-
31
+ var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
31
32
  /**
32
33
  * Mac will auto insert a fullstop when the user double taps the space key after some content.
33
34
  * Line number decorators are assumed content so on new lines the fullstop is inserted.
@@ -43,7 +44,7 @@ function codeBlockAutoFullStopTransformPlugin() {
43
44
  */
44
45
 
45
46
  // both selections must be of code block early exit
46
- if (_utils.browser.mac && fromNew === toNew && fromNew === fromOld + 1 && isCodeBlock) {
47
+ if (browser.mac && fromNew === toNew && fromNew === fromOld + 1 && isCodeBlock) {
47
48
  // detect when '.' is inserted when the previous state was a space ' '
48
49
  try {
49
50
  var textBetweenBefore = trOld.doc.textBetween(fromOld - 1, fromOld); // ' '
@@ -47,12 +47,13 @@ var createPlugin = exports.createPlugin = function createPlugin(_ref) {
47
47
  var keyEvent = event;
48
48
  var eventInputType = keyEvent.inputType;
49
49
  var eventText = keyEvent.data;
50
- if (_browser.browser.ios && event.composed &&
50
+ var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
51
+ if (browser.ios && event.composed &&
51
52
  // insertParagraph will be the input type when the enter key is pressed.
52
53
  eventInputType === 'insertParagraph' && (0, _transforms.findCodeBlock)(view.state, view.state.selection)) {
53
54
  event.preventDefault();
54
55
  return true;
55
- } else if (_browser.browser.android && event.composed && eventInputType === 'insertCompositionText' && eventText[(eventText === null || eventText === void 0 ? void 0 : eventText.length) - 1] === '\n' && (0, _transforms.findCodeBlock)(view.state, view.state.selection)) {
56
+ } else if (browser.android && event.composed && eventInputType === 'insertCompositionText' && eventText[(eventText === null || eventText === void 0 ? void 0 : eventText.length) - 1] === '\n' && (0, _transforms.findCodeBlock)(view.state, view.state.selection)) {
56
57
  // Ignored via go/ees005
57
58
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
58
59
  var resultingText = event.target.outerText + '\n';
@@ -74,7 +75,7 @@ var createPlugin = exports.createPlugin = function createPlugin(_ref) {
74
75
  }
75
76
  return true;
76
77
  }
77
- if (_browser.browser.android) {
78
+ if (browser.android) {
78
79
  (0, _editorCommands.resetShouldIgnoreFollowingMutations)(view.state, view.dispatch);
79
80
  }
80
81
  return false;
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.refreshBrowserSelection = exports.default = void 0;
7
7
  var _browser = require("@atlaskit/editor-common/browser");
8
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
8
9
  var _pluginKey = require("./plugin-key");
9
10
  // Workaround for a firefox issue where dom selection is off sync
10
11
  // https://product-fabric.atlassian.net/browse/ED-12442
@@ -20,7 +21,8 @@ var refreshBrowserSelection = exports.refreshBrowserSelection = function refresh
20
21
  };
21
22
  var refreshBrowserSelectionOnChange = function refreshBrowserSelectionOnChange(transaction, editorState) {
22
23
  var _pluginKey$getState;
23
- if (_browser.browser.gecko && transaction.docChanged &&
24
+ var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
25
+ if (browser.gecko && transaction.docChanged &&
24
26
  // codeblockState.pos should be set if current selection is in a codeblock.
25
27
  typeof ((_pluginKey$getState = _pluginKey.pluginKey.getState(editorState)) === null || _pluginKey$getState === void 0 ? void 0 : _pluginKey$getState.pos) === 'number') {
26
28
  refreshBrowserSelection();
@@ -1,8 +1,9 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import { browser } from '@atlaskit/editor-common/browser';
2
+ import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
3
3
  import { codeBlockWrappedStates, defaultWordWrapState } from '@atlaskit/editor-common/code-block';
4
4
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
5
5
  import { fg } from '@atlaskit/platform-feature-flags';
6
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
6
7
  import { resetShouldIgnoreFollowingMutations } from '../editor-commands';
7
8
  import { getPluginState } from '../pm-plugins/main-state';
8
9
  import { codeBlockClassNames } from '../ui/class-names';
@@ -149,6 +150,7 @@ export class CodeBlockView {
149
150
  }
150
151
  this.node = node;
151
152
  this.maintainDynamicGutterSize();
153
+ const browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
152
154
  if (browser.android) {
153
155
  this.coalesceDOMElements();
154
156
  resetShouldIgnoreFollowingMutations(this.view.state, this.view.dispatch);
@@ -1,8 +1,9 @@
1
+ import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
1
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
3
  import { findCodeBlock } from '@atlaskit/editor-common/transforms';
3
- import { browser } from '@atlaskit/editor-common/utils';
4
4
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
5
  import { fg } from '@atlaskit/platform-feature-flags';
6
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
6
7
  export const codeBlockAutoFullStopTransformPluginKey = new PluginKey('codeBlockAutoFullStopTransformPluginKey');
7
8
  export function codeBlockAutoFullStopTransformPlugin() {
8
9
  return new SafePlugin({
@@ -27,7 +28,7 @@ export function codeBlockAutoFullStopTransformPlugin() {
27
28
  to: toNew
28
29
  } = trNew.selection;
29
30
  const isCodeBlock = !!findCodeBlock(oldState, trOld.selection) && !!findCodeBlock(newState, trNew.selection);
30
-
31
+ const browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
31
32
  /**
32
33
  * Mac will auto insert a fullstop when the user double taps the space key after some content.
33
34
  * Line number decorators are assumed content so on new lines the fullstop is inserted.
@@ -1,4 +1,4 @@
1
- import { browser } from '@atlaskit/editor-common/browser';
1
+ import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
2
2
  import { updateCodeBlockWrappedStateNodeKeys } from '@atlaskit/editor-common/code-block';
3
3
  import { blockTypeMessages } from '@atlaskit/editor-common/messages';
4
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
@@ -36,6 +36,7 @@ export const createPlugin = ({
36
36
  const keyEvent = event;
37
37
  const eventInputType = keyEvent.inputType;
38
38
  const eventText = keyEvent.data;
39
+ const browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
39
40
  if (browser.ios && event.composed &&
40
41
  // insertParagraph will be the input type when the enter key is pressed.
41
42
  eventInputType === 'insertParagraph' && findCodeBlock(view.state, view.state.selection)) {
@@ -1,4 +1,5 @@
1
- import { browser } from '@atlaskit/editor-common/browser';
1
+ import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
2
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
2
3
  import { pluginKey } from './plugin-key';
3
4
 
4
5
  // Workaround for a firefox issue where dom selection is off sync
@@ -15,6 +16,7 @@ const refreshBrowserSelection = () => {
15
16
  };
16
17
  const refreshBrowserSelectionOnChange = (transaction, editorState) => {
17
18
  var _pluginKey$getState;
19
+ const browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
18
20
  if (browser.gecko && transaction.docChanged &&
19
21
  // codeblockState.pos should be set if current selection is in a codeblock.
20
22
  typeof ((_pluginKey$getState = pluginKey.getState(editorState)) === null || _pluginKey$getState === void 0 ? void 0 : _pluginKey$getState.pos) === 'number') {
@@ -3,10 +3,11 @@ import _createClass from "@babel/runtime/helpers/createClass";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
4
  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; }
5
5
  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; }
6
- import { browser } from '@atlaskit/editor-common/browser';
6
+ import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
7
7
  import { codeBlockWrappedStates, defaultWordWrapState } from '@atlaskit/editor-common/code-block';
8
8
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
9
9
  import { fg } from '@atlaskit/platform-feature-flags';
10
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
10
11
  import { resetShouldIgnoreFollowingMutations } from '../editor-commands';
11
12
  import { getPluginState } from '../pm-plugins/main-state';
12
13
  import { codeBlockClassNames } from '../ui/class-names';
@@ -166,6 +167,7 @@ export var CodeBlockView = /*#__PURE__*/function () {
166
167
  }
167
168
  this.node = node;
168
169
  this.maintainDynamicGutterSize();
170
+ var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
169
171
  if (browser.android) {
170
172
  this.coalesceDOMElements();
171
173
  resetShouldIgnoreFollowingMutations(this.view.state, this.view.dispatch);
@@ -1,8 +1,9 @@
1
+ import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
1
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
3
  import { findCodeBlock } from '@atlaskit/editor-common/transforms';
3
- import { browser } from '@atlaskit/editor-common/utils';
4
4
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
5
  import { fg } from '@atlaskit/platform-feature-flags';
6
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
6
7
  export var codeBlockAutoFullStopTransformPluginKey = new PluginKey('codeBlockAutoFullStopTransformPluginKey');
7
8
  export function codeBlockAutoFullStopTransformPlugin() {
8
9
  return new SafePlugin({
@@ -20,7 +21,7 @@ export function codeBlockAutoFullStopTransformPlugin() {
20
21
  fromNew = _trNew$selection.from,
21
22
  toNew = _trNew$selection.to;
22
23
  var isCodeBlock = !!findCodeBlock(oldState, trOld.selection) && !!findCodeBlock(newState, trNew.selection);
23
-
24
+ var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
24
25
  /**
25
26
  * Mac will auto insert a fullstop when the user double taps the space key after some content.
26
27
  * Line number decorators are assumed content so on new lines the fullstop is inserted.
@@ -1,7 +1,7 @@
1
1
  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
- import { browser } from '@atlaskit/editor-common/browser';
4
+ import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
5
5
  import { updateCodeBlockWrappedStateNodeKeys } from '@atlaskit/editor-common/code-block';
6
6
  import { blockTypeMessages } from '@atlaskit/editor-common/messages';
7
7
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
@@ -40,6 +40,7 @@ export var createPlugin = function createPlugin(_ref) {
40
40
  var keyEvent = event;
41
41
  var eventInputType = keyEvent.inputType;
42
42
  var eventText = keyEvent.data;
43
+ var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
43
44
  if (browser.ios && event.composed &&
44
45
  // insertParagraph will be the input type when the enter key is pressed.
45
46
  eventInputType === 'insertParagraph' && findCodeBlock(view.state, view.state.selection)) {
@@ -1,4 +1,5 @@
1
- import { browser } from '@atlaskit/editor-common/browser';
1
+ import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
2
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
2
3
  import { pluginKey } from './plugin-key';
3
4
 
4
5
  // Workaround for a firefox issue where dom selection is off sync
@@ -15,6 +16,7 @@ var refreshBrowserSelection = function refreshBrowserSelection() {
15
16
  };
16
17
  var refreshBrowserSelectionOnChange = function refreshBrowserSelectionOnChange(transaction, editorState) {
17
18
  var _pluginKey$getState;
19
+ var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
18
20
  if (browser.gecko && transaction.docChanged &&
19
21
  // codeblockState.pos should be set if current selection is in a codeblock.
20
22
  typeof ((_pluginKey$getState = pluginKey.getState(editorState)) === null || _pluginKey$getState === void 0 ? void 0 : _pluginKey$getState.pos) === 'number') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-code-block",
3
- "version": "8.0.14",
3
+ "version": "8.1.1",
4
4
  "description": "Code block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -27,9 +27,9 @@
27
27
  "sideEffects": false,
28
28
  "atlaskit:src": "src/index.ts",
29
29
  "dependencies": {
30
- "@atlaskit/adf-schema": "^51.2.0",
30
+ "@atlaskit/adf-schema": "^51.3.0",
31
31
  "@atlaskit/code": "^17.2.0",
32
- "@atlaskit/editor-plugin-analytics": "^6.1.0",
32
+ "@atlaskit/editor-plugin-analytics": "^6.2.0",
33
33
  "@atlaskit/editor-plugin-block-menu": "^4.0.0",
34
34
  "@atlaskit/editor-plugin-composition": "^5.0.0",
35
35
  "@atlaskit/editor-plugin-decorations": "^6.1.0",
@@ -47,7 +47,7 @@
47
47
  "@babel/runtime": "^7.0.0"
48
48
  },
49
49
  "peerDependencies": {
50
- "@atlaskit/editor-common": "^110.13.0",
50
+ "@atlaskit/editor-common": "^110.14.0",
51
51
  "react": "^18.2.0",
52
52
  "react-intl-next": "npm:react-intl@^5.18.1"
53
53
  },