@atlaskit/editor-plugin-type-ahead 6.5.26 → 6.6.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,24 @@
1
1
  # @atlaskit/editor-plugin-type-ahead
2
2
 
3
+ ## 6.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`a1b6e25579466`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a1b6e25579466) -
8
+ Fixes uuid import
9
+ - Updated dependencies
10
+
11
+ ## 6.6.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [`82d57d01a0f61`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/82d57d01a0f61) -
16
+ Distinguish between collab offline and internet offline cases for connectivity mode
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies
21
+
3
22
  ## 6.5.26
4
23
 
5
24
  ### Patch Changes
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.factoryDecorations = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _reactIntlNext = require("react-intl-next");
10
- var _uuid = _interopRequireDefault(require("uuid"));
10
+ var _uuid = require("uuid");
11
11
  var _w3cKeyname = require("w3c-keyname");
12
12
  var _state = require("@atlaskit/editor-prosemirror/state");
13
13
  var _view = require("@atlaskit/editor-prosemirror/view");
@@ -40,7 +40,7 @@ var factoryDecorations = exports.factoryDecorations = function factoryDecoration
40
40
  }
41
41
 
42
42
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
43
- var decorationId = "decoration_id_".concat(_constants.TYPE_AHEAD_DECORATION_KEY, "_").concat((0, _uuid.default)());
43
+ var decorationId = "decoration_id_".concat(_constants.TYPE_AHEAD_DECORATION_KEY, "_").concat((0, _uuid.v4)());
44
44
  var $cursor = selection.$cursor;
45
45
  var typeaheadComponent = document.createElement('mark');
46
46
  var stats = new _statsModifier.StatsModifier();
@@ -4,8 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.itemIsDisabled = void 0;
7
+ var _editorPluginConnectivity = require("@atlaskit/editor-plugin-connectivity");
7
8
  var itemIsDisabled = exports.itemIsDisabled = function itemIsDisabled(item, api) {
8
9
  var _api$connectivity;
9
- var isOffline = (api === null || api === void 0 || (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.sharedState.currentState()) === null || _api$connectivity === void 0 ? void 0 : _api$connectivity.mode) === 'offline';
10
+ var isOffline = (0, _editorPluginConnectivity.isOfflineMode)(api === null || api === void 0 || (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.sharedState.currentState()) === null || _api$connectivity === void 0 ? void 0 : _api$connectivity.mode);
10
11
  return isOffline && (item === null || item === void 0 ? void 0 : item.isDisabledOffline) === true;
11
12
  };
@@ -13,6 +13,7 @@ var _reactIntlNext = require("react-intl-next");
13
13
  var _hooks = require("@atlaskit/editor-common/hooks");
14
14
  var _quickInsert = require("@atlaskit/editor-common/quick-insert");
15
15
  var _typeAhead = require("@atlaskit/editor-common/type-ahead");
16
+ var _editorPluginConnectivity = require("@atlaskit/editor-plugin-connectivity");
16
17
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
17
18
  var _shortcut = require("@atlaskit/editor-shared-styles/shortcut");
18
19
  var _menu = require("@atlaskit/menu");
@@ -177,10 +178,10 @@ var TypeAheadListItem = exports.TypeAheadListItem = /*#__PURE__*/_react.default.
177
178
  connectivityMode = _useSharedPluginState.connectivityMode;
178
179
  var isItemDisabled = function isItemDisabled(item) {
179
180
  var _item$isDisabledOffli;
180
- return connectivityMode === 'offline' && ((_item$isDisabledOffli = item === null || item === void 0 ? void 0 : item.isDisabledOffline) !== null && _item$isDisabledOffli !== void 0 ? _item$isDisabledOffli : false);
181
+ return (0, _editorPluginConnectivity.isOfflineMode)(connectivityMode) && ((_item$isDisabledOffli = item === null || item === void 0 ? void 0 : item.isDisabledOffline) !== null && _item$isDisabledOffli !== void 0 ? _item$isDisabledOffli : false);
181
182
  };
182
183
  var itemIsDisabled = isItemDisabled(item);
183
- var isFirstEnabledIndex = connectivityMode === 'offline' && itemIndex === firstOnlineSupportedIndex && selectedIndex === -1;
184
+ var isFirstEnabledIndex = (0, _editorPluginConnectivity.isOfflineMode)(connectivityMode) && itemIndex === firstOnlineSupportedIndex && selectedIndex === -1;
184
185
 
185
186
  /**
186
187
  * To select and highlight the first Item when no item is selected
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { IntlProvider } from 'react-intl-next';
3
3
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
4
- import uuid from 'uuid';
4
+ import { v4 as uuid } from 'uuid';
5
5
  import { keyName as keyNameNormalized } from 'w3c-keyname';
6
6
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
7
7
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
@@ -1,5 +1,6 @@
1
+ import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
1
2
  export const itemIsDisabled = (item, api) => {
2
3
  var _api$connectivity, _api$connectivity$sha;
3
- const isOffline = (api === null || api === void 0 ? void 0 : (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 ? void 0 : (_api$connectivity$sha = _api$connectivity.sharedState.currentState()) === null || _api$connectivity$sha === void 0 ? void 0 : _api$connectivity$sha.mode) === 'offline';
4
+ const isOffline = isOfflineMode(api === null || api === void 0 ? void 0 : (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 ? void 0 : (_api$connectivity$sha = _api$connectivity.sharedState.currentState()) === null || _api$connectivity$sha === void 0 ? void 0 : _api$connectivity$sha.mode);
4
5
  return isOffline && (item === null || item === void 0 ? void 0 : item.isDisabledOffline) === true;
5
6
  };
@@ -10,6 +10,7 @@ import { useIntl } from 'react-intl-next';
10
10
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
11
11
  import { IconFallback } from '@atlaskit/editor-common/quick-insert';
12
12
  import { SelectItemMode, typeAheadListMessages } from '@atlaskit/editor-common/type-ahead';
13
+ import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
13
14
  import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
14
15
  import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
15
16
  import { ButtonItem } from '@atlaskit/menu';
@@ -189,10 +190,10 @@ export const TypeAheadListItem = /*#__PURE__*/React.memo(({
189
190
  });
190
191
  const isItemDisabled = item => {
191
192
  var _item$isDisabledOffli;
192
- return connectivityMode === 'offline' && ((_item$isDisabledOffli = item === null || item === void 0 ? void 0 : item.isDisabledOffline) !== null && _item$isDisabledOffli !== void 0 ? _item$isDisabledOffli : false);
193
+ return isOfflineMode(connectivityMode) && ((_item$isDisabledOffli = item === null || item === void 0 ? void 0 : item.isDisabledOffline) !== null && _item$isDisabledOffli !== void 0 ? _item$isDisabledOffli : false);
193
194
  };
194
195
  const itemIsDisabled = isItemDisabled(item);
195
- const isFirstEnabledIndex = connectivityMode === 'offline' && itemIndex === firstOnlineSupportedIndex && selectedIndex === -1;
196
+ const isFirstEnabledIndex = isOfflineMode(connectivityMode) && itemIndex === firstOnlineSupportedIndex && selectedIndex === -1;
196
197
 
197
198
  /**
198
199
  * To select and highlight the first Item when no item is selected
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { IntlProvider } from 'react-intl-next';
3
3
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
4
- import uuid from 'uuid';
4
+ import { v4 as uuid } from 'uuid';
5
5
  import { keyName as keyNameNormalized } from 'w3c-keyname';
6
6
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
7
7
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
@@ -1,5 +1,6 @@
1
+ import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
1
2
  export var itemIsDisabled = function itemIsDisabled(item, api) {
2
3
  var _api$connectivity;
3
- var isOffline = (api === null || api === void 0 || (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.sharedState.currentState()) === null || _api$connectivity === void 0 ? void 0 : _api$connectivity.mode) === 'offline';
4
+ var isOffline = isOfflineMode(api === null || api === void 0 || (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.sharedState.currentState()) === null || _api$connectivity === void 0 ? void 0 : _api$connectivity.mode);
4
5
  return isOffline && (item === null || item === void 0 ? void 0 : item.isDisabledOffline) === true;
5
6
  };
@@ -12,6 +12,7 @@ import { useIntl } from 'react-intl-next';
12
12
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
13
13
  import { IconFallback } from '@atlaskit/editor-common/quick-insert';
14
14
  import { SelectItemMode, typeAheadListMessages } from '@atlaskit/editor-common/type-ahead';
15
+ import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
15
16
  import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
16
17
  import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
17
18
  import { ButtonItem } from '@atlaskit/menu';
@@ -169,10 +170,10 @@ export var TypeAheadListItem = /*#__PURE__*/React.memo(function (_ref2) {
169
170
  connectivityMode = _useSharedPluginState.connectivityMode;
170
171
  var isItemDisabled = function isItemDisabled(item) {
171
172
  var _item$isDisabledOffli;
172
- return connectivityMode === 'offline' && ((_item$isDisabledOffli = item === null || item === void 0 ? void 0 : item.isDisabledOffline) !== null && _item$isDisabledOffli !== void 0 ? _item$isDisabledOffli : false);
173
+ return isOfflineMode(connectivityMode) && ((_item$isDisabledOffli = item === null || item === void 0 ? void 0 : item.isDisabledOffline) !== null && _item$isDisabledOffli !== void 0 ? _item$isDisabledOffli : false);
173
174
  };
174
175
  var itemIsDisabled = isItemDisabled(item);
175
- var isFirstEnabledIndex = connectivityMode === 'offline' && itemIndex === firstOnlineSupportedIndex && selectedIndex === -1;
176
+ var isFirstEnabledIndex = isOfflineMode(connectivityMode) && itemIndex === firstOnlineSupportedIndex && selectedIndex === -1;
176
177
 
177
178
  /**
178
179
  * To select and highlight the first Item when no item is selected
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-type-ahead",
3
- "version": "6.5.26",
3
+ "version": "6.6.1",
4
4
  "description": "Type-ahead plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,7 +31,7 @@
31
31
  "dependencies": {
32
32
  "@atlaskit/adf-schema": "^51.5.0",
33
33
  "@atlaskit/editor-plugin-analytics": "^6.2.0",
34
- "@atlaskit/editor-plugin-connectivity": "^6.0.0",
34
+ "@atlaskit/editor-plugin-connectivity": "^6.1.0",
35
35
  "@atlaskit/editor-plugin-context-panel": "^8.0.0",
36
36
  "@atlaskit/editor-plugin-metrics": "^7.1.0",
37
37
  "@atlaskit/editor-prosemirror": "^7.2.0",
@@ -45,7 +45,7 @@
45
45
  "@atlaskit/prosemirror-history": "^0.2.0",
46
46
  "@atlaskit/prosemirror-input-rules": "^3.6.0",
47
47
  "@atlaskit/theme": "^21.0.0",
48
- "@atlaskit/tmp-editor-statsig": "^16.0.0",
48
+ "@atlaskit/tmp-editor-statsig": "^16.2.0",
49
49
  "@atlaskit/tokens": "^9.0.0",
50
50
  "@atlaskit/visually-hidden": "^3.0.0",
51
51
  "@babel/runtime": "^7.0.0",
@@ -57,7 +57,7 @@
57
57
  "w3c-keyname": "^2.1.8"
58
58
  },
59
59
  "peerDependencies": {
60
- "@atlaskit/editor-common": "^110.46.0",
60
+ "@atlaskit/editor-common": "^110.48.0",
61
61
  "react": "^18.2.0",
62
62
  "react-dom": "^18.2.0",
63
63
  "react-intl-next": "npm:react-intl@^5.18.1"