@atlaskit/editor-core 189.3.12 → 189.3.14

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 (31) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/plugins/index.js +0 -7
  3. package/dist/cjs/plugins/mobile-dimensions/index.js +6 -0
  4. package/dist/cjs/presets/universal.js +2 -1
  5. package/dist/cjs/ui/Appearance/Chromeless.js +18 -9
  6. package/dist/cjs/ui/AppearanceComponents/Mobile.js +7 -9
  7. package/dist/cjs/version-wrapper.js +1 -1
  8. package/dist/es2019/plugins/index.js +0 -1
  9. package/dist/es2019/plugins/mobile-dimensions/index.js +6 -0
  10. package/dist/es2019/presets/universal.js +2 -1
  11. package/dist/es2019/ui/Appearance/Chromeless.js +17 -9
  12. package/dist/es2019/ui/AppearanceComponents/Mobile.js +8 -9
  13. package/dist/es2019/version-wrapper.js +1 -1
  14. package/dist/esm/plugins/index.js +0 -1
  15. package/dist/esm/plugins/mobile-dimensions/index.js +6 -0
  16. package/dist/esm/presets/universal.js +2 -1
  17. package/dist/esm/ui/Appearance/Chromeless.js +15 -9
  18. package/dist/esm/ui/AppearanceComponents/Mobile.js +7 -9
  19. package/dist/esm/version-wrapper.js +1 -1
  20. package/dist/types/plugins/index.d.ts +0 -1
  21. package/dist/types/plugins/mobile-dimensions/index.d.ts +4 -1
  22. package/dist/types/ui/Appearance/Chromeless.d.ts +1 -1
  23. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  24. package/dist/types-ts4.5/plugins/mobile-dimensions/index.d.ts +4 -1
  25. package/dist/types-ts4.5/ui/Appearance/Chromeless.d.ts +1 -1
  26. package/package.json +6 -5
  27. package/dist/cjs/plugins/max-content-size/index.js +0 -44
  28. package/dist/es2019/plugins/max-content-size/index.js +0 -35
  29. package/dist/esm/plugins/max-content-size/index.js +0 -37
  30. package/dist/types/plugins/max-content-size/index.d.ts +0 -13
  31. package/dist/types-ts4.5/plugins/max-content-size/index.d.ts +0 -13
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 189.3.14
4
+
5
+ ### Patch Changes
6
+
7
+ - [#42995](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42995) [`a527682dee6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a527682dee6) - add in missing dependencies for imported types
8
+ - [#42618](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42618) [`d55f8d9c0a3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d55f8d9c0a3) - ED-20359 extracted max-content-size plugin from editor-core
9
+ - Updated dependencies
10
+
11
+ ## 189.3.13
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 189.3.12
4
18
 
5
19
  ### Patch Changes
@@ -125,12 +125,6 @@ Object.defineProperty(exports, "macroPlugin", {
125
125
  return _macro.default;
126
126
  }
127
127
  });
128
- Object.defineProperty(exports, "maxContentSizePlugin", {
129
- enumerable: true,
130
- get: function get() {
131
- return _maxContentSize.default;
132
- }
133
- });
134
128
  Object.defineProperty(exports, "mobileDimensionsPlugin", {
135
129
  enumerable: true,
136
130
  get: function get() {
@@ -180,7 +174,6 @@ var _insertBlock = _interopRequireDefault(require("./insert-block"));
180
174
  var _jiraIssue = _interopRequireDefault(require("./jira-issue"));
181
175
  var _toolbarListsIndentation = _interopRequireDefault(require("./toolbar-lists-indentation"));
182
176
  var _macro = _interopRequireDefault(require("./macro"));
183
- var _maxContentSize = _interopRequireDefault(require("./max-content-size"));
184
177
  var _paste = _interopRequireDefault(require("./paste"));
185
178
  var _tasksAndDecisions = _interopRequireDefault(require("./tasks-and-decisions"));
186
179
  var _breakout = _interopRequireDefault(require("./breakout"));
@@ -79,6 +79,12 @@ var createPlugin = function createPlugin(dispatch) {
79
79
  var mobileDimensionsPlugin = function mobileDimensionsPlugin() {
80
80
  return {
81
81
  name: 'mobileDimensions',
82
+ getSharedState: function getSharedState(editorState) {
83
+ if (!editorState) {
84
+ return undefined;
85
+ }
86
+ return _pluginFactory.mobileDimensionsPluginKey.getState(editorState);
87
+ },
82
88
  pmPlugins: function pmPlugins() {
83
89
  return [{
84
90
  name: 'mobileDimensions',
@@ -13,6 +13,7 @@ var _editorPluginTextColor = require("@atlaskit/editor-plugin-text-color");
13
13
  var _editorPluginHistory = require("@atlaskit/editor-plugin-history");
14
14
  var _editorPluginStatus = require("@atlaskit/editor-plugin-status");
15
15
  var _editorPluginDate = require("@atlaskit/editor-plugin-date");
16
+ var _editorPluginMaxContentSize = require("@atlaskit/editor-plugin-max-content-size");
16
17
  var _editorPluginCaption = require("@atlaskit/editor-plugin-caption");
17
18
  var _editorPluginBorder = require("@atlaskit/editor-plugin-border");
18
19
  var _editorPluginHelpDialog = require("@atlaskit/editor-plugin-help-dialog");
@@ -234,7 +235,7 @@ function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
234
235
  })]);
235
236
  }
236
237
  return builder;
237
- }).maybeAdd(_plugins.maxContentSizePlugin, function (plugin, builder) {
238
+ }).maybeAdd(_editorPluginMaxContentSize.maxContentSizePlugin, function (plugin, builder) {
238
239
  if (props.maxContentSize) {
239
240
  return builder.add([plugin, props.maxContentSize]);
240
241
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
@@ -13,16 +14,18 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
13
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
14
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
16
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
16
- var _react = _interopRequireDefault(require("react"));
17
+ var _react = _interopRequireWildcard(require("react"));
17
18
  var _react2 = require("@emotion/react");
18
19
  var _PluginSlot = _interopRequireDefault(require("../PluginSlot"));
19
- var _WithPluginState = _interopRequireDefault(require("../WithPluginState"));
20
20
  var _ContentStyles = require("../ContentStyles");
21
- var _maxContentSize = require("../../plugins/max-content-size");
22
21
  var _styles = require("../styles");
23
22
  var _WithFlash = _interopRequireDefault(require("../WithFlash"));
23
+ var _context = require("../../presets/context");
24
+ var _hooks = require("@atlaskit/editor-common/hooks");
24
25
  var _templateObject, _templateObject2, _templateObject3;
25
26
  /** @jsx jsx */
27
+ 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); }
28
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
26
29
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
27
30
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
28
31
  var chromelessEditor = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n line-height: 20px;\n height: auto;\n\n overflow-x: hidden;\n overflow-y: auto;\n ", ";\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 & > :last-child {\n padding-bottom: 0.5em;\n }\n }\n"])), _styles.scrollbarStyles);
@@ -94,14 +97,20 @@ var Editor = exports.default = /*#__PURE__*/function (_React$Component) {
94
97
  (0, _createClass2.default)(Editor, [{
95
98
  key: "render",
96
99
  value: function render() {
97
- return (0, _react2.jsx)(_WithPluginState.default, {
98
- plugins: {
99
- maxContentSize: _maxContentSize.pluginKey
100
- },
101
- render: this.renderChrome
100
+ return (0, _react2.jsx)(RenderWithPluginState, {
101
+ renderChrome: this.renderChrome
102
102
  });
103
103
  }
104
104
  }]);
105
105
  return Editor;
106
106
  }(_react.default.Component);
107
- (0, _defineProperty2.default)(Editor, "displayName", 'ChromelessEditorAppearance');
107
+ (0, _defineProperty2.default)(Editor, "displayName", 'ChromelessEditorAppearance');
108
+ function RenderWithPluginState(_ref3) {
109
+ var renderChrome = _ref3.renderChrome;
110
+ var api = (0, _context.usePresetContext)();
111
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['maxContentSize']),
112
+ maxContentSizeState = _useSharedPluginState.maxContentSizeState;
113
+ return (0, _react2.jsx)(_react.Fragment, null, renderChrome({
114
+ maxContentSize: maxContentSizeState
115
+ }));
116
+ }
@@ -9,13 +9,11 @@ exports.MobileAppearance = void 0;
9
9
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
  var _react2 = require("@emotion/react");
12
- var _maxContentSize = require("../../plugins/max-content-size");
13
- var _pluginFactory = require("../../plugins/mobile-dimensions/plugin-factory");
14
- var _WithPluginState = _interopRequireDefault(require("../WithPluginState"));
15
12
  var _WithFlash = _interopRequireDefault(require("../WithFlash"));
16
13
  var _ContentStyles = require("../ContentStyles");
17
14
  var _Addon = require("../Addon");
18
15
  var _context = require("../../presets/context");
16
+ var _hooks = require("@atlaskit/editor-common/hooks");
19
17
  var _templateObject;
20
18
  /** @jsx jsx */
21
19
  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); }
@@ -31,6 +29,9 @@ var MobileAppearance = exports.MobileAppearance = /*#__PURE__*/(0, _react.forwar
31
29
  editorDisabled = _ref.editorDisabled,
32
30
  featureFlags = _ref.featureFlags;
33
31
  var api = (0, _context.usePresetContext)();
32
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['maxContentSize', 'mobileDimensions']),
33
+ maxContentSizeState = _useSharedPluginState.maxContentSizeState,
34
+ mobileDimensionsState = _useSharedPluginState.mobileDimensionsState;
34
35
  var render = (0, _react.useCallback)(function (_ref2) {
35
36
  var maxContentSize = _ref2.maxContentSize,
36
37
  mobileDimensions = _ref2.mobileDimensions;
@@ -80,11 +81,8 @@ var MobileAppearance = exports.MobileAppearance = /*#__PURE__*/(0, _react.forwar
80
81
  className: "ak-editor-content-area"
81
82
  }, children)))));
82
83
  }, [children, editorView, persistScrollGutter, editorDisabled, ref, featureFlags, api === null || api === void 0 || (_api$base2 = api.base) === null || _api$base2 === void 0 ? void 0 : _api$base2.sharedState]);
83
- return (0, _react2.jsx)(_WithPluginState.default, {
84
- plugins: {
85
- maxContentSize: _maxContentSize.pluginKey,
86
- mobileDimensions: _pluginFactory.mobileDimensionsPluginKey
87
- },
88
- render: render
84
+ return render({
85
+ maxContentSize: maxContentSizeState,
86
+ mobileDimensions: mobileDimensionsState
89
87
  });
90
88
  });
@@ -5,4 +5,4 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = exports.name = void 0;
7
7
  var name = exports.name = "@atlaskit/editor-core";
8
- var version = exports.version = "189.3.12";
8
+ var version = exports.version = "189.3.14";
@@ -5,7 +5,6 @@ export { default as insertBlockPlugin } from './insert-block';
5
5
  export { default as jiraIssuePlugin } from './jira-issue';
6
6
  export { default as toolbarListsIndentationPlugin } from './toolbar-lists-indentation';
7
7
  export { default as macroPlugin } from './macro';
8
- export { default as maxContentSizePlugin } from './max-content-size';
9
8
  export { default as pastePlugin } from './paste';
10
9
  export { default as tasksAndDecisionsPlugin } from './tasks-and-decisions';
11
10
  export { default as breakoutPlugin } from './breakout';
@@ -70,6 +70,12 @@ const createPlugin = dispatch => {
70
70
  };
71
71
  const mobileDimensionsPlugin = () => ({
72
72
  name: 'mobileDimensions',
73
+ getSharedState(editorState) {
74
+ if (!editorState) {
75
+ return undefined;
76
+ }
77
+ return mobileDimensionsPluginKey.getState(editorState);
78
+ },
73
79
  pmPlugins() {
74
80
  return [{
75
81
  name: 'mobileDimensions',
@@ -1,9 +1,10 @@
1
- import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, insertBlockPlugin, jiraIssuePlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, tasksAndDecisionsPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, expandPlugin, isExpandInsertionEnabled, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin } from '../plugins';
1
+ import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, insertBlockPlugin, jiraIssuePlugin, toolbarListsIndentationPlugin, macroPlugin, tasksAndDecisionsPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, expandPlugin, isExpandInsertionEnabled, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin } from '../plugins';
2
2
  import { panelPlugin } from '@atlaskit/editor-plugin-panel';
3
3
  import { textColorPlugin } from '@atlaskit/editor-plugin-text-color';
4
4
  import { historyPlugin } from '@atlaskit/editor-plugin-history';
5
5
  import { statusPlugin } from '@atlaskit/editor-plugin-status';
6
6
  import { datePlugin } from '@atlaskit/editor-plugin-date';
7
+ import { maxContentSizePlugin } from '@atlaskit/editor-plugin-max-content-size';
7
8
  import { captionPlugin } from '@atlaskit/editor-plugin-caption';
8
9
  import { borderPlugin } from '@atlaskit/editor-plugin-border';
9
10
  import { helpDialogPlugin } from '@atlaskit/editor-plugin-help-dialog';
@@ -1,13 +1,13 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  /** @jsx jsx */
3
- import React from 'react';
3
+ import React, { Fragment } from 'react';
4
4
  import { css, jsx } from '@emotion/react';
5
5
  import PluginSlot from '../PluginSlot';
6
- import WithPluginState from '../WithPluginState';
7
6
  import { createEditorContentStyle } from '../ContentStyles';
8
- import { pluginKey as maxContentSizePluginKey } from '../../plugins/max-content-size';
9
7
  import { scrollbarStyles } from '../styles';
10
8
  import WithFlash from '../WithFlash';
9
+ import { usePresetContext } from '../../presets/context';
10
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
11
11
  const chromelessEditor = css`
12
12
  line-height: 20px;
13
13
  height: auto;
@@ -91,12 +91,20 @@ export default class Editor extends React.Component {
91
91
  });
92
92
  }
93
93
  render() {
94
- return jsx(WithPluginState, {
95
- plugins: {
96
- maxContentSize: maxContentSizePluginKey
97
- },
98
- render: this.renderChrome
94
+ return jsx(RenderWithPluginState, {
95
+ renderChrome: this.renderChrome
99
96
  });
100
97
  }
101
98
  }
102
- _defineProperty(Editor, "displayName", 'ChromelessEditorAppearance');
99
+ _defineProperty(Editor, "displayName", 'ChromelessEditorAppearance');
100
+ function RenderWithPluginState({
101
+ renderChrome
102
+ }) {
103
+ const api = usePresetContext();
104
+ const {
105
+ maxContentSizeState
106
+ } = useSharedPluginState(api, ['maxContentSize']);
107
+ return jsx(Fragment, null, renderChrome({
108
+ maxContentSize: maxContentSizeState
109
+ }));
110
+ }
@@ -1,13 +1,11 @@
1
1
  /** @jsx jsx */
2
2
  import React, { useCallback, forwardRef } from 'react';
3
3
  import { css, jsx } from '@emotion/react';
4
- import { pluginKey as maxContentSizePluginKey } from '../../plugins/max-content-size';
5
- import { mobileDimensionsPluginKey } from '../../plugins/mobile-dimensions/plugin-factory';
6
- import WithPluginState from '../WithPluginState';
7
4
  import WithFlash from '../WithFlash';
8
5
  import { createEditorContentStyle } from '../ContentStyles';
9
6
  import { ClickAreaMobile as ClickArea } from '../Addon';
10
7
  import { usePresetContext } from '../../presets/context';
8
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
11
9
  const mobileEditor = css`
12
10
  min-height: 30px;
13
11
  width: 100%;
@@ -33,6 +31,10 @@ export const MobileAppearance = /*#__PURE__*/forwardRef(function MobileAppearanc
33
31
  }, ref) {
34
32
  var _api$base2;
35
33
  const api = usePresetContext();
34
+ const {
35
+ maxContentSizeState,
36
+ mobileDimensionsState
37
+ } = useSharedPluginState(api, ['maxContentSize', 'mobileDimensions']);
36
38
  const render = useCallback(({
37
39
  maxContentSize,
38
40
  mobileDimensions
@@ -85,11 +87,8 @@ export const MobileAppearance = /*#__PURE__*/forwardRef(function MobileAppearanc
85
87
  className: "ak-editor-content-area"
86
88
  }, children)))));
87
89
  }, [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]);
88
- return jsx(WithPluginState, {
89
- plugins: {
90
- maxContentSize: maxContentSizePluginKey,
91
- mobileDimensions: mobileDimensionsPluginKey
92
- },
93
- render: render
90
+ return render({
91
+ maxContentSize: maxContentSizeState,
92
+ mobileDimensions: mobileDimensionsState
94
93
  });
95
94
  });
@@ -1,2 +1,2 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "189.3.12";
2
+ export const version = "189.3.14";
@@ -5,7 +5,6 @@ export { default as insertBlockPlugin } from './insert-block';
5
5
  export { default as jiraIssuePlugin } from './jira-issue';
6
6
  export { default as toolbarListsIndentationPlugin } from './toolbar-lists-indentation';
7
7
  export { default as macroPlugin } from './macro';
8
- export { default as maxContentSizePlugin } from './max-content-size';
9
8
  export { default as pastePlugin } from './paste';
10
9
  export { default as tasksAndDecisionsPlugin } from './tasks-and-decisions';
11
10
  export { default as breakoutPlugin } from './breakout';
@@ -73,6 +73,12 @@ var createPlugin = function createPlugin(dispatch) {
73
73
  var mobileDimensionsPlugin = function mobileDimensionsPlugin() {
74
74
  return {
75
75
  name: 'mobileDimensions',
76
+ getSharedState: function getSharedState(editorState) {
77
+ if (!editorState) {
78
+ return undefined;
79
+ }
80
+ return mobileDimensionsPluginKey.getState(editorState);
81
+ },
76
82
  pmPlugins: function pmPlugins() {
77
83
  return [{
78
84
  name: 'mobileDimensions',
@@ -2,12 +2,13 @@ import _typeof from "@babel/runtime/helpers/typeof";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  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; }
4
4
  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; }
5
- import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, insertBlockPlugin, jiraIssuePlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, tasksAndDecisionsPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, expandPlugin, isExpandInsertionEnabled, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin } from '../plugins';
5
+ import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, insertBlockPlugin, jiraIssuePlugin, toolbarListsIndentationPlugin, macroPlugin, tasksAndDecisionsPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, expandPlugin, isExpandInsertionEnabled, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin } from '../plugins';
6
6
  import { panelPlugin } from '@atlaskit/editor-plugin-panel';
7
7
  import { textColorPlugin } from '@atlaskit/editor-plugin-text-color';
8
8
  import { historyPlugin } from '@atlaskit/editor-plugin-history';
9
9
  import { statusPlugin } from '@atlaskit/editor-plugin-status';
10
10
  import { datePlugin } from '@atlaskit/editor-plugin-date';
11
+ import { maxContentSizePlugin } from '@atlaskit/editor-plugin-max-content-size';
11
12
  import { captionPlugin } from '@atlaskit/editor-plugin-caption';
12
13
  import { borderPlugin } from '@atlaskit/editor-plugin-border';
13
14
  import { helpDialogPlugin } from '@atlaskit/editor-plugin-help-dialog';
@@ -10,14 +10,14 @@ var _templateObject, _templateObject2, _templateObject3;
10
10
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
11
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
12
  /** @jsx jsx */
13
- import React from 'react';
13
+ import React, { Fragment } from 'react';
14
14
  import { css, jsx } from '@emotion/react';
15
15
  import PluginSlot from '../PluginSlot';
16
- import WithPluginState from '../WithPluginState';
17
16
  import { createEditorContentStyle } from '../ContentStyles';
18
- import { pluginKey as maxContentSizePluginKey } from '../../plugins/max-content-size';
19
17
  import { scrollbarStyles } from '../styles';
20
18
  import WithFlash from '../WithFlash';
19
+ import { usePresetContext } from '../../presets/context';
20
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
21
21
  var chromelessEditor = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n line-height: 20px;\n height: auto;\n\n overflow-x: hidden;\n overflow-y: auto;\n ", ";\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 & > :last-child {\n padding-bottom: 0.5em;\n }\n }\n"])), scrollbarStyles);
22
22
  var ContentArea = createEditorContentStyle();
23
23
  ContentArea.displayName = 'ContentArea';
@@ -87,15 +87,21 @@ var Editor = /*#__PURE__*/function (_React$Component) {
87
87
  _createClass(Editor, [{
88
88
  key: "render",
89
89
  value: function render() {
90
- return jsx(WithPluginState, {
91
- plugins: {
92
- maxContentSize: maxContentSizePluginKey
93
- },
94
- render: this.renderChrome
90
+ return jsx(RenderWithPluginState, {
91
+ renderChrome: this.renderChrome
95
92
  });
96
93
  }
97
94
  }]);
98
95
  return Editor;
99
96
  }(React.Component);
100
97
  _defineProperty(Editor, "displayName", 'ChromelessEditorAppearance');
101
- export { Editor as default };
98
+ export { Editor as default };
99
+ function RenderWithPluginState(_ref3) {
100
+ var renderChrome = _ref3.renderChrome;
101
+ var api = usePresetContext();
102
+ var _useSharedPluginState = useSharedPluginState(api, ['maxContentSize']),
103
+ maxContentSizeState = _useSharedPluginState.maxContentSizeState;
104
+ return jsx(Fragment, null, renderChrome({
105
+ maxContentSize: maxContentSizeState
106
+ }));
107
+ }
@@ -3,13 +3,11 @@ var _templateObject;
3
3
  /** @jsx jsx */
4
4
  import React, { useCallback, forwardRef } from 'react';
5
5
  import { css, jsx } from '@emotion/react';
6
- import { pluginKey as maxContentSizePluginKey } from '../../plugins/max-content-size';
7
- import { mobileDimensionsPluginKey } from '../../plugins/mobile-dimensions/plugin-factory';
8
- import WithPluginState from '../WithPluginState';
9
6
  import WithFlash from '../WithFlash';
10
7
  import { createEditorContentStyle } from '../ContentStyles';
11
8
  import { ClickAreaMobile as ClickArea } from '../Addon';
12
9
  import { usePresetContext } from '../../presets/context';
10
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
13
11
  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"])));
14
12
  var ContentArea = createEditorContentStyle();
15
13
  ContentArea.displayName = 'ContentArea';
@@ -21,6 +19,9 @@ export var MobileAppearance = /*#__PURE__*/forwardRef(function MobileAppearance(
21
19
  editorDisabled = _ref.editorDisabled,
22
20
  featureFlags = _ref.featureFlags;
23
21
  var api = usePresetContext();
22
+ var _useSharedPluginState = useSharedPluginState(api, ['maxContentSize', 'mobileDimensions']),
23
+ maxContentSizeState = _useSharedPluginState.maxContentSizeState,
24
+ mobileDimensionsState = _useSharedPluginState.mobileDimensionsState;
24
25
  var render = useCallback(function (_ref2) {
25
26
  var maxContentSize = _ref2.maxContentSize,
26
27
  mobileDimensions = _ref2.mobileDimensions;
@@ -70,11 +71,8 @@ export var MobileAppearance = /*#__PURE__*/forwardRef(function MobileAppearance(
70
71
  className: "ak-editor-content-area"
71
72
  }, children)))));
72
73
  }, [children, editorView, persistScrollGutter, editorDisabled, ref, featureFlags, api === null || api === void 0 || (_api$base2 = api.base) === null || _api$base2 === void 0 ? void 0 : _api$base2.sharedState]);
73
- return jsx(WithPluginState, {
74
- plugins: {
75
- maxContentSize: maxContentSizePluginKey,
76
- mobileDimensions: mobileDimensionsPluginKey
77
- },
78
- render: render
74
+ return render({
75
+ maxContentSize: maxContentSizeState,
76
+ mobileDimensions: mobileDimensionsState
79
77
  });
80
78
  });
@@ -1,2 +1,2 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "189.3.12";
2
+ export var version = "189.3.14";
@@ -5,7 +5,6 @@ export { default as insertBlockPlugin } from './insert-block';
5
5
  export { default as jiraIssuePlugin } from './jira-issue';
6
6
  export { default as toolbarListsIndentationPlugin } from './toolbar-lists-indentation';
7
7
  export { default as macroPlugin } from './macro';
8
- export { default as maxContentSizePlugin } from './max-content-size';
9
8
  export { default as pastePlugin } from './paste';
10
9
  export { default as tasksAndDecisionsPlugin } from './tasks-and-decisions';
11
10
  export { default as breakoutPlugin } from './breakout';
@@ -1,3 +1,6 @@
1
1
  import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
2
- declare const mobileDimensionsPlugin: NextEditorPlugin<'mobileDimensions'>;
2
+ import type { MobileDimensionsPluginState } from './types';
3
+ declare const mobileDimensionsPlugin: NextEditorPlugin<'mobileDimensions', {
4
+ sharedState: MobileDimensionsPluginState | undefined;
5
+ }>;
3
6
  export default mobileDimensionsPlugin;
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
3
  import { jsx } from '@emotion/react';
4
- import { EditorAppearanceComponentProps } from '../../types';
4
+ import type { EditorAppearanceComponentProps } from '../../types';
5
5
  export default class Editor extends React.Component<EditorAppearanceComponentProps, any> {
6
6
  static displayName: string;
7
7
  private appearance;
@@ -5,7 +5,6 @@ export { default as insertBlockPlugin } from './insert-block';
5
5
  export { default as jiraIssuePlugin } from './jira-issue';
6
6
  export { default as toolbarListsIndentationPlugin } from './toolbar-lists-indentation';
7
7
  export { default as macroPlugin } from './macro';
8
- export { default as maxContentSizePlugin } from './max-content-size';
9
8
  export { default as pastePlugin } from './paste';
10
9
  export { default as tasksAndDecisionsPlugin } from './tasks-and-decisions';
11
10
  export { default as breakoutPlugin } from './breakout';
@@ -1,3 +1,6 @@
1
1
  import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
2
- declare const mobileDimensionsPlugin: NextEditorPlugin<'mobileDimensions'>;
2
+ import type { MobileDimensionsPluginState } from './types';
3
+ declare const mobileDimensionsPlugin: NextEditorPlugin<'mobileDimensions', {
4
+ sharedState: MobileDimensionsPluginState | undefined;
5
+ }>;
3
6
  export default mobileDimensionsPlugin;
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
3
  import { jsx } from '@emotion/react';
4
- import { EditorAppearanceComponentProps } from '../../types';
4
+ import type { EditorAppearanceComponentProps } from '../../types';
5
5
  export default class Editor extends React.Component<EditorAppearanceComponentProps, any> {
6
6
  static displayName: string;
7
7
  private appearance;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "189.3.12",
3
+ "version": "189.3.14",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -48,7 +48,7 @@
48
48
  "@atlaskit/analytics-next-stable-react-context": "1.0.1",
49
49
  "@atlaskit/avatar": "^21.4.0",
50
50
  "@atlaskit/avatar-group": "^9.4.0",
51
- "@atlaskit/button": "^16.13.0",
51
+ "@atlaskit/button": "^16.14.0",
52
52
  "@atlaskit/checkbox": "^13.0.0",
53
53
  "@atlaskit/code": "^14.6.0",
54
54
  "@atlaskit/date": "^0.10.0",
@@ -62,7 +62,7 @@
62
62
  "@atlaskit/editor-plugin-block-type": "^3.0.0",
63
63
  "@atlaskit/editor-plugin-border": "^0.1.0",
64
64
  "@atlaskit/editor-plugin-caption": "^0.2.0",
65
- "@atlaskit/editor-plugin-card": "^0.11.0",
65
+ "@atlaskit/editor-plugin-card": "^0.12.0",
66
66
  "@atlaskit/editor-plugin-clipboard": "^0.1.0",
67
67
  "@atlaskit/editor-plugin-code-block": "^0.1.0",
68
68
  "@atlaskit/editor-plugin-composition": "^0.1.0",
@@ -86,6 +86,7 @@
86
86
  "@atlaskit/editor-plugin-image-upload": "^0.2.0",
87
87
  "@atlaskit/editor-plugin-layout": "^0.1.0",
88
88
  "@atlaskit/editor-plugin-list": "^1.3.0",
89
+ "@atlaskit/editor-plugin-max-content-size": "^0.1.0",
89
90
  "@atlaskit/editor-plugin-media": "^0.3.0",
90
91
  "@atlaskit/editor-plugin-mentions": "^0.1.0",
91
92
  "@atlaskit/editor-plugin-panel": "^0.1.0",
@@ -136,6 +137,7 @@
136
137
  "@atlaskit/toggle": "^12.6.0",
137
138
  "@atlaskit/tokens": "^1.28.0",
138
139
  "@atlaskit/tooltip": "^17.8.0",
140
+ "@atlaskit/ufo": "^0.2.0",
139
141
  "@atlaskit/width-detector": "^4.1.0",
140
142
  "@babel/runtime": "^7.0.0",
141
143
  "@emotion/react": "^11.7.1",
@@ -166,7 +168,7 @@
166
168
  "@atlaskit/collab-provider": "9.15.4",
167
169
  "@atlaskit/dropdown-menu": "^12.1.0",
168
170
  "@atlaskit/editor-extension-dropbox": "^0.4.0",
169
- "@atlaskit/editor-palette": "1.5.1",
171
+ "@atlaskit/editor-palette": "1.5.2",
170
172
  "@atlaskit/flag": "^15.2.0",
171
173
  "@atlaskit/icon-object": "^6.3.0",
172
174
  "@atlaskit/inline-dialog": "^14.0.0",
@@ -180,7 +182,6 @@
180
182
  "@atlaskit/modal-dialog": "^12.8.0",
181
183
  "@atlaskit/renderer": "^108.15.0",
182
184
  "@atlaskit/synchrony-test-helpers": "^2.3.0",
183
- "@atlaskit/ufo": "^0.2.0",
184
185
  "@atlaskit/util-data-test": "^17.8.0",
185
186
  "@atlaskit/visual-regression": "*",
186
187
  "@atlaskit/webdriver-runner": "*",
@@ -1,44 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createPlugin = createPlugin;
7
- exports.pluginKey = exports.default = void 0;
8
- var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
9
- var _state = require("@atlaskit/editor-prosemirror/state");
10
- var pluginKey = exports.pluginKey = new _state.PluginKey('maxContentSizePlugin');
11
- function createPlugin(dispatch, maxContentSize) {
12
- if (!maxContentSize) {
13
- return;
14
- }
15
- var maxContentSizeReached = false;
16
- return new _safePlugin.SafePlugin({
17
- filterTransaction: function filterTransaction(tr) {
18
- var result = tr.doc && tr.doc.nodeSize > maxContentSize;
19
- if (result || result !== maxContentSizeReached) {
20
- dispatch(pluginKey, {
21
- maxContentSizeReached: result
22
- });
23
- }
24
- maxContentSizeReached = result;
25
- return !result;
26
- }
27
- });
28
- }
29
- var maxContentSizePlugin = function maxContentSizePlugin(_ref) {
30
- var maxContentSize = _ref.config;
31
- return {
32
- name: 'maxContentSize',
33
- pmPlugins: function pmPlugins() {
34
- return [{
35
- name: 'maxContentSize',
36
- plugin: function plugin(_ref2) {
37
- var dispatch = _ref2.dispatch;
38
- return createPlugin(dispatch, maxContentSize);
39
- }
40
- }];
41
- }
42
- };
43
- };
44
- var _default = exports.default = maxContentSizePlugin;
@@ -1,35 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- export const pluginKey = new PluginKey('maxContentSizePlugin');
4
- export function createPlugin(dispatch, maxContentSize) {
5
- if (!maxContentSize) {
6
- return;
7
- }
8
- let maxContentSizeReached = false;
9
- return new SafePlugin({
10
- filterTransaction(tr) {
11
- const result = tr.doc && tr.doc.nodeSize > maxContentSize;
12
- if (result || result !== maxContentSizeReached) {
13
- dispatch(pluginKey, {
14
- maxContentSizeReached: result
15
- });
16
- }
17
- maxContentSizeReached = result;
18
- return !result;
19
- }
20
- });
21
- }
22
- const maxContentSizePlugin = ({
23
- config: maxContentSize
24
- }) => ({
25
- name: 'maxContentSize',
26
- pmPlugins() {
27
- return [{
28
- name: 'maxContentSize',
29
- plugin: ({
30
- dispatch
31
- }) => createPlugin(dispatch, maxContentSize)
32
- }];
33
- }
34
- });
35
- export default maxContentSizePlugin;
@@ -1,37 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- export var pluginKey = new PluginKey('maxContentSizePlugin');
4
- export function createPlugin(dispatch, maxContentSize) {
5
- if (!maxContentSize) {
6
- return;
7
- }
8
- var maxContentSizeReached = false;
9
- return new SafePlugin({
10
- filterTransaction: function filterTransaction(tr) {
11
- var result = tr.doc && tr.doc.nodeSize > maxContentSize;
12
- if (result || result !== maxContentSizeReached) {
13
- dispatch(pluginKey, {
14
- maxContentSizeReached: result
15
- });
16
- }
17
- maxContentSizeReached = result;
18
- return !result;
19
- }
20
- });
21
- }
22
- var maxContentSizePlugin = function maxContentSizePlugin(_ref) {
23
- var maxContentSize = _ref.config;
24
- return {
25
- name: 'maxContentSize',
26
- pmPlugins: function pmPlugins() {
27
- return [{
28
- name: 'maxContentSize',
29
- plugin: function plugin(_ref2) {
30
- var dispatch = _ref2.dispatch;
31
- return createPlugin(dispatch, maxContentSize);
32
- }
33
- }];
34
- }
35
- };
36
- };
37
- export default maxContentSizePlugin;
@@ -1,13 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
4
- import type { Dispatch } from '../../event-dispatcher';
5
- export declare const pluginKey: PluginKey<MaxContentSizePluginState>;
6
- export type MaxContentSizePluginState = {
7
- maxContentSizeReached: boolean;
8
- };
9
- export declare function createPlugin(dispatch: Dispatch, maxContentSize?: number): SafePlugin | undefined;
10
- declare const maxContentSizePlugin: NextEditorPlugin<'maxContentSize', {
11
- pluginConfiguration: number | undefined;
12
- }>;
13
- export default maxContentSizePlugin;
@@ -1,13 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
4
- import type { Dispatch } from '../../event-dispatcher';
5
- export declare const pluginKey: PluginKey<MaxContentSizePluginState>;
6
- export type MaxContentSizePluginState = {
7
- maxContentSizeReached: boolean;
8
- };
9
- export declare function createPlugin(dispatch: Dispatch, maxContentSize?: number): SafePlugin | undefined;
10
- declare const maxContentSizePlugin: NextEditorPlugin<'maxContentSize', {
11
- pluginConfiguration: number | undefined;
12
- }>;
13
- export default maxContentSizePlugin;