From e841b0d2263a34c5c179a5a442d83efd6e4fa27f Mon Sep 17 00:00:00 2001 From: Xavi Ivars Date: Thu, 20 Apr 2023 06:34:04 +0200 Subject: [PATCH] Allow string selector for container (#3755) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🐛 Allow string selector for container * Update quill.ts --------- Co-authored-by: Zihua Li --- core/quill.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/core/quill.ts b/core/quill.ts index 1f0e9f1b4d..abdc7ceb2d 100644 --- a/core/quill.ts +++ b/core/quill.ts @@ -30,10 +30,10 @@ interface Options { debug?: string | boolean; registry?: Parchment.Registry; readOnly?: boolean; - container?: HTMLElement; + container?: HTMLElement | string; placeholder?: string; - bounds?: HTMLElement | null; - scrollingContainer?: HTMLElement | null; + bounds?: HTMLElement | string | null; + scrollingContainer?: HTMLElement | string | null; modules?: Record; } @@ -42,6 +42,8 @@ interface ExpandedOptions extends Omit { registry: Parchment.Registry; container: HTMLElement; modules: Record; + bounds?: HTMLElement | null; + scrollingContainer?: HTMLElement | null; } class Quill { @@ -147,7 +149,7 @@ class Quill { options: ExpandedOptions; - constructor(container: HTMLElement, options: Options = {}) { + constructor(container: HTMLElement | string, options: Options = {}) { this.options = expandConfig(container, options); this.container = this.options.container; if (this.container == null) { @@ -684,7 +686,7 @@ class Quill { } function expandConfig( - container: HTMLElement, + container: HTMLElement | string, userConfig: Options, ): ExpandedOptions { let expandedConfig = merge(