1 | /**
|
2 | * @license Copyright (c) 2003-2023, 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/ui/linkactionsview
|
7 | */
|
8 | import { ButtonView, View } from 'ckeditor5/src/ui';
|
9 | import { FocusTracker, KeystrokeHandler, type LocaleTranslate, type Locale } from 'ckeditor5/src/utils';
|
10 | import '@ckeditor/ckeditor5-ui/theme/components/responsive-form/responsiveform.css';
|
11 | import '../../theme/linkactions.css';
|
12 | /**
|
13 | * The link actions view class. This view displays the link preview, allows
|
14 | * unlinking or editing the link.
|
15 | */
|
16 | export default class LinkActionsView extends View {
|
17 | /**
|
18 | * Tracks information about DOM focus in the actions.
|
19 | */
|
20 | readonly focusTracker: FocusTracker;
|
21 | /**
|
22 | * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
23 | */
|
24 | readonly keystrokes: KeystrokeHandler;
|
25 | /**
|
26 | * The href preview view.
|
27 | */
|
28 | previewButtonView: View;
|
29 | /**
|
30 | * The unlink button view.
|
31 | */
|
32 | unlinkButtonView: ButtonView;
|
33 | /**
|
34 | * The edit link button view.
|
35 | */
|
36 | editButtonView: ButtonView;
|
37 | /**
|
38 | * The value of the "href" attribute of the link to use in the {@link #previewButtonView}.
|
39 | *
|
40 | * @observable
|
41 | */
|
42 | href: string | undefined;
|
43 | /**
|
44 | * A collection of views that can be focused in the view.
|
45 | */
|
46 | private readonly _focusables;
|
47 | /**
|
48 | * Helps cycling over {@link #_focusables} in the view.
|
49 | */
|
50 | private readonly _focusCycler;
|
51 | t: LocaleTranslate;
|
52 | /**
|
53 | * @inheritDoc
|
54 | */
|
55 | constructor(locale: Locale);
|
56 | /**
|
57 | * @inheritDoc
|
58 | */
|
59 | render(): void;
|
60 | /**
|
61 | * @inheritDoc
|
62 | */
|
63 | destroy(): void;
|
64 | /**
|
65 | * Focuses the fist {in the actions.
#_focusables} |
66 | */
|
67 | focus(): void;
|
68 | /**
|
69 | * Creates a button view.
|
70 | *
|
71 | * @param label The button label.
|
72 | * @param icon The button icon.
|
73 | * @param eventName An event name that the `ButtonView#execute` event will be delegated to.
|
74 | * @returns The button view instance.
|
75 | */
|
76 | private _createButton;
|
77 | /**
|
78 | * Creates a link href preview button.
|
79 | *
|
80 | * @returns The button view instance.
|
81 | */
|
82 | private _createPreviewButton;
|
83 | }
|
84 | /**
|
85 | * Fired when the {@link ~LinkActionsView#editButtonView} is clicked.
|
86 | *
|
87 | * @eventName ~LinkActionsView#edit
|
88 | */
|
89 | export type EditEvent = {
|
90 | name: 'edit';
|
91 | args: [];
|
92 | };
|
93 | /**
|
94 | * Fired when the {@link ~LinkActionsView#unlinkButtonView} is clicked.
|
95 | *
|
96 | * @eventName ~LinkActionsView#unlink
|
97 | */
|
98 | export type UnlinkEvent = {
|
99 | name: 'unlink';
|
100 | args: [];
|
101 | };
|