easy-richtextarea 4.0.3 → 4.0.4

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 (42) hide show
  1. package/README.md +0 -8
  2. package/example.js +1399 -982
  3. package/lib/constants.js +13 -4
  4. package/lib/contentCompare.js +34 -0
  5. package/lib/example/richTextarea.js +2 -2
  6. package/lib/example/view.js +18 -9
  7. package/lib/keyCodes.js +13 -0
  8. package/lib/operation/delete.js +101 -52
  9. package/lib/operation/empty.js +21 -6
  10. package/lib/operation/insert.js +78 -31
  11. package/lib/operations/fromJSON.js +4 -4
  12. package/lib/operations/generate.js +3 -3
  13. package/lib/operations/transform.js +3 -7
  14. package/lib/richTextarea.js +244 -156
  15. package/lib/selection.js +55 -13
  16. package/lib/types.js +13 -13
  17. package/lib/undoBuffer.js +105 -0
  18. package/package.json +3 -2
  19. package/src/constants.js +1 -0
  20. package/src/contentCompare.js +34 -0
  21. package/src/example/richTextarea.js +11 -9
  22. package/src/example/view.js +28 -10
  23. package/src/keyCodes.js +3 -0
  24. package/src/operation/delete.js +135 -58
  25. package/src/operation/empty.js +19 -14
  26. package/src/operation/insert.js +97 -39
  27. package/src/operations/fromJSON.js +4 -4
  28. package/src/operations/generate.js +8 -4
  29. package/src/operations/transform.js +3 -3
  30. package/src/richTextarea.js +316 -185
  31. package/src/selection.js +53 -9
  32. package/src/types.js +6 -6
  33. package/src/undoBuffer.js +73 -0
  34. package/test/content/transform.js +9 -11
  35. package/test/helpers.js +27 -21
  36. package/test/operation/delete.js +187 -147
  37. package/test/operation/empty.js +3 -5
  38. package/test/operation/insert.js +134 -118
  39. package/test/operations/generate.js +19 -22
  40. package/test/operations/transform.js +37 -98
  41. package/lib/stringCompare.js +0 -33
  42. package/src/stringCompare.js +0 -33
@@ -1,33 +0,0 @@
1
- "use strict";
2
-
3
- import { EMPTY_STRING } from "./constants";
4
-
5
- export default function stringCompare(stringA, stringB) {
6
- if ((stringA === EMPTY_STRING) && (stringB === EMPTY_STRING)) {
7
- return false;
8
- }
9
-
10
- if (stringA === EMPTY_STRING) {
11
- return true;
12
- }
13
-
14
- if (stringB === EMPTY_STRING) {
15
- return false;
16
- }
17
-
18
- const codePointA = stringA.codePointAt(0),
19
- codePointB = stringB.codePointAt(0);
20
-
21
- if (codePointA < codePointB) {
22
- return true;
23
- }
24
-
25
- if (codePointA > codePointB) {
26
- return false;
27
- }
28
-
29
- const subStringA = stringA.substring(1),
30
- subStringB = stringB.substring(1);
31
-
32
- return stringCompare(subStringA, subStringB);
33
- }