From 085e65562c2dfcc106838f458193f5c3dbacc99a Mon Sep 17 00:00:00 2001 From: Singwai Chan Date: Sun, 26 Mar 2023 08:31:16 -0400 Subject: [PATCH] improve typing (#5010) --- index.d.ts | 18 +++++++++++++++++- src/rich_text_editor/model/RichTextEditor.ts | 3 ++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/index.d.ts b/index.d.ts index e61f292f2..ca0aec46c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -7,9 +7,10 @@ declare namespace Backbone { collection: Collection; cid: string; get(prop: K): T[K]; - set(prop: K, val: T[K]): void; + set(prop: K, val: T[K], opt?: any): void; defaults(): T; on(eventName: string, callback: (...args: any[]) => void): this; + off(eventName: string, callback: (...args: any[]) => void): this; toJSON(options?: any): any; } @@ -725,6 +726,8 @@ declare namespace grapesjs { model?: Component; el?: HTMLElement; }): void; + + render(): void; } interface View { } @@ -4871,6 +4874,19 @@ declare namespace grapesjs { * Get the toolbar element */ getToolbarEl(): HTMLElement; + + /** + * Retrieves the standard (non-custom) rich text editor + */ + globalRte?: RichTextEditor + + /** + * Wrapper around [execCommand](https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand) to allow + * you to perform operations like `insertText` + * @param {string} command Command name + * @param {any} [value=null Command's arguments + */ + exec(command: string, value: string); } /** diff --git a/src/rich_text_editor/model/RichTextEditor.ts b/src/rich_text_editor/model/RichTextEditor.ts index cfa111c6a..59e9bee77 100644 --- a/src/rich_text_editor/model/RichTextEditor.ts +++ b/src/rich_text_editor/model/RichTextEditor.ts @@ -355,7 +355,8 @@ export default class RichTextEditor { } /** - * Execute the command + * Wrapper around [execCommand](https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand) to allow + * you to perform operations like `insertText` * @param {string} command Command name * @param {any} [value=null Command's arguments */