UNPKG

1.9 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 */
5/**
6 * @module block-quote/blockquotecommand
7 */
8import { Command } from 'ckeditor5/src/core.js';
9/**
10 * The block quote command plugin.
11 *
12 * @extends module:core/command~Command
13 */
14export default class BlockQuoteCommand extends Command {
15 /**
16 * Whether the selection starts in a block quote.
17 *
18 * @observable
19 * @readonly
20 */
21 value: boolean;
22 /**
23 * @inheritDoc
24 */
25 refresh(): void;
26 /**
27 * Executes the command. When the command {@link #value is on}, all top-most block quotes within
28 * the selection will be removed. If it is off, all selected blocks will be wrapped with
29 * a block quote.
30 *
31 * @fires execute
32 * @param options Command options.
33 * @param options.forceValue If set, it will force the command behavior. If `true`, the command will apply a block quote,
34 * otherwise the command will remove the block quote. If not set, the command will act basing on its current value.
35 */
36 execute(options?: {
37 forceValue?: boolean;
38 }): void;
39 /**
40 * Checks the command's {@link #value}.
41 */
42 private _getValue;
43 /**
44 * Checks whether the command can be enabled in the current context.
45 *
46 * @returns Whether the command should be enabled.
47 */
48 private _checkEnabled;
49 /**
50 * Removes the quote from given blocks.
51 *
52 * If blocks which are supposed to be "unquoted" are in the middle of a quote,
53 * start it or end it, then the quote will be split (if needed) and the blocks
54 * will be moved out of it, so other quoted blocks remained quoted.
55 */
56 private _removeQuote;
57 /**
58 * Applies the quote to given blocks.
59 */
60 private _applyQuote;
61}