jodit 4.19.5 → 4.19.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.
Files changed (66) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +19 -6
  4. package/es2015/jodit.js +355 -55
  5. package/es2015/jodit.min.js +16 -3
  6. package/es2015/plugins/debug/debug.css +1 -1
  7. package/es2015/plugins/debug/debug.js +1 -1
  8. package/es2015/plugins/debug/debug.min.js +1 -1
  9. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  10. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  12. package/es2018/jodit.fat.min.js +16 -3
  13. package/es2018/jodit.min.js +16 -3
  14. package/es2018/plugins/debug/debug.min.js +1 -1
  15. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  16. package/es2021/jodit.css +1 -1
  17. package/es2021/jodit.fat.min.js +17 -4
  18. package/es2021/jodit.js +352 -55
  19. package/es2021/jodit.min.js +17 -4
  20. package/es2021/plugins/debug/debug.css +1 -1
  21. package/es2021/plugins/debug/debug.js +1 -1
  22. package/es2021/plugins/debug/debug.min.js +1 -1
  23. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  24. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  25. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  26. package/es2021.en/jodit.css +1 -1
  27. package/es2021.en/jodit.fat.min.js +19 -6
  28. package/es2021.en/jodit.js +352 -55
  29. package/es2021.en/jodit.min.js +19 -6
  30. package/es2021.en/plugins/debug/debug.css +1 -1
  31. package/es2021.en/plugins/debug/debug.js +1 -1
  32. package/es2021.en/plugins/debug/debug.min.js +1 -1
  33. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  34. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  35. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  36. package/es5/jodit.css +2 -2
  37. package/es5/jodit.fat.min.js +2 -2
  38. package/es5/jodit.js +371 -61
  39. package/es5/jodit.min.css +2 -2
  40. package/es5/jodit.min.js +2 -2
  41. package/es5/plugins/debug/debug.css +1 -1
  42. package/es5/plugins/debug/debug.js +1 -1
  43. package/es5/plugins/debug/debug.min.js +1 -1
  44. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  45. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  46. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  47. package/es5/polyfills.fat.min.js +1 -1
  48. package/es5/polyfills.js +1 -1
  49. package/es5/polyfills.min.js +1 -1
  50. package/esm/config.d.ts +31 -0
  51. package/esm/core/constants.js +1 -1
  52. package/esm/core/selection/helpers/move-node-inside-start.js +5 -2
  53. package/esm/plugins/link/config.d.ts +31 -0
  54. package/esm/plugins/link/config.js +3 -0
  55. package/esm/plugins/link/link.d.ts +27 -0
  56. package/esm/plugins/link/link.js +144 -2
  57. package/esm/plugins/link/tlds.d.ts +18 -0
  58. package/esm/plugins/link/tlds.js +33 -0
  59. package/esm/plugins/link/typed-link.d.ts +23 -0
  60. package/esm/plugins/link/typed-link.js +92 -0
  61. package/package.json +1 -1
  62. package/types/config.d.ts +31 -0
  63. package/types/plugins/link/config.d.ts +31 -0
  64. package/types/plugins/link/link.d.ts +27 -0
  65. package/types/plugins/link/tlds.d.ts +18 -0
  66. package/types/plugins/link/typed-link.d.ts +23 -0
@@ -27,6 +27,37 @@ declare module 'jodit/config' {
27
27
  * Wrap inserted link
28
28
  */
29
29
  processPastedLink: boolean;
30
+ /**
31
+ * Link an address when the space, Enter or Tab after it is typed:
32
+ * one with a scheme (`https://…`), one that starts with `www.` or a
33
+ * bare domain such as `example.com` or `education.govt.nz`, which
34
+ * get `https://`, or an email address, which gets `mailto:`.
35
+ * Punctuation that ends a sentence stays outside the link, and
36
+ * Backspace or Undo straight after takes the link off. Not inside a
37
+ * link, `<pre>` or `<code>`. Default: false.
38
+ */
39
+ processTypedLink: boolean;
40
+ /**
41
+ * With `processTypedLink`, more endings a bare domain links with,
42
+ * in lower case and without the dot, as `['gle', 'school']` for
43
+ * `forms.gle` and `example.school`. Built in are every two-letter
44
+ * ending, such as `nz` and `io`, and the generic ones of at least 1
45
+ * in 1,000 of the most visited sites, such as `com`, `org`, `edu`
46
+ * and `app`. IANA lists them all:
47
+ * https://data.iana.org/TLD/tlds-alpha-by-domain.txt
48
+ * Default: `[]`.
49
+ */
50
+ typedLinkTlds: string[];
51
+ /**
52
+ * With `processTypedLink`, the endings a bare domain doesn't link
53
+ * with, as they're more often a file's: `photos.zip`, `README.md`,
54
+ * even when `typedLinkTlds` has them. In lower case, without the
55
+ * dot. A plain list replaces this one entry by entry from the
56
+ * start, so use `Jodit.atom` to replace the whole list.
57
+ * `Jodit.atom([])` lets every ending link.
58
+ * Default: `['zip', 'mov', 'md', 'py', 'sh', 'pub']`.
59
+ */
60
+ typedLinkFileEndings: string[];
30
61
  /**
31
62
  * When opening the link dialog for a new link with an empty URL field,
32
63
  * pre-fill it from the selected text if that text looks like a URL or
@@ -24,5 +24,32 @@ export declare class link extends Plugin {
24
24
  private __generateForm;
25
25
  /** @override */
26
26
  protected beforeDestruct(jodit: IJodit): void;
27
+ private __onTypedSpace;
28
+ /**
29
+ * Where the caret was when Enter was pressed. Enter splits the line in a
30
+ * history transaction, so the link waits until it's over
31
+ */
32
+ private __enteredAt;
33
+ private __linkAfterEnter;
34
+ private __onBeforeEnter;
35
+ private __onAfterEnter;
36
+ /**
37
+ * The link just made, which Backspace straight after takes off again, as
38
+ * in CKEditor 5. Any other key but a modifier, a click or a command
39
+ * forgets it
40
+ */
41
+ private __justLinked;
42
+ private __forgetLink;
43
+ private __onKeyDown;
44
+ /**
45
+ * Links the address that ends at `end` in a text node, as a step of its
46
+ * own in the history, so Undo straight after takes the link off and
47
+ * leaves the text
48
+ */
49
+ private __linkTyped;
50
+ /**
51
+ * Reports what's changed and makes it a history step of its own
52
+ */
53
+ private __recordStep;
27
54
  private __onClickReadOnlyLink;
28
55
  }
@@ -0,0 +1,18 @@
1
+ /*!
2
+ * Jodit Editor (https://xdsoft.net/jodit/)
3
+ * Released under MIT see LICENSE.txt in the project root for license information.
4
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ /**
7
+ * @module plugins/link
8
+ */
9
+ /**
10
+ * The endings a bare domain links with, besides those `link.typedLinkTlds`
11
+ * adds: the generic ones of at least 1 in 1,000 of the sites in Tranco's top
12
+ * million (list GQ38K, https://tranco-list.eu/list/GQ38K), then every
13
+ * two-letter one in IANA's list (version 2026102900,
14
+ * https://data.iana.org/TLD/tlds-alpha-by-domain.txt). Together they're the
15
+ * endings of 96% of those sites
16
+ * @private
17
+ */
18
+ export declare const TLDS: Set<string>;
@@ -0,0 +1,23 @@
1
+ /*!
2
+ * Jodit Editor (https://xdsoft.net/jodit/)
3
+ * Released under MIT see LICENSE.txt in the project root for license information.
4
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ /**
7
+ * An email address, for `mailto:`
8
+ * @private
9
+ */
10
+ export declare const EMAIL: RegExp;
11
+ /**
12
+ * The address that ends at `end` in a line of text typed, back to the
13
+ * whitespace before it, as `[start, end, href]`. Punctuation round it, such as
14
+ * a sentence's full stop or a bracket the address doesn't open, stays out.
15
+ * An address counts with a scheme, with `www.`, as an email address, or as a
16
+ * bare domain that `isBareDomain` accepts, so `Node.js` or `e.g.` don't
17
+ * @private
18
+ */
19
+ export declare function findTypedLink(text: string, end: number, tlds: string[], fileEndings: string[]): [
20
+ number,
21
+ number,
22
+ string
23
+ ] | null;