@toptal/picasso 19.2.0 → 19.3.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 (262) hide show
  1. package/Icon/Bold16.d.ts +10 -0
  2. package/Icon/Bold16.js +23 -0
  3. package/Icon/Bold16.js.map +1 -0
  4. package/Icon/Italic16.d.ts +10 -0
  5. package/Icon/Italic16.js +23 -0
  6. package/Icon/Italic16.js.map +1 -0
  7. package/Icon/ListOrdered16.d.ts +10 -0
  8. package/Icon/ListOrdered16.js +23 -0
  9. package/Icon/ListOrdered16.js.map +1 -0
  10. package/Icon/ListUnordered16.d.ts +10 -0
  11. package/Icon/ListUnordered16.js +23 -0
  12. package/Icon/ListUnordered16.js.map +1 -0
  13. package/Icon/index.d.ts +4 -0
  14. package/Icon/index.js +4 -0
  15. package/Icon/index.js.map +1 -1
  16. package/ListItem/styles.d.ts +1 -1
  17. package/QuillEditor/QuillEditor.d.ts +32 -0
  18. package/QuillEditor/QuillEditor.js +42 -0
  19. package/QuillEditor/QuillEditor.js.map +1 -0
  20. package/QuillEditor/constants.d.ts +1 -0
  21. package/QuillEditor/constants.js +2 -0
  22. package/QuillEditor/constants.js.map +1 -0
  23. package/QuillEditor/formats/bold.d.ts +8 -0
  24. package/QuillEditor/formats/bold.js +18 -0
  25. package/QuillEditor/formats/bold.js.map +1 -0
  26. package/QuillEditor/formats/header.d.ts +8 -0
  27. package/QuillEditor/formats/header.js +20 -0
  28. package/QuillEditor/formats/header.js.map +1 -0
  29. package/QuillEditor/formats/index.d.ts +3 -0
  30. package/QuillEditor/formats/index.js +4 -0
  31. package/QuillEditor/formats/index.js.map +1 -0
  32. package/QuillEditor/formats/use-typography-classes.d.ts +2 -0
  33. package/QuillEditor/formats/use-typography-classes.js +7 -0
  34. package/QuillEditor/formats/use-typography-classes.js.map +1 -0
  35. package/QuillEditor/hooks/index.d.ts +6 -0
  36. package/QuillEditor/hooks/index.js +7 -0
  37. package/QuillEditor/hooks/index.js.map +1 -0
  38. package/QuillEditor/hooks/useDefaultValue/index.d.ts +1 -0
  39. package/QuillEditor/hooks/useDefaultValue/index.js +2 -0
  40. package/QuillEditor/hooks/useDefaultValue/index.js.map +1 -0
  41. package/QuillEditor/hooks/useDefaultValue/useDefaultValue.d.ts +7 -0
  42. package/QuillEditor/hooks/useDefaultValue/useDefaultValue.js +15 -0
  43. package/QuillEditor/hooks/useDefaultValue/useDefaultValue.js.map +1 -0
  44. package/QuillEditor/hooks/useDisabledEditor/index.d.ts +1 -0
  45. package/QuillEditor/hooks/useDisabledEditor/index.js +2 -0
  46. package/QuillEditor/hooks/useDisabledEditor/index.js.map +1 -0
  47. package/QuillEditor/hooks/useDisabledEditor/useDisabledEditor.d.ts +6 -0
  48. package/QuillEditor/hooks/useDisabledEditor/useDisabledEditor.js +11 -0
  49. package/QuillEditor/hooks/useDisabledEditor/useDisabledEditor.js.map +1 -0
  50. package/QuillEditor/hooks/useFocus/index.d.ts +1 -0
  51. package/QuillEditor/hooks/useFocus/index.js +2 -0
  52. package/QuillEditor/hooks/useFocus/index.js.map +1 -0
  53. package/QuillEditor/hooks/useFocus/useFocus.d.ts +6 -0
  54. package/QuillEditor/hooks/useFocus/useFocus.js +13 -0
  55. package/QuillEditor/hooks/useFocus/useFocus.js.map +1 -0
  56. package/QuillEditor/hooks/useKeyBindings/index.d.ts +1 -0
  57. package/QuillEditor/hooks/useKeyBindings/index.js +2 -0
  58. package/QuillEditor/hooks/useKeyBindings/index.js.map +1 -0
  59. package/QuillEditor/hooks/useKeyBindings/useKeyBindings.d.ts +7 -0
  60. package/QuillEditor/hooks/useKeyBindings/useKeyBindings.js +32 -0
  61. package/QuillEditor/hooks/useKeyBindings/useKeyBindings.js.map +1 -0
  62. package/QuillEditor/hooks/useQuillInstance/index.d.ts +1 -0
  63. package/QuillEditor/hooks/useQuillInstance/index.js +2 -0
  64. package/QuillEditor/hooks/useQuillInstance/index.js.map +1 -0
  65. package/QuillEditor/hooks/useQuillInstance/useQuillInstance.d.ts +9 -0
  66. package/QuillEditor/hooks/useQuillInstance/useQuillInstance.js +68 -0
  67. package/QuillEditor/hooks/useQuillInstance/useQuillInstance.js.map +1 -0
  68. package/QuillEditor/hooks/useSubscribeToQuillEvents/index.d.ts +1 -0
  69. package/QuillEditor/hooks/useSubscribeToQuillEvents/index.js +2 -0
  70. package/QuillEditor/hooks/useSubscribeToQuillEvents/index.js.map +1 -0
  71. package/QuillEditor/hooks/useSubscribeToQuillEvents/useSubscribeToQuillEvents.d.ts +10 -0
  72. package/QuillEditor/hooks/useSubscribeToQuillEvents/useSubscribeToQuillEvents.js +64 -0
  73. package/QuillEditor/hooks/useSubscribeToQuillEvents/useSubscribeToQuillEvents.js.map +1 -0
  74. package/QuillEditor/hooks/useSubscribeToTextEditorEvents/index.d.ts +1 -0
  75. package/QuillEditor/hooks/useSubscribeToTextEditorEvents/index.js +2 -0
  76. package/QuillEditor/hooks/useSubscribeToTextEditorEvents/index.js.map +1 -0
  77. package/QuillEditor/hooks/useSubscribeToTextEditorEvents/useSubscribeToTextEditorEvents.d.ts +6 -0
  78. package/QuillEditor/hooks/useSubscribeToTextEditorEvents/useSubscribeToTextEditorEvents.js +23 -0
  79. package/QuillEditor/hooks/useSubscribeToTextEditorEvents/useSubscribeToTextEditorEvents.js.map +1 -0
  80. package/QuillEditor/index.d.ts +4 -0
  81. package/QuillEditor/index.js +4 -0
  82. package/QuillEditor/index.js.map +1 -0
  83. package/QuillEditor/styles.d.ts +3 -0
  84. package/QuillEditor/styles.js +100 -0
  85. package/QuillEditor/styles.js.map +1 -0
  86. package/QuillEditor/types.d.ts +27 -0
  87. package/QuillEditor/types.js +2 -0
  88. package/QuillEditor/types.js.map +1 -0
  89. package/QuillEditor/utils/getCleanupOnAllContentRemovalHandler/getCleanupOnAllContentRemovalHandler.d.ts +3 -0
  90. package/QuillEditor/utils/getCleanupOnAllContentRemovalHandler/getCleanupOnAllContentRemovalHandler.js +22 -0
  91. package/QuillEditor/utils/getCleanupOnAllContentRemovalHandler/getCleanupOnAllContentRemovalHandler.js.map +1 -0
  92. package/QuillEditor/utils/getCleanupOnAllContentRemovalHandler/index.d.ts +1 -0
  93. package/QuillEditor/utils/getCleanupOnAllContentRemovalHandler/index.js +2 -0
  94. package/QuillEditor/utils/getCleanupOnAllContentRemovalHandler/index.js.map +1 -0
  95. package/QuillEditor/utils/getEditorChangeHandler/getEditorChangeHandler.d.ts +7 -0
  96. package/QuillEditor/utils/getEditorChangeHandler/getEditorChangeHandler.js +41 -0
  97. package/QuillEditor/utils/getEditorChangeHandler/getEditorChangeHandler.js.map +1 -0
  98. package/QuillEditor/utils/getEditorChangeHandler/index.d.ts +1 -0
  99. package/QuillEditor/utils/getEditorChangeHandler/index.js +2 -0
  100. package/QuillEditor/utils/getEditorChangeHandler/index.js.map +1 -0
  101. package/QuillEditor/utils/getFormatChangeHandler/getFormatChangeHandler.d.ts +3 -0
  102. package/QuillEditor/utils/getFormatChangeHandler/getFormatChangeHandler.js +13 -0
  103. package/QuillEditor/utils/getFormatChangeHandler/getFormatChangeHandler.js.map +1 -0
  104. package/QuillEditor/utils/getFormatChangeHandler/index.d.ts +2 -0
  105. package/QuillEditor/utils/getFormatChangeHandler/index.js +3 -0
  106. package/QuillEditor/utils/getFormatChangeHandler/index.js.map +1 -0
  107. package/QuillEditor/utils/getSelectionChangeHandler/getSelectionChangeHandler.d.ts +4 -0
  108. package/QuillEditor/utils/getSelectionChangeHandler/getSelectionChangeHandler.js +19 -0
  109. package/QuillEditor/utils/getSelectionChangeHandler/getSelectionChangeHandler.js.map +1 -0
  110. package/QuillEditor/utils/getSelectionChangeHandler/index.d.ts +1 -0
  111. package/QuillEditor/utils/getSelectionChangeHandler/index.js +2 -0
  112. package/QuillEditor/utils/getSelectionChangeHandler/index.js.map +1 -0
  113. package/QuillEditor/utils/getTextChangeHandler/getTextChangeHandler.d.ts +3 -0
  114. package/QuillEditor/utils/getTextChangeHandler/getTextChangeHandler.js +22 -0
  115. package/QuillEditor/utils/getTextChangeHandler/getTextChangeHandler.js.map +1 -0
  116. package/QuillEditor/utils/getTextChangeHandler/index.d.ts +1 -0
  117. package/QuillEditor/utils/getTextChangeHandler/index.js +2 -0
  118. package/QuillEditor/utils/getTextChangeHandler/index.js.map +1 -0
  119. package/QuillEditor/utils/getTextLengthChangeHandler/getTextLengthChangeHandler.d.ts +4 -0
  120. package/QuillEditor/utils/getTextLengthChangeHandler/getTextLengthChangeHandler.js +9 -0
  121. package/QuillEditor/utils/getTextLengthChangeHandler/getTextLengthChangeHandler.js.map +1 -0
  122. package/QuillEditor/utils/getTextLengthChangeHandler/index.d.ts +1 -0
  123. package/QuillEditor/utils/getTextLengthChangeHandler/index.js +2 -0
  124. package/QuillEditor/utils/getTextLengthChangeHandler/index.js.map +1 -0
  125. package/QuillEditor/utils/remove-classes/index.d.ts +1 -0
  126. package/QuillEditor/utils/remove-classes/index.js +2 -0
  127. package/QuillEditor/utils/remove-classes/index.js.map +1 -0
  128. package/QuillEditor/utils/remove-classes/remove-classes.d.ts +2 -0
  129. package/QuillEditor/utils/remove-classes/remove-classes.js +3 -0
  130. package/QuillEditor/utils/remove-classes/remove-classes.js.map +1 -0
  131. package/QuillEditor/utils/remove-cursor-span/index.d.ts +1 -0
  132. package/QuillEditor/utils/remove-cursor-span/index.js +2 -0
  133. package/QuillEditor/utils/remove-cursor-span/index.js.map +1 -0
  134. package/QuillEditor/utils/remove-cursor-span/remove-cursor-span.d.ts +2 -0
  135. package/QuillEditor/utils/remove-cursor-span/remove-cursor-span.js +5 -0
  136. package/QuillEditor/utils/remove-cursor-span/remove-cursor-span.js.map +1 -0
  137. package/RichTextEditor/RichTextEditor.d.ts +63 -0
  138. package/RichTextEditor/RichTextEditor.js +77 -0
  139. package/RichTextEditor/RichTextEditor.js.map +1 -0
  140. package/RichTextEditor/hooks/index.d.ts +6 -0
  141. package/RichTextEditor/hooks/index.js +7 -0
  142. package/RichTextEditor/hooks/index.js.map +1 -0
  143. package/RichTextEditor/hooks/useCounter/index.d.ts +1 -0
  144. package/RichTextEditor/hooks/useCounter/index.js +2 -0
  145. package/RichTextEditor/hooks/useCounter/index.js.map +1 -0
  146. package/RichTextEditor/hooks/useCounter/useCounter.d.ts +14 -0
  147. package/RichTextEditor/hooks/useCounter/useCounter.js +68 -0
  148. package/RichTextEditor/hooks/useCounter/useCounter.js.map +1 -0
  149. package/RichTextEditor/hooks/useOnFocus/index.d.ts +1 -0
  150. package/RichTextEditor/hooks/useOnFocus/index.js +2 -0
  151. package/RichTextEditor/hooks/useOnFocus/index.js.map +1 -0
  152. package/RichTextEditor/hooks/useOnFocus/useOnFocus.d.ts +16 -0
  153. package/RichTextEditor/hooks/useOnFocus/useOnFocus.js +44 -0
  154. package/RichTextEditor/hooks/useOnFocus/useOnFocus.js.map +1 -0
  155. package/RichTextEditor/hooks/useOnSelectionChange/index.d.ts +1 -0
  156. package/RichTextEditor/hooks/useOnSelectionChange/index.js +2 -0
  157. package/RichTextEditor/hooks/useOnSelectionChange/index.js.map +1 -0
  158. package/RichTextEditor/hooks/useOnSelectionChange/useOnSelectionChange.d.ts +10 -0
  159. package/RichTextEditor/hooks/useOnSelectionChange/useOnSelectionChange.js +15 -0
  160. package/RichTextEditor/hooks/useOnSelectionChange/useOnSelectionChange.js.map +1 -0
  161. package/RichTextEditor/hooks/useOnTextFormat/index.d.ts +1 -0
  162. package/RichTextEditor/hooks/useOnTextFormat/index.js +2 -0
  163. package/RichTextEditor/hooks/useOnTextFormat/index.js.map +1 -0
  164. package/RichTextEditor/hooks/useOnTextFormat/useOnTextFormat.d.ts +10 -0
  165. package/RichTextEditor/hooks/useOnTextFormat/useOnTextFormat.js +30 -0
  166. package/RichTextEditor/hooks/useOnTextFormat/useOnTextFormat.js.map +1 -0
  167. package/RichTextEditor/hooks/useTextEditorState/index.d.ts +1 -0
  168. package/RichTextEditor/hooks/useTextEditorState/index.js +2 -0
  169. package/RichTextEditor/hooks/useTextEditorState/index.js.map +1 -0
  170. package/RichTextEditor/hooks/useTextEditorState/useTextEditorState.d.ts +7 -0
  171. package/RichTextEditor/hooks/useTextEditorState/useTextEditorState.js +8 -0
  172. package/RichTextEditor/hooks/useTextEditorState/useTextEditorState.js.map +1 -0
  173. package/RichTextEditor/hooks/useToolbarHandlers/index.d.ts +1 -0
  174. package/RichTextEditor/hooks/useToolbarHandlers/index.js +2 -0
  175. package/RichTextEditor/hooks/useToolbarHandlers/index.js.map +1 -0
  176. package/RichTextEditor/hooks/useToolbarHandlers/useToolbarHandlers.d.ts +16 -0
  177. package/RichTextEditor/hooks/useToolbarHandlers/useToolbarHandlers.js +61 -0
  178. package/RichTextEditor/hooks/useToolbarHandlers/useToolbarHandlers.js.map +1 -0
  179. package/RichTextEditor/index.d.ts +7 -0
  180. package/RichTextEditor/index.js +3 -0
  181. package/RichTextEditor/index.js.map +1 -0
  182. package/RichTextEditor/store/index.d.ts +9 -0
  183. package/RichTextEditor/store/index.js +11 -0
  184. package/RichTextEditor/store/index.js.map +1 -0
  185. package/RichTextEditor/store/toolbar/actionTypes.d.ts +9 -0
  186. package/RichTextEditor/store/toolbar/actionTypes.js +10 -0
  187. package/RichTextEditor/store/toolbar/actionTypes.js.map +1 -0
  188. package/RichTextEditor/store/toolbar/actions.d.ts +11 -0
  189. package/RichTextEditor/store/toolbar/actions.js +17 -0
  190. package/RichTextEditor/store/toolbar/actions.js.map +1 -0
  191. package/RichTextEditor/store/toolbar/index.d.ts +6 -0
  192. package/RichTextEditor/store/toolbar/index.js +7 -0
  193. package/RichTextEditor/store/toolbar/index.js.map +1 -0
  194. package/RichTextEditor/store/toolbar/initialState.d.ts +3 -0
  195. package/RichTextEditor/store/toolbar/initialState.js +11 -0
  196. package/RichTextEditor/store/toolbar/initialState.js.map +1 -0
  197. package/RichTextEditor/store/toolbar/reducer.d.ts +3 -0
  198. package/RichTextEditor/store/toolbar/reducer.js +22 -0
  199. package/RichTextEditor/store/toolbar/reducer.js.map +1 -0
  200. package/RichTextEditor/store/toolbar/types.d.ts +40 -0
  201. package/RichTextEditor/store/toolbar/types.js +2 -0
  202. package/RichTextEditor/store/toolbar/types.js.map +1 -0
  203. package/RichTextEditor/store/types.d.ts +5 -0
  204. package/RichTextEditor/store/types.js +2 -0
  205. package/RichTextEditor/store/types.js.map +1 -0
  206. package/RichTextEditor/styles.d.ts +3 -0
  207. package/RichTextEditor/styles.js +23 -0
  208. package/RichTextEditor/styles.js.map +1 -0
  209. package/RichTextEditor/types.d.ts +2 -0
  210. package/RichTextEditor/types.js +2 -0
  211. package/RichTextEditor/types.js.map +1 -0
  212. package/RichTextEditor/utils/convertFormat.d.ts +8 -0
  213. package/RichTextEditor/utils/convertFormat.js +19 -0
  214. package/RichTextEditor/utils/convertFormat.js.map +1 -0
  215. package/RichTextEditorButton/RichTextEditorButton.d.ts +18 -0
  216. package/RichTextEditorButton/RichTextEditorButton.js +38 -0
  217. package/RichTextEditorButton/RichTextEditorButton.js.map +1 -0
  218. package/RichTextEditorButton/index.d.ts +1 -0
  219. package/RichTextEditorButton/index.js +2 -0
  220. package/RichTextEditorButton/index.js.map +1 -0
  221. package/RichTextEditorButton/styles.d.ts +3 -0
  222. package/RichTextEditorButton/styles.js +16 -0
  223. package/RichTextEditorButton/styles.js.map +1 -0
  224. package/RichTextEditorCounter/RichTextEditorCounter.d.ts +10 -0
  225. package/RichTextEditorCounter/RichTextEditorCounter.js +17 -0
  226. package/RichTextEditorCounter/RichTextEditorCounter.js.map +1 -0
  227. package/RichTextEditorCounter/index.d.ts +1 -0
  228. package/RichTextEditorCounter/index.js +2 -0
  229. package/RichTextEditorCounter/index.js.map +1 -0
  230. package/RichTextEditorCounter/styles.d.ts +3 -0
  231. package/RichTextEditorCounter/styles.js +27 -0
  232. package/RichTextEditorCounter/styles.js.map +1 -0
  233. package/RichTextEditorToolbar/RichTextEditorToolbar.d.ts +22 -0
  234. package/RichTextEditorToolbar/RichTextEditorToolbar.js +44 -0
  235. package/RichTextEditorToolbar/RichTextEditorToolbar.js.map +1 -0
  236. package/RichTextEditorToolbar/index.d.ts +2 -0
  237. package/RichTextEditorToolbar/index.js +3 -0
  238. package/RichTextEditorToolbar/index.js.map +1 -0
  239. package/RichTextEditorToolbar/styles.d.ts +5 -0
  240. package/RichTextEditorToolbar/styles.js +27 -0
  241. package/RichTextEditorToolbar/styles.js.map +1 -0
  242. package/RichTextEditorToolbar/types.d.ts +6 -0
  243. package/RichTextEditorToolbar/types.js +2 -0
  244. package/RichTextEditorToolbar/types.js.map +1 -0
  245. package/Typography/Typography.js +11 -13
  246. package/Typography/Typography.js.map +1 -1
  247. package/Typography/styles.d.ts +1 -1
  248. package/Typography/styles.js +121 -114
  249. package/Typography/styles.js.map +1 -1
  250. package/Typography/utils/get-typography-class-name/get-typography-class-name.d.ts +3 -0
  251. package/Typography/utils/get-typography-class-name/get-typography-class-name.js +15 -0
  252. package/Typography/utils/get-typography-class-name/get-typography-class-name.js.map +1 -0
  253. package/Typography/utils/get-typography-class-name/index.d.ts +1 -0
  254. package/Typography/utils/get-typography-class-name/index.js +2 -0
  255. package/Typography/utils/get-typography-class-name/index.js.map +1 -0
  256. package/index.d.ts +2 -0
  257. package/index.js +1 -0
  258. package/index.js.map +1 -1
  259. package/package.json +6 -1
  260. package/Typography/utils/index.d.ts +0 -1
  261. package/Typography/utils/index.js +0 -2
  262. package/Typography/utils/index.js.map +0 -1
@@ -0,0 +1,13 @@
1
+ import { useEffect } from 'react';
2
+ const useFocus = ({ isFocused, quill }) => {
3
+ useEffect(() => {
4
+ if (!quill) {
5
+ return;
6
+ }
7
+ if (isFocused) {
8
+ quill.focus();
9
+ }
10
+ }, [quill, isFocused]);
11
+ };
12
+ export default useFocus;
13
+ //# sourceMappingURL=useFocus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFocus.js","sourceRoot":"","sources":["../../../../src/QuillEditor/hooks/useFocus/useFocus.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,MAAM,QAAQ,GAAG,CAAC,EAChB,SAAS,EACT,KAAK,EAIN,EAAE,EAAE;IACH,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,KAAK,EAAE;YACV,OAAM;SACP;QAED,IAAI,SAAS,EAAE;YACb,KAAK,CAAC,KAAK,EAAE,CAAA;SACd;IACH,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAA;AACxB,CAAC,CAAA;AAED,eAAe,QAAQ,CAAA"}
@@ -0,0 +1 @@
1
+ export { default } from './useKeyBindings';
@@ -0,0 +1,2 @@
1
+ export { default } from './useKeyBindings';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/QuillEditor/hooks/useKeyBindings/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA"}
@@ -0,0 +1,7 @@
1
+ import Quill from 'quill';
2
+ import { TextFormatHandler } from '../../types';
3
+ declare const useKeyBindings: ({ quill, onTextFormat }: {
4
+ quill?: Quill | undefined;
5
+ onTextFormat: TextFormatHandler;
6
+ }) => void;
7
+ export default useKeyBindings;
@@ -0,0 +1,32 @@
1
+ import { useEffect } from 'react';
2
+ const useKeyBindings = ({ quill, onTextFormat }) => {
3
+ useEffect(() => {
4
+ if (!quill) {
5
+ return;
6
+ }
7
+ quill.keyboard.addBinding({
8
+ key: 'B',
9
+ shortKey: true
10
+ }, function (range, context) {
11
+ const isBold = context.format.bold;
12
+ quill.format('bold', !isBold);
13
+ onTextFormat({
14
+ formatName: 'bold',
15
+ value: !isBold
16
+ });
17
+ });
18
+ quill.keyboard.addBinding({
19
+ key: 'I',
20
+ shortKey: true
21
+ }, function (range, context) {
22
+ const isItalic = context.format.italic;
23
+ quill.format('italic', !isItalic);
24
+ onTextFormat({
25
+ formatName: 'italic',
26
+ value: !isItalic
27
+ });
28
+ });
29
+ }, [quill, onTextFormat]);
30
+ };
31
+ export default useKeyBindings;
32
+ //# sourceMappingURL=useKeyBindings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useKeyBindings.js","sourceRoot":"","sources":["../../../../src/QuillEditor/hooks/useKeyBindings/useKeyBindings.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIjC,MAAM,cAAc,GAAG,CAAC,EACtB,KAAK,EACL,YAAY,EAIb,EAAE,EAAE;IACH,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,KAAK,EAAE;YACV,OAAM;SACP;QAED,KAAK,CAAC,QAAQ,CAAC,UAAU,CACvB;YACE,GAAG,EAAE,GAAG;YACR,QAAQ,EAAE,IAAI;SACf,EACD,UAAU,KAAK,EAAE,OAAO;YACtB,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA;YAElC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAA;YAC7B,YAAY,CAAC;gBACX,UAAU,EAAE,MAAM;gBAClB,KAAK,EAAE,CAAC,MAAM;aACf,CAAC,CAAA;QACJ,CAAC,CACF,CAAA;QAED,KAAK,CAAC,QAAQ,CAAC,UAAU,CACvB;YACE,GAAG,EAAE,GAAG;YACR,QAAQ,EAAE,IAAI;SACf,EACD,UAAU,KAAK,EAAE,OAAO;YACtB,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAA;YAEtC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAA;YACjC,YAAY,CAAC;gBACX,UAAU,EAAE,QAAQ;gBACpB,KAAK,EAAE,CAAC,QAAQ;aACjB,CAAC,CAAA;QACJ,CAAC,CACF,CAAA;IACH,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAA;AAC3B,CAAC,CAAA;AAED,eAAe,cAAc,CAAA"}
@@ -0,0 +1 @@
1
+ export { default } from './useQuillInstance';
@@ -0,0 +1,2 @@
1
+ export { default } from './useQuillInstance';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/QuillEditor/hooks/useQuillInstance/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA"}
@@ -0,0 +1,9 @@
1
+ import Quill, { QuillOptionsStatic } from 'quill';
2
+ import 'quill-paste-smart';
3
+ export declare type EditorOptionsType = {
4
+ id: string;
5
+ placeholder?: string;
6
+ };
7
+ export declare const getModules: () => QuillOptionsStatic['modules'];
8
+ declare const useQuillInstance: ({ id, placeholder }: EditorOptionsType) => Quill | undefined;
9
+ export default useQuillInstance;
@@ -0,0 +1,68 @@
1
+ import { useEffect, useState } from 'react';
2
+ import Quill from 'quill';
3
+ import 'quill-paste-smart';
4
+ import { useTypographyClasses, makeHeaderFormat, makeBoldFormat } from '../../formats';
5
+ export const getModules = () => {
6
+ return {
7
+ clipboard: {
8
+ matchVisual: false,
9
+ allowed: {
10
+ // unsupported tags will be also removed on BE side, so before extending
11
+ // make sure, that our API supports new type
12
+ tags: ['b', 'strong', 'i', 'em', 'p', 'br', 'ul', 'ol', 'li', 'h3'],
13
+ attributes: []
14
+ },
15
+ keepSelection: true,
16
+ substituteBlockElements: true
17
+ },
18
+ keyboard: {
19
+ // we need to specify default bindings
20
+ // because Quill don't allow us to setup bindings via
21
+ // quill.keyboard.addBinding for default Quill
22
+ // key shortcuts otherwise
23
+ bindings: {
24
+ bold: {
25
+ key: 'B',
26
+ metaKey: true,
27
+ ctrlKey: true,
28
+ handler: function () { }
29
+ },
30
+ italic: {
31
+ key: 'I',
32
+ metaKey: true,
33
+ ctrlKey: true,
34
+ handler: function () { }
35
+ }
36
+ }
37
+ }
38
+ };
39
+ };
40
+ /**
41
+ * Formats we allow to paste into editor
42
+ *
43
+ * This is separate from adding a control in the Toolbar.
44
+ * For example, you can configure Quill to allow bolded
45
+ * content to be pasted into an editor that has no bold
46
+ * button in the toolbar. */
47
+ const formats = [
48
+ 'bold',
49
+ 'italic',
50
+ 'header',
51
+ 'list'
52
+ ];
53
+ const useQuillInstance = ({ id, placeholder }) => {
54
+ const [quill, setQuill] = useState();
55
+ const typographyClasses = useTypographyClasses();
56
+ useEffect(() => {
57
+ Quill.register(makeHeaderFormat(typographyClasses), true);
58
+ Quill.register(makeBoldFormat(typographyClasses), true);
59
+ setQuill(new Quill(`#${id}`, {
60
+ modules: getModules(),
61
+ formats,
62
+ placeholder
63
+ }));
64
+ }, [typographyClasses, id, placeholder]);
65
+ return quill;
66
+ };
67
+ export default useQuillInstance;
68
+ //# sourceMappingURL=useQuillInstance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useQuillInstance.js","sourceRoot":"","sources":["../../../../src/QuillEditor/hooks/useQuillInstance/useQuillInstance.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,KAA6B,MAAM,OAAO,CAAA;AACjD,OAAO,mBAAmB,CAAA;AAE1B,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACf,MAAM,eAAe,CAAA;AAOtB,MAAM,CAAC,MAAM,UAAU,GAAG,GAAkC,EAAE;IAC5D,OAAO;QACL,SAAS,EAAE;YACT,WAAW,EAAE,KAAK;YAClB,OAAO,EAAE;gBACP,wEAAwE;gBACxE,4CAA4C;gBAC5C,IAAI,EAAE,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;gBACnE,UAAU,EAAE,EAAE;aACf;YACD,aAAa,EAAE,IAAI;YACnB,uBAAuB,EAAE,IAAI;SAC9B;QACD,QAAQ,EAAE;YACR,sCAAsC;YACtC,qDAAqD;YACrD,8CAA8C;YAC9C,0BAA0B;YAC1B,QAAQ,EAAE;gBACR,IAAI,EAAE;oBACJ,GAAG,EAAE,GAAG;oBACR,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE,cAAa,CAAC;iBACxB;gBACD,MAAM,EAAE;oBACN,GAAG,EAAE,GAAG;oBACR,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE,cAAa,CAAC;iBACxB;aACF;SACF;KACF,CAAA;AACH,CAAC,CAAA;AAED;;;;;;4BAM4B;AAC5B,MAAM,OAAO,GAAkC;IAC7C,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,MAAM;CACP,CAAA;AAED,MAAM,gBAAgB,GAAG,CAAC,EACxB,EAAE,EACF,WAAW,EACO,EAAqB,EAAE;IACzC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAS,CAAA;IAC3C,MAAM,iBAAiB,GAAG,oBAAoB,EAAE,CAAA;IAEhD,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,CAAC,QAAQ,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,EAAE,IAAI,CAAC,CAAA;QACzD,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC,iBAAiB,CAAC,EAAE,IAAI,CAAC,CAAA;QAEvD,QAAQ,CACN,IAAI,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE;YAClB,OAAO,EAAE,UAAU,EAAE;YACrB,OAAO;YACP,WAAW;SACZ,CAAC,CACH,CAAA;IACH,CAAC,EAAE,CAAC,iBAAiB,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC,CAAA;IAExC,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAED,eAAe,gBAAgB,CAAA"}
@@ -0,0 +1 @@
1
+ export { default } from './useSubscribeToQuillEvents';
@@ -0,0 +1,2 @@
1
+ export { default } from './useSubscribeToQuillEvents';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/QuillEditor/hooks/useSubscribeToQuillEvents/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAA"}
@@ -0,0 +1,10 @@
1
+ import Quill from 'quill';
2
+ import { SelectionHandler, ChangeHandler, TextLengthChangeHandler } from '../../types';
3
+ declare type Props = {
4
+ quill?: Quill;
5
+ onTextChange: ChangeHandler;
6
+ onSelectionChange: SelectionHandler;
7
+ onTextLengthChange: TextLengthChangeHandler;
8
+ };
9
+ declare const useSubscribeToQuillEvents: ({ quill, onTextChange, onSelectionChange, onTextLengthChange }: Props) => void;
10
+ export default useSubscribeToQuillEvents;
@@ -0,0 +1,64 @@
1
+ import { useMemo, useEffect } from 'react';
2
+ import getTextChangeHandler from '../../utils/getTextChangeHandler';
3
+ import getSelectionChangeHandler from '../../utils/getSelectionChangeHandler';
4
+ import getEditorChangeHandler from '../../utils/getEditorChangeHandler';
5
+ import getTextLengthChangeHandler from '../../utils/getTextLengthChangeHandler';
6
+ import getCleanupOnAllContentRemovalHandler from '../../utils/getCleanupOnAllContentRemovalHandler';
7
+ const useSubscribeToQuillEvents = ({ quill, onTextChange, onSelectionChange, onTextLengthChange }) => {
8
+ const textLengthChangeHandler = useMemo(() => {
9
+ if (!quill) {
10
+ return () => { };
11
+ }
12
+ return getTextLengthChangeHandler(quill, onTextLengthChange);
13
+ }, [quill, onTextLengthChange]);
14
+ const textChangeHandler = useMemo(() => {
15
+ if (!quill) {
16
+ return () => { };
17
+ }
18
+ return getTextChangeHandler(quill, onTextChange);
19
+ }, [quill, onTextChange]);
20
+ const selectionChangeHandler = useMemo(() => {
21
+ if (!quill) {
22
+ return () => { };
23
+ }
24
+ return getSelectionChangeHandler(quill, onSelectionChange);
25
+ }, [quill, onSelectionChange]);
26
+ const editorChangeHandler = useMemo(() => {
27
+ if (!quill) {
28
+ return () => { };
29
+ }
30
+ return getEditorChangeHandler(quill, onSelectionChange);
31
+ }, [quill, onSelectionChange]);
32
+ const cleanupOnAllContentRemovalHandler = useMemo(() => {
33
+ if (!quill) {
34
+ return () => { };
35
+ }
36
+ return getCleanupOnAllContentRemovalHandler(quill);
37
+ }, [quill]);
38
+ useEffect(() => {
39
+ if (!quill) {
40
+ return;
41
+ }
42
+ quill.on('selection-change', selectionChangeHandler);
43
+ quill.on('text-change', textChangeHandler);
44
+ quill.on('text-change', textLengthChangeHandler);
45
+ quill.on('text-change', cleanupOnAllContentRemovalHandler);
46
+ quill.on('editor-change', editorChangeHandler);
47
+ return () => {
48
+ quill.off('selection-change', selectionChangeHandler);
49
+ quill.off('text-change', textChangeHandler);
50
+ quill.off('text-change', textLengthChangeHandler);
51
+ quill.off('text-change', cleanupOnAllContentRemovalHandler);
52
+ quill.off('editor-change', editorChangeHandler);
53
+ };
54
+ }, [
55
+ quill,
56
+ textChangeHandler,
57
+ selectionChangeHandler,
58
+ editorChangeHandler,
59
+ textLengthChangeHandler,
60
+ cleanupOnAllContentRemovalHandler
61
+ ]);
62
+ };
63
+ export default useSubscribeToQuillEvents;
64
+ //# sourceMappingURL=useSubscribeToQuillEvents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSubscribeToQuillEvents.js","sourceRoot":"","sources":["../../../../src/QuillEditor/hooks/useSubscribeToQuillEvents/useSubscribeToQuillEvents.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAO1C,OAAO,oBAAoB,MAAM,kCAAkC,CAAA;AACnE,OAAO,yBAAyB,MAAM,uCAAuC,CAAA;AAC7E,OAAO,sBAAsB,MAAM,oCAAoC,CAAA;AACvE,OAAO,0BAA0B,MAAM,wCAAwC,CAAA;AAC/E,OAAO,oCAAoC,MAAM,kDAAkD,CAAA;AAcnG,MAAM,yBAAyB,GAAG,CAAC,EACjC,KAAK,EACL,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EACZ,EAAE,EAAE;IACV,MAAM,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EAAE;QACb,IAAI,CAAC,KAAK,EAAE;YACV,OAAM;SACP;QAED,KAAK,CAAC,EAAE,CAAC,kBAAkB,EAAE,sBAAsB,CAAC,CAAA;QACpD,KAAK,CAAC,EAAE,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAAA;QAC1C,KAAK,CAAC,EAAE,CAAC,aAAa,EAAE,uBAAuB,CAAC,CAAA;QAChD,KAAK,CAAC,EAAE,CAAC,aAAa,EAAE,iCAAiC,CAAC,CAAA;QAC1D,KAAK,CAAC,EAAE,CAAC,eAAe,EAAE,mBAAmB,CAAC,CAAA;QAE9C,OAAO,GAAG,EAAE;YACV,KAAK,CAAC,GAAG,CAAC,kBAAkB,EAAE,sBAAsB,CAAC,CAAA;YACrD,KAAK,CAAC,GAAG,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAAA;YAC3C,KAAK,CAAC,GAAG,CAAC,aAAa,EAAE,uBAAuB,CAAC,CAAA;YACjD,KAAK,CAAC,GAAG,CAAC,aAAa,EAAE,iCAAiC,CAAC,CAAA;YAC3D,KAAK,CAAC,GAAG,CAAC,eAAe,EAAE,mBAAmB,CAAC,CAAA;QACjD,CAAC,CAAA;IACH,CAAC,EAAE;QACD,KAAK;QACL,iBAAiB;QACjB,sBAAsB;QACtB,mBAAmB;QACnB,uBAAuB;QACvB,iCAAiC;KAClC,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,eAAe,yBAAyB,CAAA"}
@@ -0,0 +1 @@
1
+ export { default } from './useSubscribeToTextEditorEvents';
@@ -0,0 +1,2 @@
1
+ export { default } from './useSubscribeToTextEditorEvents';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/QuillEditor/hooks/useSubscribeToTextEditorEvents/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAA"}
@@ -0,0 +1,6 @@
1
+ import Quill from 'quill';
2
+ declare const useSubscribeToTextEditorEvents: ({ editorRef, quill }: {
3
+ editorRef: React.RefObject<HTMLDivElement>;
4
+ quill?: Quill | undefined;
5
+ }) => void;
6
+ export default useSubscribeToTextEditorEvents;
@@ -0,0 +1,23 @@
1
+ import { useEffect, useMemo } from 'react';
2
+ import { CUSTOM_QUILL_EDITOR_FORMAT_EVENT } from '../../constants';
3
+ import getFormatChangeHandler from '../../utils/getFormatChangeHandler';
4
+ const useSubscribeToTextEditorEvents = ({ editorRef, quill }) => {
5
+ const formatChangeHandler = useMemo(() => {
6
+ if (!quill) {
7
+ return () => { };
8
+ }
9
+ return getFormatChangeHandler(quill);
10
+ }, [quill]);
11
+ useEffect(() => {
12
+ const editor = editorRef.current;
13
+ if (!editor) {
14
+ return;
15
+ }
16
+ editor.addEventListener(CUSTOM_QUILL_EDITOR_FORMAT_EVENT, formatChangeHandler, false);
17
+ return () => {
18
+ editor === null || editor === void 0 ? void 0 : editor.removeEventListener(CUSTOM_QUILL_EDITOR_FORMAT_EVENT, formatChangeHandler, false);
19
+ };
20
+ }, [editorRef, formatChangeHandler]);
21
+ };
22
+ export default useSubscribeToTextEditorEvents;
23
+ //# sourceMappingURL=useSubscribeToTextEditorEvents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSubscribeToTextEditorEvents.js","sourceRoot":"","sources":["../../../../src/QuillEditor/hooks/useSubscribeToTextEditorEvents/useSubscribeToTextEditorEvents.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAG1C,OAAO,EAAE,gCAAgC,EAAE,MAAM,iBAAiB,CAAA;AAClE,OAAO,sBAAsB,MAAM,oCAAoC,CAAA;AAEvE,MAAM,8BAA8B,GAAG,CAAC,EACtC,SAAS,EACT,KAAK,EAIN,EAAE,EAAE;IACH,MAAM,mBAAmB,GAAG,OAAO,CAAC,GAAG,EAAE;QACvC,IAAI,CAAC,KAAK,EAAE;YACV,OAAO,GAAG,EAAE,GAAE,CAAC,CAAA;SAChB;QAED,OAAO,sBAAsB,CAAC,KAAK,CAAkB,CAAA;IACvD,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IAEX,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAA;QAEhC,IAAI,CAAC,MAAM,EAAE;YACX,OAAM;SACP;QAED,MAAM,CAAC,gBAAgB,CACrB,gCAAgC,EAChC,mBAAmB,EACnB,KAAK,CACN,CAAA;QAED,OAAO,GAAG,EAAE;YACV,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,mBAAmB,CACzB,gCAAgC,EAChC,mBAAmB,EACnB,KAAK,CACN,CAAA;QACH,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAA;AACtC,CAAC,CAAA;AAED,eAAe,8BAA8B,CAAA"}
@@ -0,0 +1,4 @@
1
+ export { default } from './QuillEditor';
2
+ export type { Props as QuillEditorProps } from './QuillEditor';
3
+ export * from './types';
4
+ export { CUSTOM_QUILL_EDITOR_FORMAT_EVENT } from './constants';
@@ -0,0 +1,4 @@
1
+ export { default } from './QuillEditor';
2
+ export * from './types';
3
+ export { CUSTOM_QUILL_EDITOR_FORMAT_EVENT } from './constants';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/QuillEditor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,gCAAgC,EAAE,MAAM,aAAa,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { Theme } from '@material-ui/core/styles';
2
+ declare const _default: (theme: Theme) => import("@material-ui/styles").StyleRules<{}, "root">;
3
+ export default _default;
@@ -0,0 +1,100 @@
1
+ import { createStyles } from '@material-ui/core/styles';
2
+ import { rem } from '@toptal/picasso-shared';
3
+ const margins = {
4
+ '& p': {
5
+ margin: '0.5rem 0'
6
+ },
7
+ '& h3': {
8
+ margin: '1rem 0 0.5rem'
9
+ },
10
+ '& p:first-child, & h3:first-child': {
11
+ margin: '0 0 0.5rem'
12
+ },
13
+ '& li:not(:last-child)': {
14
+ margin: '0 0 0.5rem'
15
+ },
16
+ '& ol, & ul': {
17
+ padding: 0,
18
+ margin: '0.5rem 0'
19
+ }
20
+ };
21
+ const listStyles = {
22
+ '& li': {
23
+ listStyleType: 'none',
24
+ paddingLeft: '2rem',
25
+ position: 'relative',
26
+ '&:before': {
27
+ display: 'inline-block',
28
+ position: 'absolute',
29
+ left: 0,
30
+ whiteSpace: 'nowrap',
31
+ width: '1rem'
32
+ }
33
+ },
34
+ '& ol li': {
35
+ counterIncrement: 'list-0',
36
+ '&:before': {
37
+ content: 'counter(list-0, decimal) "."'
38
+ }
39
+ },
40
+ '& *:not(li)': {
41
+ counterReset: 'list-0'
42
+ },
43
+ '& ul li': {
44
+ '&:before': {
45
+ content: '""',
46
+ backgroundImage: "url(\"data:image/svg+xml,%3Csvg width='16' height='16' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cdefs%3E%3Cpath d='M8 6c1.1046 0 2 .8954 2 2s-.8954 2-2 2-2-.8954-2-2 .8954-2 2-2Z' id='a'/%3E%3C/defs%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cmask id='b' fill='%23fff'%3E%3Cuse xlink:href='%23a'/%3E%3C/mask%3E%3Cuse fill='%23979797' fill-rule='nonzero' xlink:href='%23a'/%3E%3Cg mask='url(%23b)' fill='%23455065'%3E%3Cpath d='M0 0h16v16H0z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E\")",
47
+ backgroundRepeat: 'no-repeat',
48
+ backgroundPosition: 'center',
49
+ height: rem('22px'),
50
+ width: '1rem'
51
+ }
52
+ }
53
+ };
54
+ const horizontalPadding = '0.5em';
55
+ const placeholder = ({ palette }) => ({
56
+ '& .ql-blank:before': {
57
+ color: palette.grey.main2,
58
+ content: 'attr(data-placeholder)',
59
+ pointerEvents: 'none',
60
+ position: 'absolute',
61
+ left: horizontalPadding,
62
+ right: horizontalPadding
63
+ }
64
+ });
65
+ const hidden = {
66
+ '& .gl-hidden': {
67
+ display: 'none'
68
+ }
69
+ };
70
+ const editor = {
71
+ '& .ql-editor': {
72
+ height: '100%',
73
+ outline: 'none',
74
+ overflowY: 'auto',
75
+ padding: `1em ${horizontalPadding}`,
76
+ tabSize: '4',
77
+ textAlign: 'left',
78
+ whiteSpace: 'pre-wrap',
79
+ wordWrap: 'break-word'
80
+ },
81
+ '& .ql-editor > *': {
82
+ cursor: 'text'
83
+ }
84
+ };
85
+ const clipboard = {
86
+ '& .ql-clipboard': {
87
+ left: '-100000px',
88
+ height: '1px',
89
+ overflowY: 'hidden',
90
+ position: 'absolute',
91
+ top: '50%'
92
+ }
93
+ };
94
+ const quillSpecificStyles = (theme) => (Object.assign(Object.assign(Object.assign(Object.assign({}, placeholder(theme)), editor), hidden), clipboard));
95
+ export default (theme) => {
96
+ return createStyles({
97
+ root: Object.assign(Object.assign(Object.assign({ height: '12.5em', overflowY: 'hidden', resize: 'vertical', position: 'relative' }, listStyles), margins), quillSpecificStyles(theme))
98
+ });
99
+ };
100
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/QuillEditor/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAS,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAA;AAE5C,MAAM,OAAO,GAAG;IACd,KAAK,EAAE;QACL,MAAM,EAAE,UAAU;KACnB;IACD,MAAM,EAAE;QACN,MAAM,EAAE,eAAe;KACxB;IACD,mCAAmC,EAAE;QACnC,MAAM,EAAE,YAAY;KACrB;IACD,uBAAuB,EAAE;QACvB,MAAM,EAAE,YAAY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AE,MAAM;QACjB,OAAO,EAAE,OAAO,iBAAiB,EAAE;QACnC,OAAO,EAAE,GAAG;QACZ,SAAS,EAAE,MAAM;QACjB,UAAU,EAAE,UAAU;QACtB,QAAQ,EAAE,YAAY;KACvB;IACD,kBAAkB,EAAE;QAClB,MAAM,EAAE,MAAM;KACf;CACF,CAAA;AAED,MAAM,SAAS,GAAG;IAChB,iBAAiB,EAAE;QACjB,IAAI,EAAE,WAAW;QACjB,MAAM,EAAE,KAAK;QACb,SAAS,EAAE,QAAQ;QACnB,QAAQ,EAAE,UAAU;QACpB,GAAG,EAAE,KAAK;KACX;CACF,CAAA;AAED,MAAM,mBAAmB,GAAG,CAAC,KAAY,EAAE,EAAE,CAAC,6DACzC,WAAW,CAAC,KAAK,CAAC,GAClB,MAAM,GACN,MAAM,GACN,SAAS,EACZ,CAAA;AAEF,eAAe,CAAC,KAAY,EAAE,EAAE;IAC9B,OAAO,YAAY,CAAC;QAClB,IAAI,8CACF,MAAM,EAAE,QAAQ,EAChB,SAAS,EAAE,QAAQ,EACnB,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,UAAU,IACjB,UAAU,GACV,OAAO,GACP,mBAAmB,CAAC,KAAK,CAAC,CAC9B;KACF,CAAC,CAAA;AACJ,CAAC,CAAA"}
@@ -0,0 +1,27 @@
1
+ export declare type BoldValue = boolean | undefined;
2
+ export declare type ItalicValue = boolean | undefined;
3
+ export declare type ListValue = 'bullet' | 'ordered' | undefined;
4
+ export declare type HeaderValue = 3 | undefined;
5
+ export declare type FormatType = {
6
+ bold: BoldValue;
7
+ italic: ItalicValue;
8
+ list: ListValue;
9
+ header: HeaderValue;
10
+ };
11
+ export declare type TextFormatHandlerEvent = {
12
+ formatName: 'bold';
13
+ value: BoldValue;
14
+ } | {
15
+ formatName: 'italic';
16
+ value: ItalicValue;
17
+ } | {
18
+ formatName: 'list';
19
+ value: ListValue;
20
+ } | {
21
+ formatName: 'header';
22
+ value: HeaderValue;
23
+ };
24
+ export declare type TextFormatHandler = (e: TextFormatHandlerEvent) => void;
25
+ export declare type SelectionHandler = (format: FormatType) => void;
26
+ export declare type ChangeHandler = (html: string) => void;
27
+ export declare type TextLengthChangeHandler = (length: number) => void;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/QuillEditor/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import Quill, { TextChangeHandler } from 'quill';
2
+ declare const getCleanupOnAllContentRemovalHandler: (quill: Quill) => TextChangeHandler;
3
+ export default getCleanupOnAllContentRemovalHandler;
@@ -0,0 +1,22 @@
1
+ import Delta from 'quill-delta';
2
+ const getCleanupOnAllContentRemovalHandler = (quill) => {
3
+ const handler = newDelta => {
4
+ const isDeleteOperation = 'delete' in newDelta.ops[0];
5
+ if (!isDeleteOperation) {
6
+ return;
7
+ }
8
+ const textLength = quill.getLength() - 1;
9
+ const isEditorEmpty = textLength === 0;
10
+ if (!isEditorEmpty) {
11
+ return;
12
+ }
13
+ const currentFormat = quill.getFormat();
14
+ const isFormatApplied = Object.keys(currentFormat).length > 0;
15
+ if (isFormatApplied) {
16
+ quill.setContents(new Delta(), 'api');
17
+ }
18
+ };
19
+ return handler;
20
+ };
21
+ export default getCleanupOnAllContentRemovalHandler;
22
+ //# sourceMappingURL=getCleanupOnAllContentRemovalHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCleanupOnAllContentRemovalHandler.js","sourceRoot":"","sources":["../../../../src/QuillEditor/utils/getCleanupOnAllContentRemovalHandler/getCleanupOnAllContentRemovalHandler.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,aAAa,CAAA;AAE/B,MAAM,oCAAoC,GAAG,CAAC,KAAY,EAAE,EAAE;IAC5D,MAAM,OAAO,GAAsB,QAAQ,CAAC,EAAE;QAC5C,MAAM,iBAAiB,GAAG,QAAQ,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;QAErD,IAAI,CAAC,iBAAiB,EAAE;YACtB,OAAM;SACP;QAED,MAAM,UAAU,GAAG,KAAK,CAAC,SAAS,EAAE,GAAG,CAAC,CAAA;QACxC,MAAM,aAAa,GAAG,UAAU,KAAK,CAAC,CAAA;QAEtC,IAAI,CAAC,aAAa,EAAE;YAClB,OAAM;SACP;QAED,MAAM,aAAa,GAAG,KAAK,CAAC,SAAS,EAAE,CAAA;QACvC,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;QAE7D,IAAI,eAAe,EAAE;YACnB,KAAK,CAAC,WAAW,CAAC,IAAI,KAAK,EAAE,EAAE,KAAK,CAAC,CAAA;SACtC;IACH,CAAC,CAAA;IAED,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAED,eAAe,oCAAoC,CAAA"}
@@ -0,0 +1 @@
1
+ export { default } from './getCleanupOnAllContentRemovalHandler';
@@ -0,0 +1,2 @@
1
+ export { default } from './getCleanupOnAllContentRemovalHandler';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/QuillEditor/utils/getCleanupOnAllContentRemovalHandler/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wCAAwC,CAAA"}
@@ -0,0 +1,7 @@
1
+ import Quill, { RangeStatic, Sources } from 'quill';
2
+ import Delta from 'quill-delta';
3
+ import { FormatType } from '../../types';
4
+ declare type SelectionChangeArgs = [RangeStatic, RangeStatic, Sources];
5
+ declare type TextChangeArgs = [Delta, Delta, Sources];
6
+ declare const getEditorChangeHandler: (quill: Quill, onSelectionChange: (format: FormatType) => void) => (name: 'text-change' | 'selection-change', ...args: SelectionChangeArgs | TextChangeArgs) => void;
7
+ export default getEditorChangeHandler;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * When we write block format and enter new empty line, we have unformated text format.
3
+ * We need to send this information to the state
4
+ */
5
+ const handleNewLineAfterBlock = ({ quill, onSelectionChange, latestDelta }) => {
6
+ var _a;
7
+ const latestAttributes = (_a = latestDelta.ops[latestDelta.ops.length - 1]) === null || _a === void 0 ? void 0 : _a.attributes;
8
+ const isHeaderFormatRemoved = (latestAttributes === null || latestAttributes === void 0 ? void 0 : latestAttributes.header) === null;
9
+ const isListFormatRemoved = (latestAttributes === null || latestAttributes === void 0 ? void 0 : latestAttributes.list) === null;
10
+ if (isHeaderFormatRemoved || isListFormatRemoved) {
11
+ const format = quill.getFormat();
12
+ onSelectionChange(Object.assign(Object.assign({}, format), { header: undefined, list: undefined }));
13
+ }
14
+ };
15
+ const isDeleteOperationOfSelection = (delta) => {
16
+ const delOperation = delta.ops[0].delete;
17
+ return delOperation && delOperation > 1;
18
+ };
19
+ const getEditorChangeHandler = (quill, onSelectionChange) => {
20
+ const handler = (name, ...args) => {
21
+ if (name === 'text-change') {
22
+ const [latestDelta, , source] = args;
23
+ const isFromApi = source === 'api';
24
+ const isFromUser = source === 'user';
25
+ if (isFromApi) {
26
+ // this event is triggered when format of block element is changed
27
+ // for example from p > h3 | h3 > ol
28
+ onSelectionChange(quill.getFormat());
29
+ }
30
+ else if (isFromUser) {
31
+ handleNewLineAfterBlock({ latestDelta, quill, onSelectionChange });
32
+ if (isDeleteOperationOfSelection(latestDelta)) {
33
+ onSelectionChange(quill.getFormat());
34
+ }
35
+ }
36
+ }
37
+ };
38
+ return handler;
39
+ };
40
+ export default getEditorChangeHandler;
41
+ //# sourceMappingURL=getEditorChangeHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getEditorChangeHandler.js","sourceRoot":"","sources":["../../../../src/QuillEditor/utils/getEditorChangeHandler/getEditorChangeHandler.tsx"],"names":[],"mappings":"AAQA;;;GAGG;AACH,MAAM,uBAAuB,GAAG,CAAC,EAC/B,KAAK,EACL,iBAAiB,EACjB,WAAW,EAKZ,EAAE,EAAE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BAAuB,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC,CAAA;gBAElE,IAAI,4BAA4B,CAAC,WAAW,CAAC,EAAE;oBAC7C,iBAAiB,CAAC,KAAK,CAAC,SAAS,EAAgB,CAAC,CAAA;iBACnD;aACF;SACF;IACH,CAAC,CAAA;IAED,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAED,eAAe,sBAAsB,CAAA"}
@@ -0,0 +1 @@
1
+ export { default } from './getEditorChangeHandler';
@@ -0,0 +1,2 @@
1
+ export { default } from './getEditorChangeHandler';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/QuillEditor/utils/getEditorChangeHandler/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA"}
@@ -0,0 +1,3 @@
1
+ import Quill from 'quill';
2
+ import { FormatType } from '../../types';
3
+ export declare const getFormatChangeHandler: (quill: Quill) => (e: CustomEvent<FormatType>) => void;
@@ -0,0 +1,13 @@
1
+ export const getFormatChangeHandler = (quill) => {
2
+ const handler = (e) => {
3
+ const format = e.detail;
4
+ Object.entries(format).forEach(([key, value]) => {
5
+ quill.format(key, value);
6
+ if (key === 'header') {
7
+ setTimeout(() => quill.focus(), 0);
8
+ }
9
+ });
10
+ };
11
+ return handler;
12
+ };
13
+ //# sourceMappingURL=getFormatChangeHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFormatChangeHandler.js","sourceRoot":"","sources":["../../../../src/QuillEditor/utils/getFormatChangeHandler/getFormatChangeHandler.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAY,EAAE,EAAE;IACrD,MAAM,OAAO,GAAG,CAAC,CAA0B,EAAE,EAAE;QAC7C,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAA;QAEvB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YAC9C,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;YAExB,IAAI,GAAG,KAAK,QAAQ,EAAE;gBACpB,UAAU,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAA;aACnC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAA;IAED,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ import { getFormatChangeHandler } from './getFormatChangeHandler';
2
+ export default getFormatChangeHandler;
@@ -0,0 +1,3 @@
1
+ import { getFormatChangeHandler } from './getFormatChangeHandler';
2
+ export default getFormatChangeHandler;
3
+ //# sourceMappingURL=index.js.map