@atlaskit/editor-core 191.0.8 → 191.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/afm-cc/tsconfig.json +3 -3
  3. package/dist/cjs/plugins/index.js +0 -7
  4. package/dist/cjs/presets/universal.js +2 -1
  5. package/dist/cjs/ui/Appearance/Comment/Comment.js +6 -3
  6. package/dist/cjs/ui/Appearance/Comment/Toolbar.js +19 -6
  7. package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +1 -1
  8. package/dist/cjs/ui/ContentStyles/index.js +1 -1
  9. package/dist/cjs/version-wrapper.js +1 -1
  10. package/dist/es2019/plugins/index.js +0 -1
  11. package/dist/es2019/presets/universal.js +2 -1
  12. package/dist/es2019/ui/Appearance/Comment/Comment.js +6 -3
  13. package/dist/es2019/ui/Appearance/Comment/Toolbar.js +38 -6
  14. package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +1 -1
  15. package/dist/es2019/ui/ContentStyles/index.js +1 -1
  16. package/dist/es2019/version-wrapper.js +1 -1
  17. package/dist/esm/plugins/index.js +0 -1
  18. package/dist/esm/presets/universal.js +2 -1
  19. package/dist/esm/ui/Appearance/Comment/Comment.js +6 -3
  20. package/dist/esm/ui/Appearance/Comment/Toolbar.js +19 -6
  21. package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +1 -1
  22. package/dist/esm/ui/ContentStyles/index.js +1 -1
  23. package/dist/esm/version-wrapper.js +1 -1
  24. package/dist/types/plugins/index.d.ts +0 -1
  25. package/dist/types/types/editor-props.d.ts +1 -1
  26. package/dist/types/ui/Appearance/Comment/Toolbar.d.ts +2 -1
  27. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  28. package/dist/types-ts4.5/types/editor-props.d.ts +1 -1
  29. package/dist/types-ts4.5/ui/Appearance/Comment/Toolbar.d.ts +2 -1
  30. package/package.json +6 -10
  31. package/dist/cjs/plugins/find-replace/FindReplaceToolbarButtonWithState.js +0 -166
  32. package/dist/cjs/plugins/find-replace/actions.js +0 -19
  33. package/dist/cjs/plugins/find-replace/commands-with-analytics.js +0 -101
  34. package/dist/cjs/plugins/find-replace/commands.js +0 -255
  35. package/dist/cjs/plugins/find-replace/index.js +0 -94
  36. package/dist/cjs/plugins/find-replace/keymap.js +0 -24
  37. package/dist/cjs/plugins/find-replace/plugin-key.js +0 -8
  38. package/dist/cjs/plugins/find-replace/plugin.js +0 -138
  39. package/dist/cjs/plugins/find-replace/reducer.js +0 -61
  40. package/dist/cjs/plugins/find-replace/styles.js +0 -16
  41. package/dist/cjs/plugins/find-replace/types.js +0 -5
  42. package/dist/cjs/plugins/find-replace/ui/Find.js +0 -308
  43. package/dist/cjs/plugins/find-replace/ui/FindReplace.js +0 -103
  44. package/dist/cjs/plugins/find-replace/ui/FindReplaceToolbarButton.js +0 -132
  45. package/dist/cjs/plugins/find-replace/ui/FindReplaceTooltipButton.js +0 -76
  46. package/dist/cjs/plugins/find-replace/ui/Replace.js +0 -174
  47. package/dist/cjs/plugins/find-replace/ui/styles.js +0 -44
  48. package/dist/cjs/plugins/find-replace/utils/batch-decorations.js +0 -310
  49. package/dist/cjs/plugins/find-replace/utils/commands.js +0 -16
  50. package/dist/cjs/plugins/find-replace/utils/index.js +0 -290
  51. package/dist/cjs/utils/array.js +0 -13
  52. package/dist/es2019/plugins/find-replace/FindReplaceToolbarButtonWithState.js +0 -153
  53. package/dist/es2019/plugins/find-replace/actions.js +0 -13
  54. package/dist/es2019/plugins/find-replace/commands-with-analytics.js +0 -72
  55. package/dist/es2019/plugins/find-replace/commands.js +0 -240
  56. package/dist/es2019/plugins/find-replace/index.js +0 -89
  57. package/dist/es2019/plugins/find-replace/keymap.js +0 -16
  58. package/dist/es2019/plugins/find-replace/plugin-key.js +0 -2
  59. package/dist/es2019/plugins/find-replace/plugin.js +0 -117
  60. package/dist/es2019/plugins/find-replace/reducer.js +0 -56
  61. package/dist/es2019/plugins/find-replace/styles.js +0 -17
  62. package/dist/es2019/plugins/find-replace/types.js +0 -1
  63. package/dist/es2019/plugins/find-replace/ui/Find.js +0 -284
  64. package/dist/es2019/plugins/find-replace/ui/FindReplace.js +0 -78
  65. package/dist/es2019/plugins/find-replace/ui/FindReplaceToolbarButton.js +0 -122
  66. package/dist/es2019/plugins/find-replace/ui/FindReplaceTooltipButton.js +0 -50
  67. package/dist/es2019/plugins/find-replace/ui/Replace.js +0 -152
  68. package/dist/es2019/plugins/find-replace/ui/styles.js +0 -48
  69. package/dist/es2019/plugins/find-replace/utils/batch-decorations.js +0 -189
  70. package/dist/es2019/plugins/find-replace/utils/commands.js +0 -6
  71. package/dist/es2019/plugins/find-replace/utils/index.js +0 -249
  72. package/dist/es2019/utils/array.js +0 -3
  73. package/dist/esm/plugins/find-replace/FindReplaceToolbarButtonWithState.js +0 -157
  74. package/dist/esm/plugins/find-replace/actions.js +0 -13
  75. package/dist/esm/plugins/find-replace/commands-with-analytics.js +0 -95
  76. package/dist/esm/plugins/find-replace/commands.js +0 -248
  77. package/dist/esm/plugins/find-replace/index.js +0 -87
  78. package/dist/esm/plugins/find-replace/keymap.js +0 -18
  79. package/dist/esm/plugins/find-replace/plugin-key.js +0 -2
  80. package/dist/esm/plugins/find-replace/plugin.js +0 -133
  81. package/dist/esm/plugins/find-replace/reducer.js +0 -54
  82. package/dist/esm/plugins/find-replace/styles.js +0 -10
  83. package/dist/esm/plugins/find-replace/types.js +0 -1
  84. package/dist/esm/plugins/find-replace/ui/Find.js +0 -302
  85. package/dist/esm/plugins/find-replace/ui/FindReplace.js +0 -97
  86. package/dist/esm/plugins/find-replace/ui/FindReplaceToolbarButton.js +0 -126
  87. package/dist/esm/plugins/find-replace/ui/FindReplaceTooltipButton.js +0 -69
  88. package/dist/esm/plugins/find-replace/ui/Replace.js +0 -168
  89. package/dist/esm/plugins/find-replace/ui/styles.js +0 -37
  90. package/dist/esm/plugins/find-replace/utils/batch-decorations.js +0 -304
  91. package/dist/esm/plugins/find-replace/utils/commands.js +0 -10
  92. package/dist/esm/plugins/find-replace/utils/index.js +0 -280
  93. package/dist/esm/utils/array.js +0 -7
  94. package/dist/types/plugins/find-replace/FindReplaceToolbarButtonWithState.d.ts +0 -4
  95. package/dist/types/plugins/find-replace/actions.d.ts +0 -64
  96. package/dist/types/plugins/find-replace/commands-with-analytics.d.ts +0 -27
  97. package/dist/types/plugins/find-replace/commands.d.ts +0 -12
  98. package/dist/types/plugins/find-replace/index.d.ts +0 -3
  99. package/dist/types/plugins/find-replace/keymap.d.ts +0 -4
  100. package/dist/types/plugins/find-replace/plugin-key.d.ts +0 -3
  101. package/dist/types/plugins/find-replace/plugin.d.ts +0 -6
  102. package/dist/types/plugins/find-replace/reducer.d.ts +0 -4
  103. package/dist/types/plugins/find-replace/styles.d.ts +0 -3
  104. package/dist/types/plugins/find-replace/types.d.ts +0 -79
  105. package/dist/types/plugins/find-replace/ui/Find.d.ts +0 -71
  106. package/dist/types/plugins/find-replace/ui/FindReplace.d.ts +0 -43
  107. package/dist/types/plugins/find-replace/ui/FindReplaceToolbarButton.d.ts +0 -21
  108. package/dist/types/plugins/find-replace/ui/FindReplaceTooltipButton.d.ts +0 -18
  109. package/dist/types/plugins/find-replace/ui/Replace.d.ts +0 -27
  110. package/dist/types/plugins/find-replace/ui/styles.d.ts +0 -6
  111. package/dist/types/plugins/find-replace/utils/batch-decorations.d.ts +0 -36
  112. package/dist/types/plugins/find-replace/utils/commands.d.ts +0 -2
  113. package/dist/types/plugins/find-replace/utils/index.d.ts +0 -49
  114. package/dist/types/utils/array.d.ts +0 -1
  115. package/dist/types-ts4.5/plugins/find-replace/FindReplaceToolbarButtonWithState.d.ts +0 -4
  116. package/dist/types-ts4.5/plugins/find-replace/actions.d.ts +0 -64
  117. package/dist/types-ts4.5/plugins/find-replace/commands-with-analytics.d.ts +0 -27
  118. package/dist/types-ts4.5/plugins/find-replace/commands.d.ts +0 -12
  119. package/dist/types-ts4.5/plugins/find-replace/index.d.ts +0 -3
  120. package/dist/types-ts4.5/plugins/find-replace/keymap.d.ts +0 -4
  121. package/dist/types-ts4.5/plugins/find-replace/plugin-key.d.ts +0 -3
  122. package/dist/types-ts4.5/plugins/find-replace/plugin.d.ts +0 -6
  123. package/dist/types-ts4.5/plugins/find-replace/reducer.d.ts +0 -4
  124. package/dist/types-ts4.5/plugins/find-replace/styles.d.ts +0 -3
  125. package/dist/types-ts4.5/plugins/find-replace/types.d.ts +0 -79
  126. package/dist/types-ts4.5/plugins/find-replace/ui/Find.d.ts +0 -71
  127. package/dist/types-ts4.5/plugins/find-replace/ui/FindReplace.d.ts +0 -43
  128. package/dist/types-ts4.5/plugins/find-replace/ui/FindReplaceToolbarButton.d.ts +0 -21
  129. package/dist/types-ts4.5/plugins/find-replace/ui/FindReplaceTooltipButton.d.ts +0 -18
  130. package/dist/types-ts4.5/plugins/find-replace/ui/Replace.d.ts +0 -27
  131. package/dist/types-ts4.5/plugins/find-replace/ui/styles.d.ts +0 -6
  132. package/dist/types-ts4.5/plugins/find-replace/utils/batch-decorations.d.ts +0 -36
  133. package/dist/types-ts4.5/plugins/find-replace/utils/commands.d.ts +0 -2
  134. package/dist/types-ts4.5/plugins/find-replace/utils/index.d.ts +0 -49
  135. package/dist/types-ts4.5/utils/array.d.ts +0 -1
@@ -1,126 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/createClass";
4
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
5
- import _inherits from "@babel/runtime/helpers/inherits";
6
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
10
- var _templateObject, _templateObject2, _templateObject3;
11
- 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); }; }
12
- 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; } }
13
- /** @jsx jsx */
14
- import React from 'react';
15
- import { css, jsx } from '@emotion/react';
16
- import { defineMessages, injectIntl } from 'react-intl-next';
17
- import { akEditorFloatingPanelZIndex, akEditorMobileMaxWidth } from '@atlaskit/editor-shared-styles';
18
- import { ToolbarButton, TOOLBAR_BUTTON } from '@atlaskit/editor-common/ui-menu';
19
- import { Dropdown, ArrowKeyNavigationType } from '@atlaskit/editor-common/ui-menu';
20
- import EditorSearchIcon from '@atlaskit/icon/glyph/editor/search';
21
- import FindReplace from './FindReplace';
22
- import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
23
- import { ToolTipContent, findKeymapByDescription, tooltip } from '../../../keymaps';
24
- import { getAriaKeyshortcuts } from '@atlaskit/editor-common/keymaps';
25
- var toolbarButtonWrapper = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex: 1 1 auto;\n flex-grow: 0;\n justify-content: flex-end;\n align-items: center;\n padding: 0 ", ";\n @media (max-width: ", "px) {\n justify-content: center;\n padding: 0;\n }\n"])), "var(--ds-space-100, 8px)", akEditorMobileMaxWidth);
26
- var toolbarButtonWrapperFullWith = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n flex-grow: 1;\n"])));
27
- var wrapper = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n"])));
28
- var messages = defineMessages({
29
- findReplaceToolbarButton: {
30
- id: 'fabric.editor.findReplaceToolbarButton',
31
- defaultMessage: 'Find and replace',
32
- description: '"Find" highlights all instances of a word or phrase on the document, and "Replace" changes one or all of those instances to something else'
33
- }
34
- });
35
- var FindReplaceToolbarButton = /*#__PURE__*/function (_React$PureComponent) {
36
- _inherits(FindReplaceToolbarButton, _React$PureComponent);
37
- var _super = _createSuper(FindReplaceToolbarButton);
38
- function FindReplaceToolbarButton() {
39
- var _this;
40
- _classCallCheck(this, FindReplaceToolbarButton);
41
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
42
- args[_key] = arguments[_key];
43
- }
44
- _this = _super.call.apply(_super, [this].concat(args));
45
- _defineProperty(_assertThisInitialized(_this), "toggleOpen", function () {
46
- if (_this.props.isActive) {
47
- _this.props.onCancel({
48
- triggerMethod: TRIGGER_METHOD.TOOLBAR
49
- });
50
- } else {
51
- _this.props.onActivate();
52
- }
53
- });
54
- return _this;
55
- }
56
- _createClass(FindReplaceToolbarButton, [{
57
- key: "render",
58
- value: function render() {
59
- var _this2 = this;
60
- var _this$props = this.props,
61
- popupsMountPoint = _this$props.popupsMountPoint,
62
- popupsBoundariesElement = _this$props.popupsBoundariesElement,
63
- popupsScrollableElement = _this$props.popupsScrollableElement,
64
- isReducedSpacing = _this$props.isReducedSpacing,
65
- findText = _this$props.findText,
66
- replaceText = _this$props.replaceText,
67
- isActive = _this$props.isActive,
68
- index = _this$props.index,
69
- numMatches = _this$props.numMatches,
70
- formatMessage = _this$props.intl.formatMessage,
71
- takeFullWidth = _this$props.takeFullWidth;
72
- var title = formatMessage(messages.findReplaceToolbarButton);
73
- var stackBelowOtherEditorFloatingPanels = akEditorFloatingPanelZIndex - 1;
74
- var keymap = findKeymapByDescription('Find');
75
- return jsx("div", {
76
- css: [toolbarButtonWrapper, takeFullWidth && toolbarButtonWrapperFullWith]
77
- }, jsx(Dropdown, {
78
- mountTo: popupsMountPoint,
79
- boundariesElement: popupsBoundariesElement,
80
- scrollableElement: popupsScrollableElement,
81
- isOpen: isActive,
82
- handleEscapeKeydown: function handleEscapeKeydown() {
83
- if (isActive) {
84
- _this2.props.onCancel({
85
- triggerMethod: TRIGGER_METHOD.KEYBOARD
86
- });
87
- }
88
- },
89
- fitWidth: 352,
90
- zIndex: stackBelowOtherEditorFloatingPanels,
91
- arrowKeyNavigationProviderOptions: {
92
- type: ArrowKeyNavigationType.MENU,
93
- disableArrowKeyNavigation: true
94
- },
95
- trigger: jsx(ToolbarButton, {
96
- buttonId: TOOLBAR_BUTTON.FIND_REPLACE,
97
- spacing: isReducedSpacing ? 'none' : 'default',
98
- selected: isActive,
99
- title: jsx(ToolTipContent, {
100
- description: title,
101
- keymap: keymap
102
- }),
103
- iconBefore: jsx(EditorSearchIcon, {
104
- label: title
105
- }),
106
- onClick: this.toggleOpen,
107
- "aria-expanded": isActive,
108
- "aria-haspopup": true,
109
- "aria-label": keymap ? tooltip(keymap, title) : title,
110
- "aria-keyshortcuts": getAriaKeyshortcuts(keymap)
111
- })
112
- }, jsx("div", {
113
- css: wrapper
114
- }, jsx(FindReplace, _extends({
115
- findText: findText,
116
- replaceText: replaceText,
117
- count: {
118
- index: index,
119
- total: numMatches
120
- }
121
- }, this.props)))));
122
- }
123
- }]);
124
- return FindReplaceToolbarButton;
125
- }(React.PureComponent);
126
- export default injectIntl(FindReplaceToolbarButton);
@@ -1,69 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/createClass";
4
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
5
- import _inherits from "@babel/runtime/helpers/inherits";
6
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
- 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; }
10
- 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; }
11
- 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); }; }
12
- 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; } }
13
- import React from 'react';
14
- import Tooltip from '@atlaskit/tooltip';
15
- import { ToolTipContent, findKeymapByDescription } from '@atlaskit/editor-common/keymaps';
16
- import Button from '@atlaskit/button/standard-button';
17
- export var FindReplaceTooltipButton = /*#__PURE__*/function (_React$PureComponent) {
18
- _inherits(FindReplaceTooltipButton, _React$PureComponent);
19
- var _super = _createSuper(FindReplaceTooltipButton);
20
- function FindReplaceTooltipButton() {
21
- var _this;
22
- _classCallCheck(this, FindReplaceTooltipButton);
23
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
24
- args[_key] = arguments[_key];
25
- }
26
- _this = _super.call.apply(_super, [this].concat(args));
27
- _defineProperty(_assertThisInitialized(_this), "buttonRef", /*#__PURE__*/React.createRef());
28
- _defineProperty(_assertThisInitialized(_this), "handleClick", function () {
29
- _this.props.onClick(_this.buttonRef);
30
- });
31
- return _this;
32
- }
33
- _createClass(FindReplaceTooltipButton, [{
34
- key: "render",
35
- value: function render() {
36
- var _this$props = this.props,
37
- title = _this$props.title,
38
- icon = _this$props.icon,
39
- keymapDescription = _this$props.keymapDescription,
40
- disabled = _this$props.disabled,
41
- isPressed = _this$props.isPressed;
42
- var pressedProps = _objectSpread({}, typeof isPressed === 'boolean' && {
43
- 'aria-pressed': isPressed
44
- });
45
- return /*#__PURE__*/React.createElement(Tooltip, {
46
- content: /*#__PURE__*/React.createElement(ToolTipContent, {
47
- description: title,
48
- keymap: findKeymapByDescription(keymapDescription)
49
- }),
50
- hideTooltipOnClick: true,
51
- position: 'top'
52
- }, /*#__PURE__*/React.createElement(Button, _extends({
53
- label: title,
54
- appearance: "subtle",
55
- testId: title,
56
- ref: this.buttonRef,
57
- iconBefore: icon,
58
- isDisabled: disabled,
59
- onClick: this.handleClick,
60
- isSelected: isPressed,
61
- shouldFitContainer: true
62
- }, pressedProps)));
63
- }
64
- }]);
65
- return FindReplaceTooltipButton;
66
- }(React.PureComponent);
67
- _defineProperty(FindReplaceTooltipButton, "defaultProps", {
68
- keymapDescription: 'no-keymap'
69
- });
@@ -1,168 +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 Button from '@atlaskit/button/standard-button';
14
- import { defineMessages, injectIntl } from 'react-intl-next';
15
- import Textfield from '@atlaskit/textfield';
16
- import { sectionWrapperStyles, replaceSectionButtonStyles } from './styles';
17
- import { EVENT_TYPE, ACTION, ACTION_SUBJECT, TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
18
- var messages = defineMessages({
19
- replaceWith: {
20
- id: 'fabric.editor.replaceWith',
21
- defaultMessage: 'Replace with',
22
- description: 'The value that will replace the word or phrase that was searched for'
23
- },
24
- replace: {
25
- id: 'fabric.editor.replace',
26
- defaultMessage: 'Replace',
27
- description: 'Replace only the currently selected instance of the word or phrase'
28
- },
29
- replaceAll: {
30
- id: 'fabric.editor.replaceAll',
31
- defaultMessage: 'Replace all',
32
- description: 'Replace all instances of the word or phrase throughout the entire document'
33
- }
34
- });
35
- var Replace = /*#__PURE__*/function (_React$PureComponent) {
36
- _inherits(Replace, _React$PureComponent);
37
- var _super = _createSuper(Replace);
38
- function Replace(props) {
39
- var _this;
40
- _classCallCheck(this, Replace);
41
- _this = _super.call(this, props);
42
- _defineProperty(_assertThisInitialized(_this), "replaceTextfieldRef", /*#__PURE__*/React.createRef());
43
- _defineProperty(_assertThisInitialized(_this), "skipWhileComposing", function (fn) {
44
- if (_this.state.isComposing) {
45
- return;
46
- }
47
- fn();
48
- });
49
- _defineProperty(_assertThisInitialized(_this), "handleReplaceClick", function () {
50
- return _this.skipWhileComposing(function () {
51
- _this.props.onReplace({
52
- triggerMethod: TRIGGER_METHOD.BUTTON,
53
- replaceText: _this.state.replaceText
54
- });
55
- });
56
- });
57
- _defineProperty(_assertThisInitialized(_this), "handleReplaceChange", function (event) {
58
- return _this.skipWhileComposing(function () {
59
- _this.updateReplaceValue(event.target.value);
60
- });
61
- });
62
- _defineProperty(_assertThisInitialized(_this), "updateReplaceValue", function (replaceText) {
63
- var dispatchAnalyticsEvent = _this.props.dispatchAnalyticsEvent;
64
- if (dispatchAnalyticsEvent) {
65
- dispatchAnalyticsEvent({
66
- eventType: EVENT_TYPE.TRACK,
67
- action: ACTION.CHANGED_REPLACEMENT_TEXT,
68
- actionSubject: ACTION_SUBJECT.FIND_REPLACE_DIALOG
69
- });
70
- }
71
- _this.setState({
72
- replaceText: replaceText
73
- });
74
- });
75
- _defineProperty(_assertThisInitialized(_this), "handleReplaceKeyDown", function (event) {
76
- return _this.skipWhileComposing(function () {
77
- if (event.key === 'Enter') {
78
- _this.props.onReplace({
79
- triggerMethod: TRIGGER_METHOD.KEYBOARD,
80
- replaceText: _this.state.replaceText
81
- });
82
- } else if (event.key === 'ArrowUp') {
83
- // we want to move focus between find & replace texfields when user hits up/down arrows
84
- _this.props.onArrowUp();
85
- }
86
- });
87
- });
88
- _defineProperty(_assertThisInitialized(_this), "handleReplaceAllClick", function () {
89
- return _this.skipWhileComposing(function () {
90
- _this.props.onReplaceAll({
91
- replaceText: _this.state.replaceText
92
- });
93
- });
94
- });
95
- _defineProperty(_assertThisInitialized(_this), "handleCompositionStart", function () {
96
- _this.setState({
97
- isComposing: true
98
- });
99
- });
100
- _defineProperty(_assertThisInitialized(_this), "handleCompositionEnd", function (event) {
101
- _this.setState({
102
- isComposing: false
103
- });
104
- // type for React.CompositionEvent doesn't set type for target correctly
105
- _this.updateReplaceValue(event.target.value);
106
- });
107
- var _replaceText = props.replaceText,
108
- formatMessage = props.intl.formatMessage;
109
- _this.state = {
110
- replaceText: _replaceText || '',
111
- isComposing: false
112
- };
113
- _this.replaceWith = formatMessage(messages.replaceWith);
114
- _this.replace = formatMessage(messages.replace);
115
- _this.replaceAll = formatMessage(messages.replaceAll);
116
- return _this;
117
- }
118
- _createClass(Replace, [{
119
- key: "componentDidMount",
120
- value: function componentDidMount() {
121
- this.props.onReplaceTextfieldRefSet(this.replaceTextfieldRef);
122
- }
123
- }, {
124
- key: "componentDidUpdate",
125
- value: function componentDidUpdate(_ref) {
126
- var prevReplaceText = _ref.replaceText;
127
- var replaceText = this.props.replaceText;
128
- if (replaceText && replaceText !== prevReplaceText) {
129
- this.setState({
130
- replaceText: replaceText,
131
- isComposing: false
132
- });
133
- }
134
- }
135
- }, {
136
- key: "render",
137
- value: function render() {
138
- var replaceText = this.state.replaceText;
139
- var canReplace = this.props.canReplace;
140
- return jsx("div", {
141
- css: sectionWrapperStyles
142
- }, jsx(Textfield, {
143
- name: "replace",
144
- appearance: "none",
145
- placeholder: this.replaceWith,
146
- defaultValue: replaceText,
147
- ref: this.replaceTextfieldRef,
148
- autoComplete: "off",
149
- onChange: this.handleReplaceChange,
150
- onKeyDown: this.handleReplaceKeyDown,
151
- onCompositionStart: this.handleCompositionStart,
152
- onCompositionEnd: this.handleCompositionEnd
153
- }), jsx(Button, {
154
- css: replaceSectionButtonStyles,
155
- testId: this.replace,
156
- onClick: this.handleReplaceClick,
157
- isDisabled: !canReplace
158
- }, this.replace), jsx(Button, {
159
- css: replaceSectionButtonStyles,
160
- testId: this.replaceAll,
161
- onClick: this.handleReplaceAllClick,
162
- isDisabled: !canReplace
163
- }, this.replaceAll));
164
- }
165
- }]);
166
- return Replace;
167
- }(React.PureComponent);
168
- export default injectIntl(Replace);
@@ -1,37 +0,0 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- var _templateObject;
3
- /** @jsx jsx */
4
- import { css } from '@emotion/react';
5
- import { N60, N30A } from '@atlaskit/theme/colors';
6
- import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
7
- export var replaceSectionButtonStyles = css({
8
- marginLeft: "var(--ds-space-050, 4px)"
9
- });
10
- export var ruleStyles = css({
11
- width: '100%',
12
- border: 'none',
13
- backgroundColor: "".concat("var(--ds-border, ".concat(N30A, ")")),
14
- margin: "var(--ds-space-050, 4px)".concat(" 0px"),
15
- height: '1px',
16
- borderRadius: '1px'
17
- });
18
- export var wrapperStyles = css({
19
- display: 'flex',
20
- flexDirection: 'column',
21
- '> *:not(#replace-hr-element)': {
22
- margin: "0px ".concat("var(--ds-space-050, 4px)")
23
- }
24
- });
25
- export var sectionWrapperStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n\n & > * {\n display: inline-flex;\n height: 32px;\n flex: 0 0 auto;\n }\n\n & > [data-ds--text-field--container] {\n display: flex;\n flex: 1 1 auto;\n }\n"])));
26
- export var countStyles = css({
27
- color: "".concat("var(--ds-text-subtlest, ".concat(N60, ")")),
28
- fontSize: "".concat(relativeFontSizeToBase16(12)),
29
- flex: '0 0 auto',
30
- justifyContent: 'center',
31
- alignItems: 'center',
32
- marginLeft: "var(--ds-space-050, 4px)",
33
- marginRight: "var(--ds-space-100, 8px)"
34
- });
35
- export var countWrapperStyles = css({
36
- alignItems: 'center'
37
- });