@atlaskit/editor-core 187.43.18 → 187.44.0

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/index.js +6 -5
  3. package/dist/cjs/plugins/base/commands.js +20 -0
  4. package/dist/cjs/plugins/base/plugin.js +3 -2
  5. package/dist/cjs/plugins/base/pm-plugins/{scroll-gutter.js → scroll-gutter/index.js} +24 -4
  6. package/dist/cjs/plugins/base/pm-plugins/scroll-gutter/plugin-key.js +15 -0
  7. package/dist/cjs/plugins/mobile-dimensions/actions.js +0 -1
  8. package/dist/cjs/plugins/mobile-dimensions/commands.js +1 -8
  9. package/dist/cjs/plugins/mobile-dimensions/index.js +0 -1
  10. package/dist/cjs/plugins/mobile-dimensions/reducer.js +0 -4
  11. package/dist/cjs/ui/AppearanceComponents/Mobile.js +9 -3
  12. package/dist/cjs/version-wrapper.js +1 -1
  13. package/dist/es2019/index.js +2 -1
  14. package/dist/es2019/plugins/base/commands.js +13 -0
  15. package/dist/es2019/plugins/base/plugin.js +3 -2
  16. package/dist/es2019/plugins/base/pm-plugins/{scroll-gutter.js → scroll-gutter/index.js} +20 -3
  17. package/dist/es2019/plugins/base/pm-plugins/scroll-gutter/plugin-key.js +7 -0
  18. package/dist/es2019/plugins/mobile-dimensions/actions.js +0 -1
  19. package/dist/es2019/plugins/mobile-dimensions/commands.js +0 -4
  20. package/dist/es2019/plugins/mobile-dimensions/index.js +0 -1
  21. package/dist/es2019/plugins/mobile-dimensions/reducer.js +0 -5
  22. package/dist/es2019/ui/AppearanceComponents/Mobile.js +8 -2
  23. package/dist/es2019/version-wrapper.js +1 -1
  24. package/dist/esm/index.js +2 -1
  25. package/dist/esm/plugins/base/commands.js +13 -0
  26. package/dist/esm/plugins/base/plugin.js +3 -2
  27. package/dist/esm/plugins/base/pm-plugins/{scroll-gutter.js → scroll-gutter/index.js} +22 -3
  28. package/dist/esm/plugins/base/pm-plugins/scroll-gutter/plugin-key.js +7 -0
  29. package/dist/esm/plugins/mobile-dimensions/actions.js +0 -1
  30. package/dist/esm/plugins/mobile-dimensions/commands.js +0 -6
  31. package/dist/esm/plugins/mobile-dimensions/index.js +0 -1
  32. package/dist/esm/plugins/mobile-dimensions/reducer.js +0 -4
  33. package/dist/esm/ui/AppearanceComponents/Mobile.js +9 -3
  34. package/dist/esm/version-wrapper.js +1 -1
  35. package/dist/types/index.d.ts +2 -1
  36. package/dist/types/plugins/base/commands.d.ts +2 -0
  37. package/dist/types/plugins/base/plugin.d.ts +2 -0
  38. package/dist/{types-ts4.5/plugins/base/pm-plugins/scroll-gutter.d.ts → types/plugins/base/pm-plugins/scroll-gutter/index.d.ts} +3 -1
  39. package/dist/types/plugins/base/pm-plugins/scroll-gutter/plugin-key.d.ts +7 -0
  40. package/dist/types/plugins/mobile-dimensions/actions.d.ts +1 -6
  41. package/dist/types/plugins/mobile-dimensions/commands.d.ts +0 -1
  42. package/dist/types/plugins/mobile-dimensions/index.d.ts +1 -1
  43. package/dist/types/plugins/mobile-dimensions/reducer.d.ts +2 -2
  44. package/dist/types/plugins/mobile-dimensions/types.d.ts +0 -2
  45. package/dist/types-ts4.5/index.d.ts +2 -1
  46. package/dist/types-ts4.5/plugins/base/commands.d.ts +2 -0
  47. package/dist/types-ts4.5/plugins/base/plugin.d.ts +2 -0
  48. package/dist/{types/plugins/base/pm-plugins/scroll-gutter.d.ts → types-ts4.5/plugins/base/pm-plugins/scroll-gutter/index.d.ts} +3 -1
  49. package/dist/types-ts4.5/plugins/base/pm-plugins/scroll-gutter/plugin-key.d.ts +7 -0
  50. package/dist/types-ts4.5/plugins/mobile-dimensions/actions.d.ts +1 -6
  51. package/dist/types-ts4.5/plugins/mobile-dimensions/commands.d.ts +0 -1
  52. package/dist/types-ts4.5/plugins/mobile-dimensions/index.d.ts +1 -1
  53. package/dist/types-ts4.5/plugins/mobile-dimensions/reducer.d.ts +2 -2
  54. package/dist/types-ts4.5/plugins/mobile-dimensions/types.d.ts +0 -2
  55. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 187.44.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`11861bb36d4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/11861bb36d4) - [ux] [ECA11Y-44] [ECA11Y-22] [ECA11Y-19] Change the focus order in the status popup to improve accessibility.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+
13
+ ## 187.43.19
14
+
15
+ ### Patch Changes
16
+
17
+ - [`2a6a2518852`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2a6a2518852) - Reverse dependencies for mobile dimensions plugin & base plugin
18
+
3
19
  ## 187.43.18
4
20
 
5
21
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -278,7 +278,7 @@ Object.defineProperty(exports, "insertDate", {
278
278
  Object.defineProperty(exports, "insertExpand", {
279
279
  enumerable: true,
280
280
  get: function get() {
281
- return _commands5.insertExpand;
281
+ return _commands6.insertExpand;
282
282
  }
283
283
  });
284
284
  Object.defineProperty(exports, "insertMediaSingleNode", {
@@ -350,7 +350,7 @@ Object.defineProperty(exports, "selectionPluginKey", {
350
350
  Object.defineProperty(exports, "setIsExpanded", {
351
351
  enumerable: true,
352
352
  get: function get() {
353
- return _commands4.setIsExpanded;
353
+ return _commands5.setIsExpanded;
354
354
  }
355
355
  });
356
356
  Object.defineProperty(exports, "setKeyboardHeight", {
@@ -362,7 +362,7 @@ Object.defineProperty(exports, "setKeyboardHeight", {
362
362
  Object.defineProperty(exports, "setMobilePaddingTop", {
363
363
  enumerable: true,
364
364
  get: function get() {
365
- return _commands4.setMobilePaddingTop;
365
+ return _commands5.setMobilePaddingTop;
366
366
  }
367
367
  });
368
368
  Object.defineProperty(exports, "setStatusPickerAt", {
@@ -462,7 +462,8 @@ var _actions2 = require("./plugins/status/actions");
462
462
  var _typeAhead = require("./plugins/type-ahead");
463
463
  var _history = require("./plugins/history");
464
464
  var _analytics = require("@atlaskit/editor-common/analytics");
465
- var _commands4 = require("./plugins/mobile-dimensions/commands");
465
+ var _commands4 = require("./plugins/base/commands");
466
+ var _commands5 = require("./plugins/mobile-dimensions/commands");
466
467
  var _utils = require("./utils");
467
468
  var _utils2 = require("@atlaskit/editor-common/utils");
468
469
  var _createEditor = require("./create-editor");
@@ -470,7 +471,7 @@ var _actions3 = _interopRequireDefault(require("./actions"));
470
471
  var _portalProvider = require("@atlaskit/editor-common/portal-provider");
471
472
  var _gapCursorSelection = require("./plugins/selection/gap-cursor-selection");
472
473
  var _mobileSelection = require("./plugins/mobile-selection");
473
- var _commands5 = require("./plugins/expand/commands");
474
+ var _commands6 = require("./plugins/expand/commands");
474
475
  var _WithPluginState = _interopRequireDefault(require("./ui/WithPluginState"));
475
476
  var _statusColorPalette = require("./ui/ColorPalette/Palettes/statusColorPalette");
476
477
  var _common = require("./ui/ColorPalette/Palettes/common");
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.setKeyboardHeight = void 0;
7
+ var _pluginKey = require("./pm-plugins/scroll-gutter/plugin-key");
8
+ var setKeyboardHeight = function setKeyboardHeight(keyboardHeight) {
9
+ return function (state, dispatch) {
10
+ var tr = state.tr;
11
+ tr.setMeta(_pluginKey.scrollGutterPluginKey, {
12
+ keyboardHeight: keyboardHeight
13
+ });
14
+ if (dispatch) {
15
+ dispatch(tr);
16
+ }
17
+ return true;
18
+ };
19
+ };
20
+ exports.setKeyboardHeight = setKeyboardHeight;
@@ -18,7 +18,7 @@ var _disableSpellChecking = _interopRequireDefault(require("./pm-plugins/disable
18
18
  var _contextIdentifier = _interopRequireWildcard(require("./pm-plugins/context-identifier"));
19
19
  var _newlinePreserveMarks = _interopRequireDefault(require("./pm-plugins/newline-preserve-marks"));
20
20
  var _inlineCursorTarget = _interopRequireDefault(require("./pm-plugins/inline-cursor-target"));
21
- var _scrollGutter = _interopRequireDefault(require("./pm-plugins/scroll-gutter"));
21
+ var _scrollGutter = _interopRequireWildcard(require("./pm-plugins/scroll-gutter"));
22
22
  var _keymaps = require("@atlaskit/editor-common/keymaps");
23
23
  var _frozenEditor = _interopRequireDefault(require("./pm-plugins/frozen-editor"));
24
24
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -37,7 +37,8 @@ var basePlugin = function basePlugin(_ref) {
37
37
  name: 'base',
38
38
  getSharedState: function getSharedState(editorState) {
39
39
  return {
40
- contextIdentifier: (0, _contextIdentifier.getContextIdentifier)(editorState)
40
+ contextIdentifier: (0, _contextIdentifier.getContextIdentifier)(editorState),
41
+ keyboardHeight: (0, _scrollGutter.getKeyboardHeight)(editorState)
41
42
  };
42
43
  },
43
44
  pmPlugins: function pmPlugins() {
@@ -3,10 +3,17 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.getKeyboardHeight = exports.default = void 0;
7
7
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
8
8
  var _utils = require("@atlaskit/editor-common/utils");
9
- var _utils2 = require("../../mobile-dimensions/utils");
9
+ var _pluginKey = require("./plugin-key");
10
+ var getKeyboardHeight = function getKeyboardHeight(state) {
11
+ if (state) {
12
+ var scrollGutterPluginState = (0, _pluginKey.getScrollGutterPluginState)(state);
13
+ return scrollGutterPluginState ? scrollGutterPluginState.keyboardHeight : undefined;
14
+ }
15
+ };
16
+ exports.getKeyboardHeight = getKeyboardHeight;
10
17
  var MIN_TAP_SIZE_IN_PX = 40;
11
18
  function supportsIntersectionObserver() {
12
19
  if (typeof window !== 'undefined' && 'IntersectionObserver' in window && 'IntersectionObserverEntry' in window && 'intersectionRatio' in window.IntersectionObserverEntry.prototype) {
@@ -151,6 +158,18 @@ var _default = function _default() {
151
158
  var scrollElement = null; // | undefined;
152
159
 
153
160
  return new _safePlugin.SafePlugin({
161
+ key: _pluginKey.scrollGutterPluginKey,
162
+ state: {
163
+ init: function init() {
164
+ return {};
165
+ },
166
+ apply: function apply(tr, pluginState) {
167
+ if (tr.getMeta(_pluginKey.scrollGutterPluginKey)) {
168
+ return tr.getMeta(_pluginKey.scrollGutterPluginKey);
169
+ }
170
+ return pluginState;
171
+ }
172
+ },
154
173
  props: {
155
174
  // Determines the distance (in pixels) between the cursor and the end of the visible viewport at which point,
156
175
  // when scrolling the cursor into view, scrolling takes place.
@@ -195,6 +214,7 @@ var _default = function _default() {
195
214
  * Toggle the Scroll Gutter Element
196
215
  */
197
216
  update: function update(view, prevState) {
217
+ var _getKeyboardHeight;
198
218
  if (!scrollElement || !editorParentElement) {
199
219
  return;
200
220
  }
@@ -219,8 +239,8 @@ var _default = function _default() {
219
239
  return;
220
240
  }
221
241
  // Determine whether we need to consider Keyboard Height
222
- var mobileDimensionsPluginState = (0, _utils2.getMobileDimensionsPluginState)(state);
223
- var viewportHeight = scrollElement.offsetHeight - (mobileDimensionsPluginState && mobileDimensionsPluginState.keyboardHeight ? mobileDimensionsPluginState.keyboardHeight : 0);
242
+ var keyboardHeight = (_getKeyboardHeight = getKeyboardHeight(state)) !== null && _getKeyboardHeight !== void 0 ? _getKeyboardHeight : 0;
243
+ var viewportHeight = scrollElement.offsetHeight - keyboardHeight;
224
244
  var contentHeight = editorParentElement.offsetHeight - (gutterMounted ? gutterSize : 0);
225
245
 
226
246
  // Add or remove the gutter based on whether the content is about to exceed the viewport height.
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.scrollGutterPluginKey = exports.getScrollGutterPluginState = void 0;
7
+ var _state = require("@atlaskit/editor-prosemirror/state");
8
+ var scrollGutterPluginKey = new _state.PluginKey('scrollGutter');
9
+ exports.scrollGutterPluginKey = scrollGutterPluginKey;
10
+ var getScrollGutterPluginState = function getScrollGutterPluginState(state) {
11
+ if (state) {
12
+ return scrollGutterPluginKey.getState(state);
13
+ }
14
+ };
15
+ exports.getScrollGutterPluginState = getScrollGutterPluginState;
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.MobileDimensionsActionTypes = void 0;
7
7
  var MobileDimensionsActionTypes = /*#__PURE__*/function (MobileDimensionsActionTypes) {
8
- MobileDimensionsActionTypes["SET_KEYBOARD_HEIGHT"] = "SET_KEYBOARD_HEIGHT";
9
8
  MobileDimensionsActionTypes["SET_WINDOW_HEIGHT"] = "SET_WINDOW_HEIGHT";
10
9
  MobileDimensionsActionTypes["SET_MOBILE_PADDING_TOP"] = "SET_MOBILE_PADDING_TOP";
11
10
  MobileDimensionsActionTypes["SET_IS_EXPANDED"] = "SET_IS_EXPANDED";
@@ -3,16 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.setWindowHeight = exports.setMobilePaddingTop = exports.setKeyboardHeight = exports.setIsExpanded = void 0;
6
+ exports.setWindowHeight = exports.setMobilePaddingTop = exports.setIsExpanded = void 0;
7
7
  var _actions = require("./actions");
8
8
  var _pluginFactory = require("./plugin-factory");
9
- var setKeyboardHeight = function setKeyboardHeight(keyboardHeight) {
10
- return (0, _pluginFactory.createCommand)({
11
- type: _actions.MobileDimensionsActionTypes.SET_KEYBOARD_HEIGHT,
12
- keyboardHeight: keyboardHeight
13
- });
14
- };
15
- exports.setKeyboardHeight = setKeyboardHeight;
16
9
  var setWindowHeight = function setWindowHeight(windowHeight) {
17
10
  return (0, _pluginFactory.createCommand)({
18
11
  type: _actions.MobileDimensionsActionTypes.SET_WINDOW_HEIGHT,
@@ -9,7 +9,6 @@ var _commands = require("./commands");
9
9
  var _pluginFactory = require("./plugin-factory");
10
10
  var getInitialState = function getInitialState() {
11
11
  return {
12
- keyboardHeight: -1,
13
12
  mobilePaddingTop: 0,
14
13
  windowHeight: window.innerHeight,
15
14
  isExpanded: false
@@ -11,10 +11,6 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
11
11
  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) { (0, _defineProperty2.default)(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; }
12
12
  function _default(state, action) {
13
13
  switch (action.type) {
14
- case _actions.MobileDimensionsActionTypes.SET_KEYBOARD_HEIGHT:
15
- return _objectSpread(_objectSpread({}, state), {}, {
16
- keyboardHeight: action.keyboardHeight
17
- });
18
14
  case _actions.MobileDimensionsActionTypes.SET_WINDOW_HEIGHT:
19
15
  return _objectSpread(_objectSpread({}, state), {}, {
20
16
  windowHeight: action.windowHeight
@@ -15,6 +15,7 @@ var _WithPluginState = _interopRequireDefault(require("../WithPluginState"));
15
15
  var _WithFlash = _interopRequireDefault(require("../WithFlash"));
16
16
  var _ContentStyles = require("../ContentStyles");
17
17
  var _Addon = require("../Addon");
18
+ var _context = require("../../presets/context");
18
19
  var _templateObject;
19
20
  /** @jsx jsx */
20
21
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -23,11 +24,13 @@ var mobileEditor = (0, _react2.css)(_templateObject || (_templateObject = (0, _t
23
24
  var ContentArea = (0, _ContentStyles.createEditorContentStyle)();
24
25
  ContentArea.displayName = 'ContentArea';
25
26
  var MobileAppearance = /*#__PURE__*/(0, _react.forwardRef)(function MobileAppearance(_ref, ref) {
27
+ var _api$base2;
26
28
  var editorView = _ref.editorView,
27
29
  persistScrollGutter = _ref.persistScrollGutter,
28
30
  children = _ref.children,
29
31
  editorDisabled = _ref.editorDisabled,
30
32
  featureFlags = _ref.featureFlags;
33
+ var api = (0, _context.usePresetContext)();
31
34
  var render = (0, _react.useCallback)(function (_ref2) {
32
35
  var maxContentSize = _ref2.maxContentSize,
33
36
  mobileDimensions = _ref2.mobileDimensions;
@@ -35,10 +38,13 @@ var MobileAppearance = /*#__PURE__*/(0, _react.forwardRef)(function MobileAppear
35
38
  var minHeight = 100;
36
39
  var currentIsExpanded = true; // isExpanded prop should always be true for Hybrid Editor
37
40
  if (mobileDimensions) {
38
- var keyboardHeight = mobileDimensions.keyboardHeight,
39
- windowHeight = mobileDimensions.windowHeight,
41
+ var _api$base, _basePluginState$keyb;
42
+ var windowHeight = mobileDimensions.windowHeight,
40
43
  mobilePaddingTop = mobileDimensions.mobilePaddingTop,
41
44
  isExpanded = mobileDimensions.isExpanded;
45
+ var basePluginState = api === null || api === void 0 ? void 0 : (_api$base = api.base) === null || _api$base === void 0 ? void 0 : _api$base.sharedState.currentState();
46
+ var keyboardHeight = (_basePluginState$keyb = basePluginState === null || basePluginState === void 0 ? void 0 : basePluginState.keyboardHeight) !== null && _basePluginState$keyb !== void 0 ? _basePluginState$keyb : -1;
47
+
42
48
  /*
43
49
  We calculate the min-height based on the windowHeight - keyboardHeight - paddingTop.
44
50
  This is needed due to scrolling issues when there is no content to scroll (like, only having 1 paragraph),
@@ -73,7 +79,7 @@ var MobileAppearance = /*#__PURE__*/(0, _react.forwardRef)(function MobileAppear
73
79
  }, (0, _react2.jsx)("div", {
74
80
  className: "ak-editor-content-area"
75
81
  }, children)))));
76
- }, [children, editorView, persistScrollGutter, editorDisabled, ref, featureFlags]);
82
+ }, [children, editorView, persistScrollGutter, editorDisabled, ref, featureFlags, api === null || api === void 0 ? void 0 : (_api$base2 = api.base) === null || _api$base2 === void 0 ? void 0 : _api$base2.sharedState]);
77
83
  return (0, _react2.jsx)(_WithPluginState.default, {
78
84
  plugins: {
79
85
  maxContentSize: _maxContentSize.pluginKey,
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = "@atlaskit/editor-core";
8
8
  exports.name = name;
9
- var version = "187.43.18";
9
+ var version = "187.44.0";
10
10
  exports.version = version;
11
11
  var nextMajorVersion = function nextMajorVersion() {
12
12
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
@@ -41,7 +41,8 @@ export { commitStatusPicker, setStatusPickerAt, updateStatus, updateStatusWithAn
41
41
  export { typeAheadPluginKey } from './plugins/type-ahead';
42
42
  export { historyPluginKey } from './plugins/history';
43
43
  export { INPUT_METHOD, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
44
- export { setKeyboardHeight, setMobilePaddingTop, setIsExpanded } from './plugins/mobile-dimensions/commands';
44
+ export { setKeyboardHeight } from './plugins/base/commands';
45
+ export { setMobilePaddingTop, setIsExpanded } from './plugins/mobile-dimensions/commands';
45
46
 
46
47
  // Used in editor-test-helpers and mobile bridge
47
48
  export { setTextSelection, getNodesCount, measurements } from './utils';
@@ -0,0 +1,13 @@
1
+ import { scrollGutterPluginKey } from './pm-plugins/scroll-gutter/plugin-key';
2
+ export const setKeyboardHeight = keyboardHeight => (state, dispatch) => {
3
+ const {
4
+ tr
5
+ } = state;
6
+ tr.setMeta(scrollGutterPluginKey, {
7
+ keyboardHeight
8
+ });
9
+ if (dispatch) {
10
+ dispatch(tr);
11
+ }
12
+ return true;
13
+ };
@@ -9,7 +9,7 @@ import disableSpellcheckingPlugin from './pm-plugins/disable-spell-checking';
9
9
  import contextIdentifierPlugin, { getContextIdentifier } from './pm-plugins/context-identifier';
10
10
  import newlinePreserveMarksPlugin from './pm-plugins/newline-preserve-marks';
11
11
  import inlineCursorTargetPlugin from './pm-plugins/inline-cursor-target';
12
- import scrollGutter from './pm-plugins/scroll-gutter';
12
+ import scrollGutter, { getKeyboardHeight } from './pm-plugins/scroll-gutter';
13
13
  import { keymap } from '@atlaskit/editor-common/keymaps';
14
14
  import frozenEditor from './pm-plugins/frozen-editor';
15
15
  // Chrome >= 88
@@ -24,7 +24,8 @@ const basePlugin = ({
24
24
  name: 'base',
25
25
  getSharedState(editorState) {
26
26
  return {
27
- contextIdentifier: getContextIdentifier(editorState)
27
+ contextIdentifier: getContextIdentifier(editorState),
28
+ keyboardHeight: getKeyboardHeight(editorState)
28
29
  };
29
30
  },
30
31
  pmPlugins() {
@@ -1,6 +1,12 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import { GUTTER_SELECTOR, GUTTER_SIZE_IN_PX, isEmptyDocument } from '@atlaskit/editor-common/utils';
3
- import { getMobileDimensionsPluginState } from '../../mobile-dimensions/utils';
3
+ import { getScrollGutterPluginState, scrollGutterPluginKey } from './plugin-key';
4
+ export const getKeyboardHeight = state => {
5
+ if (state) {
6
+ const scrollGutterPluginState = getScrollGutterPluginState(state);
7
+ return scrollGutterPluginState ? scrollGutterPluginState.keyboardHeight : undefined;
8
+ }
9
+ };
4
10
  const MIN_TAP_SIZE_IN_PX = 40;
5
11
  function supportsIntersectionObserver() {
6
12
  if (typeof window !== 'undefined' && 'IntersectionObserver' in window && 'IntersectionObserverEntry' in window && 'intersectionRatio' in window.IntersectionObserverEntry.prototype) {
@@ -143,6 +149,16 @@ export default ((pluginOptions = {}) => {
143
149
  let scrollElement = null; // | undefined;
144
150
 
145
151
  return new SafePlugin({
152
+ key: scrollGutterPluginKey,
153
+ state: {
154
+ init: () => ({}),
155
+ apply: (tr, pluginState) => {
156
+ if (tr.getMeta(scrollGutterPluginKey)) {
157
+ return tr.getMeta(scrollGutterPluginKey);
158
+ }
159
+ return pluginState;
160
+ }
161
+ },
146
162
  props: {
147
163
  // Determines the distance (in pixels) between the cursor and the end of the visible viewport at which point,
148
164
  // when scrolling the cursor into view, scrolling takes place.
@@ -179,6 +195,7 @@ export default ((pluginOptions = {}) => {
179
195
  * Toggle the Scroll Gutter Element
180
196
  */
181
197
  update(view, prevState) {
198
+ var _getKeyboardHeight;
182
199
  if (!scrollElement || !editorParentElement) {
183
200
  return;
184
201
  }
@@ -203,8 +220,8 @@ export default ((pluginOptions = {}) => {
203
220
  return;
204
221
  }
205
222
  // Determine whether we need to consider Keyboard Height
206
- const mobileDimensionsPluginState = getMobileDimensionsPluginState(state);
207
- const viewportHeight = scrollElement.offsetHeight - (mobileDimensionsPluginState && mobileDimensionsPluginState.keyboardHeight ? mobileDimensionsPluginState.keyboardHeight : 0);
223
+ const keyboardHeight = (_getKeyboardHeight = getKeyboardHeight(state)) !== null && _getKeyboardHeight !== void 0 ? _getKeyboardHeight : 0;
224
+ const viewportHeight = scrollElement.offsetHeight - keyboardHeight;
208
225
  const contentHeight = editorParentElement.offsetHeight - (gutterMounted ? gutterSize : 0);
209
226
 
210
227
  // Add or remove the gutter based on whether the content is about to exceed the viewport height.
@@ -0,0 +1,7 @@
1
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
+ export const scrollGutterPluginKey = new PluginKey('scrollGutter');
3
+ export const getScrollGutterPluginState = state => {
4
+ if (state) {
5
+ return scrollGutterPluginKey.getState(state);
6
+ }
7
+ };
@@ -1,5 +1,4 @@
1
1
  export let MobileDimensionsActionTypes = /*#__PURE__*/function (MobileDimensionsActionTypes) {
2
- MobileDimensionsActionTypes["SET_KEYBOARD_HEIGHT"] = "SET_KEYBOARD_HEIGHT";
3
2
  MobileDimensionsActionTypes["SET_WINDOW_HEIGHT"] = "SET_WINDOW_HEIGHT";
4
3
  MobileDimensionsActionTypes["SET_MOBILE_PADDING_TOP"] = "SET_MOBILE_PADDING_TOP";
5
4
  MobileDimensionsActionTypes["SET_IS_EXPANDED"] = "SET_IS_EXPANDED";
@@ -1,9 +1,5 @@
1
1
  import { MobileDimensionsActionTypes } from './actions';
2
2
  import { createCommand } from './plugin-factory';
3
- export const setKeyboardHeight = keyboardHeight => createCommand({
4
- type: MobileDimensionsActionTypes.SET_KEYBOARD_HEIGHT,
5
- keyboardHeight
6
- });
7
3
  export const setWindowHeight = windowHeight => createCommand({
8
4
  type: MobileDimensionsActionTypes.SET_WINDOW_HEIGHT,
9
5
  windowHeight
@@ -2,7 +2,6 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import { setWindowHeight } from './commands';
3
3
  import { createPluginState, mobileDimensionsPluginKey } from './plugin-factory';
4
4
  const getInitialState = () => ({
5
- keyboardHeight: -1,
6
5
  mobilePaddingTop: 0,
7
6
  windowHeight: window.innerHeight,
8
7
  isExpanded: false
@@ -1,11 +1,6 @@
1
1
  import { MobileDimensionsActionTypes } from './actions';
2
2
  export default function (state, action) {
3
3
  switch (action.type) {
4
- case MobileDimensionsActionTypes.SET_KEYBOARD_HEIGHT:
5
- return {
6
- ...state,
7
- keyboardHeight: action.keyboardHeight
8
- };
9
4
  case MobileDimensionsActionTypes.SET_WINDOW_HEIGHT:
10
5
  return {
11
6
  ...state,
@@ -7,6 +7,7 @@ import WithPluginState from '../WithPluginState';
7
7
  import WithFlash from '../WithFlash';
8
8
  import { createEditorContentStyle } from '../ContentStyles';
9
9
  import { ClickAreaMobile as ClickArea } from '../Addon';
10
+ import { usePresetContext } from '../../presets/context';
10
11
  const mobileEditor = css`
11
12
  min-height: 30px;
12
13
  width: 100%;
@@ -30,6 +31,8 @@ export const MobileAppearance = /*#__PURE__*/forwardRef(function MobileAppearanc
30
31
  editorDisabled,
31
32
  featureFlags
32
33
  }, ref) {
34
+ var _api$base2;
35
+ const api = usePresetContext();
33
36
  const render = useCallback(({
34
37
  maxContentSize,
35
38
  mobileDimensions
@@ -38,12 +41,15 @@ export const MobileAppearance = /*#__PURE__*/forwardRef(function MobileAppearanc
38
41
  let minHeight = 100;
39
42
  let currentIsExpanded = true; // isExpanded prop should always be true for Hybrid Editor
40
43
  if (mobileDimensions) {
44
+ var _api$base, _basePluginState$keyb;
41
45
  const {
42
- keyboardHeight,
43
46
  windowHeight,
44
47
  mobilePaddingTop,
45
48
  isExpanded
46
49
  } = mobileDimensions;
50
+ const basePluginState = api === null || api === void 0 ? void 0 : (_api$base = api.base) === null || _api$base === void 0 ? void 0 : _api$base.sharedState.currentState();
51
+ const keyboardHeight = (_basePluginState$keyb = basePluginState === null || basePluginState === void 0 ? void 0 : basePluginState.keyboardHeight) !== null && _basePluginState$keyb !== void 0 ? _basePluginState$keyb : -1;
52
+
47
53
  /*
48
54
  We calculate the min-height based on the windowHeight - keyboardHeight - paddingTop.
49
55
  This is needed due to scrolling issues when there is no content to scroll (like, only having 1 paragraph),
@@ -78,7 +84,7 @@ export const MobileAppearance = /*#__PURE__*/forwardRef(function MobileAppearanc
78
84
  }, jsx("div", {
79
85
  className: "ak-editor-content-area"
80
86
  }, children)))));
81
- }, [children, editorView, persistScrollGutter, editorDisabled, ref, featureFlags]);
87
+ }, [children, editorView, persistScrollGutter, editorDisabled, ref, featureFlags, api === null || api === void 0 ? void 0 : (_api$base2 = api.base) === null || _api$base2 === void 0 ? void 0 : _api$base2.sharedState]);
82
88
  return jsx(WithPluginState, {
83
89
  plugins: {
84
90
  maxContentSize: maxContentSizePluginKey,
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "187.43.18";
2
+ export const version = "187.44.0";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
package/dist/esm/index.js CHANGED
@@ -41,7 +41,8 @@ export { commitStatusPicker, setStatusPickerAt, updateStatus, updateStatusWithAn
41
41
  export { typeAheadPluginKey } from './plugins/type-ahead';
42
42
  export { historyPluginKey } from './plugins/history';
43
43
  export { INPUT_METHOD, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
44
- export { setKeyboardHeight, setMobilePaddingTop, setIsExpanded } from './plugins/mobile-dimensions/commands';
44
+ export { setKeyboardHeight } from './plugins/base/commands';
45
+ export { setMobilePaddingTop, setIsExpanded } from './plugins/mobile-dimensions/commands';
45
46
 
46
47
  // Used in editor-test-helpers and mobile bridge
47
48
  export { setTextSelection, getNodesCount, measurements } from './utils';
@@ -0,0 +1,13 @@
1
+ import { scrollGutterPluginKey } from './pm-plugins/scroll-gutter/plugin-key';
2
+ export var setKeyboardHeight = function setKeyboardHeight(keyboardHeight) {
3
+ return function (state, dispatch) {
4
+ var tr = state.tr;
5
+ tr.setMeta(scrollGutterPluginKey, {
6
+ keyboardHeight: keyboardHeight
7
+ });
8
+ if (dispatch) {
9
+ dispatch(tr);
10
+ }
11
+ return true;
12
+ };
13
+ };
@@ -12,7 +12,7 @@ import disableSpellcheckingPlugin from './pm-plugins/disable-spell-checking';
12
12
  import contextIdentifierPlugin, { getContextIdentifier } from './pm-plugins/context-identifier';
13
13
  import newlinePreserveMarksPlugin from './pm-plugins/newline-preserve-marks';
14
14
  import inlineCursorTargetPlugin from './pm-plugins/inline-cursor-target';
15
- import scrollGutter from './pm-plugins/scroll-gutter';
15
+ import scrollGutter, { getKeyboardHeight } from './pm-plugins/scroll-gutter';
16
16
  import { keymap } from '@atlaskit/editor-common/keymaps';
17
17
  import frozenEditor from './pm-plugins/frozen-editor';
18
18
  // Chrome >= 88
@@ -26,7 +26,8 @@ var basePlugin = function basePlugin(_ref) {
26
26
  name: 'base',
27
27
  getSharedState: function getSharedState(editorState) {
28
28
  return {
29
- contextIdentifier: getContextIdentifier(editorState)
29
+ contextIdentifier: getContextIdentifier(editorState),
30
+ keyboardHeight: getKeyboardHeight(editorState)
30
31
  };
31
32
  },
32
33
  pmPlugins: function pmPlugins() {
@@ -1,6 +1,12 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import { GUTTER_SELECTOR, GUTTER_SIZE_IN_PX, isEmptyDocument } from '@atlaskit/editor-common/utils';
3
- import { getMobileDimensionsPluginState } from '../../mobile-dimensions/utils';
3
+ import { getScrollGutterPluginState, scrollGutterPluginKey } from './plugin-key';
4
+ export var getKeyboardHeight = function getKeyboardHeight(state) {
5
+ if (state) {
6
+ var scrollGutterPluginState = getScrollGutterPluginState(state);
7
+ return scrollGutterPluginState ? scrollGutterPluginState.keyboardHeight : undefined;
8
+ }
9
+ };
4
10
  var MIN_TAP_SIZE_IN_PX = 40;
5
11
  function supportsIntersectionObserver() {
6
12
  if (typeof window !== 'undefined' && 'IntersectionObserver' in window && 'IntersectionObserverEntry' in window && 'intersectionRatio' in window.IntersectionObserverEntry.prototype) {
@@ -145,6 +151,18 @@ export default (function () {
145
151
  var scrollElement = null; // | undefined;
146
152
 
147
153
  return new SafePlugin({
154
+ key: scrollGutterPluginKey,
155
+ state: {
156
+ init: function init() {
157
+ return {};
158
+ },
159
+ apply: function apply(tr, pluginState) {
160
+ if (tr.getMeta(scrollGutterPluginKey)) {
161
+ return tr.getMeta(scrollGutterPluginKey);
162
+ }
163
+ return pluginState;
164
+ }
165
+ },
148
166
  props: {
149
167
  // Determines the distance (in pixels) between the cursor and the end of the visible viewport at which point,
150
168
  // when scrolling the cursor into view, scrolling takes place.
@@ -189,6 +207,7 @@ export default (function () {
189
207
  * Toggle the Scroll Gutter Element
190
208
  */
191
209
  update: function update(view, prevState) {
210
+ var _getKeyboardHeight;
192
211
  if (!scrollElement || !editorParentElement) {
193
212
  return;
194
213
  }
@@ -213,8 +232,8 @@ export default (function () {
213
232
  return;
214
233
  }
215
234
  // Determine whether we need to consider Keyboard Height
216
- var mobileDimensionsPluginState = getMobileDimensionsPluginState(state);
217
- var viewportHeight = scrollElement.offsetHeight - (mobileDimensionsPluginState && mobileDimensionsPluginState.keyboardHeight ? mobileDimensionsPluginState.keyboardHeight : 0);
235
+ var keyboardHeight = (_getKeyboardHeight = getKeyboardHeight(state)) !== null && _getKeyboardHeight !== void 0 ? _getKeyboardHeight : 0;
236
+ var viewportHeight = scrollElement.offsetHeight - keyboardHeight;
218
237
  var contentHeight = editorParentElement.offsetHeight - (gutterMounted ? gutterSize : 0);
219
238
 
220
239
  // Add or remove the gutter based on whether the content is about to exceed the viewport height.
@@ -0,0 +1,7 @@
1
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
+ export var scrollGutterPluginKey = new PluginKey('scrollGutter');
3
+ export var getScrollGutterPluginState = function getScrollGutterPluginState(state) {
4
+ if (state) {
5
+ return scrollGutterPluginKey.getState(state);
6
+ }
7
+ };
@@ -1,5 +1,4 @@
1
1
  export var MobileDimensionsActionTypes = /*#__PURE__*/function (MobileDimensionsActionTypes) {
2
- MobileDimensionsActionTypes["SET_KEYBOARD_HEIGHT"] = "SET_KEYBOARD_HEIGHT";
3
2
  MobileDimensionsActionTypes["SET_WINDOW_HEIGHT"] = "SET_WINDOW_HEIGHT";
4
3
  MobileDimensionsActionTypes["SET_MOBILE_PADDING_TOP"] = "SET_MOBILE_PADDING_TOP";
5
4
  MobileDimensionsActionTypes["SET_IS_EXPANDED"] = "SET_IS_EXPANDED";
@@ -1,11 +1,5 @@
1
1
  import { MobileDimensionsActionTypes } from './actions';
2
2
  import { createCommand } from './plugin-factory';
3
- export var setKeyboardHeight = function setKeyboardHeight(keyboardHeight) {
4
- return createCommand({
5
- type: MobileDimensionsActionTypes.SET_KEYBOARD_HEIGHT,
6
- keyboardHeight: keyboardHeight
7
- });
8
- };
9
3
  export var setWindowHeight = function setWindowHeight(windowHeight) {
10
4
  return createCommand({
11
5
  type: MobileDimensionsActionTypes.SET_WINDOW_HEIGHT,
@@ -3,7 +3,6 @@ import { setWindowHeight } from './commands';
3
3
  import { createPluginState, mobileDimensionsPluginKey } from './plugin-factory';
4
4
  var getInitialState = function getInitialState() {
5
5
  return {
6
- keyboardHeight: -1,
7
6
  mobilePaddingTop: 0,
8
7
  windowHeight: window.innerHeight,
9
8
  isExpanded: false
@@ -4,10 +4,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  import { MobileDimensionsActionTypes } from './actions';
5
5
  export default function (state, action) {
6
6
  switch (action.type) {
7
- case MobileDimensionsActionTypes.SET_KEYBOARD_HEIGHT:
8
- return _objectSpread(_objectSpread({}, state), {}, {
9
- keyboardHeight: action.keyboardHeight
10
- });
11
7
  case MobileDimensionsActionTypes.SET_WINDOW_HEIGHT:
12
8
  return _objectSpread(_objectSpread({}, state), {}, {
13
9
  windowHeight: action.windowHeight
@@ -9,15 +9,18 @@ import WithPluginState from '../WithPluginState';
9
9
  import WithFlash from '../WithFlash';
10
10
  import { createEditorContentStyle } from '../ContentStyles';
11
11
  import { ClickAreaMobile as ClickArea } from '../Addon';
12
+ import { usePresetContext } from '../../presets/context';
12
13
  var mobileEditor = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n min-height: 30px;\n width: 100%;\n max-width: inherit;\n box-sizing: border-box;\n word-wrap: break-word;\n\n div > .ProseMirror {\n outline: none;\n white-space: pre-wrap;\n padding: 0;\n margin: 0;\n }\n"])));
13
14
  var ContentArea = createEditorContentStyle();
14
15
  ContentArea.displayName = 'ContentArea';
15
16
  export var MobileAppearance = /*#__PURE__*/forwardRef(function MobileAppearance(_ref, ref) {
17
+ var _api$base2;
16
18
  var editorView = _ref.editorView,
17
19
  persistScrollGutter = _ref.persistScrollGutter,
18
20
  children = _ref.children,
19
21
  editorDisabled = _ref.editorDisabled,
20
22
  featureFlags = _ref.featureFlags;
23
+ var api = usePresetContext();
21
24
  var render = useCallback(function (_ref2) {
22
25
  var maxContentSize = _ref2.maxContentSize,
23
26
  mobileDimensions = _ref2.mobileDimensions;
@@ -25,10 +28,13 @@ export var MobileAppearance = /*#__PURE__*/forwardRef(function MobileAppearance(
25
28
  var minHeight = 100;
26
29
  var currentIsExpanded = true; // isExpanded prop should always be true for Hybrid Editor
27
30
  if (mobileDimensions) {
28
- var keyboardHeight = mobileDimensions.keyboardHeight,
29
- windowHeight = mobileDimensions.windowHeight,
31
+ var _api$base, _basePluginState$keyb;
32
+ var windowHeight = mobileDimensions.windowHeight,
30
33
  mobilePaddingTop = mobileDimensions.mobilePaddingTop,
31
34
  isExpanded = mobileDimensions.isExpanded;
35
+ var basePluginState = api === null || api === void 0 ? void 0 : (_api$base = api.base) === null || _api$base === void 0 ? void 0 : _api$base.sharedState.currentState();
36
+ var keyboardHeight = (_basePluginState$keyb = basePluginState === null || basePluginState === void 0 ? void 0 : basePluginState.keyboardHeight) !== null && _basePluginState$keyb !== void 0 ? _basePluginState$keyb : -1;
37
+
32
38
  /*
33
39
  We calculate the min-height based on the windowHeight - keyboardHeight - paddingTop.
34
40
  This is needed due to scrolling issues when there is no content to scroll (like, only having 1 paragraph),
@@ -63,7 +69,7 @@ export var MobileAppearance = /*#__PURE__*/forwardRef(function MobileAppearance(
63
69
  }, jsx("div", {
64
70
  className: "ak-editor-content-area"
65
71
  }, children)))));
66
- }, [children, editorView, persistScrollGutter, editorDisabled, ref, featureFlags]);
72
+ }, [children, editorView, persistScrollGutter, editorDisabled, ref, featureFlags, api === null || api === void 0 ? void 0 : (_api$base2 = api.base) === null || _api$base2 === void 0 ? void 0 : _api$base2.sharedState]);
67
73
  return jsx(WithPluginState, {
68
74
  plugins: {
69
75
  maxContentSize: maxContentSizePluginKey,
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "187.43.18";
2
+ export var version = "187.44.0";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -61,7 +61,8 @@ QuickInsertProvider, } from '@atlaskit/editor-common/provider-factory';
61
61
  export { historyPluginKey } from './plugins/history';
62
62
  export { INPUT_METHOD, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, } from '@atlaskit/editor-common/analytics';
63
63
  export type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
64
- export { setKeyboardHeight, setMobilePaddingTop, setIsExpanded, } from './plugins/mobile-dimensions/commands';
64
+ export { setKeyboardHeight } from './plugins/base/commands';
65
+ export { setMobilePaddingTop, setIsExpanded, } from './plugins/mobile-dimensions/commands';
65
66
  export { setTextSelection, getNodesCount, measurements } from './utils';
66
67
  export {
67
68
  /**
@@ -0,0 +1,2 @@
1
+ import type { Command } from '@atlaskit/editor-common/types';
2
+ export declare const setKeyboardHeight: (keyboardHeight: number) => Command;
@@ -12,6 +12,8 @@ export interface BasePluginOptions {
12
12
  }
13
13
  export type BasePluginState = {
14
14
  contextIdentifier: ContextIdentifierProvider | undefined;
15
+ /** Current height of keyboard (+ custom toolbar) in iOS app */
16
+ keyboardHeight: number | undefined;
15
17
  };
16
18
  export type BasePlugin = NextEditorPlugin<'base', {
17
19
  pluginConfiguration: BasePluginOptions | undefined;
@@ -1,5 +1,7 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
3
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
+ export declare const getKeyboardHeight: (state?: EditorState) => number | undefined;
3
5
  export type ScrollGutterPluginOptions = {
4
6
  /** Element the page uses for scrolling */
5
7
  getScrollElement?: (view: EditorView) => HTMLElement | null;
@@ -16,5 +18,5 @@ export type ScrollGutterPluginOptions = {
16
18
  persistScrollGutter?: boolean;
17
19
  gutterSize?: number;
18
20
  };
19
- declare const _default: (pluginOptions?: ScrollGutterPluginOptions) => SafePlugin<any> | undefined;
21
+ declare const _default: (pluginOptions?: ScrollGutterPluginOptions) => SafePlugin<{}> | undefined;
20
22
  export default _default;
@@ -0,0 +1,7 @@
1
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
+ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
+ export type ScrollGutterPluginState = {
4
+ keyboardHeight: number;
5
+ };
6
+ export declare const scrollGutterPluginKey: PluginKey<ScrollGutterPluginState>;
7
+ export declare const getScrollGutterPluginState: (state?: EditorState) => ScrollGutterPluginState | undefined;
@@ -1,5 +1,4 @@
1
1
  export declare enum MobileDimensionsActionTypes {
2
- SET_KEYBOARD_HEIGHT = "SET_KEYBOARD_HEIGHT",
3
2
  SET_WINDOW_HEIGHT = "SET_WINDOW_HEIGHT",
4
3
  SET_MOBILE_PADDING_TOP = "SET_MOBILE_PADDING_TOP",
5
4
  SET_IS_EXPANDED = "SET_IS_EXPANDED"
@@ -8,10 +7,6 @@ export interface SetMobilePaddingTop {
8
7
  type: MobileDimensionsActionTypes.SET_MOBILE_PADDING_TOP;
9
8
  paddingTop: number;
10
9
  }
11
- export interface SetKeyboardHeight {
12
- type: MobileDimensionsActionTypes.SET_KEYBOARD_HEIGHT;
13
- keyboardHeight: number;
14
- }
15
10
  export interface SetWindowHeight {
16
11
  type: MobileDimensionsActionTypes.SET_WINDOW_HEIGHT;
17
12
  windowHeight: number;
@@ -20,4 +15,4 @@ export interface SetIsExpanded {
20
15
  type: MobileDimensionsActionTypes.SET_IS_EXPANDED;
21
16
  isExpanded: boolean;
22
17
  }
23
- export type MobileDimensionsAction = SetKeyboardHeight | SetWindowHeight | SetMobilePaddingTop | SetIsExpanded;
18
+ export type MobileDimensionsAction = SetWindowHeight | SetMobilePaddingTop | SetIsExpanded;
@@ -1,4 +1,3 @@
1
- export declare const setKeyboardHeight: (keyboardHeight: number) => import("@atlaskit/editor-common/types").Command;
2
1
  export declare const setWindowHeight: (windowHeight: number) => import("@atlaskit/editor-common/types").Command;
3
2
  export declare const setMobilePaddingTop: (paddingTop: number) => import("@atlaskit/editor-common/types").Command;
4
3
  export declare const setIsExpanded: (isExpanded: boolean) => import("@atlaskit/editor-common/types").Command;
@@ -1,3 +1,3 @@
1
- import { NextEditorPlugin } from '@atlaskit/editor-common/types';
1
+ import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
2
2
  declare const mobileDimensionsPlugin: NextEditorPlugin<'mobileDimensions'>;
3
3
  export default mobileDimensionsPlugin;
@@ -1,3 +1,3 @@
1
- import { MobileDimensionsAction } from './actions';
2
- import { MobileDimensionsPluginState } from './types';
1
+ import type { MobileDimensionsAction } from './actions';
2
+ import type { MobileDimensionsPluginState } from './types';
3
3
  export default function (state: MobileDimensionsPluginState, action: MobileDimensionsAction): MobileDimensionsPluginState;
@@ -1,6 +1,4 @@
1
1
  export type MobileDimensionsPluginState = {
2
- /** Current height of keyboard (+ custom toolbar) in iOS app */
3
- keyboardHeight: number;
4
2
  /** Current value of window.innerHeight, on Android this changes when keyboards shows/hides */
5
3
  windowHeight: number;
6
4
  /** Current value of padding top set from native (see WebBridge abstract class implementation) */
@@ -61,7 +61,8 @@ QuickInsertProvider, } from '@atlaskit/editor-common/provider-factory';
61
61
  export { historyPluginKey } from './plugins/history';
62
62
  export { INPUT_METHOD, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, } from '@atlaskit/editor-common/analytics';
63
63
  export type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
64
- export { setKeyboardHeight, setMobilePaddingTop, setIsExpanded, } from './plugins/mobile-dimensions/commands';
64
+ export { setKeyboardHeight } from './plugins/base/commands';
65
+ export { setMobilePaddingTop, setIsExpanded, } from './plugins/mobile-dimensions/commands';
65
66
  export { setTextSelection, getNodesCount, measurements } from './utils';
66
67
  export {
67
68
  /**
@@ -0,0 +1,2 @@
1
+ import type { Command } from '@atlaskit/editor-common/types';
2
+ export declare const setKeyboardHeight: (keyboardHeight: number) => Command;
@@ -12,6 +12,8 @@ export interface BasePluginOptions {
12
12
  }
13
13
  export type BasePluginState = {
14
14
  contextIdentifier: ContextIdentifierProvider | undefined;
15
+ /** Current height of keyboard (+ custom toolbar) in iOS app */
16
+ keyboardHeight: number | undefined;
15
17
  };
16
18
  export type BasePlugin = NextEditorPlugin<'base', {
17
19
  pluginConfiguration: BasePluginOptions | undefined;
@@ -1,5 +1,7 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
3
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
+ export declare const getKeyboardHeight: (state?: EditorState) => number | undefined;
3
5
  export type ScrollGutterPluginOptions = {
4
6
  /** Element the page uses for scrolling */
5
7
  getScrollElement?: (view: EditorView) => HTMLElement | null;
@@ -16,5 +18,5 @@ export type ScrollGutterPluginOptions = {
16
18
  persistScrollGutter?: boolean;
17
19
  gutterSize?: number;
18
20
  };
19
- declare const _default: (pluginOptions?: ScrollGutterPluginOptions) => SafePlugin<any> | undefined;
21
+ declare const _default: (pluginOptions?: ScrollGutterPluginOptions) => SafePlugin<{}> | undefined;
20
22
  export default _default;
@@ -0,0 +1,7 @@
1
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
+ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
+ export type ScrollGutterPluginState = {
4
+ keyboardHeight: number;
5
+ };
6
+ export declare const scrollGutterPluginKey: PluginKey<ScrollGutterPluginState>;
7
+ export declare const getScrollGutterPluginState: (state?: EditorState) => ScrollGutterPluginState | undefined;
@@ -1,5 +1,4 @@
1
1
  export declare enum MobileDimensionsActionTypes {
2
- SET_KEYBOARD_HEIGHT = "SET_KEYBOARD_HEIGHT",
3
2
  SET_WINDOW_HEIGHT = "SET_WINDOW_HEIGHT",
4
3
  SET_MOBILE_PADDING_TOP = "SET_MOBILE_PADDING_TOP",
5
4
  SET_IS_EXPANDED = "SET_IS_EXPANDED"
@@ -8,10 +7,6 @@ export interface SetMobilePaddingTop {
8
7
  type: MobileDimensionsActionTypes.SET_MOBILE_PADDING_TOP;
9
8
  paddingTop: number;
10
9
  }
11
- export interface SetKeyboardHeight {
12
- type: MobileDimensionsActionTypes.SET_KEYBOARD_HEIGHT;
13
- keyboardHeight: number;
14
- }
15
10
  export interface SetWindowHeight {
16
11
  type: MobileDimensionsActionTypes.SET_WINDOW_HEIGHT;
17
12
  windowHeight: number;
@@ -20,4 +15,4 @@ export interface SetIsExpanded {
20
15
  type: MobileDimensionsActionTypes.SET_IS_EXPANDED;
21
16
  isExpanded: boolean;
22
17
  }
23
- export type MobileDimensionsAction = SetKeyboardHeight | SetWindowHeight | SetMobilePaddingTop | SetIsExpanded;
18
+ export type MobileDimensionsAction = SetWindowHeight | SetMobilePaddingTop | SetIsExpanded;
@@ -1,4 +1,3 @@
1
- export declare const setKeyboardHeight: (keyboardHeight: number) => import("@atlaskit/editor-common/types").Command;
2
1
  export declare const setWindowHeight: (windowHeight: number) => import("@atlaskit/editor-common/types").Command;
3
2
  export declare const setMobilePaddingTop: (paddingTop: number) => import("@atlaskit/editor-common/types").Command;
4
3
  export declare const setIsExpanded: (isExpanded: boolean) => import("@atlaskit/editor-common/types").Command;
@@ -1,3 +1,3 @@
1
- import { NextEditorPlugin } from '@atlaskit/editor-common/types';
1
+ import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
2
2
  declare const mobileDimensionsPlugin: NextEditorPlugin<'mobileDimensions'>;
3
3
  export default mobileDimensionsPlugin;
@@ -1,3 +1,3 @@
1
- import { MobileDimensionsAction } from './actions';
2
- import { MobileDimensionsPluginState } from './types';
1
+ import type { MobileDimensionsAction } from './actions';
2
+ import type { MobileDimensionsPluginState } from './types';
3
3
  export default function (state: MobileDimensionsPluginState, action: MobileDimensionsAction): MobileDimensionsPluginState;
@@ -1,6 +1,4 @@
1
1
  export type MobileDimensionsPluginState = {
2
- /** Current height of keyboard (+ custom toolbar) in iOS app */
3
- keyboardHeight: number;
4
2
  /** Current value of window.innerHeight, on Android this changes when keyboards shows/hides */
5
3
  windowHeight: number;
6
4
  /** Current value of padding top set from native (see WebBridge abstract class implementation) */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.43.18",
3
+ "version": "187.44.0",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -114,14 +114,14 @@
114
114
  "@atlaskit/smart-card": "^26.27.0",
115
115
  "@atlaskit/smart-user-picker": "^6.3.0",
116
116
  "@atlaskit/spinner": "^15.5.0",
117
- "@atlaskit/status": "^1.3.0",
117
+ "@atlaskit/status": "^1.4.0",
118
118
  "@atlaskit/tabs": "^13.4.0",
119
119
  "@atlaskit/task-decision": "^17.9.0",
120
120
  "@atlaskit/textarea": "^4.7.0",
121
121
  "@atlaskit/textfield": "^5.6.0",
122
122
  "@atlaskit/theme": "^12.6.0",
123
123
  "@atlaskit/toggle": "^12.6.0",
124
- "@atlaskit/tokens": "^1.24.0",
124
+ "@atlaskit/tokens": "^1.25.0",
125
125
  "@atlaskit/tooltip": "^17.8.0",
126
126
  "@atlaskit/width-detector": "^4.1.0",
127
127
  "@babel/runtime": "^7.0.0",