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 { ButtonView, View, FocusCycler, LabeledFieldView, type InputTextView } from 'ckeditor5/src/ui.js';
|
6 | import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils.js';
|
7 | /**
|
8 | * The insert an image via URL view.
|
9 | *
|
10 | * See {@link module:image/imageinsert/imageinsertviaurlui~ImageInsertViaUrlUI}.
|
11 | */
|
12 | export default class ImageInsertUrlView extends View {
|
13 | /**
|
14 | * The URL input field view.
|
15 | */
|
16 | urlInputView: LabeledFieldView<InputTextView>;
|
17 | /**
|
18 | * The "insert/update" button view.
|
19 | */
|
20 | insertButtonView: ButtonView;
|
21 | /**
|
22 | * The "cancel" button view.
|
23 | */
|
24 | cancelButtonView: ButtonView;
|
25 | /**
|
26 | * The value of the URL input.
|
27 | *
|
28 | * @observable
|
29 | */
|
30 | imageURLInputValue: string;
|
31 | /**
|
32 | * Observable property used to alter labels while some image is selected and when it is not.
|
33 | *
|
34 | * @observable
|
35 | */
|
36 | isImageSelected: boolean;
|
37 | /**
|
38 | * Observable property indicating whether the form interactive elements should be enabled.
|
39 | *
|
40 | * @observable
|
41 | */
|
42 | isEnabled: boolean;
|
43 | /**
|
44 | * Tracks information about DOM focus in the form.
|
45 | */
|
46 | readonly focusTracker: FocusTracker;
|
47 | /**
|
48 | * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
49 | */
|
50 | readonly keystrokes: KeystrokeHandler;
|
51 | /**
|
52 | * Helps cycling over {@link #_focusables} in the form.
|
53 | */
|
54 | readonly focusCycler: FocusCycler;
|
55 | /**
|
56 | * A collection of views that can be focused in the form.
|
57 | */
|
58 | private readonly _focusables;
|
59 | /**
|
60 | * Creates a view for the dropdown panel of {@link module:image/imageinsert/imageinsertui~ImageInsertUI}.
|
61 | *
|
62 | * @param locale The localization services instance.
|
63 | */
|
64 | constructor(locale: Locale);
|
65 | /**
|
66 | * @inheritDoc
|
67 | */
|
68 | render(): void;
|
69 | /**
|
70 | * @inheritDoc
|
71 | */
|
72 | destroy(): void;
|
73 | /**
|
74 | * Creates the { #urlInputView}.
|
75 | */
|
76 | private _createUrlInputView;
|
77 | /**
|
78 | * Creates the {@link #insertButtonView}.
|
79 | */
|
80 | private _createInsertButton;
|
81 | /**
|
82 | * Creates the {@link #cancelButtonView}.
|
83 | */
|
84 | private _createCancelButton;
|
85 | /**
|
86 | * Focuses the view.
|
87 | */
|
88 | focus(direction: 1 | -1): void;
|
89 | }
|
90 | /**
|
91 | * Fired when the form view is submitted.
|
92 | *
|
93 | * @eventName ~ImageInsertUrlView#submit
|
94 | */
|
95 | export type ImageInsertUrlViewSubmitEvent = {
|
96 | name: 'submit';
|
97 | args: [];
|
98 | };
|
99 | /**
|
100 | * Fired when the form view is canceled.
|
101 | *
|
102 | * @eventName ~ImageInsertUrlView#cancel
|
103 | */
|
104 | export type ImageInsertUrlViewCancelEvent = {
|
105 | name: 'cancel';
|
106 | args: [];
|
107 | };
|