@ckeditor/ckeditor5-link 41.1.0 → 41.2.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 (133) hide show
  1. package/build/link.js +2 -2
  2. package/build/translations/ar.js +1 -1
  3. package/build/translations/ast.js +1 -1
  4. package/build/translations/az.js +1 -1
  5. package/build/translations/bg.js +1 -1
  6. package/build/translations/bn.js +1 -1
  7. package/build/translations/ca.js +1 -1
  8. package/build/translations/cs.js +1 -1
  9. package/build/translations/da.js +1 -1
  10. package/build/translations/de-ch.js +1 -1
  11. package/build/translations/de.js +1 -1
  12. package/build/translations/el.js +1 -1
  13. package/build/translations/en-au.js +1 -1
  14. package/build/translations/en-gb.js +1 -1
  15. package/build/translations/eo.js +1 -1
  16. package/build/translations/es.js +1 -1
  17. package/build/translations/et.js +1 -1
  18. package/build/translations/eu.js +1 -1
  19. package/build/translations/fa.js +1 -1
  20. package/build/translations/fi.js +1 -1
  21. package/build/translations/fr.js +1 -1
  22. package/build/translations/gl.js +1 -1
  23. package/build/translations/he.js +1 -1
  24. package/build/translations/hi.js +1 -1
  25. package/build/translations/hr.js +1 -1
  26. package/build/translations/hu.js +1 -1
  27. package/build/translations/hy.js +1 -1
  28. package/build/translations/id.js +1 -1
  29. package/build/translations/it.js +1 -1
  30. package/build/translations/ja.js +1 -1
  31. package/build/translations/km.js +1 -1
  32. package/build/translations/kn.js +1 -1
  33. package/build/translations/ko.js +1 -1
  34. package/build/translations/ku.js +1 -1
  35. package/build/translations/lt.js +1 -1
  36. package/build/translations/lv.js +1 -1
  37. package/build/translations/ms.js +1 -1
  38. package/build/translations/nb.js +1 -1
  39. package/build/translations/ne.js +1 -1
  40. package/build/translations/nl.js +1 -1
  41. package/build/translations/no.js +1 -1
  42. package/build/translations/pl.js +1 -1
  43. package/build/translations/pt-br.js +1 -1
  44. package/build/translations/pt.js +1 -1
  45. package/build/translations/ro.js +1 -1
  46. package/build/translations/ru.js +1 -1
  47. package/build/translations/sk.js +1 -1
  48. package/build/translations/sq.js +1 -1
  49. package/build/translations/sr-latn.js +1 -1
  50. package/build/translations/sr.js +1 -1
  51. package/build/translations/sv.js +1 -1
  52. package/build/translations/th.js +1 -1
  53. package/build/translations/tk.js +1 -1
  54. package/build/translations/tr.js +1 -1
  55. package/build/translations/tt.js +1 -1
  56. package/build/translations/ug.js +1 -1
  57. package/build/translations/uk.js +1 -1
  58. package/build/translations/ur.js +1 -1
  59. package/build/translations/uz.js +1 -1
  60. package/build/translations/vi.js +1 -1
  61. package/build/translations/zh-cn.js +1 -1
  62. package/build/translations/zh.js +1 -1
  63. package/lang/contexts.json +3 -1
  64. package/lang/translations/ar.po +8 -0
  65. package/lang/translations/ast.po +8 -0
  66. package/lang/translations/az.po +8 -0
  67. package/lang/translations/bg.po +8 -0
  68. package/lang/translations/bn.po +8 -0
  69. package/lang/translations/ca.po +8 -0
  70. package/lang/translations/cs.po +8 -0
  71. package/lang/translations/da.po +8 -0
  72. package/lang/translations/de-ch.po +8 -0
  73. package/lang/translations/de.po +8 -0
  74. package/lang/translations/el.po +8 -0
  75. package/lang/translations/en-au.po +8 -0
  76. package/lang/translations/en-gb.po +8 -0
  77. package/lang/translations/en.po +8 -0
  78. package/lang/translations/eo.po +8 -0
  79. package/lang/translations/es.po +8 -0
  80. package/lang/translations/et.po +8 -0
  81. package/lang/translations/eu.po +8 -0
  82. package/lang/translations/fa.po +8 -0
  83. package/lang/translations/fi.po +8 -0
  84. package/lang/translations/fr.po +8 -0
  85. package/lang/translations/gl.po +8 -0
  86. package/lang/translations/he.po +9 -1
  87. package/lang/translations/hi.po +8 -0
  88. package/lang/translations/hr.po +8 -0
  89. package/lang/translations/hu.po +8 -0
  90. package/lang/translations/hy.po +8 -0
  91. package/lang/translations/id.po +8 -0
  92. package/lang/translations/it.po +8 -0
  93. package/lang/translations/ja.po +8 -0
  94. package/lang/translations/km.po +8 -0
  95. package/lang/translations/kn.po +8 -0
  96. package/lang/translations/ko.po +8 -0
  97. package/lang/translations/ku.po +8 -0
  98. package/lang/translations/lt.po +8 -0
  99. package/lang/translations/lv.po +8 -0
  100. package/lang/translations/ms.po +8 -0
  101. package/lang/translations/nb.po +8 -0
  102. package/lang/translations/ne.po +8 -0
  103. package/lang/translations/nl.po +8 -0
  104. package/lang/translations/no.po +8 -0
  105. package/lang/translations/pl.po +8 -0
  106. package/lang/translations/pt-br.po +8 -0
  107. package/lang/translations/pt.po +12 -4
  108. package/lang/translations/ro.po +8 -0
  109. package/lang/translations/ru.po +8 -0
  110. package/lang/translations/sk.po +8 -0
  111. package/lang/translations/sq.po +8 -0
  112. package/lang/translations/sr-latn.po +8 -0
  113. package/lang/translations/sr.po +8 -0
  114. package/lang/translations/sv.po +8 -0
  115. package/lang/translations/th.po +8 -0
  116. package/lang/translations/tk.po +8 -0
  117. package/lang/translations/tr.po +8 -0
  118. package/lang/translations/tt.po +8 -0
  119. package/lang/translations/ug.po +8 -0
  120. package/lang/translations/uk.po +8 -0
  121. package/lang/translations/ur.po +8 -0
  122. package/lang/translations/uz.po +8 -0
  123. package/lang/translations/vi.po +8 -0
  124. package/lang/translations/zh-cn.po +8 -0
  125. package/lang/translations/zh.po +8 -0
  126. package/package.json +3 -3
  127. package/src/linkconfig.d.ts +20 -0
  128. package/src/linkediting.js +2 -1
  129. package/src/linkui.js +18 -1
  130. package/src/ui/linkactionsview.d.ts +3 -1
  131. package/src/ui/linkactionsview.js +3 -2
  132. package/src/utils.d.ts +1 -1
  133. package/src/utils.js +12 -5
@@ -52,3 +52,11 @@ msgstr "नयाँ ट्याबमा खोल्न"
52
52
  msgctxt "The label of the switch button that controls whether the edited link refers to downloadable resource."
53
53
  msgid "Downloadable"
54
54
  msgstr "डाउनलोड योग्य"
55
+
56
+ msgctxt "Keystroke description for assistive technologies: keystroke for creating a link."
57
+ msgid "Create link"
58
+ msgstr ""
59
+
60
+ msgctxt "Keystroke description for assistive technologies: keystroke for moving out of a link."
61
+ msgid "Move out of a link"
62
+ msgstr ""
@@ -52,3 +52,11 @@ msgstr "Open een nieuw tabblad"
52
52
  msgctxt "The label of the switch button that controls whether the edited link refers to downloadable resource."
53
53
  msgid "Downloadable"
54
54
  msgstr "Downloadbaar"
55
+
56
+ msgctxt "Keystroke description for assistive technologies: keystroke for creating a link."
57
+ msgid "Create link"
58
+ msgstr "Creëer link"
59
+
60
+ msgctxt "Keystroke description for assistive technologies: keystroke for moving out of a link."
61
+ msgid "Move out of a link"
62
+ msgstr "Uit een link gaan"
@@ -52,3 +52,11 @@ msgstr "Åpne i ny fane"
52
52
  msgctxt "The label of the switch button that controls whether the edited link refers to downloadable resource."
53
53
  msgid "Downloadable"
54
54
  msgstr "Nedlastbar"
55
+
56
+ msgctxt "Keystroke description for assistive technologies: keystroke for creating a link."
57
+ msgid "Create link"
58
+ msgstr "Opprett lenke"
59
+
60
+ msgctxt "Keystroke description for assistive technologies: keystroke for moving out of a link."
61
+ msgid "Move out of a link"
62
+ msgstr "Flytt ut fra en lenke"
@@ -52,3 +52,11 @@ msgstr "Otwórz w nowej zakładce"
52
52
  msgctxt "The label of the switch button that controls whether the edited link refers to downloadable resource."
53
53
  msgid "Downloadable"
54
54
  msgstr "Do pobrania"
55
+
56
+ msgctxt "Keystroke description for assistive technologies: keystroke for creating a link."
57
+ msgid "Create link"
58
+ msgstr "Tworzy link"
59
+
60
+ msgctxt "Keystroke description for assistive technologies: keystroke for moving out of a link."
61
+ msgid "Move out of a link"
62
+ msgstr "Umożliwia wyjście z linku"
@@ -52,3 +52,11 @@ msgstr "Abrir em nova aba"
52
52
  msgctxt "The label of the switch button that controls whether the edited link refers to downloadable resource."
53
53
  msgid "Downloadable"
54
54
  msgstr "Pode ser baixado"
55
+
56
+ msgctxt "Keystroke description for assistive technologies: keystroke for creating a link."
57
+ msgid "Create link"
58
+ msgstr "Criar link"
59
+
60
+ msgctxt "Keystroke description for assistive technologies: keystroke for moving out of a link."
61
+ msgid "Move out of a link"
62
+ msgstr "Sair de um link"
@@ -31,19 +31,19 @@ msgstr "URL da ligação"
31
31
 
32
32
  msgctxt "Label for the image link button."
33
33
  msgid "Link image"
34
- msgstr "Adicionar link a imagem"
34
+ msgstr "Imagem da hiperligação"
35
35
 
36
36
  msgctxt "Button opening the Link URL editing balloon."
37
37
  msgid "Edit link"
38
- msgstr "Editar link"
38
+ msgstr "Editar hiperligação"
39
39
 
40
40
  msgctxt "Button opening the link in new browser tab."
41
41
  msgid "Open link in new tab"
42
- msgstr "Abrir link num novo separador"
42
+ msgstr "Abrir hiperligação num novo separador"
43
43
 
44
44
  msgctxt "Label explaining that a link has no URL set (the URL is empty)."
45
45
  msgid "This link has no URL"
46
- msgstr "Este link não tem URL"
46
+ msgstr "Esta hiperligação não tem URL"
47
47
 
48
48
  msgctxt "The label of the switch button that controls whether the edited link will open in a new tab."
49
49
  msgid "Open in a new tab"
@@ -52,3 +52,11 @@ msgstr "Abrir num novo separador"
52
52
  msgctxt "The label of the switch button that controls whether the edited link refers to downloadable resource."
53
53
  msgid "Downloadable"
54
54
  msgstr "Descarregável"
55
+
56
+ msgctxt "Keystroke description for assistive technologies: keystroke for creating a link."
57
+ msgid "Create link"
58
+ msgstr "Criar ligação"
59
+
60
+ msgctxt "Keystroke description for assistive technologies: keystroke for moving out of a link."
61
+ msgid "Move out of a link"
62
+ msgstr "Sair de uma ligação"
@@ -52,3 +52,11 @@ msgstr "Deschide în tab nou"
52
52
  msgctxt "The label of the switch button that controls whether the edited link refers to downloadable resource."
53
53
  msgid "Downloadable"
54
54
  msgstr "Descărcabil"
55
+
56
+ msgctxt "Keystroke description for assistive technologies: keystroke for creating a link."
57
+ msgid "Create link"
58
+ msgstr "Crearea unui link"
59
+
60
+ msgctxt "Keystroke description for assistive technologies: keystroke for moving out of a link."
61
+ msgid "Move out of a link"
62
+ msgstr "Ieșire dintr-un link"
@@ -52,3 +52,11 @@ msgstr "Открыть в новой вкладке"
52
52
  msgctxt "The label of the switch button that controls whether the edited link refers to downloadable resource."
53
53
  msgid "Downloadable"
54
54
  msgstr "Загружаемые"
55
+
56
+ msgctxt "Keystroke description for assistive technologies: keystroke for creating a link."
57
+ msgid "Create link"
58
+ msgstr "Создать ссылку"
59
+
60
+ msgctxt "Keystroke description for assistive technologies: keystroke for moving out of a link."
61
+ msgid "Move out of a link"
62
+ msgstr "Выйти из ссылки"
@@ -52,3 +52,11 @@ msgstr "Otvoriť v novej záložke"
52
52
  msgctxt "The label of the switch button that controls whether the edited link refers to downloadable resource."
53
53
  msgid "Downloadable"
54
54
  msgstr "Na stiahnutie"
55
+
56
+ msgctxt "Keystroke description for assistive technologies: keystroke for creating a link."
57
+ msgid "Create link"
58
+ msgstr "Vytvoriť odkaz"
59
+
60
+ msgctxt "Keystroke description for assistive technologies: keystroke for moving out of a link."
61
+ msgid "Move out of a link"
62
+ msgstr "Presunúť sa mimo odkazu"
@@ -52,3 +52,11 @@ msgstr "Hape në një fletë të re"
52
52
  msgctxt "The label of the switch button that controls whether the edited link refers to downloadable resource."
53
53
  msgid "Downloadable"
54
54
  msgstr "E shkarkueshme"
55
+
56
+ msgctxt "Keystroke description for assistive technologies: keystroke for creating a link."
57
+ msgid "Create link"
58
+ msgstr ""
59
+
60
+ msgctxt "Keystroke description for assistive technologies: keystroke for moving out of a link."
61
+ msgid "Move out of a link"
62
+ msgstr ""
@@ -52,3 +52,11 @@ msgstr "Otvori u novoj kartici"
52
52
  msgctxt "The label of the switch button that controls whether the edited link refers to downloadable resource."
53
53
  msgid "Downloadable"
54
54
  msgstr "Moguće preuzimanje"
55
+
56
+ msgctxt "Keystroke description for assistive technologies: keystroke for creating a link."
57
+ msgid "Create link"
58
+ msgstr ""
59
+
60
+ msgctxt "Keystroke description for assistive technologies: keystroke for moving out of a link."
61
+ msgid "Move out of a link"
62
+ msgstr ""
@@ -52,3 +52,11 @@ msgstr "Отвори у новој картици"
52
52
  msgctxt "The label of the switch button that controls whether the edited link refers to downloadable resource."
53
53
  msgid "Downloadable"
54
54
  msgstr "Могуће преузимање"
55
+
56
+ msgctxt "Keystroke description for assistive technologies: keystroke for creating a link."
57
+ msgid "Create link"
58
+ msgstr "Napravi vezu"
59
+
60
+ msgctxt "Keystroke description for assistive technologies: keystroke for moving out of a link."
61
+ msgid "Move out of a link"
62
+ msgstr "Idi sa veze"
@@ -52,3 +52,11 @@ msgstr "Öppna i en ny flik"
52
52
  msgctxt "The label of the switch button that controls whether the edited link refers to downloadable resource."
53
53
  msgid "Downloadable"
54
54
  msgstr "Nedladdningsbar"
55
+
56
+ msgctxt "Keystroke description for assistive technologies: keystroke for creating a link."
57
+ msgid "Create link"
58
+ msgstr "Skapa länk"
59
+
60
+ msgctxt "Keystroke description for assistive technologies: keystroke for moving out of a link."
61
+ msgid "Move out of a link"
62
+ msgstr "Flytta bort från länken"
@@ -52,3 +52,11 @@ msgstr "เปิดในแท็บใหม่"
52
52
  msgctxt "The label of the switch button that controls whether the edited link refers to downloadable resource."
53
53
  msgid "Downloadable"
54
54
  msgstr "ที่สามารถดาวน์โหลดได้"
55
+
56
+ msgctxt "Keystroke description for assistive technologies: keystroke for creating a link."
57
+ msgid "Create link"
58
+ msgstr "สร้างลิงก์"
59
+
60
+ msgctxt "Keystroke description for assistive technologies: keystroke for moving out of a link."
61
+ msgid "Move out of a link"
62
+ msgstr "ย้ายออกจากลิงก์"
@@ -52,3 +52,11 @@ msgstr "Täze goýmada açyň"
52
52
  msgctxt "The label of the switch button that controls whether the edited link refers to downloadable resource."
53
53
  msgid "Downloadable"
54
54
  msgstr "Göçürip alyp bolýar"
55
+
56
+ msgctxt "Keystroke description for assistive technologies: keystroke for creating a link."
57
+ msgid "Create link"
58
+ msgstr ""
59
+
60
+ msgctxt "Keystroke description for assistive technologies: keystroke for moving out of a link."
61
+ msgid "Move out of a link"
62
+ msgstr ""
@@ -52,3 +52,11 @@ msgstr "Yeni sekmede aç"
52
52
  msgctxt "The label of the switch button that controls whether the edited link refers to downloadable resource."
53
53
  msgid "Downloadable"
54
54
  msgstr "İndirilebilir"
55
+
56
+ msgctxt "Keystroke description for assistive technologies: keystroke for creating a link."
57
+ msgid "Create link"
58
+ msgstr "Bağlantı oluştur"
59
+
60
+ msgctxt "Keystroke description for assistive technologies: keystroke for moving out of a link."
61
+ msgid "Move out of a link"
62
+ msgstr "Bir bağlantıdan çık"
@@ -52,3 +52,11 @@ msgstr ""
52
52
  msgctxt "The label of the switch button that controls whether the edited link refers to downloadable resource."
53
53
  msgid "Downloadable"
54
54
  msgstr ""
55
+
56
+ msgctxt "Keystroke description for assistive technologies: keystroke for creating a link."
57
+ msgid "Create link"
58
+ msgstr ""
59
+
60
+ msgctxt "Keystroke description for assistive technologies: keystroke for moving out of a link."
61
+ msgid "Move out of a link"
62
+ msgstr ""
@@ -52,3 +52,11 @@ msgstr "يېڭى بەتكۈچتە ئاچ"
52
52
  msgctxt "The label of the switch button that controls whether the edited link refers to downloadable resource."
53
53
  msgid "Downloadable"
54
54
  msgstr "چۈشۈرۈشچان"
55
+
56
+ msgctxt "Keystroke description for assistive technologies: keystroke for creating a link."
57
+ msgid "Create link"
58
+ msgstr ""
59
+
60
+ msgctxt "Keystroke description for assistive technologies: keystroke for moving out of a link."
61
+ msgid "Move out of a link"
62
+ msgstr ""
@@ -52,3 +52,11 @@ msgstr "Вікрити у новій вкладці"
52
52
  msgctxt "The label of the switch button that controls whether the edited link refers to downloadable resource."
53
53
  msgid "Downloadable"
54
54
  msgstr "Завантажувальне"
55
+
56
+ msgctxt "Keystroke description for assistive technologies: keystroke for creating a link."
57
+ msgid "Create link"
58
+ msgstr "Створити посилання"
59
+
60
+ msgctxt "Keystroke description for assistive technologies: keystroke for moving out of a link."
61
+ msgid "Move out of a link"
62
+ msgstr "Вийти з посилання"
@@ -52,3 +52,11 @@ msgstr "نئی ٹیب کھولیں"
52
52
  msgctxt "The label of the switch button that controls whether the edited link refers to downloadable resource."
53
53
  msgid "Downloadable"
54
54
  msgstr "ڈاؤنلوڈ ہو سکتا ہے"
55
+
56
+ msgctxt "Keystroke description for assistive technologies: keystroke for creating a link."
57
+ msgid "Create link"
58
+ msgstr ""
59
+
60
+ msgctxt "Keystroke description for assistive technologies: keystroke for moving out of a link."
61
+ msgid "Move out of a link"
62
+ msgstr ""
@@ -52,3 +52,11 @@ msgstr "Yangi oynada oching"
52
52
  msgctxt "The label of the switch button that controls whether the edited link refers to downloadable resource."
53
53
  msgid "Downloadable"
54
54
  msgstr "Yuklab olinadigan"
55
+
56
+ msgctxt "Keystroke description for assistive technologies: keystroke for creating a link."
57
+ msgid "Create link"
58
+ msgstr ""
59
+
60
+ msgctxt "Keystroke description for assistive technologies: keystroke for moving out of a link."
61
+ msgid "Move out of a link"
62
+ msgstr ""
@@ -52,3 +52,11 @@ msgstr "Mở trên tab mới"
52
52
  msgctxt "The label of the switch button that controls whether the edited link refers to downloadable resource."
53
53
  msgid "Downloadable"
54
54
  msgstr "Có thể tải về"
55
+
56
+ msgctxt "Keystroke description for assistive technologies: keystroke for creating a link."
57
+ msgid "Create link"
58
+ msgstr "Tạo liên kết"
59
+
60
+ msgctxt "Keystroke description for assistive technologies: keystroke for moving out of a link."
61
+ msgid "Move out of a link"
62
+ msgstr "Di chuyển ra khỏi một liên kết"
@@ -52,3 +52,11 @@ msgstr "在新标签页中打开"
52
52
  msgctxt "The label of the switch button that controls whether the edited link refers to downloadable resource."
53
53
  msgid "Downloadable"
54
54
  msgstr "可下载"
55
+
56
+ msgctxt "Keystroke description for assistive technologies: keystroke for creating a link."
57
+ msgid "Create link"
58
+ msgstr "创建链接"
59
+
60
+ msgctxt "Keystroke description for assistive technologies: keystroke for moving out of a link."
61
+ msgid "Move out of a link"
62
+ msgstr "移出链接"
@@ -52,3 +52,11 @@ msgstr "在新視窗開啟"
52
52
  msgctxt "The label of the switch button that controls whether the edited link refers to downloadable resource."
53
53
  msgid "Downloadable"
54
54
  msgstr "可下載"
55
+
56
+ msgctxt "Keystroke description for assistive technologies: keystroke for creating a link."
57
+ msgid "Create link"
58
+ msgstr "建立連結"
59
+
60
+ msgctxt "Keystroke description for assistive technologies: keystroke for moving out of a link."
61
+ msgid "Move out of a link"
62
+ msgstr "移出連結"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-link",
3
- "version": "41.1.0",
3
+ "version": "41.2.0",
4
4
  "description": "Link feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -13,8 +13,8 @@
13
13
  "type": "module",
14
14
  "main": "src/index.js",
15
15
  "dependencies": {
16
- "@ckeditor/ckeditor5-ui": "41.1.0",
17
- "ckeditor5": "41.1.0",
16
+ "@ckeditor/ckeditor5-ui": "41.2.0",
17
+ "ckeditor5": "41.2.0",
18
18
  "lodash-es": "4.17.21"
19
19
  },
20
20
  "author": "CKSource (http://cksource.com/)",
@@ -43,6 +43,26 @@ export interface LinkConfig {
43
43
  * **NOTE:** If no configuration is provided, the editor will not auto-fix the links.
44
44
  */
45
45
  defaultProtocol?: string;
46
+ /**
47
+ * This is a protocols whitelist that can be used in links, defined as an array of strings.
48
+ * When not set, the editor will use a default list of allowed protocols.
49
+ *
50
+ * **Note:** Use this with caution and at your own risk - adding unsafe protocols like `javascript:`
51
+ * can result in serious security vulnerabilities!
52
+ *
53
+ * ```ts
54
+ * ClassicEditor
55
+ * .create( editorElement, {
56
+ * link: {
57
+ * allowedProtocols: [ 'http', 'https', 'ftp', 'tel', 'mailto', 'ssh' ]
58
+ * }
59
+ * } )
60
+ * .then( ... )
61
+ * .catch( ... );
62
+ * ```
63
+ *
64
+ */
65
+ allowedProtocols?: Array<string>;
46
66
  /**
47
67
  * When set to `true`, the form will accept an empty value in the URL field, creating a link with an empty `href` (`<a href="">`).
48
68
  *
@@ -53,13 +53,14 @@ export default class LinkEditing extends Plugin {
53
53
  */
54
54
  init() {
55
55
  const editor = this.editor;
56
+ const allowedProtocols = this.editor.config.get('link.allowedProtocols');
56
57
  // Allow link attribute on all inline nodes.
57
58
  editor.model.schema.extend('$text', { allowAttributes: 'linkHref' });
58
59
  editor.conversion.for('dataDowncast')
59
60
  .attributeToElement({ model: 'linkHref', view: createLinkElement });
60
61
  editor.conversion.for('editingDowncast')
61
62
  .attributeToElement({ model: 'linkHref', view: (href, conversionApi) => {
62
- return createLinkElement(ensureSafeUrl(href), conversionApi);
63
+ return createLinkElement(ensureSafeUrl(href, allowedProtocols), conversionApi);
63
64
  } });
64
65
  editor.conversion.for('upcast')
65
66
  .elementToAttribute({
package/src/linkui.js CHANGED
@@ -49,6 +49,7 @@ export default class LinkUI extends Plugin {
49
49
  */
50
50
  init() {
51
51
  const editor = this.editor;
52
+ const t = this.editor.t;
52
53
  editor.editing.view.addObserver(ClickObserver);
53
54
  this._balloon = editor.plugins.get(ContextualBalloon);
54
55
  // Create toolbar buttons.
@@ -69,6 +70,22 @@ export default class LinkUI extends Plugin {
69
70
  classes: ['ck-fake-link-selection', 'ck-fake-link-selection_collapsed']
70
71
  }
71
72
  });
73
+ // Add the information about the keystrokes to the accessibility database.
74
+ editor.accessibility.addKeystrokeInfos({
75
+ keystrokes: [
76
+ {
77
+ label: t('Create link'),
78
+ keystroke: LINK_KEYSTROKE
79
+ },
80
+ {
81
+ label: t('Move out of a link'),
82
+ keystroke: [
83
+ ['arrowleft', 'arrowleft'],
84
+ ['arrowright', 'arrowright']
85
+ ]
86
+ }
87
+ ]
88
+ });
72
89
  }
73
90
  /**
74
91
  * @inheritDoc
@@ -97,7 +114,7 @@ export default class LinkUI extends Plugin {
97
114
  */
98
115
  _createActionsView() {
99
116
  const editor = this.editor;
100
- const actionsView = new LinkActionsView(editor.locale);
117
+ const actionsView = new LinkActionsView(editor.locale, editor.config.get('link'));
101
118
  const linkCommand = editor.commands.get('link');
102
119
  const unlinkCommand = editor.commands.get('unlink');
103
120
  actionsView.bind('href').to(linkCommand, 'value');
@@ -9,6 +9,7 @@ import { ButtonView, View } from 'ckeditor5/src/ui.js';
9
9
  import { FocusTracker, KeystrokeHandler, type LocaleTranslate, type Locale } from 'ckeditor5/src/utils.js';
10
10
  import '@ckeditor/ckeditor5-ui/theme/components/responsive-form/responsiveform.css';
11
11
  import '../../theme/linkactions.css';
12
+ import type { LinkConfig } from '../linkconfig.js';
12
13
  /**
13
14
  * The link actions view class. This view displays the link preview, allows
14
15
  * unlinking or editing the link.
@@ -48,11 +49,12 @@ export default class LinkActionsView extends View {
48
49
  * Helps cycling over {@link #_focusables} in the view.
49
50
  */
50
51
  private readonly _focusCycler;
52
+ private readonly _linkConfig;
51
53
  t: LocaleTranslate;
52
54
  /**
53
55
  * @inheritDoc
54
56
  */
55
- constructor(locale: Locale);
57
+ constructor(locale: Locale, linkConfig?: LinkConfig);
56
58
  /**
57
59
  * @inheritDoc
58
60
  */
@@ -22,7 +22,7 @@ export default class LinkActionsView extends View {
22
22
  /**
23
23
  * @inheritDoc
24
24
  */
25
- constructor(locale) {
25
+ constructor(locale, linkConfig = {}) {
26
26
  super(locale);
27
27
  /**
28
28
  * Tracks information about DOM focus in the actions.
@@ -41,6 +41,7 @@ export default class LinkActionsView extends View {
41
41
  this.unlinkButtonView = this._createButton(t('Unlink'), unlinkIcon, 'unlink');
42
42
  this.editButtonView = this._createButton(t('Edit link'), icons.pencil, 'edit');
43
43
  this.set('href', undefined);
44
+ this._linkConfig = linkConfig;
44
45
  this._focusCycler = new FocusCycler({
45
46
  focusables: this._focusables,
46
47
  focusTracker: this.focusTracker,
@@ -140,7 +141,7 @@ export default class LinkActionsView extends View {
140
141
  'ck',
141
142
  'ck-link-actions__preview'
142
143
  ],
143
- href: bind.to('href', href => href && ensureSafeUrl(href)),
144
+ href: bind.to('href', href => href && ensureSafeUrl(href, this._linkConfig.allowedProtocols)),
144
145
  target: '_blank',
145
146
  rel: 'noopener noreferrer'
146
147
  }
package/src/utils.d.ts CHANGED
@@ -29,7 +29,7 @@ export declare function createLinkElement(href: string, { writer }: DowncastConv
29
29
  *
30
30
  * @internal
31
31
  */
32
- export declare function ensureSafeUrl(url: unknown): string;
32
+ export declare function ensureSafeUrl(url: unknown, allowedProtocols?: Array<string>): string;
33
33
  /**
34
34
  * Returns the {@link module:link/linkconfig~LinkConfig#decorators `config.link.decorators`} configuration processed
35
35
  * to respect the locale of the editor, i.e. to display the {@link module:link/linkconfig~LinkDecoratorManualDefinition label}
package/src/utils.js CHANGED
@@ -4,12 +4,17 @@
4
4
  */
5
5
  import { upperFirst } from 'lodash-es';
6
6
  const ATTRIBUTE_WHITESPACES = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g; // eslint-disable-line no-control-regex
7
- const SAFE_URL = /^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i;
7
+ const SAFE_URL_TEMPLATE = '^(?:(?:<protocols>):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))';
8
8
  // Simplified email test - should be run over previously found URL.
9
9
  const EMAIL_REG_EXP = /^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i;
10
10
  // The regex checks for the protocol syntax ('xxxx://' or 'xxxx:')
11
11
  // or non-word characters at the beginning of the link ('/', '#' etc.).
12
12
  const PROTOCOL_REG_EXP = /^((\w+:(\/{2,})?)|(\W))/i;
13
+ const DEFAULT_LINK_PROTOCOLS = [
14
+ 'https?',
15
+ 'ftps?',
16
+ 'mailto'
17
+ ];
13
18
  /**
14
19
  * A keystroke used by the {@link module:link/linkui~LinkUI link UI feature}.
15
20
  */
@@ -38,16 +43,18 @@ export function createLinkElement(href, { writer }) {
38
43
  *
39
44
  * @internal
40
45
  */
41
- export function ensureSafeUrl(url) {
46
+ export function ensureSafeUrl(url, allowedProtocols = DEFAULT_LINK_PROTOCOLS) {
42
47
  const urlString = String(url);
43
- return isSafeUrl(urlString) ? urlString : '#';
48
+ const protocolsList = allowedProtocols.join('|');
49
+ const customSafeRegex = new RegExp(`${SAFE_URL_TEMPLATE.replace('<protocols>', protocolsList)}`, 'i');
50
+ return isSafeUrl(urlString, customSafeRegex) ? urlString : '#';
44
51
  }
45
52
  /**
46
53
  * Checks whether the given URL is safe for the user (does not contain any malicious code).
47
54
  */
48
- function isSafeUrl(url) {
55
+ function isSafeUrl(url, customRegexp) {
49
56
  const normalizedUrl = url.replace(ATTRIBUTE_WHITESPACES, '');
50
- return !!normalizedUrl.match(SAFE_URL);
57
+ return !!normalizedUrl.match(customRegexp);
51
58
  }
52
59
  /**
53
60
  * Returns the {@link module:link/linkconfig~LinkConfig#decorators `config.link.decorators`} configuration processed