@atlaskit/editor-core 190.1.6 → 190.1.8

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 (155) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/afm-cc/tsconfig.json +3 -0
  3. package/dist/cjs/plugins/index.js +0 -28
  4. package/dist/cjs/presets/universal.js +2 -16
  5. package/dist/cjs/ui/Addon/ClickAreaInline/index.js +1 -1
  6. package/dist/cjs/ui/AppearanceComponents/Mobile.js +3 -0
  7. package/dist/cjs/utils/action.js +0 -28
  8. package/dist/cjs/version-wrapper.js +1 -1
  9. package/dist/es2019/plugins/index.js +0 -4
  10. package/dist/es2019/presets/universal.js +2 -16
  11. package/dist/es2019/ui/Addon/ClickAreaInline/index.js +1 -1
  12. package/dist/es2019/ui/AppearanceComponents/Mobile.js +4 -0
  13. package/dist/es2019/utils/action.js +0 -28
  14. package/dist/es2019/version-wrapper.js +1 -1
  15. package/dist/esm/plugins/index.js +0 -4
  16. package/dist/esm/presets/universal.js +2 -16
  17. package/dist/esm/ui/Addon/ClickAreaInline/index.js +1 -1
  18. package/dist/esm/ui/AppearanceComponents/Mobile.js +4 -0
  19. package/dist/esm/utils/action.js +0 -28
  20. package/dist/esm/version-wrapper.js +1 -1
  21. package/dist/types/plugins/index.d.ts +0 -4
  22. package/dist/types/utils/action.d.ts +0 -6
  23. package/dist/types-ts4.5/plugins/index.d.ts +0 -4
  24. package/dist/types-ts4.5/utils/action.d.ts +0 -6
  25. package/package.json +2 -1
  26. package/dist/cjs/commands/index.js +0 -42
  27. package/dist/cjs/plugins/alignment/commands/index.js +0 -36
  28. package/dist/cjs/plugins/alignment/index.js +0 -70
  29. package/dist/cjs/plugins/alignment/pm-plugins/keymap.js +0 -14
  30. package/dist/cjs/plugins/alignment/pm-plugins/main.js +0 -45
  31. package/dist/cjs/plugins/alignment/pm-plugins/types.js +0 -5
  32. package/dist/cjs/plugins/alignment/ui/ToolbarAlignment/icon-map.js +0 -36
  33. package/dist/cjs/plugins/alignment/ui/ToolbarAlignment/index.js +0 -169
  34. package/dist/cjs/plugins/alignment/ui/ToolbarAlignment/messages.js +0 -29
  35. package/dist/cjs/plugins/alignment/ui/ToolbarAlignment/styles.js +0 -13
  36. package/dist/cjs/plugins/alignment/utils/index.js +0 -27
  37. package/dist/cjs/plugins/mobile-dimensions/actions.js +0 -12
  38. package/dist/cjs/plugins/mobile-dimensions/commands.js +0 -26
  39. package/dist/cjs/plugins/mobile-dimensions/index.js +0 -99
  40. package/dist/cjs/plugins/mobile-dimensions/plugin-factory.js +0 -15
  41. package/dist/cjs/plugins/mobile-dimensions/reducer.js +0 -28
  42. package/dist/cjs/plugins/mobile-dimensions/types.js +0 -5
  43. package/dist/cjs/plugins/mobile-selection/content-in-selection.js +0 -24
  44. package/dist/cjs/plugins/mobile-selection/index.js +0 -18
  45. package/dist/cjs/plugins/mobile-selection/mobile-selection-plugin.js +0 -59
  46. package/dist/cjs/plugins/mobile-selection/types.js +0 -5
  47. package/dist/cjs/plugins/view-update-subscription/index.js +0 -90
  48. package/dist/cjs/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +0 -109
  49. package/dist/cjs/ui/Alignment/AlignmentButton/index.js +0 -71
  50. package/dist/cjs/ui/Alignment/index.js +0 -74
  51. package/dist/cjs/ui/Alignment/styles.js +0 -11
  52. package/dist/es2019/commands/index.js +0 -1
  53. package/dist/es2019/plugins/alignment/commands/index.js +0 -30
  54. package/dist/es2019/plugins/alignment/index.js +0 -58
  55. package/dist/es2019/plugins/alignment/pm-plugins/keymap.js +0 -8
  56. package/dist/es2019/plugins/alignment/pm-plugins/main.js +0 -34
  57. package/dist/es2019/plugins/alignment/pm-plugins/types.js +0 -1
  58. package/dist/es2019/plugins/alignment/ui/ToolbarAlignment/icon-map.js +0 -30
  59. package/dist/es2019/plugins/alignment/ui/ToolbarAlignment/index.js +0 -140
  60. package/dist/es2019/plugins/alignment/ui/ToolbarAlignment/messages.js +0 -23
  61. package/dist/es2019/plugins/alignment/ui/ToolbarAlignment/styles.js +0 -14
  62. package/dist/es2019/plugins/alignment/utils/index.js +0 -15
  63. package/dist/es2019/plugins/mobile-dimensions/actions.js +0 -6
  64. package/dist/es2019/plugins/mobile-dimensions/commands.js +0 -14
  65. package/dist/es2019/plugins/mobile-dimensions/index.js +0 -88
  66. package/dist/es2019/plugins/mobile-dimensions/plugin-factory.js +0 -9
  67. package/dist/es2019/plugins/mobile-dimensions/reducer.js +0 -21
  68. package/dist/es2019/plugins/mobile-dimensions/types.js +0 -1
  69. package/dist/es2019/plugins/mobile-selection/content-in-selection.js +0 -17
  70. package/dist/es2019/plugins/mobile-selection/index.js +0 -1
  71. package/dist/es2019/plugins/mobile-selection/mobile-selection-plugin.js +0 -53
  72. package/dist/es2019/plugins/mobile-selection/types.js +0 -1
  73. package/dist/es2019/plugins/view-update-subscription/index.js +0 -73
  74. package/dist/es2019/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +0 -106
  75. package/dist/es2019/ui/Alignment/AlignmentButton/index.js +0 -44
  76. package/dist/es2019/ui/Alignment/index.js +0 -54
  77. package/dist/es2019/ui/Alignment/styles.js +0 -7
  78. package/dist/esm/commands/index.js +0 -1
  79. package/dist/esm/plugins/alignment/commands/index.js +0 -30
  80. package/dist/esm/plugins/alignment/index.js +0 -63
  81. package/dist/esm/plugins/alignment/pm-plugins/keymap.js +0 -8
  82. package/dist/esm/plugins/alignment/pm-plugins/main.js +0 -36
  83. package/dist/esm/plugins/alignment/pm-plugins/types.js +0 -1
  84. package/dist/esm/plugins/alignment/ui/ToolbarAlignment/icon-map.js +0 -29
  85. package/dist/esm/plugins/alignment/ui/ToolbarAlignment/index.js +0 -163
  86. package/dist/esm/plugins/alignment/ui/ToolbarAlignment/messages.js +0 -23
  87. package/dist/esm/plugins/alignment/ui/ToolbarAlignment/styles.js +0 -6
  88. package/dist/esm/plugins/alignment/utils/index.js +0 -21
  89. package/dist/esm/plugins/mobile-dimensions/actions.js +0 -6
  90. package/dist/esm/plugins/mobile-dimensions/commands.js +0 -20
  91. package/dist/esm/plugins/mobile-dimensions/index.js +0 -93
  92. package/dist/esm/plugins/mobile-dimensions/plugin-factory.js +0 -9
  93. package/dist/esm/plugins/mobile-dimensions/reducer.js +0 -21
  94. package/dist/esm/plugins/mobile-dimensions/types.js +0 -1
  95. package/dist/esm/plugins/mobile-selection/content-in-selection.js +0 -18
  96. package/dist/esm/plugins/mobile-selection/index.js +0 -1
  97. package/dist/esm/plugins/mobile-selection/mobile-selection-plugin.js +0 -53
  98. package/dist/esm/plugins/mobile-selection/types.js +0 -1
  99. package/dist/esm/plugins/view-update-subscription/index.js +0 -83
  100. package/dist/esm/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +0 -103
  101. package/dist/esm/ui/Alignment/AlignmentButton/index.js +0 -62
  102. package/dist/esm/ui/Alignment/index.js +0 -68
  103. package/dist/esm/ui/Alignment/styles.js +0 -4
  104. package/dist/types/commands/index.d.ts +0 -1
  105. package/dist/types/plugins/alignment/commands/index.d.ts +0 -4
  106. package/dist/types/plugins/alignment/index.d.ts +0 -5
  107. package/dist/types/plugins/alignment/pm-plugins/keymap.d.ts +0 -2
  108. package/dist/types/plugins/alignment/pm-plugins/main.d.ts +0 -8
  109. package/dist/types/plugins/alignment/pm-plugins/types.d.ts +0 -5
  110. package/dist/types/plugins/alignment/ui/ToolbarAlignment/icon-map.d.ts +0 -6
  111. package/dist/types/plugins/alignment/ui/ToolbarAlignment/index.d.ts +0 -33
  112. package/dist/types/plugins/alignment/ui/ToolbarAlignment/messages.d.ts +0 -22
  113. package/dist/types/plugins/alignment/ui/ToolbarAlignment/styles.d.ts +0 -3
  114. package/dist/types/plugins/alignment/utils/index.d.ts +0 -3
  115. package/dist/types/plugins/mobile-dimensions/actions.d.ts +0 -18
  116. package/dist/types/plugins/mobile-dimensions/commands.d.ts +0 -3
  117. package/dist/types/plugins/mobile-dimensions/index.d.ts +0 -7
  118. package/dist/types/plugins/mobile-dimensions/plugin-factory.d.ts +0 -5
  119. package/dist/types/plugins/mobile-dimensions/reducer.d.ts +0 -3
  120. package/dist/types/plugins/mobile-dimensions/types.d.ts +0 -8
  121. package/dist/types/plugins/mobile-selection/content-in-selection.d.ts +0 -5
  122. package/dist/types/plugins/mobile-selection/index.d.ts +0 -2
  123. package/dist/types/plugins/mobile-selection/mobile-selection-plugin.d.ts +0 -7
  124. package/dist/types/plugins/mobile-selection/types.d.ts +0 -32
  125. package/dist/types/plugins/view-update-subscription/index.d.ts +0 -19
  126. package/dist/types/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.d.ts +0 -12
  127. package/dist/types/ui/Alignment/AlignmentButton/index.d.ts +0 -17
  128. package/dist/types/ui/Alignment/index.d.ts +0 -12
  129. package/dist/types/ui/Alignment/styles.d.ts +0 -1
  130. package/dist/types-ts4.5/commands/index.d.ts +0 -1
  131. package/dist/types-ts4.5/plugins/alignment/commands/index.d.ts +0 -4
  132. package/dist/types-ts4.5/plugins/alignment/index.d.ts +0 -5
  133. package/dist/types-ts4.5/plugins/alignment/pm-plugins/keymap.d.ts +0 -2
  134. package/dist/types-ts4.5/plugins/alignment/pm-plugins/main.d.ts +0 -8
  135. package/dist/types-ts4.5/plugins/alignment/pm-plugins/types.d.ts +0 -5
  136. package/dist/types-ts4.5/plugins/alignment/ui/ToolbarAlignment/icon-map.d.ts +0 -6
  137. package/dist/types-ts4.5/plugins/alignment/ui/ToolbarAlignment/index.d.ts +0 -33
  138. package/dist/types-ts4.5/plugins/alignment/ui/ToolbarAlignment/messages.d.ts +0 -22
  139. package/dist/types-ts4.5/plugins/alignment/ui/ToolbarAlignment/styles.d.ts +0 -3
  140. package/dist/types-ts4.5/plugins/alignment/utils/index.d.ts +0 -3
  141. package/dist/types-ts4.5/plugins/mobile-dimensions/actions.d.ts +0 -18
  142. package/dist/types-ts4.5/plugins/mobile-dimensions/commands.d.ts +0 -3
  143. package/dist/types-ts4.5/plugins/mobile-dimensions/index.d.ts +0 -7
  144. package/dist/types-ts4.5/plugins/mobile-dimensions/plugin-factory.d.ts +0 -5
  145. package/dist/types-ts4.5/plugins/mobile-dimensions/reducer.d.ts +0 -3
  146. package/dist/types-ts4.5/plugins/mobile-dimensions/types.d.ts +0 -8
  147. package/dist/types-ts4.5/plugins/mobile-selection/content-in-selection.d.ts +0 -5
  148. package/dist/types-ts4.5/plugins/mobile-selection/index.d.ts +0 -2
  149. package/dist/types-ts4.5/plugins/mobile-selection/mobile-selection-plugin.d.ts +0 -7
  150. package/dist/types-ts4.5/plugins/mobile-selection/types.d.ts +0 -32
  151. package/dist/types-ts4.5/plugins/view-update-subscription/index.d.ts +0 -19
  152. package/dist/types-ts4.5/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.d.ts +0 -12
  153. package/dist/types-ts4.5/ui/Alignment/AlignmentButton/index.d.ts +0 -17
  154. package/dist/types-ts4.5/ui/Alignment/index.d.ts +0 -12
  155. package/dist/types-ts4.5/ui/Alignment/styles.d.ts +0 -1
@@ -1,70 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.defaultConfig = exports.default = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
- var _adfSchema = require("@atlaskit/adf-schema");
10
- var _WithPluginState = _interopRequireDefault(require("../../ui/WithPluginState"));
11
- var _main = require("./pm-plugins/main");
12
- var _commands = require("./commands");
13
- var _ToolbarAlignment = _interopRequireDefault(require("./ui/ToolbarAlignment"));
14
- var _keymap = require("./pm-plugins/keymap");
15
- var defaultConfig = exports.defaultConfig = {
16
- align: 'start'
17
- };
18
- var alignmentPlugin = function alignmentPlugin() {
19
- return {
20
- name: 'alignment',
21
- marks: function marks() {
22
- return [{
23
- name: 'alignment',
24
- mark: _adfSchema.alignment
25
- }];
26
- },
27
- pmPlugins: function pmPlugins() {
28
- return [{
29
- name: 'alignmentPlugin',
30
- plugin: function plugin(_ref) {
31
- var dispatch = _ref.dispatch;
32
- return (0, _main.createPlugin)(dispatch, defaultConfig);
33
- }
34
- }, {
35
- name: 'annotationKeymap',
36
- plugin: function plugin() {
37
- return (0, _keymap.keymapPlugin)();
38
- }
39
- }];
40
- },
41
- primaryToolbarComponent: function primaryToolbarComponent(_ref2) {
42
- var editorView = _ref2.editorView,
43
- popupsMountPoint = _ref2.popupsMountPoint,
44
- popupsBoundariesElement = _ref2.popupsBoundariesElement,
45
- popupsScrollableElement = _ref2.popupsScrollableElement,
46
- disabled = _ref2.disabled,
47
- isToolbarReducedSpacing = _ref2.isToolbarReducedSpacing;
48
- return /*#__PURE__*/_react.default.createElement(_WithPluginState.default, {
49
- plugins: {
50
- align: _main.pluginKey
51
- },
52
- render: function render(_ref3) {
53
- var align = _ref3.align;
54
- return /*#__PURE__*/_react.default.createElement(_ToolbarAlignment.default, {
55
- pluginState: align,
56
- isReducedSpacing: isToolbarReducedSpacing,
57
- changeAlignment: function changeAlignment(align) {
58
- return (0, _commands.changeAlignment)(align)(editorView.state, editorView.dispatch);
59
- },
60
- disabled: disabled || !align.isEnabled,
61
- popupsMountPoint: popupsMountPoint,
62
- popupsBoundariesElement: popupsBoundariesElement,
63
- popupsScrollableElement: popupsScrollableElement
64
- });
65
- }
66
- });
67
- }
68
- };
69
- };
70
- var _default = exports.default = alignmentPlugin;
@@ -1,14 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.keymapPlugin = keymapPlugin;
7
- var _keymap = require("@atlaskit/editor-prosemirror/keymap");
8
- var _keymaps = require("../../../keymaps");
9
- var _commands = require("../commands");
10
- function keymapPlugin() {
11
- var list = {};
12
- (0, _keymaps.bindKeymapWithCommand)(_keymaps.alignLeft.common, (0, _commands.changeAlignment)('start'), list);
13
- return (0, _keymap.keymap)(list);
14
- }
@@ -1,45 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createInitialPluginState = createInitialPluginState;
8
- exports.createPlugin = createPlugin;
9
- exports.pluginKey = void 0;
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
- var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
12
- var _state = require("@atlaskit/editor-prosemirror/state");
13
- var _commands = require("../commands");
14
- var _utils = require("../utils");
15
- 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; }
16
- 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; }
17
- function createInitialPluginState(editorState, pluginConfig) {
18
- return {
19
- align: (0, _utils.getActiveAlignment)(editorState) || pluginConfig.align,
20
- isEnabled: true
21
- };
22
- }
23
- var pluginKey = exports.pluginKey = new _state.PluginKey('alignmentPlugin');
24
- function createPlugin(dispatch, pluginConfig) {
25
- return new _safePlugin.SafePlugin({
26
- key: pluginKey,
27
- state: {
28
- init: function init(_config, editorState) {
29
- return createInitialPluginState(editorState, pluginConfig);
30
- },
31
- apply: function apply(_tr, state, _prevState, nextState) {
32
- var nextPluginState = (0, _utils.getActiveAlignment)(nextState);
33
- var isEnabled = (0, _commands.isAlignable)(nextPluginState)(nextState);
34
- var newState = _objectSpread(_objectSpread({}, state), {}, {
35
- align: nextPluginState,
36
- isEnabled: isEnabled
37
- });
38
- if (nextPluginState !== state.align || isEnabled !== state.isEnabled) {
39
- dispatch(pluginKey, newState);
40
- }
41
- return newState;
42
- }
43
- }
44
- });
45
- }
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
@@ -1,36 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.IconMap = void 0;
8
- var _alignLeft = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/align-left"));
9
- var _alignRight = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/align-right"));
10
- var _alignCenter = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/align-center"));
11
- var _reactIntlNext = require("react-intl-next");
12
- var _messages = require("./messages");
13
- var _react = _interopRequireDefault(require("react"));
14
- var iconAndMessageMap = {
15
- start: {
16
- Component: _alignLeft.default,
17
- label: _messages.messages.alignLeft
18
- },
19
- end: {
20
- Component: _alignRight.default,
21
- label: _messages.messages.alignRight
22
- },
23
- center: {
24
- Component: _alignCenter.default,
25
- label: _messages.messages.alignCenter
26
- }
27
- };
28
- var IconMap = exports.IconMap = function IconMap(props) {
29
- var _iconAndMessageMap$pr = iconAndMessageMap[props.alignment],
30
- Component = _iconAndMessageMap$pr.Component,
31
- label = _iconAndMessageMap$pr.label;
32
- var intl = (0, _reactIntlNext.useIntl)();
33
- return /*#__PURE__*/_react.default.createElement(Component, {
34
- label: intl.formatMessage(label)
35
- });
36
- };
@@ -1,169 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = exports.AlignmentToolbar = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
11
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
12
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
13
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
14
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
- var _react = _interopRequireDefault(require("react"));
16
- var _react2 = require("@emotion/react");
17
- var _reactIntlNext = require("react-intl-next");
18
- var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-down"));
19
- var _ToolbarButton = _interopRequireDefault(require("../../../../ui/ToolbarButton"));
20
- var _uiMenu = require("@atlaskit/editor-common/ui-menu");
21
- var _Alignment = _interopRequireDefault(require("../../../../ui/Alignment"));
22
- var _styles = require("./styles");
23
- var _styles2 = require("@atlaskit/editor-common/styles");
24
- var _iconMap = require("./icon-map");
25
- var _messages = require("./messages");
26
- 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
- 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; } } /** @jsx jsx */
28
- var AlignmentToolbar = exports.AlignmentToolbar = /*#__PURE__*/function (_React$Component) {
29
- (0, _inherits2.default)(AlignmentToolbar, _React$Component);
30
- var _super = _createSuper(AlignmentToolbar);
31
- function AlignmentToolbar() {
32
- var _this;
33
- (0, _classCallCheck2.default)(this, AlignmentToolbar);
34
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
35
- args[_key] = arguments[_key];
36
- }
37
- _this = _super.call.apply(_super, [this].concat(args));
38
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "toolbarItemRef", /*#__PURE__*/_react.default.createRef());
39
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
40
- isOpen: false
41
- });
42
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "changeAlignment", function (align, togglePopup) {
43
- if (togglePopup) {
44
- _this.toggleOpen();
45
- }
46
- return _this.props.changeAlignment(align);
47
- });
48
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "toggleOpen", function () {
49
- _this.setState({
50
- isOpen: !_this.state.isOpen
51
- });
52
- });
53
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "toggleOpenByKeyboard", function (event) {
54
- if (event.key === 'Enter' || event.key === ' ') {
55
- event.preventDefault();
56
- _this.setState({
57
- isOpen: !_this.state.isOpen
58
- });
59
- }
60
- });
61
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hide", function (attrs) {
62
- if (_this.state.isOpen) {
63
- _this.setState({
64
- isOpen: false
65
- });
66
- if ((attrs === null || attrs === void 0 ? void 0 : attrs.event) instanceof KeyboardEvent && attrs.event.key === 'Escape') {
67
- var _this$toolbarItemRef;
68
- (_this$toolbarItemRef = _this.toolbarItemRef) === null || _this$toolbarItemRef === void 0 || (_this$toolbarItemRef = _this$toolbarItemRef.current) === null || _this$toolbarItemRef === void 0 || _this$toolbarItemRef.focus();
69
- }
70
- }
71
- });
72
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hideOnEscape", function () {
73
- var _this$toolbarItemRef2;
74
- _this.hide();
75
- (_this$toolbarItemRef2 = _this.toolbarItemRef) === null || _this$toolbarItemRef2 === void 0 || (_this$toolbarItemRef2 = _this$toolbarItemRef2.current) === null || _this$toolbarItemRef2 === void 0 || _this$toolbarItemRef2.focus();
76
- });
77
- return _this;
78
- }
79
- (0, _createClass2.default)(AlignmentToolbar, [{
80
- key: "render",
81
- value: function render() {
82
- var _this2 = this;
83
- var isOpen = this.state.isOpen;
84
- var _this$props = this.props,
85
- popupsMountPoint = _this$props.popupsMountPoint,
86
- popupsBoundariesElement = _this$props.popupsBoundariesElement,
87
- popupsScrollableElement = _this$props.popupsScrollableElement,
88
- isReducedSpacing = _this$props.isReducedSpacing,
89
- pluginState = _this$props.pluginState,
90
- disabled = _this$props.disabled,
91
- intl = _this$props.intl;
92
- var title = intl.formatMessage(_messages.messages.alignment);
93
- return (0, _react2.jsx)("span", {
94
- css: _styles.wrapper
95
- }, (0, _react2.jsx)(_uiMenu.DropdownContainer, {
96
- mountTo: popupsMountPoint,
97
- boundariesElement: popupsBoundariesElement,
98
- scrollableElement: popupsScrollableElement,
99
- isOpen: isOpen,
100
- handleClickOutside: function handleClickOutside(event) {
101
- if (event instanceof MouseEvent) {
102
- _this2.hide({
103
- isOpen: false,
104
- event: event
105
- });
106
- }
107
- },
108
- handleEscapeKeydown: this.hideOnEscape,
109
- arrowKeyNavigationProviderOptions: {
110
- type: _uiMenu.ArrowKeyNavigationType.MENU
111
- },
112
- fitWidth: 112,
113
- fitHeight: 80,
114
- closeOnTab: true,
115
- trigger: (0, _react2.jsx)(_ToolbarButton.default, {
116
- spacing: isReducedSpacing ? 'none' : 'default',
117
- disabled: disabled,
118
- selected: isOpen,
119
- title: title,
120
- className: "align-btn",
121
- "aria-label": title,
122
- "aria-expanded": isOpen,
123
- "aria-haspopup": true,
124
- onClick: this.toggleOpen,
125
- onKeyDown: this.toggleOpenByKeyboard,
126
- iconBefore: (0, _react2.jsx)("div", {
127
- css: _styles.triggerWrapper
128
- }, (0, _react2.jsx)(_iconMap.IconMap, {
129
- alignment: pluginState.align
130
- }), (0, _react2.jsx)("span", {
131
- css: _styles.expandIconWrapper
132
- }, (0, _react2.jsx)(_chevronDown.default, {
133
- label: ""
134
- }))),
135
- ref: this.toolbarItemRef
136
- })
137
- }, (0, _react2.jsx)(_Alignment.default, {
138
- onClick: function onClick(align) {
139
- return _this2.changeAlignment(align, false);
140
- },
141
- selectedAlignment: pluginState.align
142
- })), (0, _react2.jsx)("span", {
143
- css: _styles2.separatorStyles
144
- }));
145
- }
146
- }, {
147
- key: "componentDidUpdate",
148
- value: function componentDidUpdate(prevProps) {
149
- var _this3 = this;
150
- if (this.state.isOpen) {
151
- // by triggering the keyboard event with a setTimeout, we ensure that the tooltip
152
- // associated with the alignment button doesn't render until the next render cycle
153
- // where the popup will be correctly positioned and the relative position of the tooltip
154
- // will not overlap with the button.
155
- setTimeout(function () {
156
- var _this3$toolbarItemRef;
157
- var keyboardEvent = new KeyboardEvent('keydown', {
158
- bubbles: true,
159
- key: 'ArrowDown'
160
- });
161
- (_this3$toolbarItemRef = _this3.toolbarItemRef.current) === null || _this3$toolbarItemRef === void 0 || _this3$toolbarItemRef.dispatchEvent(keyboardEvent);
162
- }, 0);
163
- }
164
- }
165
- }]);
166
- return AlignmentToolbar;
167
- }(_react.default.Component);
168
- (0, _defineProperty2.default)(AlignmentToolbar, "displayName", 'AlignmentToolbar');
169
- var _default = exports.default = (0, _reactIntlNext.injectIntl)(AlignmentToolbar);
@@ -1,29 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.messages = void 0;
7
- var _reactIntlNext = require("react-intl-next");
8
- var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
9
- alignment: {
10
- id: 'fabric.editor.alignment',
11
- defaultMessage: 'Text alignment',
12
- description: 'Opens drop down menu of options to configure text alignment'
13
- },
14
- alignLeft: {
15
- id: 'fabric.editor.alignLeft',
16
- defaultMessage: 'Align left',
17
- description: 'label stating that text is aligned left'
18
- },
19
- alignRight: {
20
- id: 'fabric.editor.alignRight',
21
- defaultMessage: 'Align Right',
22
- description: 'label stating that text is aligned right'
23
- },
24
- alignCenter: {
25
- id: 'fabric.editor.alignCenter',
26
- defaultMessage: 'Align Center',
27
- description: 'label stating that text is aligned center'
28
- }
29
- });
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.wrapper = exports.triggerWrapper = exports.expandIconWrapper = void 0;
8
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
- var _react = require("@emotion/react");
10
- var _templateObject, _templateObject2, _templateObject3;
11
- var triggerWrapper = exports.triggerWrapper = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n"])));
12
- var wrapper = exports.wrapper = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n div {\n display: flex;\n }\n"])));
13
- var expandIconWrapper = exports.expandIconWrapper = (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n margin-left: ", ";\n"])), "var(--ds-space-negative-100, -8px)");
@@ -1,27 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getActiveAlignment = void 0;
7
- var _utils = require("@atlaskit/editor-prosemirror/utils");
8
- var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
9
- var getActiveAlignment = exports.getActiveAlignment = function getActiveAlignment(state) {
10
- if (state.selection instanceof _cellSelection.CellSelection) {
11
- var marks = [];
12
- state.selection.forEachCell(function (cell) {
13
- var mark = cell.firstChild.marks.filter(function (mark) {
14
- return mark.type === state.schema.marks.alignment;
15
- })[0];
16
- marks.push(mark ? mark.attrs.align : 'start');
17
- });
18
- return marks.every(function (mark) {
19
- return mark === marks[0];
20
- }) ? marks[0] : 'start';
21
- }
22
- var node = (0, _utils.findParentNodeOfType)([state.schema.nodes.paragraph, state.schema.nodes.heading])(state.selection);
23
- var getMark = node && node.node.marks.filter(function (mark) {
24
- return mark.type === state.schema.marks.alignment;
25
- })[0];
26
- return getMark && getMark.attrs.align || 'start';
27
- };
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.MobileDimensionsActionTypes = void 0;
7
- var MobileDimensionsActionTypes = exports.MobileDimensionsActionTypes = /*#__PURE__*/function (MobileDimensionsActionTypes) {
8
- MobileDimensionsActionTypes["SET_WINDOW_HEIGHT"] = "SET_WINDOW_HEIGHT";
9
- MobileDimensionsActionTypes["SET_MOBILE_PADDING_TOP"] = "SET_MOBILE_PADDING_TOP";
10
- MobileDimensionsActionTypes["SET_IS_EXPANDED"] = "SET_IS_EXPANDED";
11
- return MobileDimensionsActionTypes;
12
- }({});
@@ -1,26 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.setWindowHeight = exports.setMobilePaddingTop = exports.setIsExpanded = void 0;
7
- var _actions = require("./actions");
8
- var _pluginFactory = require("./plugin-factory");
9
- var setWindowHeight = exports.setWindowHeight = function setWindowHeight(windowHeight) {
10
- return (0, _pluginFactory.createCommand)({
11
- type: _actions.MobileDimensionsActionTypes.SET_WINDOW_HEIGHT,
12
- windowHeight: windowHeight
13
- });
14
- };
15
- var setMobilePaddingTop = exports.setMobilePaddingTop = function setMobilePaddingTop(paddingTop) {
16
- return (0, _pluginFactory.createCommand)({
17
- type: _actions.MobileDimensionsActionTypes.SET_MOBILE_PADDING_TOP,
18
- paddingTop: paddingTop
19
- });
20
- };
21
- var setIsExpanded = exports.setIsExpanded = function setIsExpanded(isExpanded) {
22
- return (0, _pluginFactory.createCommand)({
23
- type: _actions.MobileDimensionsActionTypes.SET_IS_EXPANDED,
24
- isExpanded: isExpanded
25
- });
26
- };
@@ -1,99 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
8
- var _commands = require("./commands");
9
- var _pluginFactory = require("./plugin-factory");
10
- var getInitialState = function getInitialState() {
11
- return {
12
- mobilePaddingTop: 0,
13
- windowHeight: window.innerHeight,
14
- isExpanded: false
15
- };
16
- };
17
-
18
- /**
19
- * Plugin to store the dimensions of the mobile such as keyboard height and window size
20
- */
21
-
22
- var createPlugin = function createPlugin(dispatch) {
23
- var rafId;
24
- return new _safePlugin.SafePlugin({
25
- state: (0, _pluginFactory.createPluginState)(dispatch, getInitialState),
26
- key: _pluginFactory.mobileDimensionsPluginKey,
27
- props: {
28
- scrollThreshold: {
29
- top: 12,
30
- left: 0,
31
- right: 0,
32
- bottom: 12
33
- },
34
- scrollMargin: {
35
- top: 12,
36
- bottom: 12,
37
- left: 0,
38
- right: 0
39
- }
40
- },
41
- view: function view(editorView) {
42
- var handleResize = function handleResize() {
43
- if (rafId) {
44
- window.cancelAnimationFrame(rafId);
45
- }
46
- var windowInnerHeight = window.innerHeight;
47
- var count = 0;
48
- var checkWindowHeight = function checkWindowHeight() {
49
- // wait for height to stabilise before we commit to set it
50
- // this helps handle menu transitions in Android which we don't want to scroll for
51
- if (window.innerHeight === windowInnerHeight) {
52
- count++;
53
- if (count >= 5) {
54
- rafId = undefined;
55
- (0, _commands.setWindowHeight)(window.innerHeight)(editorView.state, editorView.dispatch);
56
- } else {
57
- rafId = requestAnimationFrame(checkWindowHeight);
58
- }
59
- } else {
60
- rafId = requestAnimationFrame(checkWindowHeight);
61
- }
62
- windowInnerHeight = window.innerHeight;
63
- };
64
- rafId = requestAnimationFrame(checkWindowHeight);
65
- };
66
- // the window will resize on Android when the keyboard shows/hides
67
- window.addEventListener('resize', handleResize);
68
- return {
69
- destroy: function destroy() {
70
- window.removeEventListener('resize', handleResize);
71
- if (rafId) {
72
- window.cancelAnimationFrame(rafId);
73
- }
74
- }
75
- };
76
- }
77
- });
78
- };
79
- var mobileDimensionsPlugin = function mobileDimensionsPlugin() {
80
- return {
81
- name: 'mobileDimensions',
82
- getSharedState: function getSharedState(editorState) {
83
- if (!editorState) {
84
- return undefined;
85
- }
86
- return _pluginFactory.mobileDimensionsPluginKey.getState(editorState);
87
- },
88
- pmPlugins: function pmPlugins() {
89
- return [{
90
- name: 'mobileDimensions',
91
- plugin: function plugin(_ref) {
92
- var dispatch = _ref.dispatch;
93
- return createPlugin(dispatch);
94
- }
95
- }];
96
- }
97
- };
98
- };
99
- var _default = exports.default = mobileDimensionsPlugin;
@@ -1,15 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.mobileDimensionsPluginKey = exports.getPluginState = exports.createPluginState = exports.createCommand = void 0;
8
- var _state = require("@atlaskit/editor-prosemirror/state");
9
- var _pluginStateFactory = require("../../utils/plugin-state-factory");
10
- var _reducer = _interopRequireDefault(require("./reducer"));
11
- var mobileDimensionsPluginKey = exports.mobileDimensionsPluginKey = new _state.PluginKey('mobileDimensions');
12
- var _pluginFactory = (0, _pluginStateFactory.pluginFactory)(mobileDimensionsPluginKey, _reducer.default),
13
- createPluginState = exports.createPluginState = _pluginFactory.createPluginState,
14
- getPluginState = exports.getPluginState = _pluginFactory.getPluginState,
15
- createCommand = exports.createCommand = _pluginFactory.createCommand;
@@ -1,28 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = _default;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _actions = require("./actions");
10
- 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; }
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
- function _default(state, action) {
13
- switch (action.type) {
14
- case _actions.MobileDimensionsActionTypes.SET_WINDOW_HEIGHT:
15
- return _objectSpread(_objectSpread({}, state), {}, {
16
- windowHeight: action.windowHeight
17
- });
18
- case _actions.MobileDimensionsActionTypes.SET_MOBILE_PADDING_TOP:
19
- return _objectSpread(_objectSpread({}, state), {}, {
20
- mobilePaddingTop: action.paddingTop
21
- });
22
- case _actions.MobileDimensionsActionTypes.SET_IS_EXPANDED:
23
- return _objectSpread(_objectSpread({}, state), {}, {
24
- isExpanded: action.isExpanded
25
- });
26
- }
27
- return state;
28
- }
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
@@ -1,24 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.contentInSelection = void 0;
7
- // Gets a plain text representation of the nodes in the current selection
8
- var contentInSelection = exports.contentInSelection = function contentInSelection(_ref) {
9
- var selection = _ref.selection,
10
- doc = _ref.doc;
11
- var nodes = new Array();
12
- var marks = new Array();
13
- doc.nodesBetween(selection.from, selection.to, function (node) {
14
- nodes.push(node.type.name);
15
- node.marks.forEach(function (mark) {
16
- return marks.push(mark.type.name);
17
- });
18
- return true;
19
- });
20
- return {
21
- nodeTypes: Array.from(nodes),
22
- markTypes: Array.from(marks)
23
- };
24
- };
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "default", {
7
- enumerable: true,
8
- get: function get() {
9
- return _mobileSelectionPlugin.mobileSelectionPlugin;
10
- }
11
- });
12
- Object.defineProperty(exports, "selectionPluginKey", {
13
- enumerable: true,
14
- get: function get() {
15
- return _mobileSelectionPlugin.selectionPluginKey;
16
- }
17
- });
18
- var _mobileSelectionPlugin = require("./mobile-selection-plugin");