@ckeditor/ckeditor5-link 47.6.1 → 48.0.0-alpha.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 (203) hide show
  1. package/LICENSE.md +1 -1
  2. package/ckeditor5-metadata.json +6 -6
  3. package/{src → dist}/autolink.d.ts +2 -2
  4. package/dist/index-editor.css +181 -105
  5. package/dist/index.css +169 -151
  6. package/dist/index.css.map +1 -1
  7. package/{src → dist}/index.d.ts +1 -1
  8. package/dist/index.js +8 -8
  9. package/dist/index.js.map +1 -1
  10. package/{src → dist}/link.d.ts +1 -1
  11. package/{src → dist}/linkcommand.d.ts +2 -2
  12. package/{src → dist}/linkconfig.d.ts +1 -1
  13. package/{src → dist}/linkediting.d.ts +3 -3
  14. package/{src → dist}/linkimage.d.ts +1 -1
  15. package/{src → dist}/linkimageediting.d.ts +3 -2
  16. package/{src → dist}/linkimageui.d.ts +3 -2
  17. package/{src → dist}/linkui.d.ts +2 -2
  18. package/{src → dist}/ui/linkbuttonview.d.ts +2 -2
  19. package/{src → dist}/ui/linkformview.d.ts +2 -4
  20. package/{src → dist}/ui/linkpreviewbuttonview.d.ts +2 -2
  21. package/{src → dist}/ui/linkpropertiesview.d.ts +2 -2
  22. package/{src → dist}/ui/linkprovideritemsview.d.ts +2 -2
  23. package/{src → dist}/unlinkcommand.d.ts +1 -1
  24. package/{src → dist}/utils/automaticdecorators.d.ts +2 -2
  25. package/{src → dist}/utils/manualdecorator.d.ts +4 -4
  26. package/{src → dist}/utils.d.ts +2 -2
  27. package/package.json +29 -52
  28. package/build/link.js +0 -5
  29. package/build/translations/af.js +0 -1
  30. package/build/translations/ar.js +0 -1
  31. package/build/translations/ast.js +0 -1
  32. package/build/translations/az.js +0 -1
  33. package/build/translations/be.js +0 -1
  34. package/build/translations/bg.js +0 -1
  35. package/build/translations/bn.js +0 -1
  36. package/build/translations/bs.js +0 -1
  37. package/build/translations/ca.js +0 -1
  38. package/build/translations/cs.js +0 -1
  39. package/build/translations/da.js +0 -1
  40. package/build/translations/de-ch.js +0 -1
  41. package/build/translations/de.js +0 -1
  42. package/build/translations/el.js +0 -1
  43. package/build/translations/en-au.js +0 -1
  44. package/build/translations/en-gb.js +0 -1
  45. package/build/translations/eo.js +0 -1
  46. package/build/translations/es-co.js +0 -1
  47. package/build/translations/es.js +0 -1
  48. package/build/translations/et.js +0 -1
  49. package/build/translations/eu.js +0 -1
  50. package/build/translations/fa.js +0 -1
  51. package/build/translations/fi.js +0 -1
  52. package/build/translations/fr.js +0 -1
  53. package/build/translations/gl.js +0 -1
  54. package/build/translations/gu.js +0 -1
  55. package/build/translations/he.js +0 -1
  56. package/build/translations/hi.js +0 -1
  57. package/build/translations/hr.js +0 -1
  58. package/build/translations/hu.js +0 -1
  59. package/build/translations/hy.js +0 -1
  60. package/build/translations/id.js +0 -1
  61. package/build/translations/it.js +0 -1
  62. package/build/translations/ja.js +0 -1
  63. package/build/translations/jv.js +0 -1
  64. package/build/translations/kk.js +0 -1
  65. package/build/translations/km.js +0 -1
  66. package/build/translations/kn.js +0 -1
  67. package/build/translations/ko.js +0 -1
  68. package/build/translations/ku.js +0 -1
  69. package/build/translations/lt.js +0 -1
  70. package/build/translations/lv.js +0 -1
  71. package/build/translations/ms.js +0 -1
  72. package/build/translations/nb.js +0 -1
  73. package/build/translations/ne.js +0 -1
  74. package/build/translations/nl.js +0 -1
  75. package/build/translations/no.js +0 -1
  76. package/build/translations/oc.js +0 -1
  77. package/build/translations/pl.js +0 -1
  78. package/build/translations/pt-br.js +0 -1
  79. package/build/translations/pt.js +0 -1
  80. package/build/translations/ro.js +0 -1
  81. package/build/translations/ru.js +0 -1
  82. package/build/translations/si.js +0 -1
  83. package/build/translations/sk.js +0 -1
  84. package/build/translations/sl.js +0 -1
  85. package/build/translations/sq.js +0 -1
  86. package/build/translations/sr-latn.js +0 -1
  87. package/build/translations/sr.js +0 -1
  88. package/build/translations/sv.js +0 -1
  89. package/build/translations/th.js +0 -1
  90. package/build/translations/ti.js +0 -1
  91. package/build/translations/tk.js +0 -1
  92. package/build/translations/tr.js +0 -1
  93. package/build/translations/tt.js +0 -1
  94. package/build/translations/ug.js +0 -1
  95. package/build/translations/uk.js +0 -1
  96. package/build/translations/ur.js +0 -1
  97. package/build/translations/uz.js +0 -1
  98. package/build/translations/vi.js +0 -1
  99. package/build/translations/zh-cn.js +0 -1
  100. package/build/translations/zh.js +0 -1
  101. package/lang/contexts.json +0 -16
  102. package/lang/translations/af.po +0 -68
  103. package/lang/translations/ar.po +0 -68
  104. package/lang/translations/ast.po +0 -68
  105. package/lang/translations/az.po +0 -68
  106. package/lang/translations/be.po +0 -68
  107. package/lang/translations/bg.po +0 -68
  108. package/lang/translations/bn.po +0 -70
  109. package/lang/translations/bs.po +0 -68
  110. package/lang/translations/ca.po +0 -68
  111. package/lang/translations/cs.po +0 -68
  112. package/lang/translations/da.po +0 -68
  113. package/lang/translations/de-ch.po +0 -68
  114. package/lang/translations/de.po +0 -68
  115. package/lang/translations/el.po +0 -68
  116. package/lang/translations/en-au.po +0 -68
  117. package/lang/translations/en-gb.po +0 -68
  118. package/lang/translations/en.po +0 -68
  119. package/lang/translations/eo.po +0 -68
  120. package/lang/translations/es-co.po +0 -68
  121. package/lang/translations/es.po +0 -68
  122. package/lang/translations/et.po +0 -68
  123. package/lang/translations/eu.po +0 -68
  124. package/lang/translations/fa.po +0 -68
  125. package/lang/translations/fi.po +0 -68
  126. package/lang/translations/fr.po +0 -68
  127. package/lang/translations/gl.po +0 -68
  128. package/lang/translations/gu.po +0 -68
  129. package/lang/translations/he.po +0 -68
  130. package/lang/translations/hi.po +0 -68
  131. package/lang/translations/hr.po +0 -68
  132. package/lang/translations/hu.po +0 -68
  133. package/lang/translations/hy.po +0 -68
  134. package/lang/translations/id.po +0 -68
  135. package/lang/translations/it.po +0 -68
  136. package/lang/translations/ja.po +0 -68
  137. package/lang/translations/jv.po +0 -68
  138. package/lang/translations/kk.po +0 -68
  139. package/lang/translations/km.po +0 -68
  140. package/lang/translations/kn.po +0 -68
  141. package/lang/translations/ko.po +0 -68
  142. package/lang/translations/ku.po +0 -68
  143. package/lang/translations/lt.po +0 -68
  144. package/lang/translations/lv.po +0 -68
  145. package/lang/translations/ms.po +0 -68
  146. package/lang/translations/nb.po +0 -68
  147. package/lang/translations/ne.po +0 -68
  148. package/lang/translations/nl.po +0 -68
  149. package/lang/translations/no.po +0 -68
  150. package/lang/translations/oc.po +0 -68
  151. package/lang/translations/pl.po +0 -68
  152. package/lang/translations/pt-br.po +0 -68
  153. package/lang/translations/pt.po +0 -68
  154. package/lang/translations/ro.po +0 -68
  155. package/lang/translations/ru.po +0 -68
  156. package/lang/translations/si.po +0 -68
  157. package/lang/translations/sk.po +0 -68
  158. package/lang/translations/sl.po +0 -68
  159. package/lang/translations/sq.po +0 -68
  160. package/lang/translations/sr-latn.po +0 -68
  161. package/lang/translations/sr.po +0 -68
  162. package/lang/translations/sv.po +0 -68
  163. package/lang/translations/th.po +0 -68
  164. package/lang/translations/ti.po +0 -68
  165. package/lang/translations/tk.po +0 -68
  166. package/lang/translations/tr.po +0 -68
  167. package/lang/translations/tt.po +0 -68
  168. package/lang/translations/ug.po +0 -68
  169. package/lang/translations/uk.po +0 -68
  170. package/lang/translations/ur.po +0 -68
  171. package/lang/translations/uz.po +0 -68
  172. package/lang/translations/vi.po +0 -68
  173. package/lang/translations/zh-cn.po +0 -68
  174. package/lang/translations/zh.po +0 -68
  175. package/src/augmentation.js +0 -5
  176. package/src/autolink.js +0 -307
  177. package/src/index.js +0 -25
  178. package/src/link.js +0 -37
  179. package/src/linkcommand.js +0 -431
  180. package/src/linkconfig.js +0 -5
  181. package/src/linkediting.js +0 -402
  182. package/src/linkimage.js +0 -37
  183. package/src/linkimageediting.js +0 -264
  184. package/src/linkimageui.js +0 -102
  185. package/src/linkui.js +0 -1072
  186. package/src/ui/linkbuttonview.js +0 -54
  187. package/src/ui/linkformview.js +0 -302
  188. package/src/ui/linkpreviewbuttonview.js +0 -43
  189. package/src/ui/linkpropertiesview.js +0 -170
  190. package/src/ui/linkprovideritemsview.js +0 -207
  191. package/src/unlinkcommand.js +0 -66
  192. package/src/utils/automaticdecorators.js +0 -181
  193. package/src/utils/conflictingdecorators.js +0 -80
  194. package/src/utils/manualdecorator.js +0 -69
  195. package/src/utils.js +0 -157
  196. package/theme/link.css +0 -10
  197. package/theme/linkform.css +0 -24
  198. package/theme/linkimage.css +0 -16
  199. package/theme/linkproperties.css +0 -4
  200. package/theme/linkprovideritems.css +0 -18
  201. package/theme/linktoolbar.css +0 -12
  202. /package/{src → dist}/augmentation.d.ts +0 -0
  203. /package/{src → dist}/utils/conflictingdecorators.d.ts +0 -0
package/src/utils.js DELETED
@@ -1,157 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- import { upperFirst } from 'es-toolkit/compat';
6
- const ATTRIBUTE_WHITESPACES = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g; // eslint-disable-line no-control-regex
7
- const SAFE_URL_TEMPLATE = '^(?:(?:<protocols>):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))';
8
- // Simplified email test - should be run over previously found URL.
9
- const EMAIL_REG_EXP = /^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i;
10
- // The regex checks for the protocol syntax ('xxxx://' or 'xxxx:')
11
- // or non-word characters at the beginning of the link ('/', '#' etc.).
12
- const PROTOCOL_REG_EXP = /^((\w+:(\/{2,})?)|(\W))/i;
13
- const DEFAULT_LINK_PROTOCOLS = [
14
- 'https?',
15
- 'ftps?',
16
- 'mailto'
17
- ];
18
- /**
19
- * A keystroke used by the {@link module:link/linkui~LinkUI link UI feature}.
20
- */
21
- export const LINK_KEYSTROKE = 'Ctrl+K';
22
- /**
23
- * Returns `true` if a given view node is the link element.
24
- */
25
- export function isLinkElement(node) {
26
- return node.is('attributeElement') && !!node.getCustomProperty('link');
27
- }
28
- /**
29
- * Creates a link {@link module:engine/view/attributeelement~ViewAttributeElement} with the provided `href` attribute.
30
- */
31
- export function createLinkElement(href, { writer }) {
32
- // Priority 5 - https://github.com/ckeditor/ckeditor5-link/issues/121.
33
- const linkElement = writer.createAttributeElement('a', { href }, { priority: 5 });
34
- writer.setCustomProperty('link', true, linkElement);
35
- return linkElement;
36
- }
37
- /**
38
- * Returns a safe URL based on a given value.
39
- *
40
- * A URL is considered safe if it is safe for the user (does not contain any malicious code).
41
- *
42
- * If a URL is considered unsafe, a simple `"#"` is returned.
43
- *
44
- * @internal
45
- */
46
- export function ensureSafeUrl(url, allowedProtocols = DEFAULT_LINK_PROTOCOLS) {
47
- const urlString = String(url);
48
- const protocolsList = allowedProtocols.join('|');
49
- const customSafeRegex = new RegExp(`${SAFE_URL_TEMPLATE.replace('<protocols>', protocolsList)}`, 'i');
50
- return isSafeUrl(urlString, customSafeRegex) ? urlString : '#';
51
- }
52
- /**
53
- * Checks whether the given URL is safe for the user (does not contain any malicious code).
54
- */
55
- function isSafeUrl(url, customRegexp) {
56
- const normalizedUrl = url.replace(ATTRIBUTE_WHITESPACES, '');
57
- return !!normalizedUrl.match(customRegexp);
58
- }
59
- /**
60
- * Returns the {@link module:link/linkconfig~LinkConfig#decorators `config.link.decorators`} configuration processed
61
- * to respect the locale of the editor, i.e. to display the {@link module:link/linkconfig~LinkDecoratorManualDefinition label}
62
- * in the correct language.
63
- *
64
- * **Note**: Only the few most commonly used labels are translated automatically. Other labels should be manually
65
- * translated in the {@link module:link/linkconfig~LinkConfig#decorators `config.link.decorators`} configuration.
66
- *
67
- * @param t Shorthand for {@link module:utils/locale~Locale#t Locale#t}.
68
- * @param decorators The decorator reference where the label values should be localized.
69
- * @internal
70
- */
71
- export function getLocalizedDecorators(t, decorators) {
72
- const localizedDecoratorsLabels = {
73
- 'Open in a new tab': t('Open in a new tab'),
74
- 'Downloadable': t('Downloadable')
75
- };
76
- decorators.forEach(decorator => {
77
- if ('label' in decorator && localizedDecoratorsLabels[decorator.label]) {
78
- decorator.label = localizedDecoratorsLabels[decorator.label];
79
- }
80
- return decorator;
81
- });
82
- return decorators;
83
- }
84
- /**
85
- * Converts an object with defined decorators to a normalized array of decorators. The `id` key is added for each decorator and
86
- * is used as the attribute's name in the model.
87
- *
88
- * @internal
89
- */
90
- export function normalizeDecorators(decorators) {
91
- const retArray = [];
92
- if (decorators) {
93
- for (const [key, value] of Object.entries(decorators)) {
94
- const decorator = Object.assign({}, value, { id: `link${upperFirst(key)}` });
95
- retArray.push(decorator);
96
- }
97
- }
98
- return retArray;
99
- }
100
- /**
101
- * Returns `true` if the specified `element` can be linked (the element allows the `linkHref` attribute).
102
- */
103
- export function isLinkableElement(element, schema) {
104
- if (!element) {
105
- return false;
106
- }
107
- return schema.checkAttribute(element.name, 'linkHref');
108
- }
109
- /**
110
- * Returns `true` if the specified `value` is an email.
111
- *
112
- * @internal
113
- */
114
- export function isEmail(value) {
115
- return EMAIL_REG_EXP.test(value);
116
- }
117
- /**
118
- * Adds the protocol prefix to the specified `link` when:
119
- *
120
- * * it does not contain it already, and there is a {@link module:link/linkconfig~LinkConfig#defaultProtocol `defaultProtocol` }
121
- * configuration value provided,
122
- * * or the link is an email address.
123
- */
124
- export function addLinkProtocolIfApplicable(link, defaultProtocol) {
125
- const protocol = isEmail(link) ? 'mailto:' : defaultProtocol;
126
- const isProtocolNeeded = !!protocol && !linkHasProtocol(link);
127
- return link && isProtocolNeeded ? protocol + link : link;
128
- }
129
- /**
130
- * Checks if protocol is already included in the link.
131
- *
132
- * @internal
133
- */
134
- export function linkHasProtocol(link) {
135
- return PROTOCOL_REG_EXP.test(link);
136
- }
137
- /**
138
- * Opens the link in a new browser tab.
139
- */
140
- export function openLink(link) {
141
- window.open(link, '_blank', 'noopener');
142
- }
143
- /**
144
- * Returns a text of a link range.
145
- *
146
- * If the returned value is `undefined`, the range contains elements other than text nodes.
147
- */
148
- export function extractTextFromLinkRange(range) {
149
- let text = '';
150
- for (const item of range.getItems()) {
151
- if (!item.is('$text') && !item.is('$textProxy')) {
152
- return;
153
- }
154
- text += item.data;
155
- }
156
- return text;
157
- }
package/theme/link.css DELETED
@@ -1,10 +0,0 @@
1
- /*
2
- * Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
-
6
- /*
7
- * Note: This file should contain the wireframe styles only. But since there are no such styles,
8
- * it acts as a message to the builder telling that it should look for the corresponding styles
9
- * **in the theme** when compiling the editor.
10
- */
@@ -1,24 +0,0 @@
1
- /*
2
- * Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
-
6
- @import "@ckeditor/ckeditor5-ui/theme/mixins/_rwd.css";
7
-
8
- /* Generic class that wraps each link balloon view. */
9
- .ck.ck-link-form {
10
- & .ck-link-form__providers-list {
11
- display: flex;
12
- flex-direction: column;
13
-
14
- & .ck-link__button {
15
- & > .ck-button__label {
16
- flex-grow: 1;
17
- }
18
- }
19
- }
20
-
21
- & .ck-link__items:empty {
22
- display: none;
23
- }
24
- }
@@ -1,16 +0,0 @@
1
- /*
2
- * Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
-
6
- .ck.ck-editor__editable {
7
- /* Linked image indicator */
8
- & figure.image > a,
9
- & a span.image-inline {
10
- &::after {
11
- display: block;
12
- position: absolute;
13
- }
14
- }
15
- }
16
-
@@ -1,4 +0,0 @@
1
- /*
2
- * Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
@@ -1,18 +0,0 @@
1
- /*
2
- * Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
-
6
- .ck.ck-link-providers {
7
- & > .ck-link-providers__list {
8
- overflow-x: hidden;
9
- overflow-y: auto;
10
- overscroll-behavior: contain;
11
-
12
- & .ck-button {
13
- & > .ck-icon {
14
- flex-shrink: 0;
15
- }
16
- }
17
- }
18
- }
@@ -1,12 +0,0 @@
1
- /*
2
- * Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
-
6
- .ck.ck-link-toolbar__preview {
7
- display: inline-block;
8
-
9
- & .ck-button__label {
10
- overflow: hidden;
11
- }
12
- }
File without changes
File without changes