Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
hzgotb committed Apr 19, 2024
1 parent d8a8d50 commit 6d92a98
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packages/quill/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import Delta, { Op, OpIterator, AttributeMap } from 'quill-delta';
import Input from './modules/input.js';
import UINode from './modules/uiNode.js';

export { default as Module } from './core/module.js'
export { default as Module } from './core/module.js';
export { Delta, Op, OpIterator, AttributeMap, Parchment, Range };
export type {
Bounds,
Expand Down
29 changes: 18 additions & 11 deletions packages/quill/src/core/quill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ const debug = logger('quill');
const globalRegistry = new Parchment.Registry();
Parchment.ParentBlot.uiClass = 'ql-ui';

type ClassToConstructor<T> = { new (...args: any[]): T & object }
type ClassToConstructor<T> = { new (...args: any[]): T & object };

type RegistryTarget = Parchment.RegistryDefinition | Module | boolean
type RegistryTarget = Parchment.RegistryDefinition | Module | boolean;

interface RegistryRecord {
[key: `blots/${string}`]: Parchment.BlotConstructor
[key: `formats/${string}`]: Parchment.BlotConstructor | Parchment.Attributor
[key: `attributors/${string}`]: Parchment.Attributor
[key: `modules/${string}`]: ClassToConstructor<Module>
[key: `themes/${string}`]: ClassToConstructor<Theme>
[key: `blots/${string}`]: Parchment.BlotConstructor;
[key: `formats/${string}`]: Parchment.BlotConstructor | Parchment.Attributor;
[key: `attributors/${string}`]: Parchment.Attributor;
[key: `modules/${string}`]: ClassToConstructor<Module>;
[key: `themes/${string}`]: ClassToConstructor<Theme>;
[key: string]: any;
}

Expand Down Expand Up @@ -134,9 +134,16 @@ class Quill {
return this.imports[name];
}

static register(record: RegistryRecord, overwrite?: boolean): void
static register(target: Omit<RegistryTarget, 'boolean' | 'Module'>, overwrite?: boolean): void
static register(path: string, target: RegistryTarget, overwrite?: boolean): void
static register(record: RegistryRecord, overwrite?: boolean): void;
static register(
target: Omit<RegistryTarget, 'boolean' | 'Module'>,
overwrite?: boolean,
): void;
static register(
path: string,
target: RegistryTarget,
overwrite?: boolean,
): void;
static register(...args: any[]): void {
const path = typeof args[0] === 'string' ? args[0] : '';
const target = path ? args[1] : args[0];
Expand All @@ -157,7 +164,7 @@ class Quill {
if (typeof target.register === 'function') {
target.register(globalRegistry);
}
return
return;
}
const name: string | undefined = target['attrName'] ?? target['blotName'];
if (typeof name === 'string') {
Expand Down
2 changes: 1 addition & 1 deletion packages/quill/src/quill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Quill.register(
true,
);

export { default as Module } from './core/module.js'
export { default as Module } from './core/module.js';
export type {
Bounds,
DebugLevel,
Expand Down

0 comments on commit 6d92a98

Please sign in to comment.