@ckeditor/ckeditor5-link 0.0.0-internal-20241017.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.
- package/CHANGELOG.md +4 -0
- package/LICENSE.md +21 -0
- package/README.md +26 -0
- package/build/link.js +5 -0
- package/build/translations/ar.js +1 -0
- package/build/translations/ast.js +1 -0
- package/build/translations/az.js +1 -0
- package/build/translations/bg.js +1 -0
- package/build/translations/bn.js +1 -0
- package/build/translations/ca.js +1 -0
- package/build/translations/cs.js +1 -0
- package/build/translations/da.js +1 -0
- package/build/translations/de-ch.js +1 -0
- package/build/translations/de.js +1 -0
- package/build/translations/el.js +1 -0
- package/build/translations/en-au.js +1 -0
- package/build/translations/en-gb.js +1 -0
- package/build/translations/eo.js +1 -0
- package/build/translations/es.js +1 -0
- package/build/translations/et.js +1 -0
- package/build/translations/eu.js +1 -0
- package/build/translations/fa.js +1 -0
- package/build/translations/fi.js +1 -0
- package/build/translations/fr.js +1 -0
- package/build/translations/gl.js +1 -0
- package/build/translations/he.js +1 -0
- package/build/translations/hi.js +1 -0
- package/build/translations/hr.js +1 -0
- package/build/translations/hu.js +1 -0
- package/build/translations/hy.js +1 -0
- package/build/translations/id.js +1 -0
- package/build/translations/it.js +1 -0
- package/build/translations/ja.js +1 -0
- package/build/translations/km.js +1 -0
- package/build/translations/kn.js +1 -0
- package/build/translations/ko.js +1 -0
- package/build/translations/ku.js +1 -0
- package/build/translations/lt.js +1 -0
- package/build/translations/lv.js +1 -0
- package/build/translations/ms.js +1 -0
- package/build/translations/nb.js +1 -0
- package/build/translations/ne.js +1 -0
- package/build/translations/nl.js +1 -0
- package/build/translations/no.js +1 -0
- package/build/translations/pl.js +1 -0
- package/build/translations/pt-br.js +1 -0
- package/build/translations/pt.js +1 -0
- package/build/translations/ro.js +1 -0
- package/build/translations/ru.js +1 -0
- package/build/translations/sk.js +1 -0
- package/build/translations/sq.js +1 -0
- package/build/translations/sr-latn.js +1 -0
- package/build/translations/sr.js +1 -0
- package/build/translations/sv.js +1 -0
- package/build/translations/th.js +1 -0
- package/build/translations/ti.js +1 -0
- package/build/translations/tk.js +1 -0
- package/build/translations/tr.js +1 -0
- package/build/translations/tt.js +1 -0
- package/build/translations/ug.js +1 -0
- package/build/translations/uk.js +1 -0
- package/build/translations/ur.js +1 -0
- package/build/translations/uz.js +1 -0
- package/build/translations/vi.js +1 -0
- package/build/translations/zh-cn.js +1 -0
- package/build/translations/zh.js +1 -0
- package/ckeditor5-metadata.json +78 -0
- package/dist/augmentation.d.ts +34 -0
- package/dist/autolink.d.ts +83 -0
- package/dist/index-content.css +4 -0
- package/dist/index-editor.css +98 -0
- package/dist/index.css +148 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +2567 -0
- package/dist/index.js.map +1 -0
- package/dist/link.d.ts +35 -0
- package/dist/linkcommand.d.ts +136 -0
- package/dist/linkconfig.d.ts +294 -0
- package/dist/linkediting.d.ts +78 -0
- package/dist/linkimage.d.ts +35 -0
- package/dist/linkimageediting.d.ts +47 -0
- package/dist/linkimageui.d.ts +48 -0
- package/dist/linkui.d.ts +177 -0
- package/dist/translations/ar.d.ts +8 -0
- package/dist/translations/ar.js +5 -0
- package/dist/translations/ar.umd.js +11 -0
- package/dist/translations/ast.d.ts +8 -0
- package/dist/translations/ast.js +5 -0
- package/dist/translations/ast.umd.js +11 -0
- package/dist/translations/az.d.ts +8 -0
- package/dist/translations/az.js +5 -0
- package/dist/translations/az.umd.js +11 -0
- package/dist/translations/bg.d.ts +8 -0
- package/dist/translations/bg.js +5 -0
- package/dist/translations/bg.umd.js +11 -0
- package/dist/translations/bn.d.ts +8 -0
- package/dist/translations/bn.js +5 -0
- package/dist/translations/bn.umd.js +11 -0
- package/dist/translations/ca.d.ts +8 -0
- package/dist/translations/ca.js +5 -0
- package/dist/translations/ca.umd.js +11 -0
- package/dist/translations/cs.d.ts +8 -0
- package/dist/translations/cs.js +5 -0
- package/dist/translations/cs.umd.js +11 -0
- package/dist/translations/da.d.ts +8 -0
- package/dist/translations/da.js +5 -0
- package/dist/translations/da.umd.js +11 -0
- package/dist/translations/de-ch.d.ts +8 -0
- package/dist/translations/de-ch.js +5 -0
- package/dist/translations/de-ch.umd.js +11 -0
- package/dist/translations/de.d.ts +8 -0
- package/dist/translations/de.js +5 -0
- package/dist/translations/de.umd.js +11 -0
- package/dist/translations/el.d.ts +8 -0
- package/dist/translations/el.js +5 -0
- package/dist/translations/el.umd.js +11 -0
- package/dist/translations/en-au.d.ts +8 -0
- package/dist/translations/en-au.js +5 -0
- package/dist/translations/en-au.umd.js +11 -0
- package/dist/translations/en-gb.d.ts +8 -0
- package/dist/translations/en-gb.js +5 -0
- package/dist/translations/en-gb.umd.js +11 -0
- package/dist/translations/en.d.ts +8 -0
- package/dist/translations/en.js +5 -0
- package/dist/translations/en.umd.js +11 -0
- package/dist/translations/eo.d.ts +8 -0
- package/dist/translations/eo.js +5 -0
- package/dist/translations/eo.umd.js +11 -0
- package/dist/translations/es.d.ts +8 -0
- package/dist/translations/es.js +5 -0
- package/dist/translations/es.umd.js +11 -0
- package/dist/translations/et.d.ts +8 -0
- package/dist/translations/et.js +5 -0
- package/dist/translations/et.umd.js +11 -0
- package/dist/translations/eu.d.ts +8 -0
- package/dist/translations/eu.js +5 -0
- package/dist/translations/eu.umd.js +11 -0
- package/dist/translations/fa.d.ts +8 -0
- package/dist/translations/fa.js +5 -0
- package/dist/translations/fa.umd.js +11 -0
- package/dist/translations/fi.d.ts +8 -0
- package/dist/translations/fi.js +5 -0
- package/dist/translations/fi.umd.js +11 -0
- package/dist/translations/fr.d.ts +8 -0
- package/dist/translations/fr.js +5 -0
- package/dist/translations/fr.umd.js +11 -0
- package/dist/translations/gl.d.ts +8 -0
- package/dist/translations/gl.js +5 -0
- package/dist/translations/gl.umd.js +11 -0
- package/dist/translations/he.d.ts +8 -0
- package/dist/translations/he.js +5 -0
- package/dist/translations/he.umd.js +11 -0
- package/dist/translations/hi.d.ts +8 -0
- package/dist/translations/hi.js +5 -0
- package/dist/translations/hi.umd.js +11 -0
- package/dist/translations/hr.d.ts +8 -0
- package/dist/translations/hr.js +5 -0
- package/dist/translations/hr.umd.js +11 -0
- package/dist/translations/hu.d.ts +8 -0
- package/dist/translations/hu.js +5 -0
- package/dist/translations/hu.umd.js +11 -0
- package/dist/translations/hy.d.ts +8 -0
- package/dist/translations/hy.js +5 -0
- package/dist/translations/hy.umd.js +11 -0
- package/dist/translations/id.d.ts +8 -0
- package/dist/translations/id.js +5 -0
- package/dist/translations/id.umd.js +11 -0
- package/dist/translations/it.d.ts +8 -0
- package/dist/translations/it.js +5 -0
- package/dist/translations/it.umd.js +11 -0
- package/dist/translations/ja.d.ts +8 -0
- package/dist/translations/ja.js +5 -0
- package/dist/translations/ja.umd.js +11 -0
- package/dist/translations/km.d.ts +8 -0
- package/dist/translations/km.js +5 -0
- package/dist/translations/km.umd.js +11 -0
- package/dist/translations/kn.d.ts +8 -0
- package/dist/translations/kn.js +5 -0
- package/dist/translations/kn.umd.js +11 -0
- package/dist/translations/ko.d.ts +8 -0
- package/dist/translations/ko.js +5 -0
- package/dist/translations/ko.umd.js +11 -0
- package/dist/translations/ku.d.ts +8 -0
- package/dist/translations/ku.js +5 -0
- package/dist/translations/ku.umd.js +11 -0
- package/dist/translations/lt.d.ts +8 -0
- package/dist/translations/lt.js +5 -0
- package/dist/translations/lt.umd.js +11 -0
- package/dist/translations/lv.d.ts +8 -0
- package/dist/translations/lv.js +5 -0
- package/dist/translations/lv.umd.js +11 -0
- package/dist/translations/ms.d.ts +8 -0
- package/dist/translations/ms.js +5 -0
- package/dist/translations/ms.umd.js +11 -0
- package/dist/translations/nb.d.ts +8 -0
- package/dist/translations/nb.js +5 -0
- package/dist/translations/nb.umd.js +11 -0
- package/dist/translations/ne.d.ts +8 -0
- package/dist/translations/ne.js +5 -0
- package/dist/translations/ne.umd.js +11 -0
- package/dist/translations/nl.d.ts +8 -0
- package/dist/translations/nl.js +5 -0
- package/dist/translations/nl.umd.js +11 -0
- package/dist/translations/no.d.ts +8 -0
- package/dist/translations/no.js +5 -0
- package/dist/translations/no.umd.js +11 -0
- package/dist/translations/pl.d.ts +8 -0
- package/dist/translations/pl.js +5 -0
- package/dist/translations/pl.umd.js +11 -0
- package/dist/translations/pt-br.d.ts +8 -0
- package/dist/translations/pt-br.js +5 -0
- package/dist/translations/pt-br.umd.js +11 -0
- package/dist/translations/pt.d.ts +8 -0
- package/dist/translations/pt.js +5 -0
- package/dist/translations/pt.umd.js +11 -0
- package/dist/translations/ro.d.ts +8 -0
- package/dist/translations/ro.js +5 -0
- package/dist/translations/ro.umd.js +11 -0
- package/dist/translations/ru.d.ts +8 -0
- package/dist/translations/ru.js +5 -0
- package/dist/translations/ru.umd.js +11 -0
- package/dist/translations/sk.d.ts +8 -0
- package/dist/translations/sk.js +5 -0
- package/dist/translations/sk.umd.js +11 -0
- package/dist/translations/sq.d.ts +8 -0
- package/dist/translations/sq.js +5 -0
- package/dist/translations/sq.umd.js +11 -0
- package/dist/translations/sr-latn.d.ts +8 -0
- package/dist/translations/sr-latn.js +5 -0
- package/dist/translations/sr-latn.umd.js +11 -0
- package/dist/translations/sr.d.ts +8 -0
- package/dist/translations/sr.js +5 -0
- package/dist/translations/sr.umd.js +11 -0
- package/dist/translations/sv.d.ts +8 -0
- package/dist/translations/sv.js +5 -0
- package/dist/translations/sv.umd.js +11 -0
- package/dist/translations/th.d.ts +8 -0
- package/dist/translations/th.js +5 -0
- package/dist/translations/th.umd.js +11 -0
- package/dist/translations/ti.d.ts +8 -0
- package/dist/translations/ti.js +5 -0
- package/dist/translations/ti.umd.js +11 -0
- package/dist/translations/tk.d.ts +8 -0
- package/dist/translations/tk.js +5 -0
- package/dist/translations/tk.umd.js +11 -0
- package/dist/translations/tr.d.ts +8 -0
- package/dist/translations/tr.js +5 -0
- package/dist/translations/tr.umd.js +11 -0
- package/dist/translations/tt.d.ts +8 -0
- package/dist/translations/tt.js +5 -0
- package/dist/translations/tt.umd.js +11 -0
- package/dist/translations/ug.d.ts +8 -0
- package/dist/translations/ug.js +5 -0
- package/dist/translations/ug.umd.js +11 -0
- package/dist/translations/uk.d.ts +8 -0
- package/dist/translations/uk.js +5 -0
- package/dist/translations/uk.umd.js +11 -0
- package/dist/translations/ur.d.ts +8 -0
- package/dist/translations/ur.js +5 -0
- package/dist/translations/ur.umd.js +11 -0
- package/dist/translations/uz.d.ts +8 -0
- package/dist/translations/uz.js +5 -0
- package/dist/translations/uz.umd.js +11 -0
- package/dist/translations/vi.d.ts +8 -0
- package/dist/translations/vi.js +5 -0
- package/dist/translations/vi.umd.js +11 -0
- package/dist/translations/zh-cn.d.ts +8 -0
- package/dist/translations/zh-cn.js +5 -0
- package/dist/translations/zh-cn.umd.js +11 -0
- package/dist/translations/zh.d.ts +8 -0
- package/dist/translations/zh.js +5 -0
- package/dist/translations/zh.umd.js +11 -0
- package/dist/ui/linkactionsview.d.ts +107 -0
- package/dist/ui/linkformview.d.ts +175 -0
- package/dist/unlinkcommand.d.ts +35 -0
- package/dist/utils/automaticdecorators.d.ts +49 -0
- package/dist/utils/manualdecorator.d.ts +76 -0
- package/dist/utils.d.ts +84 -0
- package/lang/contexts.json +14 -0
- package/lang/translations/ar.po +66 -0
- package/lang/translations/ast.po +66 -0
- package/lang/translations/az.po +66 -0
- package/lang/translations/bg.po +66 -0
- package/lang/translations/bn.po +68 -0
- package/lang/translations/ca.po +66 -0
- package/lang/translations/cs.po +66 -0
- package/lang/translations/da.po +66 -0
- package/lang/translations/de-ch.po +66 -0
- package/lang/translations/de.po +66 -0
- package/lang/translations/el.po +66 -0
- package/lang/translations/en-au.po +66 -0
- package/lang/translations/en-gb.po +66 -0
- package/lang/translations/en.po +66 -0
- package/lang/translations/eo.po +66 -0
- package/lang/translations/es.po +66 -0
- package/lang/translations/et.po +66 -0
- package/lang/translations/eu.po +66 -0
- package/lang/translations/fa.po +66 -0
- package/lang/translations/fi.po +66 -0
- package/lang/translations/fr.po +66 -0
- package/lang/translations/gl.po +66 -0
- package/lang/translations/he.po +66 -0
- package/lang/translations/hi.po +66 -0
- package/lang/translations/hr.po +66 -0
- package/lang/translations/hu.po +66 -0
- package/lang/translations/hy.po +66 -0
- package/lang/translations/id.po +66 -0
- package/lang/translations/it.po +66 -0
- package/lang/translations/ja.po +66 -0
- package/lang/translations/km.po +66 -0
- package/lang/translations/kn.po +66 -0
- package/lang/translations/ko.po +66 -0
- package/lang/translations/ku.po +66 -0
- package/lang/translations/lt.po +66 -0
- package/lang/translations/lv.po +66 -0
- package/lang/translations/ms.po +66 -0
- package/lang/translations/nb.po +66 -0
- package/lang/translations/ne.po +66 -0
- package/lang/translations/nl.po +66 -0
- package/lang/translations/no.po +66 -0
- package/lang/translations/pl.po +66 -0
- package/lang/translations/pt-br.po +66 -0
- package/lang/translations/pt.po +66 -0
- package/lang/translations/ro.po +66 -0
- package/lang/translations/ru.po +66 -0
- package/lang/translations/sk.po +66 -0
- package/lang/translations/sq.po +66 -0
- package/lang/translations/sr-latn.po +66 -0
- package/lang/translations/sr.po +66 -0
- package/lang/translations/sv.po +66 -0
- package/lang/translations/th.po +66 -0
- package/lang/translations/ti.po +66 -0
- package/lang/translations/tk.po +66 -0
- package/lang/translations/tr.po +66 -0
- package/lang/translations/tt.po +66 -0
- package/lang/translations/ug.po +66 -0
- package/lang/translations/uk.po +66 -0
- package/lang/translations/ur.po +66 -0
- package/lang/translations/uz.po +66 -0
- package/lang/translations/vi.po +66 -0
- package/lang/translations/zh-cn.po +66 -0
- package/lang/translations/zh.po +66 -0
- package/package.json +46 -0
- package/src/augmentation.d.ts +30 -0
- package/src/augmentation.js +5 -0
- package/src/autolink.d.ts +79 -0
- package/src/autolink.js +290 -0
- package/src/index.d.ts +21 -0
- package/src/index.js +20 -0
- package/src/link.d.ts +31 -0
- package/src/link.js +37 -0
- package/src/linkcommand.d.ts +132 -0
- package/src/linkcommand.js +285 -0
- package/src/linkconfig.d.ts +290 -0
- package/src/linkconfig.js +5 -0
- package/src/linkediting.d.ts +74 -0
- package/src/linkediting.js +286 -0
- package/src/linkimage.d.ts +31 -0
- package/src/linkimage.js +37 -0
- package/src/linkimageediting.d.ts +43 -0
- package/src/linkimageediting.js +251 -0
- package/src/linkimageui.d.ts +44 -0
- package/src/linkimageui.js +102 -0
- package/src/linkui.d.ts +173 -0
- package/src/linkui.js +652 -0
- package/src/ui/linkactionsview.d.ts +103 -0
- package/src/ui/linkactionsview.js +157 -0
- package/src/ui/linkformview.d.ts +171 -0
- package/src/ui/linkformview.js +273 -0
- package/src/unlinkcommand.d.ts +31 -0
- package/src/unlinkcommand.js +66 -0
- package/src/utils/automaticdecorators.d.ts +45 -0
- package/src/utils/automaticdecorators.js +140 -0
- package/src/utils/manualdecorator.d.ts +72 -0
- package/src/utils/manualdecorator.js +47 -0
- package/src/utils.d.ts +80 -0
- package/src/utils.js +135 -0
- package/theme/icons/link.svg +1 -0
- package/theme/icons/unlink.svg +1 -0
- package/theme/link.css +10 -0
- package/theme/linkactions.css +32 -0
- package/theme/linkform.css +46 -0
- package/theme/linkimage.css +16 -0
package/src/linkimage.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module link/linkimage
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import LinkImageEditing from './linkimageediting.js';
|
|
10
|
+
import LinkImageUI from './linkimageui.js';
|
|
11
|
+
import '../theme/linkimage.css';
|
|
12
|
+
/**
|
|
13
|
+
* The `LinkImage` plugin.
|
|
14
|
+
*
|
|
15
|
+
* This is a "glue" plugin that loads the {@link module:link/linkimageediting~LinkImageEditing link image editing feature}
|
|
16
|
+
* and {@link module:link/linkimageui~LinkImageUI link image UI feature}.
|
|
17
|
+
*/
|
|
18
|
+
export default class LinkImage extends Plugin {
|
|
19
|
+
/**
|
|
20
|
+
* @inheritDoc
|
|
21
|
+
*/
|
|
22
|
+
static get requires() {
|
|
23
|
+
return [LinkImageEditing, LinkImageUI];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @inheritDoc
|
|
27
|
+
*/
|
|
28
|
+
static get pluginName() {
|
|
29
|
+
return 'LinkImage';
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @inheritDoc
|
|
33
|
+
*/
|
|
34
|
+
static get isOfficialPlugin() {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module link/linkimageediting
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import LinkEditing from './linkediting.js';
|
|
10
|
+
/**
|
|
11
|
+
* The link image engine feature.
|
|
12
|
+
*
|
|
13
|
+
* It accepts the `linkHref="url"` attribute in the model for the {@link module:image/image~Image `<imageBlock>`} element
|
|
14
|
+
* which allows linking images.
|
|
15
|
+
*/
|
|
16
|
+
export default class LinkImageEditing extends Plugin {
|
|
17
|
+
/**
|
|
18
|
+
* @inheritDoc
|
|
19
|
+
*/
|
|
20
|
+
static get requires(): readonly ["ImageEditing", "ImageUtils", typeof LinkEditing];
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
static get pluginName(): "LinkImageEditing";
|
|
25
|
+
/**
|
|
26
|
+
* @inheritDoc
|
|
27
|
+
*/
|
|
28
|
+
static get isOfficialPlugin(): true;
|
|
29
|
+
/**
|
|
30
|
+
* @inheritDoc
|
|
31
|
+
*/
|
|
32
|
+
afterInit(): void;
|
|
33
|
+
/**
|
|
34
|
+
* Processes {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition automatic decorators} definitions and
|
|
35
|
+
* attaches proper converters that will work when linking an image.`
|
|
36
|
+
*/
|
|
37
|
+
private _enableAutomaticDecorators;
|
|
38
|
+
/**
|
|
39
|
+
* Processes transformed {@link module:link/utils/manualdecorator~ManualDecorator} instances and attaches proper converters
|
|
40
|
+
* that will work when linking an image.
|
|
41
|
+
*/
|
|
42
|
+
private _enableManualDecorators;
|
|
43
|
+
}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module link/linkimageediting
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { Matcher } from 'ckeditor5/src/engine.js';
|
|
10
|
+
import { toMap } from 'ckeditor5/src/utils.js';
|
|
11
|
+
import LinkEditing from './linkediting.js';
|
|
12
|
+
/**
|
|
13
|
+
* The link image engine feature.
|
|
14
|
+
*
|
|
15
|
+
* It accepts the `linkHref="url"` attribute in the model for the {@link module:image/image~Image `<imageBlock>`} element
|
|
16
|
+
* which allows linking images.
|
|
17
|
+
*/
|
|
18
|
+
export default class LinkImageEditing extends Plugin {
|
|
19
|
+
/**
|
|
20
|
+
* @inheritDoc
|
|
21
|
+
*/
|
|
22
|
+
static get requires() {
|
|
23
|
+
return ['ImageEditing', 'ImageUtils', LinkEditing];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @inheritDoc
|
|
27
|
+
*/
|
|
28
|
+
static get pluginName() {
|
|
29
|
+
return 'LinkImageEditing';
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @inheritDoc
|
|
33
|
+
*/
|
|
34
|
+
static get isOfficialPlugin() {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @inheritDoc
|
|
39
|
+
*/
|
|
40
|
+
afterInit() {
|
|
41
|
+
const editor = this.editor;
|
|
42
|
+
const schema = editor.model.schema;
|
|
43
|
+
if (editor.plugins.has('ImageBlockEditing')) {
|
|
44
|
+
schema.extend('imageBlock', { allowAttributes: ['linkHref'] });
|
|
45
|
+
}
|
|
46
|
+
editor.conversion.for('upcast').add(upcastLink(editor));
|
|
47
|
+
editor.conversion.for('downcast').add(downcastImageLink(editor));
|
|
48
|
+
// Definitions for decorators are provided by the `link` command and the `LinkEditing` plugin.
|
|
49
|
+
this._enableAutomaticDecorators();
|
|
50
|
+
this._enableManualDecorators();
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Processes {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition automatic decorators} definitions and
|
|
54
|
+
* attaches proper converters that will work when linking an image.`
|
|
55
|
+
*/
|
|
56
|
+
_enableAutomaticDecorators() {
|
|
57
|
+
const editor = this.editor;
|
|
58
|
+
const command = editor.commands.get('link');
|
|
59
|
+
const automaticDecorators = command.automaticDecorators;
|
|
60
|
+
if (automaticDecorators.length) {
|
|
61
|
+
editor.conversion.for('downcast').add(automaticDecorators.getDispatcherForLinkedImage());
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Processes transformed {@link module:link/utils/manualdecorator~ManualDecorator} instances and attaches proper converters
|
|
66
|
+
* that will work when linking an image.
|
|
67
|
+
*/
|
|
68
|
+
_enableManualDecorators() {
|
|
69
|
+
const editor = this.editor;
|
|
70
|
+
const command = editor.commands.get('link');
|
|
71
|
+
for (const decorator of command.manualDecorators) {
|
|
72
|
+
if (editor.plugins.has('ImageBlockEditing')) {
|
|
73
|
+
editor.model.schema.extend('imageBlock', { allowAttributes: decorator.id });
|
|
74
|
+
}
|
|
75
|
+
if (editor.plugins.has('ImageInlineEditing')) {
|
|
76
|
+
editor.model.schema.extend('imageInline', { allowAttributes: decorator.id });
|
|
77
|
+
}
|
|
78
|
+
editor.conversion.for('downcast').add(downcastImageLinkManualDecorator(decorator));
|
|
79
|
+
editor.conversion.for('upcast').add(upcastImageLinkManualDecorator(editor, decorator));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Returns a converter for linked block images that consumes the "href" attribute
|
|
85
|
+
* if a link contains an image.
|
|
86
|
+
*
|
|
87
|
+
* @param editor The editor instance.
|
|
88
|
+
*/
|
|
89
|
+
function upcastLink(editor) {
|
|
90
|
+
const isImageInlinePluginLoaded = editor.plugins.has('ImageInlineEditing');
|
|
91
|
+
const imageUtils = editor.plugins.get('ImageUtils');
|
|
92
|
+
return dispatcher => {
|
|
93
|
+
dispatcher.on('element:a', (evt, data, conversionApi) => {
|
|
94
|
+
const viewLink = data.viewItem;
|
|
95
|
+
const imageInLink = imageUtils.findViewImgElement(viewLink);
|
|
96
|
+
if (!imageInLink) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const blockImageView = imageInLink.findAncestor(element => imageUtils.isBlockImageView(element));
|
|
100
|
+
// There are four possible cases to consider here
|
|
101
|
+
//
|
|
102
|
+
// 1. A "root > ... > figure.image > a > img" structure.
|
|
103
|
+
// 2. A "root > ... > figure.image > a > picture > img" structure.
|
|
104
|
+
// 3. A "root > ... > block > a > img" structure.
|
|
105
|
+
// 4. A "root > ... > block > a > picture > img" structure.
|
|
106
|
+
//
|
|
107
|
+
// but the last 2 cases should only be considered by this converter when the inline image plugin
|
|
108
|
+
// is NOT loaded in the editor (because otherwise, that would be a plain, linked inline image).
|
|
109
|
+
if (isImageInlinePluginLoaded && !blockImageView) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
// There's an image inside an <a> element - we consume it so it won't be picked up by the Link plugin.
|
|
113
|
+
const consumableAttributes = { attributes: ['href'] };
|
|
114
|
+
// Consume the `href` attribute so the default one will not convert it to $text attribute.
|
|
115
|
+
if (!conversionApi.consumable.consume(viewLink, consumableAttributes)) {
|
|
116
|
+
// Might be consumed by something else - i.e. other converter with priority=highest - a standard check.
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const linkHref = viewLink.getAttribute('href');
|
|
120
|
+
// Missing the 'href' attribute.
|
|
121
|
+
if (!linkHref) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
// A full definition of the image feature.
|
|
125
|
+
// figure > a > img: parent of the view link element is an image element (figure).
|
|
126
|
+
let modelElement = data.modelCursor.parent;
|
|
127
|
+
if (!modelElement.is('element', 'imageBlock')) {
|
|
128
|
+
// a > img: parent of the view link is not the image (figure) element. We need to convert it manually.
|
|
129
|
+
const conversionResult = conversionApi.convertItem(imageInLink, data.modelCursor);
|
|
130
|
+
// Set image range as conversion result.
|
|
131
|
+
data.modelRange = conversionResult.modelRange;
|
|
132
|
+
// Continue conversion where image conversion ends.
|
|
133
|
+
data.modelCursor = conversionResult.modelCursor;
|
|
134
|
+
modelElement = data.modelCursor.nodeBefore;
|
|
135
|
+
}
|
|
136
|
+
if (modelElement && modelElement.is('element', 'imageBlock')) {
|
|
137
|
+
// Set the linkHref attribute from link element on model image element.
|
|
138
|
+
conversionApi.writer.setAttribute('linkHref', linkHref, modelElement);
|
|
139
|
+
}
|
|
140
|
+
}, { priority: 'high' });
|
|
141
|
+
// Using the same priority that `upcastImageLinkManualDecorator()` converter guarantees
|
|
142
|
+
// that manual decorators will decorate the proper element.
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Creates a converter that adds `<a>` to linked block image view elements.
|
|
147
|
+
*/
|
|
148
|
+
function downcastImageLink(editor) {
|
|
149
|
+
const imageUtils = editor.plugins.get('ImageUtils');
|
|
150
|
+
return dispatcher => {
|
|
151
|
+
dispatcher.on('attribute:linkHref:imageBlock', (evt, data, conversionApi) => {
|
|
152
|
+
if (!conversionApi.consumable.consume(data.item, evt.name)) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
// The image will be already converted - so it will be present in the view.
|
|
156
|
+
const viewFigure = conversionApi.mapper.toViewElement(data.item);
|
|
157
|
+
const writer = conversionApi.writer;
|
|
158
|
+
// But we need to check whether the link element exists.
|
|
159
|
+
const linkInImage = Array.from(viewFigure.getChildren())
|
|
160
|
+
.find((child) => child.is('element', 'a'));
|
|
161
|
+
const viewImage = imageUtils.findViewImgElement(viewFigure);
|
|
162
|
+
// <picture>...<img/></picture> or <img/>
|
|
163
|
+
const viewImgOrPicture = viewImage.parent.is('element', 'picture') ? viewImage.parent : viewImage;
|
|
164
|
+
// If so, update the attribute if it's defined or remove the entire link if the attribute is empty.
|
|
165
|
+
if (linkInImage) {
|
|
166
|
+
if (data.attributeNewValue) {
|
|
167
|
+
writer.setAttribute('href', data.attributeNewValue, linkInImage);
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
writer.move(writer.createRangeOn(viewImgOrPicture), writer.createPositionAt(viewFigure, 0));
|
|
171
|
+
writer.remove(linkInImage);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
// But if it does not exist. Let's wrap already converted image by newly created link element.
|
|
176
|
+
// 1. Create an empty link element.
|
|
177
|
+
const linkElement = writer.createContainerElement('a', { href: data.attributeNewValue });
|
|
178
|
+
// 2. Insert link inside the associated image.
|
|
179
|
+
writer.insert(writer.createPositionAt(viewFigure, 0), linkElement);
|
|
180
|
+
// 3. Move the image to the link.
|
|
181
|
+
writer.move(writer.createRangeOn(viewImgOrPicture), writer.createPositionAt(linkElement, 0));
|
|
182
|
+
}
|
|
183
|
+
}, { priority: 'high' });
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Returns a converter that decorates the `<a>` element when the image is the link label.
|
|
188
|
+
*/
|
|
189
|
+
function downcastImageLinkManualDecorator(decorator) {
|
|
190
|
+
return dispatcher => {
|
|
191
|
+
dispatcher.on(`attribute:${decorator.id}:imageBlock`, (evt, data, conversionApi) => {
|
|
192
|
+
const viewFigure = conversionApi.mapper.toViewElement(data.item);
|
|
193
|
+
const linkInImage = Array.from(viewFigure.getChildren())
|
|
194
|
+
.find((child) => child.is('element', 'a'));
|
|
195
|
+
// The <a> element was removed by the time this converter is executed.
|
|
196
|
+
// It may happen when the base `linkHref` and decorator attributes are removed
|
|
197
|
+
// at the same time (see #8401).
|
|
198
|
+
if (!linkInImage) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
for (const [key, val] of toMap(decorator.attributes)) {
|
|
202
|
+
conversionApi.writer.setAttribute(key, val, linkInImage);
|
|
203
|
+
}
|
|
204
|
+
if (decorator.classes) {
|
|
205
|
+
conversionApi.writer.addClass(decorator.classes, linkInImage);
|
|
206
|
+
}
|
|
207
|
+
for (const key in decorator.styles) {
|
|
208
|
+
conversionApi.writer.setStyle(key, decorator.styles[key], linkInImage);
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Returns a converter that checks whether manual decorators should be applied to the link.
|
|
215
|
+
*/
|
|
216
|
+
function upcastImageLinkManualDecorator(editor, decorator) {
|
|
217
|
+
const isImageInlinePluginLoaded = editor.plugins.has('ImageInlineEditing');
|
|
218
|
+
const imageUtils = editor.plugins.get('ImageUtils');
|
|
219
|
+
return dispatcher => {
|
|
220
|
+
dispatcher.on('element:a', (evt, data, conversionApi) => {
|
|
221
|
+
const viewLink = data.viewItem;
|
|
222
|
+
const imageInLink = imageUtils.findViewImgElement(viewLink);
|
|
223
|
+
// We need to check whether an image is inside a link because the converter handles
|
|
224
|
+
// only manual decorators for linked images. See #7975.
|
|
225
|
+
if (!imageInLink) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
const blockImageView = imageInLink.findAncestor(element => imageUtils.isBlockImageView(element));
|
|
229
|
+
if (isImageInlinePluginLoaded && !blockImageView) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
const matcher = new Matcher(decorator._createPattern());
|
|
233
|
+
const result = matcher.match(viewLink);
|
|
234
|
+
// The link element does not have required attributes or/and proper values.
|
|
235
|
+
if (!result) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
// Check whether we can consume those attributes.
|
|
239
|
+
if (!conversionApi.consumable.consume(viewLink, result.match)) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
// At this stage we can assume that we have the `<imageBlock>` element.
|
|
243
|
+
// `nodeBefore` comes after conversion: `<a><img></a>`.
|
|
244
|
+
// `parent` comes with full image definition: `<figure><a><img></a></figure>.
|
|
245
|
+
// See the body of the `upcastLink()` function.
|
|
246
|
+
const modelElement = data.modelCursor.nodeBefore || data.modelCursor.parent;
|
|
247
|
+
conversionApi.writer.setAttribute(decorator.id, true, modelElement);
|
|
248
|
+
}, { priority: 'high' });
|
|
249
|
+
// Using the same priority that `upcastLink()` converter guarantees that the linked image was properly converted.
|
|
250
|
+
};
|
|
251
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
6
|
+
import LinkUI from './linkui.js';
|
|
7
|
+
import LinkEditing from './linkediting.js';
|
|
8
|
+
/**
|
|
9
|
+
* The link image UI plugin.
|
|
10
|
+
*
|
|
11
|
+
* This plugin provides the `'linkImage'` button that can be displayed in the {@link module:image/imagetoolbar~ImageToolbar}.
|
|
12
|
+
* It can be used to wrap images in links.
|
|
13
|
+
*/
|
|
14
|
+
export default class LinkImageUI extends Plugin {
|
|
15
|
+
/**
|
|
16
|
+
* @inheritDoc
|
|
17
|
+
*/
|
|
18
|
+
static get requires(): readonly [typeof LinkEditing, typeof LinkUI, "ImageBlockEditing"];
|
|
19
|
+
/**
|
|
20
|
+
* @inheritDoc
|
|
21
|
+
*/
|
|
22
|
+
static get pluginName(): "LinkImageUI";
|
|
23
|
+
/**
|
|
24
|
+
* @inheritDoc
|
|
25
|
+
*/
|
|
26
|
+
static get isOfficialPlugin(): true;
|
|
27
|
+
/**
|
|
28
|
+
* @inheritDoc
|
|
29
|
+
*/
|
|
30
|
+
init(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Creates a `LinkImageUI` button view.
|
|
33
|
+
*
|
|
34
|
+
* Clicking this button shows a {@link module:link/linkui~LinkUI#_balloon} attached to the selection.
|
|
35
|
+
* When an image is already linked, the view shows {@link module:link/linkui~LinkUI#actionsView} or
|
|
36
|
+
* {@link module:link/linkui~LinkUI#formView} if it is not.
|
|
37
|
+
*/
|
|
38
|
+
private _createToolbarLinkImageButton;
|
|
39
|
+
/**
|
|
40
|
+
* Returns true if a linked image (either block or inline) is the only selected element
|
|
41
|
+
* in the model document.
|
|
42
|
+
*/
|
|
43
|
+
private _isSelectedLinkedImage;
|
|
44
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module link/linkimageui
|
|
7
|
+
*/
|
|
8
|
+
import { ButtonView } from 'ckeditor5/src/ui.js';
|
|
9
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
10
|
+
import LinkUI from './linkui.js';
|
|
11
|
+
import LinkEditing from './linkediting.js';
|
|
12
|
+
import { LINK_KEYSTROKE } from './utils.js';
|
|
13
|
+
import linkIcon from '../theme/icons/link.svg';
|
|
14
|
+
/**
|
|
15
|
+
* The link image UI plugin.
|
|
16
|
+
*
|
|
17
|
+
* This plugin provides the `'linkImage'` button that can be displayed in the {@link module:image/imagetoolbar~ImageToolbar}.
|
|
18
|
+
* It can be used to wrap images in links.
|
|
19
|
+
*/
|
|
20
|
+
export default class LinkImageUI extends Plugin {
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
static get requires() {
|
|
25
|
+
return [LinkEditing, LinkUI, 'ImageBlockEditing'];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @inheritDoc
|
|
29
|
+
*/
|
|
30
|
+
static get pluginName() {
|
|
31
|
+
return 'LinkImageUI';
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @inheritDoc
|
|
35
|
+
*/
|
|
36
|
+
static get isOfficialPlugin() {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* @inheritDoc
|
|
41
|
+
*/
|
|
42
|
+
init() {
|
|
43
|
+
const editor = this.editor;
|
|
44
|
+
const viewDocument = editor.editing.view.document;
|
|
45
|
+
this.listenTo(viewDocument, 'click', (evt, data) => {
|
|
46
|
+
if (this._isSelectedLinkedImage(editor.model.document.selection)) {
|
|
47
|
+
// Prevent browser navigation when clicking a linked image.
|
|
48
|
+
data.preventDefault();
|
|
49
|
+
// Block the `LinkUI` plugin when an image was clicked.
|
|
50
|
+
// In such a case, we'd like to display the image toolbar.
|
|
51
|
+
evt.stop();
|
|
52
|
+
}
|
|
53
|
+
}, { priority: 'high' });
|
|
54
|
+
this._createToolbarLinkImageButton();
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Creates a `LinkImageUI` button view.
|
|
58
|
+
*
|
|
59
|
+
* Clicking this button shows a {@link module:link/linkui~LinkUI#_balloon} attached to the selection.
|
|
60
|
+
* When an image is already linked, the view shows {@link module:link/linkui~LinkUI#actionsView} or
|
|
61
|
+
* {@link module:link/linkui~LinkUI#formView} if it is not.
|
|
62
|
+
*/
|
|
63
|
+
_createToolbarLinkImageButton() {
|
|
64
|
+
const editor = this.editor;
|
|
65
|
+
const t = editor.t;
|
|
66
|
+
editor.ui.componentFactory.add('linkImage', locale => {
|
|
67
|
+
const button = new ButtonView(locale);
|
|
68
|
+
const plugin = editor.plugins.get('LinkUI');
|
|
69
|
+
const linkCommand = editor.commands.get('link');
|
|
70
|
+
button.set({
|
|
71
|
+
isEnabled: true,
|
|
72
|
+
label: t('Link image'),
|
|
73
|
+
icon: linkIcon,
|
|
74
|
+
keystroke: LINK_KEYSTROKE,
|
|
75
|
+
tooltip: true,
|
|
76
|
+
isToggleable: true
|
|
77
|
+
});
|
|
78
|
+
// Bind button to the command.
|
|
79
|
+
button.bind('isEnabled').to(linkCommand, 'isEnabled');
|
|
80
|
+
button.bind('isOn').to(linkCommand, 'value', value => !!value);
|
|
81
|
+
// Show the actionsView or formView (both from LinkUI) on button click depending on whether the image is linked already.
|
|
82
|
+
this.listenTo(button, 'execute', () => {
|
|
83
|
+
if (this._isSelectedLinkedImage(editor.model.document.selection)) {
|
|
84
|
+
plugin._addActionsView();
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
plugin._showUI(true);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
return button;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Returns true if a linked image (either block or inline) is the only selected element
|
|
95
|
+
* in the model document.
|
|
96
|
+
*/
|
|
97
|
+
_isSelectedLinkedImage(selection) {
|
|
98
|
+
const selectedModelElement = selection.getSelectedElement();
|
|
99
|
+
const imageUtils = this.editor.plugins.get('ImageUtils');
|
|
100
|
+
return imageUtils.isImage(selectedModelElement) && selectedModelElement.hasAttribute('linkHref');
|
|
101
|
+
}
|
|
102
|
+
}
|
package/src/linkui.d.ts
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module link/linkui
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { ContextualBalloon, type ViewWithCssTransitionDisabler } from 'ckeditor5/src/ui.js';
|
|
10
|
+
import LinkFormView from './ui/linkformview.js';
|
|
11
|
+
import LinkActionsView from './ui/linkactionsview.js';
|
|
12
|
+
/**
|
|
13
|
+
* The link UI plugin. It introduces the `'link'` and `'unlink'` buttons and support for the <kbd>Ctrl+K</kbd> keystroke.
|
|
14
|
+
*
|
|
15
|
+
* It uses the
|
|
16
|
+
* {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon contextual balloon plugin}.
|
|
17
|
+
*/
|
|
18
|
+
export default class LinkUI extends Plugin {
|
|
19
|
+
/**
|
|
20
|
+
* The actions view displayed inside of the balloon.
|
|
21
|
+
*/
|
|
22
|
+
actionsView: LinkActionsView | null;
|
|
23
|
+
/**
|
|
24
|
+
* The form view displayed inside the balloon.
|
|
25
|
+
*/
|
|
26
|
+
formView: LinkFormView & ViewWithCssTransitionDisabler | null;
|
|
27
|
+
/**
|
|
28
|
+
* The contextual balloon plugin instance.
|
|
29
|
+
*/
|
|
30
|
+
private _balloon;
|
|
31
|
+
/**
|
|
32
|
+
* @inheritDoc
|
|
33
|
+
*/
|
|
34
|
+
static get requires(): readonly [typeof ContextualBalloon];
|
|
35
|
+
/**
|
|
36
|
+
* @inheritDoc
|
|
37
|
+
*/
|
|
38
|
+
static get pluginName(): "LinkUI";
|
|
39
|
+
/**
|
|
40
|
+
* @inheritDoc
|
|
41
|
+
*/
|
|
42
|
+
static get isOfficialPlugin(): true;
|
|
43
|
+
/**
|
|
44
|
+
* @inheritDoc
|
|
45
|
+
*/
|
|
46
|
+
init(): void;
|
|
47
|
+
/**
|
|
48
|
+
* @inheritDoc
|
|
49
|
+
*/
|
|
50
|
+
destroy(): void;
|
|
51
|
+
/**
|
|
52
|
+
* Creates views.
|
|
53
|
+
*/
|
|
54
|
+
private _createViews;
|
|
55
|
+
/**
|
|
56
|
+
* Creates the {@link module:link/ui/linkactionsview~LinkActionsView} instance.
|
|
57
|
+
*/
|
|
58
|
+
private _createActionsView;
|
|
59
|
+
/**
|
|
60
|
+
* Creates the {@link module:link/ui/linkformview~LinkFormView} instance.
|
|
61
|
+
*/
|
|
62
|
+
private _createFormView;
|
|
63
|
+
/**
|
|
64
|
+
* Creates a toolbar Link button. Clicking this button will show
|
|
65
|
+
* a {@link #_balloon} attached to the selection.
|
|
66
|
+
*/
|
|
67
|
+
private _createToolbarLinkButton;
|
|
68
|
+
/**
|
|
69
|
+
* Creates a button for link command to use either in toolbar or in menu bar.
|
|
70
|
+
*/
|
|
71
|
+
private _createButton;
|
|
72
|
+
/**
|
|
73
|
+
* Attaches actions that control whether the balloon panel containing the
|
|
74
|
+
* {@link #formView} should be displayed.
|
|
75
|
+
*/
|
|
76
|
+
private _enableBalloonActivators;
|
|
77
|
+
/**
|
|
78
|
+
* Attaches actions that control whether the balloon panel containing the
|
|
79
|
+
* {@link #formView} is visible or not.
|
|
80
|
+
*/
|
|
81
|
+
private _enableUserBalloonInteractions;
|
|
82
|
+
/**
|
|
83
|
+
* Adds the {@link #actionsView} to the {@link #_balloon}.
|
|
84
|
+
*
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
_addActionsView(): void;
|
|
88
|
+
/**
|
|
89
|
+
* Adds the {@link #formView} to the {@link #_balloon}.
|
|
90
|
+
*/
|
|
91
|
+
private _addFormView;
|
|
92
|
+
/**
|
|
93
|
+
* Closes the form view. Decides whether the balloon should be hidden completely or if the action view should be shown. This is
|
|
94
|
+
* decided upon the link command value (which has a value if the document selection is in the link).
|
|
95
|
+
*
|
|
96
|
+
* Additionally, if any {@link module:link/linkconfig~LinkConfig#decorators} are defined in the editor configuration, the state of
|
|
97
|
+
* switch buttons responsible for manual decorator handling is restored.
|
|
98
|
+
*/
|
|
99
|
+
private _closeFormView;
|
|
100
|
+
/**
|
|
101
|
+
* Removes the {@link #formView} from the {@link #_balloon}.
|
|
102
|
+
*/
|
|
103
|
+
private _removeFormView;
|
|
104
|
+
/**
|
|
105
|
+
* Shows the correct UI type. It is either {@link #formView} or {@link #actionsView}.
|
|
106
|
+
*
|
|
107
|
+
* @internal
|
|
108
|
+
*/
|
|
109
|
+
_showUI(forceVisible?: boolean): void;
|
|
110
|
+
/**
|
|
111
|
+
* Removes the {@link #formView} from the {@link #_balloon}.
|
|
112
|
+
*
|
|
113
|
+
* See {@link #_addFormView}, {@link #_addActionsView}.
|
|
114
|
+
*/
|
|
115
|
+
private _hideUI;
|
|
116
|
+
/**
|
|
117
|
+
* Makes the UI react to the {@link module:ui/editorui/editorui~EditorUI#event:update} event to
|
|
118
|
+
* reposition itself when the editor UI should be refreshed.
|
|
119
|
+
*
|
|
120
|
+
* See: {@link #_hideUI} to learn when the UI stops reacting to the `update` event.
|
|
121
|
+
*/
|
|
122
|
+
private _startUpdatingUI;
|
|
123
|
+
/**
|
|
124
|
+
* Returns `true` when {@link #formView} is in the {@link #_balloon}.
|
|
125
|
+
*/
|
|
126
|
+
private get _isFormInPanel();
|
|
127
|
+
/**
|
|
128
|
+
* Returns `true` when {@link #actionsView} is in the {@link #_balloon}.
|
|
129
|
+
*/
|
|
130
|
+
private get _areActionsInPanel();
|
|
131
|
+
/**
|
|
132
|
+
* Returns `true` when {@link #actionsView} is in the {@link #_balloon} and it is
|
|
133
|
+
* currently visible.
|
|
134
|
+
*/
|
|
135
|
+
private get _areActionsVisible();
|
|
136
|
+
/**
|
|
137
|
+
* Returns `true` when {@link #actionsView} or {@link #formView} is in the {@link #_balloon}.
|
|
138
|
+
*/
|
|
139
|
+
private get _isUIInPanel();
|
|
140
|
+
/**
|
|
141
|
+
* Returns `true` when {@link #actionsView} or {@link #formView} is in the {@link #_balloon} and it is
|
|
142
|
+
* currently visible.
|
|
143
|
+
*/
|
|
144
|
+
private get _isUIVisible();
|
|
145
|
+
/**
|
|
146
|
+
* Returns positioning options for the {@link #_balloon}. They control the way the balloon is attached
|
|
147
|
+
* to the target element or selection.
|
|
148
|
+
*
|
|
149
|
+
* If the selection is collapsed and inside a link element, the panel will be attached to the
|
|
150
|
+
* entire link element. Otherwise, it will be attached to the selection.
|
|
151
|
+
*/
|
|
152
|
+
private _getBalloonPositionData;
|
|
153
|
+
/**
|
|
154
|
+
* Returns the link {@link module:engine/view/attributeelement~AttributeElement} under
|
|
155
|
+
* the {@link module:engine/view/document~Document editing view's} selection or `null`
|
|
156
|
+
* if there is none.
|
|
157
|
+
*
|
|
158
|
+
* **Note**: For a non–collapsed selection, the link element is returned when **fully**
|
|
159
|
+
* selected and the **only** element within the selection boundaries, or when
|
|
160
|
+
* a linked widget is selected.
|
|
161
|
+
*/
|
|
162
|
+
private _getSelectedLinkElement;
|
|
163
|
+
/**
|
|
164
|
+
* Displays a fake visual selection when the contextual balloon is displayed.
|
|
165
|
+
*
|
|
166
|
+
* This adds a 'link-ui' marker into the document that is rendered as a highlight on selected text fragment.
|
|
167
|
+
*/
|
|
168
|
+
private _showFakeVisualSelection;
|
|
169
|
+
/**
|
|
170
|
+
* Hides the fake visual selection created in {@link #_showFakeVisualSelection}.
|
|
171
|
+
*/
|
|
172
|
+
private _hideFakeVisualSelection;
|
|
173
|
+
}
|