Skip to content

Commit

Permalink
Allow string selector for container (#3755)
Browse files Browse the repository at this point in the history
* 🐛 Allow string selector for container

* Update quill.ts

---------

Co-authored-by: Zihua Li <i@zihua.li>
  • Loading branch information
xavivars and luin authored Apr 20, 2023
1 parent bfb5845 commit e841b0d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions core/quill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, unknown>;
}

Expand All @@ -42,6 +42,8 @@ interface ExpandedOptions extends Omit<Options, 'theme'> {
registry: Parchment.Registry;
container: HTMLElement;
modules: Record<string, unknown>;
bounds?: HTMLElement | null;
scrollingContainer?: HTMLElement | null;
}

class Quill {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -684,7 +686,7 @@ class Quill {
}

function expandConfig(
container: HTMLElement,
container: HTMLElement | string,
userConfig: Options,
): ExpandedOptions {
let expandedConfig = merge(
Expand Down

0 comments on commit e841b0d

Please sign in to comment.