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 | import { ButtonView, View, ViewCollection, FocusCycler } from 'ckeditor5/src/ui';
|
6 | import { Collection, FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils';
|
7 | import '../../../theme/imageinsert.css';
|
8 | export type ViewWithName = View & {
|
9 | name: string;
|
10 | };
|
11 | /**
|
12 | * The insert an image via URL view controller class.
|
13 | *
|
14 | * See {@link module:image/imageinsert/ui/imageinsertpanelview~ImageInsertPanelView}.
|
15 | */
|
16 | export default class ImageInsertPanelView extends View {
|
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 | * Tracks information about DOM focus in the form.
|
33 | */
|
34 | readonly focusTracker: FocusTracker;
|
35 | /**
|
36 | * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
37 | */
|
38 | readonly keystrokes: KeystrokeHandler;
|
39 | /**
|
40 | * A collection of views that can be focused in the form.
|
41 | */
|
42 | protected readonly _focusables: ViewCollection;
|
43 | /**
|
44 | * Helps cycling over {@link #_focusables} in the form.
|
45 | */
|
46 | protected readonly _focusCycler: FocusCycler;
|
47 | /**
|
48 | * A collection of the defined integrations for inserting the images.
|
49 | *
|
50 | * @private
|
51 | */
|
52 | _integrations: Collection<ViewWithName>;
|
53 | /**
|
54 | * Creates a view for the dropdown panel of {@link module:image/imageinsert/imageinsertui~ImageInsertUI}.
|
55 | *
|
56 | * @param locale The localization services instance.
|
57 | * @param integrations An integrations object that contains components (or tokens for components) to be shown in the panel view.
|
58 | */
|
59 | constructor(locale: Locale, integrations?: Record<string, View>);
|
60 | /**
|
61 | * @inheritDoc
|
62 | */
|
63 | render(): void;
|
64 | /**
|
65 | * @inheritDoc
|
66 | */
|
67 | destroy(): void;
|
68 | /**
|
69 | * Returns a view of the integration.
|
70 | *
|
71 | * @param name The name of the integration.
|
72 | */
|
73 | getIntegration(name: string): View;
|
74 | /**
|
75 | * Creates the following form controls:
|
76 | *
|
77 | * * { #insertButtonView},
|
78 | * * { #cancelButtonView}.
|
79 | *
|
80 | * locale The localization services instance.
|
81 | */
|
82 | private _createActionButtons;
|
83 | /**
|
84 | * Focuses the first {@link #_focusables focusable} in the form.
|
85 | */
|
86 | focus(): void;
|
87 | }
|
88 | /**
|
89 | * Fired when the form view is submitted (when one of the children triggered the submit event),
|
90 | * e.g. by a click on {@link ~ImageInsertPanelView#insertButtonView}.
|
91 | *
|
92 | * @eventName ~ImageInsertPanelView#submit
|
93 | */
|
94 | export type SubmitEvent = {
|
95 | name: 'submit';
|
96 | args: [];
|
97 | };
|
98 | /**
|
99 | * Fired when the form view is canceled, e.g. by a click on {@link ~ImageInsertPanelView#cancelButtonView}.
|
100 | *
|
101 | * @eventName ~ImageInsertPanelView#cancel
|
102 | */
|
103 | export type CancelEvent = {
|
104 | name: 'cancel';
|
105 | args: [];
|
106 | };
|