@atlaskit/editor-core 190.1.7 → 190.1.9

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 (101) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/afm-cc/tsconfig.json +6 -0
  3. package/dist/cjs/plugins/index.js +0 -14
  4. package/dist/cjs/presets/universal.js +4 -2
  5. package/dist/cjs/ui/Addon/ClickAreaInline/index.js +1 -1
  6. package/dist/cjs/ui/ContentStyles/index.js +1 -1
  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 -2
  10. package/dist/es2019/presets/universal.js +4 -2
  11. package/dist/es2019/ui/Addon/ClickAreaInline/index.js +1 -1
  12. package/dist/es2019/ui/ContentStyles/index.js +1 -1
  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 -2
  16. package/dist/esm/presets/universal.js +4 -2
  17. package/dist/esm/ui/Addon/ClickAreaInline/index.js +1 -1
  18. package/dist/esm/ui/ContentStyles/index.js +1 -1
  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 -2
  22. package/dist/types/utils/action.d.ts +0 -6
  23. package/dist/types-ts4.5/plugins/index.d.ts +0 -2
  24. package/dist/types-ts4.5/utils/action.d.ts +0 -6
  25. package/package.json +4 -2
  26. package/tsconfig.json +1 -1
  27. package/dist/cjs/commands/index.js +0 -42
  28. package/dist/cjs/plugins/alignment/commands/index.js +0 -36
  29. package/dist/cjs/plugins/alignment/index.js +0 -70
  30. package/dist/cjs/plugins/alignment/pm-plugins/keymap.js +0 -14
  31. package/dist/cjs/plugins/alignment/pm-plugins/main.js +0 -45
  32. package/dist/cjs/plugins/alignment/pm-plugins/types.js +0 -5
  33. package/dist/cjs/plugins/alignment/ui/ToolbarAlignment/icon-map.js +0 -36
  34. package/dist/cjs/plugins/alignment/ui/ToolbarAlignment/index.js +0 -169
  35. package/dist/cjs/plugins/alignment/ui/ToolbarAlignment/messages.js +0 -29
  36. package/dist/cjs/plugins/alignment/ui/ToolbarAlignment/styles.js +0 -13
  37. package/dist/cjs/plugins/alignment/utils/index.js +0 -27
  38. package/dist/cjs/plugins/data-consumer/index.js +0 -19
  39. package/dist/cjs/ui/Alignment/AlignmentButton/index.js +0 -71
  40. package/dist/cjs/ui/Alignment/index.js +0 -74
  41. package/dist/cjs/ui/Alignment/styles.js +0 -11
  42. package/dist/es2019/commands/index.js +0 -1
  43. package/dist/es2019/plugins/alignment/commands/index.js +0 -30
  44. package/dist/es2019/plugins/alignment/index.js +0 -58
  45. package/dist/es2019/plugins/alignment/pm-plugins/keymap.js +0 -8
  46. package/dist/es2019/plugins/alignment/pm-plugins/main.js +0 -34
  47. package/dist/es2019/plugins/alignment/pm-plugins/types.js +0 -1
  48. package/dist/es2019/plugins/alignment/ui/ToolbarAlignment/icon-map.js +0 -30
  49. package/dist/es2019/plugins/alignment/ui/ToolbarAlignment/index.js +0 -140
  50. package/dist/es2019/plugins/alignment/ui/ToolbarAlignment/messages.js +0 -23
  51. package/dist/es2019/plugins/alignment/ui/ToolbarAlignment/styles.js +0 -14
  52. package/dist/es2019/plugins/alignment/utils/index.js +0 -15
  53. package/dist/es2019/plugins/data-consumer/index.js +0 -11
  54. package/dist/es2019/ui/Alignment/AlignmentButton/index.js +0 -44
  55. package/dist/es2019/ui/Alignment/index.js +0 -54
  56. package/dist/es2019/ui/Alignment/styles.js +0 -7
  57. package/dist/esm/commands/index.js +0 -1
  58. package/dist/esm/plugins/alignment/commands/index.js +0 -30
  59. package/dist/esm/plugins/alignment/index.js +0 -63
  60. package/dist/esm/plugins/alignment/pm-plugins/keymap.js +0 -8
  61. package/dist/esm/plugins/alignment/pm-plugins/main.js +0 -36
  62. package/dist/esm/plugins/alignment/pm-plugins/types.js +0 -1
  63. package/dist/esm/plugins/alignment/ui/ToolbarAlignment/icon-map.js +0 -29
  64. package/dist/esm/plugins/alignment/ui/ToolbarAlignment/index.js +0 -163
  65. package/dist/esm/plugins/alignment/ui/ToolbarAlignment/messages.js +0 -23
  66. package/dist/esm/plugins/alignment/ui/ToolbarAlignment/styles.js +0 -6
  67. package/dist/esm/plugins/alignment/utils/index.js +0 -21
  68. package/dist/esm/plugins/data-consumer/index.js +0 -13
  69. package/dist/esm/ui/Alignment/AlignmentButton/index.js +0 -62
  70. package/dist/esm/ui/Alignment/index.js +0 -68
  71. package/dist/esm/ui/Alignment/styles.js +0 -4
  72. package/dist/types/commands/index.d.ts +0 -1
  73. package/dist/types/plugins/alignment/commands/index.d.ts +0 -4
  74. package/dist/types/plugins/alignment/index.d.ts +0 -5
  75. package/dist/types/plugins/alignment/pm-plugins/keymap.d.ts +0 -2
  76. package/dist/types/plugins/alignment/pm-plugins/main.d.ts +0 -8
  77. package/dist/types/plugins/alignment/pm-plugins/types.d.ts +0 -5
  78. package/dist/types/plugins/alignment/ui/ToolbarAlignment/icon-map.d.ts +0 -6
  79. package/dist/types/plugins/alignment/ui/ToolbarAlignment/index.d.ts +0 -33
  80. package/dist/types/plugins/alignment/ui/ToolbarAlignment/messages.d.ts +0 -22
  81. package/dist/types/plugins/alignment/ui/ToolbarAlignment/styles.d.ts +0 -3
  82. package/dist/types/plugins/alignment/utils/index.d.ts +0 -3
  83. package/dist/types/plugins/data-consumer/index.d.ts +0 -3
  84. package/dist/types/ui/Alignment/AlignmentButton/index.d.ts +0 -17
  85. package/dist/types/ui/Alignment/index.d.ts +0 -12
  86. package/dist/types/ui/Alignment/styles.d.ts +0 -1
  87. package/dist/types-ts4.5/commands/index.d.ts +0 -1
  88. package/dist/types-ts4.5/plugins/alignment/commands/index.d.ts +0 -4
  89. package/dist/types-ts4.5/plugins/alignment/index.d.ts +0 -5
  90. package/dist/types-ts4.5/plugins/alignment/pm-plugins/keymap.d.ts +0 -2
  91. package/dist/types-ts4.5/plugins/alignment/pm-plugins/main.d.ts +0 -8
  92. package/dist/types-ts4.5/plugins/alignment/pm-plugins/types.d.ts +0 -5
  93. package/dist/types-ts4.5/plugins/alignment/ui/ToolbarAlignment/icon-map.d.ts +0 -6
  94. package/dist/types-ts4.5/plugins/alignment/ui/ToolbarAlignment/index.d.ts +0 -33
  95. package/dist/types-ts4.5/plugins/alignment/ui/ToolbarAlignment/messages.d.ts +0 -22
  96. package/dist/types-ts4.5/plugins/alignment/ui/ToolbarAlignment/styles.d.ts +0 -3
  97. package/dist/types-ts4.5/plugins/alignment/utils/index.d.ts +0 -3
  98. package/dist/types-ts4.5/plugins/data-consumer/index.d.ts +0 -3
  99. package/dist/types-ts4.5/ui/Alignment/AlignmentButton/index.d.ts +0 -17
  100. package/dist/types-ts4.5/ui/Alignment/index.d.ts +0 -12
  101. package/dist/types-ts4.5/ui/Alignment/styles.d.ts +0 -1
@@ -1,163 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/inherits";
5
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
- 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); }; }
9
- 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; } }
10
- /** @jsx jsx */
11
- import React from 'react';
12
- import { jsx } from '@emotion/react';
13
- import { injectIntl } from 'react-intl-next';
14
- import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
15
- import ToolbarButton from '../../../../ui/ToolbarButton';
16
- import { ArrowKeyNavigationType, DropdownContainer as Dropdown } from '@atlaskit/editor-common/ui-menu';
17
- import Alignment from '../../../../ui/Alignment';
18
- import { expandIconWrapper, triggerWrapper, wrapper } from './styles';
19
- import { separatorStyles } from '@atlaskit/editor-common/styles';
20
- import { IconMap } from './icon-map';
21
- import { messages } from './messages';
22
- export var AlignmentToolbar = /*#__PURE__*/function (_React$Component) {
23
- _inherits(AlignmentToolbar, _React$Component);
24
- var _super = _createSuper(AlignmentToolbar);
25
- function AlignmentToolbar() {
26
- var _this;
27
- _classCallCheck(this, AlignmentToolbar);
28
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
29
- args[_key] = arguments[_key];
30
- }
31
- _this = _super.call.apply(_super, [this].concat(args));
32
- _defineProperty(_assertThisInitialized(_this), "toolbarItemRef", /*#__PURE__*/React.createRef());
33
- _defineProperty(_assertThisInitialized(_this), "state", {
34
- isOpen: false
35
- });
36
- _defineProperty(_assertThisInitialized(_this), "changeAlignment", function (align, togglePopup) {
37
- if (togglePopup) {
38
- _this.toggleOpen();
39
- }
40
- return _this.props.changeAlignment(align);
41
- });
42
- _defineProperty(_assertThisInitialized(_this), "toggleOpen", function () {
43
- _this.setState({
44
- isOpen: !_this.state.isOpen
45
- });
46
- });
47
- _defineProperty(_assertThisInitialized(_this), "toggleOpenByKeyboard", function (event) {
48
- if (event.key === 'Enter' || event.key === ' ') {
49
- event.preventDefault();
50
- _this.setState({
51
- isOpen: !_this.state.isOpen
52
- });
53
- }
54
- });
55
- _defineProperty(_assertThisInitialized(_this), "hide", function (attrs) {
56
- if (_this.state.isOpen) {
57
- _this.setState({
58
- isOpen: false
59
- });
60
- if ((attrs === null || attrs === void 0 ? void 0 : attrs.event) instanceof KeyboardEvent && attrs.event.key === 'Escape') {
61
- var _this$toolbarItemRef;
62
- (_this$toolbarItemRef = _this.toolbarItemRef) === null || _this$toolbarItemRef === void 0 || (_this$toolbarItemRef = _this$toolbarItemRef.current) === null || _this$toolbarItemRef === void 0 || _this$toolbarItemRef.focus();
63
- }
64
- }
65
- });
66
- _defineProperty(_assertThisInitialized(_this), "hideOnEscape", function () {
67
- var _this$toolbarItemRef2;
68
- _this.hide();
69
- (_this$toolbarItemRef2 = _this.toolbarItemRef) === null || _this$toolbarItemRef2 === void 0 || (_this$toolbarItemRef2 = _this$toolbarItemRef2.current) === null || _this$toolbarItemRef2 === void 0 || _this$toolbarItemRef2.focus();
70
- });
71
- return _this;
72
- }
73
- _createClass(AlignmentToolbar, [{
74
- key: "render",
75
- value: function render() {
76
- var _this2 = this;
77
- var isOpen = this.state.isOpen;
78
- var _this$props = this.props,
79
- popupsMountPoint = _this$props.popupsMountPoint,
80
- popupsBoundariesElement = _this$props.popupsBoundariesElement,
81
- popupsScrollableElement = _this$props.popupsScrollableElement,
82
- isReducedSpacing = _this$props.isReducedSpacing,
83
- pluginState = _this$props.pluginState,
84
- disabled = _this$props.disabled,
85
- intl = _this$props.intl;
86
- var title = intl.formatMessage(messages.alignment);
87
- return jsx("span", {
88
- css: wrapper
89
- }, jsx(Dropdown, {
90
- mountTo: popupsMountPoint,
91
- boundariesElement: popupsBoundariesElement,
92
- scrollableElement: popupsScrollableElement,
93
- isOpen: isOpen,
94
- handleClickOutside: function handleClickOutside(event) {
95
- if (event instanceof MouseEvent) {
96
- _this2.hide({
97
- isOpen: false,
98
- event: event
99
- });
100
- }
101
- },
102
- handleEscapeKeydown: this.hideOnEscape,
103
- arrowKeyNavigationProviderOptions: {
104
- type: ArrowKeyNavigationType.MENU
105
- },
106
- fitWidth: 112,
107
- fitHeight: 80,
108
- closeOnTab: true,
109
- trigger: jsx(ToolbarButton, {
110
- spacing: isReducedSpacing ? 'none' : 'default',
111
- disabled: disabled,
112
- selected: isOpen,
113
- title: title,
114
- className: "align-btn",
115
- "aria-label": title,
116
- "aria-expanded": isOpen,
117
- "aria-haspopup": true,
118
- onClick: this.toggleOpen,
119
- onKeyDown: this.toggleOpenByKeyboard,
120
- iconBefore: jsx("div", {
121
- css: triggerWrapper
122
- }, jsx(IconMap, {
123
- alignment: pluginState.align
124
- }), jsx("span", {
125
- css: expandIconWrapper
126
- }, jsx(ExpandIcon, {
127
- label: ""
128
- }))),
129
- ref: this.toolbarItemRef
130
- })
131
- }, jsx(Alignment, {
132
- onClick: function onClick(align) {
133
- return _this2.changeAlignment(align, false);
134
- },
135
- selectedAlignment: pluginState.align
136
- })), jsx("span", {
137
- css: separatorStyles
138
- }));
139
- }
140
- }, {
141
- key: "componentDidUpdate",
142
- value: function componentDidUpdate(prevProps) {
143
- var _this3 = this;
144
- if (this.state.isOpen) {
145
- // by triggering the keyboard event with a setTimeout, we ensure that the tooltip
146
- // associated with the alignment button doesn't render until the next render cycle
147
- // where the popup will be correctly positioned and the relative position of the tooltip
148
- // will not overlap with the button.
149
- setTimeout(function () {
150
- var _this3$toolbarItemRef;
151
- var keyboardEvent = new KeyboardEvent('keydown', {
152
- bubbles: true,
153
- key: 'ArrowDown'
154
- });
155
- (_this3$toolbarItemRef = _this3.toolbarItemRef.current) === null || _this3$toolbarItemRef === void 0 || _this3$toolbarItemRef.dispatchEvent(keyboardEvent);
156
- }, 0);
157
- }
158
- }
159
- }]);
160
- return AlignmentToolbar;
161
- }(React.Component);
162
- _defineProperty(AlignmentToolbar, "displayName", 'AlignmentToolbar');
163
- export default injectIntl(AlignmentToolbar);
@@ -1,23 +0,0 @@
1
- import { defineMessages } from 'react-intl-next';
2
- export var messages = defineMessages({
3
- alignment: {
4
- id: 'fabric.editor.alignment',
5
- defaultMessage: 'Text alignment',
6
- description: 'Opens drop down menu of options to configure text alignment'
7
- },
8
- alignLeft: {
9
- id: 'fabric.editor.alignLeft',
10
- defaultMessage: 'Align left',
11
- description: 'label stating that text is aligned left'
12
- },
13
- alignRight: {
14
- id: 'fabric.editor.alignRight',
15
- defaultMessage: 'Align Right',
16
- description: 'label stating that text is aligned right'
17
- },
18
- alignCenter: {
19
- id: 'fabric.editor.alignCenter',
20
- defaultMessage: 'Align Center',
21
- description: 'label stating that text is aligned center'
22
- }
23
- });
@@ -1,6 +0,0 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- var _templateObject, _templateObject2, _templateObject3;
3
- import { css } from '@emotion/react';
4
- export var triggerWrapper = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n"])));
5
- export var wrapper = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n div {\n display: flex;\n }\n"])));
6
- export var expandIconWrapper = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-left: ", ";\n"])), "var(--ds-space-negative-100, -8px)");
@@ -1,21 +0,0 @@
1
- import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
2
- import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
3
- export var getActiveAlignment = function getActiveAlignment(state) {
4
- if (state.selection instanceof CellSelection) {
5
- var marks = [];
6
- state.selection.forEachCell(function (cell) {
7
- var mark = cell.firstChild.marks.filter(function (mark) {
8
- return mark.type === state.schema.marks.alignment;
9
- })[0];
10
- marks.push(mark ? mark.attrs.align : 'start');
11
- });
12
- return marks.every(function (mark) {
13
- return mark === marks[0];
14
- }) ? marks[0] : 'start';
15
- }
16
- var node = findParentNodeOfType([state.schema.nodes.paragraph, state.schema.nodes.heading])(state.selection);
17
- var getMark = node && node.node.marks.filter(function (mark) {
18
- return mark.type === state.schema.marks.alignment;
19
- })[0];
20
- return getMark && getMark.attrs.align || 'start';
21
- };
@@ -1,13 +0,0 @@
1
- import { dataConsumer } from '@atlaskit/adf-schema';
2
- var dataConsumerMarkPlugin = function dataConsumerMarkPlugin() {
3
- return {
4
- name: 'dataConsumerPlugin',
5
- marks: function marks() {
6
- return [{
7
- name: 'dataConsumer',
8
- mark: dataConsumer
9
- }];
10
- }
11
- };
12
- };
13
- export default dataConsumerMarkPlugin;
@@ -1,62 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/inherits";
5
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
- 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); }; }
9
- 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; } }
10
- import React from 'react';
11
- import { PureComponent } from 'react';
12
- import ToolbarButton from '../../ToolbarButton';
13
- import { ToolTipContent, tooltip } from '../../../keymaps';
14
- import { getAriaKeyshortcuts } from '@atlaskit/editor-common/keymaps';
15
- var AlignmentButton = /*#__PURE__*/function (_PureComponent) {
16
- _inherits(AlignmentButton, _PureComponent);
17
- var _super = _createSuper(AlignmentButton);
18
- function AlignmentButton() {
19
- var _this;
20
- _classCallCheck(this, AlignmentButton);
21
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
22
- args[_key] = arguments[_key];
23
- }
24
- _this = _super.call.apply(_super, [this].concat(args));
25
- _defineProperty(_assertThisInitialized(_this), "onClick", function (e) {
26
- var _this$props = _this.props,
27
- onClick = _this$props.onClick,
28
- value = _this$props.value;
29
-
30
- // detect if the click event comes from keyboard where screenX and screenY are 0
31
- var isMouseEvent = e instanceof MouseEvent;
32
- e.preventDefault();
33
- onClick(value, isMouseEvent);
34
- });
35
- return _this;
36
- }
37
- _createClass(AlignmentButton, [{
38
- key: "render",
39
- value: function render() {
40
- var _this$props2 = this.props,
41
- label = _this$props2.label,
42
- isSelected = _this$props2.isSelected,
43
- content = _this$props2.content,
44
- shortcut = _this$props2.shortcut;
45
- return /*#__PURE__*/React.createElement(ToolbarButton, {
46
- disabled: false,
47
- selected: isSelected,
48
- title: /*#__PURE__*/React.createElement(ToolTipContent, {
49
- description: label,
50
- keymap: shortcut
51
- }),
52
- "aria-label": shortcut ? tooltip(shortcut, label) : label,
53
- "aria-pressed": isSelected,
54
- "aria-keyshortcuts": getAriaKeyshortcuts(shortcut),
55
- onClick: this.onClick,
56
- iconBefore: content
57
- });
58
- }
59
- }]);
60
- return AlignmentButton;
61
- }(PureComponent);
62
- export default AlignmentButton;
@@ -1,68 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _inherits from "@babel/runtime/helpers/inherits";
4
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
- 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); }; }
7
- 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; } }
8
- /** @jsx jsx */
9
- import { jsx } from '@emotion/react';
10
- import { PureComponent } from 'react';
11
- import { injectIntl } from 'react-intl-next';
12
- import { IconMap } from '../../plugins/alignment/ui/ToolbarAlignment/icon-map';
13
- import AlignmentButton from './AlignmentButton';
14
- import { alignmentMessages } from '@atlaskit/editor-common/messages';
15
- import { alignmentWrapper } from './styles';
16
- import { alignLeft } from '../../keymaps';
17
- var alignmentOptions = [{
18
- title: alignmentMessages.alignLeft,
19
- shortcut: alignLeft,
20
- value: 'start'
21
- }, {
22
- title: alignmentMessages.alignCenter,
23
- value: 'center'
24
- }, {
25
- title: alignmentMessages.alignRight,
26
- value: 'end'
27
- }];
28
- var Alignment = /*#__PURE__*/function (_PureComponent) {
29
- _inherits(Alignment, _PureComponent);
30
- var _super = _createSuper(Alignment);
31
- function Alignment() {
32
- _classCallCheck(this, Alignment);
33
- return _super.apply(this, arguments);
34
- }
35
- _createClass(Alignment, [{
36
- key: "render",
37
- value: function render() {
38
- var _this$props = this.props,
39
- onClick = _this$props.onClick,
40
- selectedAlignment = _this$props.selectedAlignment,
41
- className = _this$props.className,
42
- intl = _this$props.intl;
43
- return jsx("div", {
44
- "data-testid": "alignment-buttons",
45
- css: alignmentWrapper,
46
- className: className
47
- }, alignmentOptions.map(function (alignment) {
48
- var value = alignment.value,
49
- title = alignment.title,
50
- shortcut = alignment.shortcut;
51
- var message = intl.formatMessage(title);
52
- return jsx(AlignmentButton, {
53
- content: jsx(IconMap, {
54
- alignment: value
55
- }),
56
- key: value,
57
- value: value,
58
- label: message,
59
- shortcut: shortcut,
60
- onClick: onClick,
61
- isSelected: value === selectedAlignment
62
- });
63
- }));
64
- }
65
- }]);
66
- return Alignment;
67
- }(PureComponent);
68
- export default injectIntl(Alignment);
@@ -1,4 +0,0 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- var _templateObject;
3
- import { css } from '@emotion/react';
4
- export var alignmentWrapper = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 0 ", ";\n display: flex;\n flex-wrap: wrap;\n max-width: ", "px;\n"])), "var(--ds-space-100, 8px)", 3 * 32);
@@ -1 +0,0 @@
1
- export { addParagraphAtEnd, createParagraphAtEnd, changeImageAlignment, createToggleBlockMarkOnRange, toggleBlockMark, clearEditorContent, } from '@atlaskit/editor-common/commands';
@@ -1,4 +0,0 @@
1
- import { Command } from '../../../types/command';
2
- import { AlignmentState } from '../pm-plugins/types';
3
- export declare const isAlignable: (align?: AlignmentState) => Command;
4
- export declare const changeAlignment: (align?: AlignmentState) => Command;
@@ -1,5 +0,0 @@
1
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
2
- import { AlignmentPluginState } from './pm-plugins/types';
3
- export declare const defaultConfig: AlignmentPluginState;
4
- declare const alignmentPlugin: NextEditorPlugin<'alignment'>;
5
- export default alignmentPlugin;
@@ -1,2 +0,0 @@
1
- import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- export declare function keymapPlugin(): SafePlugin;
@@ -1,8 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
4
- import type { Dispatch } from '../../../event-dispatcher';
5
- import type { AlignmentPluginState } from './types';
6
- export declare function createInitialPluginState(editorState: EditorState, pluginConfig: AlignmentPluginState): AlignmentPluginState;
7
- export declare const pluginKey: PluginKey<AlignmentPluginState>;
8
- export declare function createPlugin(dispatch: Dispatch, pluginConfig: AlignmentPluginState): SafePlugin;
@@ -1,5 +0,0 @@
1
- export type AlignmentState = 'start' | 'end' | 'center';
2
- export type AlignmentPluginState = {
3
- align: AlignmentState;
4
- isEnabled?: boolean;
5
- };
@@ -1,6 +0,0 @@
1
- /// <reference types="react" />
2
- type Props = {
3
- alignment: string;
4
- };
5
- export declare const IconMap: (props: Props) => JSX.Element;
6
- export {};
@@ -1,33 +0,0 @@
1
- /** @jsx jsx */
2
- import React from 'react';
3
- import { jsx } from '@emotion/react';
4
- import type { WrappedComponentProps } from 'react-intl-next';
5
- import type { AlignmentPluginState, AlignmentState } from '../../pm-plugins/types';
6
- export interface State {
7
- isOpen: boolean;
8
- }
9
- export interface Props {
10
- pluginState: AlignmentPluginState;
11
- changeAlignment: (align: AlignmentState) => void;
12
- popupsMountPoint?: HTMLElement;
13
- popupsBoundariesElement?: HTMLElement;
14
- popupsScrollableElement?: HTMLElement;
15
- isReducedSpacing?: boolean;
16
- disabled?: boolean;
17
- }
18
- export declare class AlignmentToolbar extends React.Component<Props & WrappedComponentProps, State> {
19
- static displayName: string;
20
- private toolbarItemRef;
21
- state: State;
22
- render(): jsx.JSX.Element;
23
- componentDidUpdate(prevProps: Props): void;
24
- private changeAlignment;
25
- private toggleOpen;
26
- private toggleOpenByKeyboard;
27
- private hide;
28
- private hideOnEscape;
29
- }
30
- declare const _default: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps<"intl">>> & {
31
- WrappedComponent: React.ComponentType<Props & WrappedComponentProps<"intl">>;
32
- };
33
- export default _default;
@@ -1,22 +0,0 @@
1
- export declare const messages: {
2
- alignment: {
3
- id: string;
4
- defaultMessage: string;
5
- description: string;
6
- };
7
- alignLeft: {
8
- id: string;
9
- defaultMessage: string;
10
- description: string;
11
- };
12
- alignRight: {
13
- id: string;
14
- defaultMessage: string;
15
- description: string;
16
- };
17
- alignCenter: {
18
- id: string;
19
- defaultMessage: string;
20
- description: string;
21
- };
22
- };
@@ -1,3 +0,0 @@
1
- export declare const triggerWrapper: import("@emotion/react").SerializedStyles;
2
- export declare const wrapper: import("@emotion/react").SerializedStyles;
3
- export declare const expandIconWrapper: import("@emotion/react").SerializedStyles;
@@ -1,3 +0,0 @@
1
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
- import type { AlignmentState } from '../pm-plugins/types';
3
- export declare const getActiveAlignment: (state: EditorState) => AlignmentState | undefined;
@@ -1,3 +0,0 @@
1
- import { NextEditorPlugin } from '@atlaskit/editor-common/types';
2
- declare const dataConsumerMarkPlugin: NextEditorPlugin<'dataConsumerPlugin'>;
3
- export default dataConsumerMarkPlugin;
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- import { PureComponent } from 'react';
3
- import { AlignmentState } from '../../../plugins/alignment/pm-plugins/types';
4
- import { Keymap } from '../../../keymaps';
5
- export interface Props {
6
- value: AlignmentState;
7
- label: string;
8
- isSelected?: boolean;
9
- onClick: (value: AlignmentState, shouldClosePopup: boolean) => void;
10
- content: React.ReactElement<any>;
11
- shortcut?: Keymap;
12
- }
13
- declare class AlignmentButton extends PureComponent<Props> {
14
- render(): JSX.Element;
15
- onClick: (e: any) => void;
16
- }
17
- export default AlignmentButton;
@@ -1,12 +0,0 @@
1
- /// <reference types="react" />
2
- import type { WrappedComponentProps } from 'react-intl-next';
3
- import type { AlignmentState } from '../../plugins/alignment/pm-plugins/types';
4
- export interface Props {
5
- selectedAlignment?: string;
6
- onClick: (value: AlignmentState) => void;
7
- className?: string;
8
- }
9
- declare const _default: import("react").FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps<"intl">>> & {
10
- WrappedComponent: import("react").ComponentType<Props & WrappedComponentProps<"intl">>;
11
- };
12
- export default _default;
@@ -1 +0,0 @@
1
- export declare const alignmentWrapper: import("@emotion/react").SerializedStyles;
@@ -1 +0,0 @@
1
- export { addParagraphAtEnd, createParagraphAtEnd, changeImageAlignment, createToggleBlockMarkOnRange, toggleBlockMark, clearEditorContent, } from '@atlaskit/editor-common/commands';
@@ -1,4 +0,0 @@
1
- import { Command } from '../../../types/command';
2
- import { AlignmentState } from '../pm-plugins/types';
3
- export declare const isAlignable: (align?: AlignmentState) => Command;
4
- export declare const changeAlignment: (align?: AlignmentState) => Command;
@@ -1,5 +0,0 @@
1
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
2
- import { AlignmentPluginState } from './pm-plugins/types';
3
- export declare const defaultConfig: AlignmentPluginState;
4
- declare const alignmentPlugin: NextEditorPlugin<'alignment'>;
5
- export default alignmentPlugin;
@@ -1,2 +0,0 @@
1
- import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- export declare function keymapPlugin(): SafePlugin;
@@ -1,8 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
4
- import type { Dispatch } from '../../../event-dispatcher';
5
- import type { AlignmentPluginState } from './types';
6
- export declare function createInitialPluginState(editorState: EditorState, pluginConfig: AlignmentPluginState): AlignmentPluginState;
7
- export declare const pluginKey: PluginKey<AlignmentPluginState>;
8
- export declare function createPlugin(dispatch: Dispatch, pluginConfig: AlignmentPluginState): SafePlugin;
@@ -1,5 +0,0 @@
1
- export type AlignmentState = 'start' | 'end' | 'center';
2
- export type AlignmentPluginState = {
3
- align: AlignmentState;
4
- isEnabled?: boolean;
5
- };
@@ -1,6 +0,0 @@
1
- /// <reference types="react" />
2
- type Props = {
3
- alignment: string;
4
- };
5
- export declare const IconMap: (props: Props) => JSX.Element;
6
- export {};
@@ -1,33 +0,0 @@
1
- /** @jsx jsx */
2
- import React from 'react';
3
- import { jsx } from '@emotion/react';
4
- import type { WrappedComponentProps } from 'react-intl-next';
5
- import type { AlignmentPluginState, AlignmentState } from '../../pm-plugins/types';
6
- export interface State {
7
- isOpen: boolean;
8
- }
9
- export interface Props {
10
- pluginState: AlignmentPluginState;
11
- changeAlignment: (align: AlignmentState) => void;
12
- popupsMountPoint?: HTMLElement;
13
- popupsBoundariesElement?: HTMLElement;
14
- popupsScrollableElement?: HTMLElement;
15
- isReducedSpacing?: boolean;
16
- disabled?: boolean;
17
- }
18
- export declare class AlignmentToolbar extends React.Component<Props & WrappedComponentProps, State> {
19
- static displayName: string;
20
- private toolbarItemRef;
21
- state: State;
22
- render(): jsx.JSX.Element;
23
- componentDidUpdate(prevProps: Props): void;
24
- private changeAlignment;
25
- private toggleOpen;
26
- private toggleOpenByKeyboard;
27
- private hide;
28
- private hideOnEscape;
29
- }
30
- declare const _default: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps<"intl">>> & {
31
- WrappedComponent: React.ComponentType<Props & WrappedComponentProps<"intl">>;
32
- };
33
- export default _default;
@@ -1,22 +0,0 @@
1
- export declare const messages: {
2
- alignment: {
3
- id: string;
4
- defaultMessage: string;
5
- description: string;
6
- };
7
- alignLeft: {
8
- id: string;
9
- defaultMessage: string;
10
- description: string;
11
- };
12
- alignRight: {
13
- id: string;
14
- defaultMessage: string;
15
- description: string;
16
- };
17
- alignCenter: {
18
- id: string;
19
- defaultMessage: string;
20
- description: string;
21
- };
22
- };
@@ -1,3 +0,0 @@
1
- export declare const triggerWrapper: import("@emotion/react").SerializedStyles;
2
- export declare const wrapper: import("@emotion/react").SerializedStyles;
3
- export declare const expandIconWrapper: import("@emotion/react").SerializedStyles;
@@ -1,3 +0,0 @@
1
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
- import type { AlignmentState } from '../pm-plugins/types';
3
- export declare const getActiveAlignment: (state: EditorState) => AlignmentState | undefined;
@@ -1,3 +0,0 @@
1
- import { NextEditorPlugin } from '@atlaskit/editor-common/types';
2
- declare const dataConsumerMarkPlugin: NextEditorPlugin<'dataConsumerPlugin'>;
3
- export default dataConsumerMarkPlugin;