@pega/cosmos-react-rte 3.0.0-dev.9.1 → 3.0.0-rc.10

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 (79) hide show
  1. package/lib/components/Editor/Editor.d.ts +2 -0
  2. package/lib/components/Editor/Editor.d.ts.map +1 -1
  3. package/lib/components/Editor/Editor.js +111 -18
  4. package/lib/components/Editor/Editor.js.map +1 -1
  5. package/lib/components/Editor/Editor.styles.d.ts +2 -1
  6. package/lib/components/Editor/Editor.styles.d.ts.map +1 -1
  7. package/lib/components/Editor/Editor.styles.js +24 -9
  8. package/lib/components/Editor/Editor.styles.js.map +1 -1
  9. package/lib/components/Editor/Editor.types.d.ts +10 -3
  10. package/lib/components/Editor/Editor.types.d.ts.map +1 -1
  11. package/lib/components/Editor/Editor.types.js.map +1 -1
  12. package/lib/components/Editor/ImageEditor.d.ts +1 -0
  13. package/lib/components/Editor/ImageEditor.d.ts.map +1 -1
  14. package/lib/components/Editor/ImageEditor.js +29 -35
  15. package/lib/components/Editor/ImageEditor.js.map +1 -1
  16. package/lib/components/Editor/Toolbar/AnchorButton.d.ts.map +1 -1
  17. package/lib/components/Editor/Toolbar/AnchorButton.js +21 -7
  18. package/lib/components/Editor/Toolbar/AnchorButton.js.map +1 -1
  19. package/lib/components/Editor/Toolbar/TextSelect.d.ts.map +1 -1
  20. package/lib/components/Editor/Toolbar/TextSelect.js +15 -2
  21. package/lib/components/Editor/Toolbar/TextSelect.js.map +1 -1
  22. package/lib/components/Editor/Toolbar/Toolbar.d.ts.map +1 -1
  23. package/lib/components/Editor/Toolbar/Toolbar.js +18 -8
  24. package/lib/components/Editor/Toolbar/Toolbar.js.map +1 -1
  25. package/lib/components/RichTextEditor/DecoratorComponents/Image.js +2 -2
  26. package/lib/components/RichTextEditor/DecoratorComponents/Image.js.map +1 -1
  27. package/lib/components/RichTextEditor/DecoratorComponents/Link.js +3 -3
  28. package/lib/components/RichTextEditor/DecoratorComponents/Link.js.map +1 -1
  29. package/lib/components/RichTextEditor/RichTextEditor.d.ts.map +1 -1
  30. package/lib/components/RichTextEditor/RichTextEditor.js +53 -12
  31. package/lib/components/RichTextEditor/RichTextEditor.js.map +1 -1
  32. package/lib/components/RichTextEditor/RichTextEditor.types.d.ts +2 -10
  33. package/lib/components/RichTextEditor/RichTextEditor.types.d.ts.map +1 -1
  34. package/lib/components/RichTextEditor/RichTextEditor.types.js.map +1 -1
  35. package/lib/components/RichTextEditor/RichTextTreeRenderer.d.ts +9 -0
  36. package/lib/components/RichTextEditor/RichTextTreeRenderer.d.ts.map +1 -0
  37. package/lib/components/RichTextEditor/RichTextTreeRenderer.js +15 -0
  38. package/lib/components/RichTextEditor/RichTextTreeRenderer.js.map +1 -0
  39. package/lib/components/RichTextEditor/RichTextViewer.d.ts +1 -0
  40. package/lib/components/RichTextEditor/RichTextViewer.d.ts.map +1 -1
  41. package/lib/components/RichTextEditor/RichTextViewer.js +10 -18
  42. package/lib/components/RichTextEditor/RichTextViewer.js.map +1 -1
  43. package/lib/components/RichTextEditor/RichTextViewer.types.d.ts +7 -0
  44. package/lib/components/RichTextEditor/RichTextViewer.types.d.ts.map +1 -1
  45. package/lib/components/RichTextEditor/RichTextViewer.types.js.map +1 -1
  46. package/lib/components/RichTextEditor/Toolbar/AnchorButton.js +1 -1
  47. package/lib/components/RichTextEditor/Toolbar/AnchorButton.js.map +1 -1
  48. package/lib/components/RichTextEditor/Toolbar/IndentButton.d.ts.map +1 -1
  49. package/lib/components/RichTextEditor/Toolbar/IndentButton.js +5 -2
  50. package/lib/components/RichTextEditor/Toolbar/IndentButton.js.map +1 -1
  51. package/lib/components/RichTextEditor/Toolbar/Toolbar.d.ts.map +1 -1
  52. package/lib/components/RichTextEditor/Toolbar/Toolbar.js +14 -5
  53. package/lib/components/RichTextEditor/Toolbar/Toolbar.js.map +1 -1
  54. package/lib/components/RichTextEditor/Toolbar/ToolbarButton.d.ts.map +1 -1
  55. package/lib/components/RichTextEditor/Toolbar/ToolbarButton.js +3 -2
  56. package/lib/components/RichTextEditor/Toolbar/ToolbarButton.js.map +1 -1
  57. package/lib/components/RichTextEditor/index.d.ts +1 -0
  58. package/lib/components/RichTextEditor/index.d.ts.map +1 -1
  59. package/lib/components/RichTextEditor/index.js +1 -0
  60. package/lib/components/RichTextEditor/index.js.map +1 -1
  61. package/lib/components/RichTextEditor/utils/EditorCommands.d.ts +1 -1
  62. package/lib/components/RichTextEditor/utils/EditorCommands.d.ts.map +1 -1
  63. package/lib/components/RichTextEditor/utils/EditorCommands.js +25 -6
  64. package/lib/components/RichTextEditor/utils/EditorCommands.js.map +1 -1
  65. package/lib/components/RichTextEditor/utils/interactionRenderer.d.ts +2 -8
  66. package/lib/components/RichTextEditor/utils/interactionRenderer.d.ts.map +1 -1
  67. package/lib/components/RichTextEditor/utils/interactionRenderer.js +50 -23
  68. package/lib/components/RichTextEditor/utils/interactionRenderer.js.map +1 -1
  69. package/lib/components/RichTextEditor/utils/markdownConverter.d.ts +3 -4
  70. package/lib/components/RichTextEditor/utils/markdownConverter.d.ts.map +1 -1
  71. package/lib/components/RichTextEditor/utils/markdownConverter.js.map +1 -1
  72. package/lib/components/RichTextEditor/utils/renderers.d.ts +20 -3
  73. package/lib/components/RichTextEditor/utils/renderers.d.ts.map +1 -1
  74. package/lib/components/RichTextEditor/utils/renderers.js +85 -3
  75. package/lib/components/RichTextEditor/utils/renderers.js.map +1 -1
  76. package/lib/components/RichTextEditor/utils/search.d.ts.map +1 -1
  77. package/lib/components/RichTextEditor/utils/search.js +9 -1
  78. package/lib/components/RichTextEditor/utils/search.js.map +1 -1
  79. package/package.json +9 -10
@@ -2,7 +2,15 @@ import { Editor, Range } from 'slate';
2
2
  // eslint-disable-next-line import/prefer-default-export
3
3
  export const onSearchChange = (editor, { groupId, regex, trigger }) => {
4
4
  const { selection } = editor;
5
- if (selection && Range.isCollapsed(selection)) {
5
+ let collapsed;
6
+ // Prevents error on triple clicks
7
+ try {
8
+ collapsed = selection ? Range.isCollapsed(selection) : false;
9
+ }
10
+ catch (e) {
11
+ collapsed = false;
12
+ }
13
+ if (selection && collapsed) {
6
14
  // Gets the cursor position in the RTE
7
15
  const [cursorPos] = Range.edges(selection);
8
16
  // Gets the Slate node at the search trigger
@@ -1 +1 @@
1
- {"version":3,"file":"search.js","sourceRoot":"","sources":["../../../../src/components/RichTextEditor/utils/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAQ,MAAM,OAAO,CAAC;AAE5C,wDAAwD;AACxD,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,MAAc,EACd,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAuD,EAChF,EAAE;IACF,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;IAE7B,IAAI,SAAS,IAAI,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE;QAC7C,sCAAsC;QACtC,MAAM,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC3C,4CAA4C;QAC5C,MAAM,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QACpD,gFAAgF;QAChF,IAAK,UAAmB,EAAE,YAAY;YAAE,OAAO;QAE/C,0EAA0E;QAC1E,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QACzE,2DAA2D;QAC3D,MAAM,SAAS,GAAG,aAAa,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;QAClF,2CAA2C;QAC3C,MAAM,QAAQ,GAAG,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAE/D,+DAA+D;QAC/D,MAAM,WAAW,GAAG,QAAQ,IAAI,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAEtD,IAAI,WAAW,IAAI,OAAO,WAAW,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,EAAE;YACpE,MAAM,WAAW,GAAG,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;YACpD,qEAAqE;YACrE,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAC9B,MAAM,EACN,EAAE,GAAG,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,MAAM,GAAG,WAAW,EAAE,EACxD,SAAS,CACV,CAAC;YACF,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;SAC9E;KACF;AACH,CAAC,CAAC","sourcesContent":["import { Editor, Range, Text } from 'slate';\n\n// eslint-disable-next-line import/prefer-default-export\nexport const onSearchChange = (\n editor: Editor,\n { groupId, regex, trigger }: { groupId: string; regex: RegExp; trigger: string }\n) => {\n const { selection } = editor;\n\n if (selection && Range.isCollapsed(selection)) {\n // Gets the cursor position in the RTE\n const [cursorPos] = Range.edges(selection);\n // Gets the Slate node at the search trigger\n const [searchNode] = Editor.node(editor, cursorPos);\n // If the search is triggered from within a searchResult node, ignore the search\n if ((searchNode as Text)?.searchResult) return;\n\n // Gets the point before the line that is currently being typed in the RTE\n const posBeforeWord = Editor.before(editor, cursorPos, { unit: 'line' });\n // Gets the range before the line up to the cursor position\n const lineRange = posBeforeWord && Editor.range(editor, posBeforeWord, cursorPos);\n // Gets all of the text on the current line\n const lineText = lineRange && Editor.string(editor, lineRange);\n\n // Matches the text on the current line with the regex provided\n const beforeMatch = lineText && lineText.match(regex);\n\n if (beforeMatch && typeof beforeMatch.groups?.[groupId] === 'string') {\n const matchLength = beforeMatch.groups.match.length;\n // Gets the range of the matching text to place the popover correctly\n const targetRange = Editor.range(\n editor,\n { ...cursorPos, offset: cursorPos.offset - matchLength },\n cursorPos\n );\n return { search: beforeMatch.groups[groupId], target: targetRange, trigger };\n }\n }\n};\n"]}
1
+ {"version":3,"file":"search.js","sourceRoot":"","sources":["../../../../src/components/RichTextEditor/utils/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAQ,MAAM,OAAO,CAAC;AAE5C,wDAAwD;AACxD,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,MAAc,EACd,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAuD,EAChF,EAAE;IACF,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;IAC7B,IAAI,SAAS,CAAC;IAEd,kCAAkC;IAClC,IAAI;QACF,SAAS,GAAG,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;KAC9D;IAAC,OAAO,CAAC,EAAE;QACV,SAAS,GAAG,KAAK,CAAC;KACnB;IAED,IAAI,SAAS,IAAI,SAAS,EAAE;QAC1B,sCAAsC;QACtC,MAAM,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC3C,4CAA4C;QAC5C,MAAM,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QACpD,gFAAgF;QAChF,IAAK,UAAmB,EAAE,YAAY;YAAE,OAAO;QAE/C,0EAA0E;QAC1E,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QACzE,2DAA2D;QAC3D,MAAM,SAAS,GAAG,aAAa,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;QAClF,2CAA2C;QAC3C,MAAM,QAAQ,GAAG,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAE/D,+DAA+D;QAC/D,MAAM,WAAW,GAAG,QAAQ,IAAI,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAEtD,IAAI,WAAW,IAAI,OAAO,WAAW,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,EAAE;YACpE,MAAM,WAAW,GAAG,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;YACpD,qEAAqE;YACrE,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAC9B,MAAM,EACN,EAAE,GAAG,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,MAAM,GAAG,WAAW,EAAE,EACxD,SAAS,CACV,CAAC;YACF,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;SAC9E;KACF;AACH,CAAC,CAAC","sourcesContent":["import { Editor, Range, Text } from 'slate';\n\n// eslint-disable-next-line import/prefer-default-export\nexport const onSearchChange = (\n editor: Editor,\n { groupId, regex, trigger }: { groupId: string; regex: RegExp; trigger: string }\n) => {\n const { selection } = editor;\n let collapsed;\n\n // Prevents error on triple clicks\n try {\n collapsed = selection ? Range.isCollapsed(selection) : false;\n } catch (e) {\n collapsed = false;\n }\n\n if (selection && collapsed) {\n // Gets the cursor position in the RTE\n const [cursorPos] = Range.edges(selection);\n // Gets the Slate node at the search trigger\n const [searchNode] = Editor.node(editor, cursorPos);\n // If the search is triggered from within a searchResult node, ignore the search\n if ((searchNode as Text)?.searchResult) return;\n\n // Gets the point before the line that is currently being typed in the RTE\n const posBeforeWord = Editor.before(editor, cursorPos, { unit: 'line' });\n // Gets the range before the line up to the cursor position\n const lineRange = posBeforeWord && Editor.range(editor, posBeforeWord, cursorPos);\n // Gets all of the text on the current line\n const lineText = lineRange && Editor.string(editor, lineRange);\n\n // Matches the text on the current line with the regex provided\n const beforeMatch = lineText && lineText.match(regex);\n\n if (beforeMatch && typeof beforeMatch.groups?.[groupId] === 'string') {\n const matchLength = beforeMatch.groups.match.length;\n // Gets the range of the matching text to place the popover correctly\n const targetRange = Editor.range(\n editor,\n { ...cursorPos, offset: cursorPos.offset - matchLength },\n cursorPos\n );\n return { search: beforeMatch.groups[groupId], target: targetRange, trigger };\n }\n }\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/cosmos-react-rte",
3
- "version": "3.0.0-dev.9.1",
3
+ "version": "3.0.0-rc.10",
4
4
  "author": "Pegasystems",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {
@@ -20,27 +20,27 @@
20
20
  "build": "tsc -b"
21
21
  },
22
22
  "dependencies": {
23
- "@pega/cosmos-react-core": "3.0.0-dev.9.1",
24
- "@popperjs/core": "^2.11.0",
23
+ "@pega/cosmos-react-core": "3.0.0-rc.10",
24
+ "@popperjs/core": "^2.11.6",
25
25
  "@types/marked": "^4.0.2",
26
26
  "@types/parse5": "^6.0.0",
27
27
  "@types/react": "^16.14.24 || ^17.0.38",
28
28
  "@types/react-dom": "^16.9.14 || ^17.0.11",
29
- "@types/styled-components": "^5.1.7",
29
+ "@types/styled-components": "^5.1.26",
30
30
  "@types/stylis": "^4.0.2",
31
- "@types/tinymce": "^4.6.4",
31
+ "global-tld-list": "0.0.862",
32
32
  "marked": "^4.0.12",
33
33
  "parse5": "^6.0.1",
34
34
  "polished": "^4.1.0",
35
35
  "react": "^16.14.0 || ^17.0.0",
36
36
  "react-dom": "^16.14.0 || ^17.0.0",
37
37
  "react-popper": "^2.2.5",
38
- "slate": "^0.72.3",
38
+ "slate": "^0.76.1",
39
39
  "slate-history": "^0.66.0",
40
- "slate-react": "^0.72.1",
40
+ "slate-react": "^0.76.1",
41
41
  "styled-components": "^5.2.0",
42
42
  "stylis": "^4.0.13",
43
- "tinymce": "^5.10.2"
43
+ "tinymce": "^6.0.3"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@storybook/addon-a11y": "^6.4.19",
@@ -50,7 +50,6 @@
50
50
  "@storybook/addons": "^6.4.19",
51
51
  "@storybook/react": "^6.4.19",
52
52
  "@storybook/theming": "^6.4.19",
53
- "enzyme": "^3.11.0",
54
- "typescript": "~4.6.2"
53
+ "typescript": "~4.7.2"
55
54
  }
56
55
  }