UNPKG

1.03 kBTypeScriptView Raw
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 */
5import { Command } from 'ckeditor5/src/core.js';
6/**
7 * The insert media command.
8 *
9 * The command is registered by the {@link module:media-embed/mediaembedediting~MediaEmbedEditing} as `'mediaEmbed'`.
10 *
11 * To insert media at the current selection, execute the command and specify the URL:
12 *
13 * ```ts
14 * editor.execute( 'mediaEmbed', 'http://url.to.the/media' );
15 * ```
16 */
17export default class MediaEmbedCommand extends Command {
18 /**
19 * Media url.
20 */
21 value: string | undefined;
22 /**
23 * @inheritDoc
24 */
25 refresh(): void;
26 /**
27 * Executes the command, which either:
28 *
29 * * updates the URL of the selected media,
30 * * inserts the new media into the editor and puts the selection around it.
31 *
32 * @fires execute
33 * @param url The URL of the media.
34 */
35 execute(url: string): void;
36}