@squiz/formatted-text-editor 1.34.1-alpha.5 → 1.34.1-alpha.6

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.
@@ -65,7 +65,7 @@ const FloatingToolbar = () => {
65
65
  }
66
66
  else if (!marks?.[Extensions_1.MarkName.Link].isActive && !marks?.[Extensions_1.MarkName.AssetLink].isActive) {
67
67
  // if none of the selected text is a link show the option to create a link.
68
- buttons.push(react_1.default.createElement(react_components_1.VerticalDivider, { key: "link-divider", className: "editor-divider" }), react_1.default.createElement(LinkButton_1.default, { key: "add-link", inPopover: true }));
68
+ buttons.push(react_1.default.createElement(react_components_1.VerticalDivider, { key: "link-divider" }), react_1.default.createElement(LinkButton_1.default, { key: "add-link", inPopover: true }));
69
69
  }
70
70
  // Clear formatting will always be the last button in the toolbar
71
71
  if (extensionNames.clearFormatting && clearFormatting.enabled()) {
@@ -24,7 +24,7 @@ const Toolbar = () => {
24
24
  extensionNames.history && (react_1.default.createElement(react_1.default.Fragment, null,
25
25
  react_1.default.createElement(UndoButton_1.default, null),
26
26
  react_1.default.createElement(RedoButton_1.default, null),
27
- react_1.default.createElement(react_components_1.VerticalDivider, { className: "editor-divider" }))),
27
+ react_1.default.createElement(react_components_1.VerticalDivider, null))),
28
28
  extensionNames.heading && extensionNames.paragraph && extensionNames.preformatted && react_1.default.createElement(TextTypeDropdown_1.default, null),
29
29
  extensionNames.bold && react_1.default.createElement(BoldButton_1.default, null),
30
30
  extensionNames.italic && react_1.default.createElement(ItalicButton_1.default, null),
@@ -11,11 +11,11 @@ const JustifyAlignButton_1 = __importDefault(require("./JustifyAlign/JustifyAlig
11
11
  const react_components_1 = require("@remirror/react-components");
12
12
  const TextAlignButtons = () => {
13
13
  return (react_1.default.createElement(react_1.default.Fragment, null,
14
- react_1.default.createElement(react_components_1.VerticalDivider, { className: "editor-divider" }),
14
+ react_1.default.createElement(react_components_1.VerticalDivider, null),
15
15
  react_1.default.createElement(LeftAlignButton_1.default, null),
16
16
  react_1.default.createElement(CenterAlignButton_1.default, null),
17
17
  react_1.default.createElement(RightAlignButton_1.default, null),
18
18
  react_1.default.createElement(JustifyAlignButton_1.default, null),
19
- react_1.default.createElement(react_components_1.VerticalDivider, { className: "editor-divider" })));
19
+ react_1.default.createElement(react_components_1.VerticalDivider, null)));
20
20
  };
21
21
  exports.default = TextAlignButtons;
@@ -35,6 +35,6 @@ const TextTypeDropdown = () => {
35
35
  react_1.default.createElement(HeadingButton_1.default, { level: 5 }),
36
36
  react_1.default.createElement(HeadingButton_1.default, { level: 6 }),
37
37
  react_1.default.createElement(PreformattedButton_1.default, null)),
38
- react_1.default.createElement(react_2.VerticalDivider, { className: "editor-divider" })));
38
+ react_1.default.createElement(react_2.VerticalDivider, null)));
39
39
  };
40
40
  exports.default = TextTypeDropdown;
@@ -15,7 +15,7 @@ let ClearFormattingExtension = class ClearFormattingExtension extends core_1.Pla
15
15
  return 'clearFormatting';
16
16
  }
17
17
  clearFormatting() {
18
- return ({ dispatch, tr, state, view }) => {
18
+ return ({ dispatch, tr, state }) => {
19
19
  const { empty, ranges } = state.selection;
20
20
  const schema = state.schema;
21
21
  const formattingNodes = (0, getNodeNamesByGroup_1.getNodeNamesByGroup)(schema, core_1.ExtensionTag.FormattingNode);
@@ -49,12 +49,7 @@ let ClearFormattingExtension = class ClearFormattingExtension extends core_1.Pla
49
49
  }
50
50
  });
51
51
  });
52
- if (!empty) {
53
- // Move the cursor to the end of the selection
54
- tr.setSelection((0, core_1.getTextSelection)({ from: state.selection.to, to: state.selection.to }, tr.doc));
55
- }
56
52
  dispatch?.(tr);
57
- view?.focus();
58
53
  return isChanged;
59
54
  };
60
55
  }
package/lib/index.css CHANGED
@@ -812,12 +812,12 @@
812
812
  display: flex;
813
813
  justify-items: center;
814
814
  }
815
- .squiz-fte-scope .editor-toolbar > *:not(:first-child, .editor-divider),
816
- .squiz-fte-scope .squiz-fte-scope__floating-popover > *:not(:first-child, .editor-divider) {
815
+ .squiz-fte-scope .editor-toolbar > *:not(:first-child, .MuiDivider-root),
816
+ .squiz-fte-scope__floating-popover > *:not(:first-child, .MuiDivider-root) {
817
817
  margin: 0 0 0 2px;
818
818
  }
819
- .squiz-fte-scope .editor-toolbar .editor-divider,
820
- .squiz-fte-scope .squiz-fte-scope__floating-popover .editor-divider {
819
+ .squiz-fte-scope .editor-toolbar .MuiDivider-root,
820
+ .squiz-fte-scope__floating-popover .MuiDivider-root {
821
821
  margin-top: -0.25rem;
822
822
  margin-bottom: -0.25rem;
823
823
  margin-left: 0.25rem;
@@ -827,12 +827,12 @@
827
827
  height: auto;
828
828
  }
829
829
  .squiz-fte-scope .editor-toolbar .squiz-fte-btn,
830
- .squiz-fte-scope .squiz-fte-scope__floating-popover .squiz-fte-btn {
830
+ .squiz-fte-scope__floating-popover .squiz-fte-btn {
831
831
  padding: 0.25rem;
832
832
  font-weight: 700;
833
833
  }
834
834
  .squiz-fte-scope .editor-toolbar .squiz-fte-btn ~ .squiz-fte-btn,
835
- .squiz-fte-scope .squiz-fte-scope__floating-popover .squiz-fte-btn ~ .squiz-fte-btn {
835
+ .squiz-fte-scope__floating-popover .squiz-fte-btn ~ .squiz-fte-btn {
836
836
  margin-left: 2px;
837
837
  }
838
838
  .squiz-fte-scope__floating-popover {
@@ -851,7 +851,7 @@
851
851
  var(--tw-ring-shadow, 0 0 #0000),
852
852
  var(--tw-shadow);
853
853
  }
854
- .squiz-fte-scope .squiz-fte-scope__floating-popover .editor-divider {
854
+ .squiz-fte-scope__floating-popover .MuiDivider-root {
855
855
  margin-top: 0px;
856
856
  margin-bottom: 0px;
857
857
  }
@@ -1042,12 +1042,12 @@
1042
1042
  font-weight: 700;
1043
1043
  }
1044
1044
  .squiz-fte-scope .editor-toolbar .squiz-fte-modal-footer__button,
1045
- .squiz-fte-scope .squiz-fte-scope__floating-popover .squiz-fte-modal-footer__button {
1045
+ .squiz-fte-scope__floating-popover .squiz-fte-modal-footer__button {
1046
1046
  padding: 0.25rem;
1047
1047
  font-weight: 700;
1048
1048
  }
1049
1049
  .squiz-fte-scope .editor-toolbar .squiz-fte-modal-footer__button ~ .squiz-fte-btn,
1050
- .squiz-fte-scope .squiz-fte-scope__floating-popover .squiz-fte-modal-footer__button ~ .squiz-fte-btn {
1050
+ .squiz-fte-scope__floating-popover .squiz-fte-modal-footer__button ~ .squiz-fte-btn {
1051
1051
  margin-left: 2px;
1052
1052
  }
1053
1053
  .squiz-fte-scope .squiz-fte-modal-footer__button {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squiz/formatted-text-editor",
3
- "version": "1.34.1-alpha.5",
3
+ "version": "1.34.1-alpha.6",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "scripts": {
@@ -20,8 +20,8 @@
20
20
  "@headlessui/react": "1.7.11",
21
21
  "@mui/icons-material": "5.11.16",
22
22
  "@remirror/react": "2.0.25",
23
- "@squiz/dx-json-schema-lib": "1.34.1-alpha.5",
24
- "@squiz/resource-browser": "1.34.1-alpha.5",
23
+ "@squiz/dx-json-schema-lib": "1.34.1-alpha.6",
24
+ "@squiz/resource-browser": "1.34.1-alpha.6",
25
25
  "clsx": "1.2.1",
26
26
  "react-hook-form": "7.43.2",
27
27
  "react-image-size": "2.0.0",
@@ -75,5 +75,5 @@
75
75
  "volta": {
76
76
  "node": "18.15.0"
77
77
  },
78
- "gitHead": "96b2fec093ea7e6746c0718074221b9e88b989ba"
78
+ "gitHead": "82f279a64c198e72d7ccfb6296624052bd4ce510"
79
79
  }
package/postcss.config.js CHANGED
@@ -5,7 +5,7 @@ module.exports = {
5
5
  require('postcss-nested'),
6
6
  require('postcss-prefix-selector')({
7
7
  prefix: '.squiz-fte-scope',
8
- exclude: ['.squiz-fte-scope__floating-popover'],
8
+ exclude: [/\.squiz-fte-scope__floating-popover/],
9
9
  includeFiles: ['./src/index.scss'],
10
10
  }),
11
11
  ],
@@ -41,10 +41,7 @@ export const FloatingToolbar = () => {
41
41
  ];
42
42
  } else if (!marks?.[MarkName.Link].isActive && !marks?.[MarkName.AssetLink].isActive) {
43
43
  // if none of the selected text is a link show the option to create a link.
44
- buttons.push(
45
- <VerticalDivider key="link-divider" className="editor-divider" />,
46
- <LinkButton key="add-link" inPopover={true} />,
47
- );
44
+ buttons.push(<VerticalDivider key="link-divider" />, <LinkButton key="add-link" inPopover={true} />);
48
45
  }
49
46
 
50
47
  // Clear formatting will always be the last button in the toolbar
@@ -22,7 +22,7 @@ export const Toolbar = () => {
22
22
  <>
23
23
  <UndoButton />
24
24
  <RedoButton />
25
- <VerticalDivider className="editor-divider" />
25
+ <VerticalDivider />
26
26
  </>
27
27
  )}
28
28
  {extensionNames.heading && extensionNames.paragraph && extensionNames.preformatted && <TextTypeDropdown />}
@@ -8,12 +8,12 @@ import { VerticalDivider } from '@remirror/react-components';
8
8
  const TextAlignButtons = () => {
9
9
  return (
10
10
  <>
11
- <VerticalDivider className="editor-divider" />
11
+ <VerticalDivider />
12
12
  <LeftAlignButton />
13
13
  <CenterAlignButton />
14
14
  <RightAlignButton />
15
15
  <JustifyAlignButton />
16
- <VerticalDivider className="editor-divider" />
16
+ <VerticalDivider />
17
17
  </>
18
18
  );
19
19
  };
@@ -36,7 +36,7 @@ const TextTypeDropdown = () => {
36
36
  <HeadingButton level={6} />
37
37
  <PreformattedButton />
38
38
  </ToolbarDropdown>
39
- <VerticalDivider className="editor-divider" />
39
+ <VerticalDivider />
40
40
  </>
41
41
  );
42
42
  };
@@ -3,7 +3,7 @@
3
3
  @extend .editor-toolbar;
4
4
  @apply bg-white border-gray-200 p-1 shadow rounded-md border flex;
5
5
 
6
- .editor-divider {
6
+ .MuiDivider-root {
7
7
  @apply my-0;
8
8
  }
9
9
  }
@@ -4,11 +4,11 @@
4
4
  display: flex;
5
5
  justify-items: center;
6
6
 
7
- > *:not(:first-child, .editor-divider) {
7
+ > *:not(:first-child, .MuiDivider-root) {
8
8
  margin: 0 0 0 2px;
9
9
  }
10
10
 
11
- .editor-divider {
11
+ .MuiDivider-root {
12
12
  @apply -my-1 mx-1 border;
13
13
  margin-right: 2px;
14
14
  height: auto;
@@ -1,12 +1,4 @@
1
- import {
2
- command,
3
- extension,
4
- PlainExtension,
5
- CommandFunction,
6
- Mark,
7
- ExtensionTag,
8
- getTextSelection,
9
- } from '@remirror/core';
1
+ import { command, extension, PlainExtension, CommandFunction, Mark, ExtensionTag } from '@remirror/core';
10
2
  import { getNodeNamesByGroup } from '../../utils/getNodeNamesByGroup';
11
3
  import { getMarkNamesByGroup } from '../../utils/getMarkNamesByGroup';
12
4
 
@@ -18,7 +10,7 @@ export class ClearFormattingExtension extends PlainExtension {
18
10
 
19
11
  @command()
20
12
  clearFormatting(): CommandFunction {
21
- return ({ dispatch, tr, state, view }) => {
13
+ return ({ dispatch, tr, state }) => {
22
14
  const { empty, ranges } = state.selection;
23
15
  const schema = state.schema;
24
16
 
@@ -57,13 +49,7 @@ export class ClearFormattingExtension extends PlainExtension {
57
49
  });
58
50
  });
59
51
 
60
- if (!empty) {
61
- // Move the cursor to the end of the selection
62
- tr.setSelection(getTextSelection({ from: state.selection.to, to: state.selection.to }, tr.doc));
63
- }
64
-
65
52
  dispatch?.(tr);
66
- view?.focus();
67
53
 
68
54
  return isChanged;
69
55
  };