@contentful/field-editor-rich-text 3.17.7 → 3.18.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.
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "ButtonRedo", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return ButtonRedo;
9
+ }
10
+ });
11
+ const _react = _interop_require_default(require("react"));
12
+ const _f36components = require("@contentful/f36-components");
13
+ const _ContentfulEditorProvider = require("../../ContentfulEditorProvider");
14
+ const _ToolbarButton = require("../../plugins/shared/ToolbarButton");
15
+ function _interop_require_default(obj) {
16
+ return obj && obj.__esModule ? obj : {
17
+ default: obj
18
+ };
19
+ }
20
+ const ButtonRedo = ()=>{
21
+ const editor = (0, _ContentfulEditorProvider.useContentfulEditor)();
22
+ return _react.default.createElement(_ToolbarButton.ToolbarButton, {
23
+ title: "Redo",
24
+ testId: "redo-toolbar-button",
25
+ onClick: editor.redo,
26
+ isActive: false,
27
+ isDisabled: editor.history.redos.length === 0
28
+ }, _react.default.createElement(_f36components.Icon, {
29
+ variant: "secondary"
30
+ }, _react.default.createElement("path", {
31
+ d: "M18.4,10.6C16.55,9 14.15,8 11.5,8C6.85,8 2.92,11.03 1.54,15.22L3.9,16C4.95,12.81 7.95,10.5 11.5,10.5C13.45,10.5 15.23,11.22 16.62,12.38L13,16H22V7L18.4,10.6Z"
32
+ })));
33
+ };
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "ButtonUndo", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return ButtonUndo;
9
+ }
10
+ });
11
+ const _react = _interop_require_default(require("react"));
12
+ const _f36components = require("@contentful/f36-components");
13
+ const _ContentfulEditorProvider = require("../../ContentfulEditorProvider");
14
+ const _ToolbarButton = require("../../plugins/shared/ToolbarButton");
15
+ function _interop_require_default(obj) {
16
+ return obj && obj.__esModule ? obj : {
17
+ default: obj
18
+ };
19
+ }
20
+ const ButtonUndo = ()=>{
21
+ const editor = (0, _ContentfulEditorProvider.useContentfulEditor)();
22
+ return _react.default.createElement(_ToolbarButton.ToolbarButton, {
23
+ title: "Undo",
24
+ testId: "undo-toolbar-button",
25
+ onClick: editor.undo,
26
+ isActive: false,
27
+ isDisabled: editor.history.undos.length === 0
28
+ }, _react.default.createElement(_f36components.Icon, {
29
+ variant: "secondary"
30
+ }, _react.default.createElement("path", {
31
+ d: "M12.5,8C9.85,8 7.45,9 5.6,10.6L2,7V16H11L7.38,12.38C8.77,11.22 10.54,10.5 12.5,10.5C16.04,10.5 19.05,12.81 20.1,16L22.47,15.22C21.08,11.03 17.15,8 12.5,8Z"
32
+ })));
33
+ };
@@ -31,6 +31,8 @@ const _Underline = require("../plugins/Marks/Underline");
31
31
  const _Quote = require("../plugins/Quote");
32
32
  const _Table = require("../plugins/Table");
33
33
  const _SdkProvider = require("../SdkProvider");
34
+ const _ButtonRedo = require("./components/ButtonRedo");
35
+ const _ButtonUndo = require("./components/ButtonUndo");
34
36
  const _EmbedEntityWidget = require("./components/EmbedEntityWidget");
35
37
  function _interop_require_default(obj) {
36
38
  return obj && obj.__esModule ? obj : {
@@ -106,8 +108,7 @@ const styles = {
106
108
  ],
107
109
  webkitAlignSelf: 'flex-start',
108
110
  alignSelf: 'flex-start',
109
- msFlexItemAlign: 'start',
110
- marginLeft: 'auto'
111
+ msFlexItemAlign: 'start'
111
112
  }),
112
113
  formattingOptionsWrapper: (0, _emotion.css)({
113
114
  display: [
@@ -156,14 +157,19 @@ const Toolbar = ({ isDisabled })=>{
156
157
  const dropdownItemsAvailable = (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.SUPERSCRIPT) || (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.SUBSCRIPT) || (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.CODE);
157
158
  const shouldShowDropdown = boldItalicUnderlineAvailable && dropdownItemsAvailable;
158
159
  return _react.createElement(_f36components.Flex, {
160
+ gap: "spacingS",
161
+ flexWrap: "wrap",
162
+ flexDirection: "row",
159
163
  testId: "toolbar",
160
164
  className: styles.toolbar,
161
- alignItems: "center"
165
+ justifyContent: "space-between"
162
166
  }, _react.createElement("div", {
163
167
  className: styles.formattingOptionsWrapper
164
168
  }, _react.createElement(_Heading.ToolbarHeadingButton, {
165
169
  isDisabled: isDisabled || !canInsertBlocks
166
- }), validationInfo.isAnyMarkEnabled && _react.createElement("span", {
170
+ }), _react.createElement("span", {
171
+ className: styles.divider
172
+ }), _react.createElement(_ButtonUndo.ButtonUndo, null), _react.createElement(_ButtonRedo.ButtonRedo, null), validationInfo.isAnyMarkEnabled && _react.createElement("span", {
167
173
  className: styles.divider
168
174
  }), (0, _validations.isMarkEnabled)(sdk.field, _richtexttypes.MARKS.BOLD) && _react.createElement(_Bold.ToolbarBoldButton, {
169
175
  isDisabled: isDisabled
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { Icon } from '@contentful/f36-components';
3
+ import { useContentfulEditor } from '../../ContentfulEditorProvider';
4
+ import { ToolbarButton } from '../../plugins/shared/ToolbarButton';
5
+ export const ButtonRedo = ()=>{
6
+ const editor = useContentfulEditor();
7
+ return React.createElement(ToolbarButton, {
8
+ title: "Redo",
9
+ testId: "redo-toolbar-button",
10
+ onClick: editor.redo,
11
+ isActive: false,
12
+ isDisabled: editor.history.redos.length === 0
13
+ }, React.createElement(Icon, {
14
+ variant: "secondary"
15
+ }, React.createElement("path", {
16
+ d: "M18.4,10.6C16.55,9 14.15,8 11.5,8C6.85,8 2.92,11.03 1.54,15.22L3.9,16C4.95,12.81 7.95,10.5 11.5,10.5C13.45,10.5 15.23,11.22 16.62,12.38L13,16H22V7L18.4,10.6Z"
17
+ })));
18
+ };
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { Icon } from '@contentful/f36-components';
3
+ import { useContentfulEditor } from '../../ContentfulEditorProvider';
4
+ import { ToolbarButton } from '../../plugins/shared/ToolbarButton';
5
+ export const ButtonUndo = ()=>{
6
+ const editor = useContentfulEditor();
7
+ return React.createElement(ToolbarButton, {
8
+ title: "Undo",
9
+ testId: "undo-toolbar-button",
10
+ onClick: editor.undo,
11
+ isActive: false,
12
+ isDisabled: editor.history.undos.length === 0
13
+ }, React.createElement(Icon, {
14
+ variant: "secondary"
15
+ }, React.createElement("path", {
16
+ d: "M12.5,8C9.85,8 7.45,9 5.6,10.6L2,7V16H11L7.38,12.38C8.77,11.22 10.54,10.5 12.5,10.5C16.04,10.5 19.05,12.81 20.1,16L22.47,15.22C21.08,11.03 17.15,8 12.5,8Z"
17
+ })));
18
+ };
@@ -21,6 +21,8 @@ import { ToolbarUnderlineButton } from '../plugins/Marks/Underline';
21
21
  import { ToolbarQuoteButton } from '../plugins/Quote';
22
22
  import { ToolbarTableButton } from '../plugins/Table';
23
23
  import { useSdkContext } from '../SdkProvider';
24
+ import { ButtonRedo } from './components/ButtonRedo';
25
+ import { ButtonUndo } from './components/ButtonUndo';
24
26
  import { EmbedEntityWidget } from './components/EmbedEntityWidget';
25
27
  const styles = {
26
28
  toolbar: css({
@@ -50,8 +52,7 @@ const styles = {
50
52
  ],
51
53
  webkitAlignSelf: 'flex-start',
52
54
  alignSelf: 'flex-start',
53
- msFlexItemAlign: 'start',
54
- marginLeft: 'auto'
55
+ msFlexItemAlign: 'start'
55
56
  }),
56
57
  formattingOptionsWrapper: css({
57
58
  display: [
@@ -100,14 +101,19 @@ const Toolbar = ({ isDisabled })=>{
100
101
  const dropdownItemsAvailable = isMarkEnabled(sdk.field, MARKS.SUPERSCRIPT) || isMarkEnabled(sdk.field, MARKS.SUBSCRIPT) || isMarkEnabled(sdk.field, MARKS.CODE);
101
102
  const shouldShowDropdown = boldItalicUnderlineAvailable && dropdownItemsAvailable;
102
103
  return React.createElement(Flex, {
104
+ gap: "spacingS",
105
+ flexWrap: "wrap",
106
+ flexDirection: "row",
103
107
  testId: "toolbar",
104
108
  className: styles.toolbar,
105
- alignItems: "center"
109
+ justifyContent: "space-between"
106
110
  }, React.createElement("div", {
107
111
  className: styles.formattingOptionsWrapper
108
112
  }, React.createElement(ToolbarHeadingButton, {
109
113
  isDisabled: isDisabled || !canInsertBlocks
110
- }), validationInfo.isAnyMarkEnabled && React.createElement("span", {
114
+ }), React.createElement("span", {
115
+ className: styles.divider
116
+ }), React.createElement(ButtonUndo, null), React.createElement(ButtonRedo, null), validationInfo.isAnyMarkEnabled && React.createElement("span", {
111
117
  className: styles.divider
112
118
  }), isMarkEnabled(sdk.field, MARKS.BOLD) && React.createElement(ToolbarBoldButton, {
113
119
  isDisabled: isDisabled
@@ -0,0 +1 @@
1
+ export declare const ButtonRedo: () => JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const ButtonUndo: () => JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-rich-text",
3
- "version": "3.17.7",
3
+ "version": "3.18.0",
4
4
  "source": "./src/index.tsx",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -86,5 +86,5 @@
86
86
  "publishConfig": {
87
87
  "registry": "https://npm.pkg.github.com/"
88
88
  },
89
- "gitHead": "f251d113bc64fc7941017981bfb24975ccaa4c18"
89
+ "gitHead": "07c583c9bd150caf992c18cdbccc536e8f3a6467"
90
90
  }