diff --git a/eslint.config.mjs b/eslint.config.mjs index 15237fb..82cf9e9 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -47,6 +47,7 @@ export default antfu( 'no-restricted-globals': 'off', 'eqeqeq': 'off', + 'no-new': 'off', 'no-new-func': 'off', 'no-alert': 'off', 'prefer-promise-reject-errors': 'off', diff --git a/packages/docs/fluent-editor/docs/api/fluent-editor-class.md b/packages/docs/fluent-editor/docs/api/fluent-editor-class.md index 655af9c..cd8c959 100644 --- a/packages/docs/fluent-editor/docs/api/fluent-editor-class.md +++ b/packages/docs/fluent-editor/docs/api/fluent-editor-class.md @@ -19,7 +19,9 @@ FluentEditor 类继承自 Quill 类,包含了 Quill 类的全部静态变量 - 类型 ```typescript -Quill.import(path): any +class Quill { + static import(path): any +} ``` - 详细信息 @@ -51,9 +53,12 @@ const Link = FluentEditor.import('formats/link') - 类型 ```typescript -Quill.register(format: Attributor | BlotDefinintion, supressWarning: boolean = false) -Quill.register(path: string, def: any, supressWarning: boolean = false) -Quill.register(defs: { [path: string]: any }, supressWarning: boolean = false) +class Quill { + static register(format: Attributor | BlotDefinintion, supressWarning: boolean = false): void + static register(path: string, def: any, supressWarning: boolean = false): void + static register(defs: { [path: string]: any }, supressWarning: boolean = false): void + static register(...args: any[]): void +} ``` - 详细信息 diff --git a/packages/docs/fluent-editor/docs/api/fluent-editor-instance.md b/packages/docs/fluent-editor/docs/api/fluent-editor-instance.md index ddbc37c..4631d77 100644 --- a/packages/docs/fluent-editor/docs/api/fluent-editor-instance.md +++ b/packages/docs/fluent-editor/docs/api/fluent-editor-instance.md @@ -19,8 +19,10 @@ Fluent Editor 基于 Quill,因此 Fluent Editor 的实例对象包含 Quill - 类型 -```typescript -getModule(name: string): any +```ts +class Quill { + getModule(name: string): any +} ``` - 详细信息 @@ -43,7 +45,9 @@ const i18n = quill.getModule('i18n') - 类型 ```typescript -getContents(index: number = 0, length: number = remaining): Delta +class Quill { + getContents(index: number = 0, length: number = remaining): Delta +} ``` - 详细信息 @@ -65,7 +69,9 @@ const delta = editor.getContents() - 类型 ```typescript -setContents(delta: Delta, source: string = 'api'): Delta +class Quill { + setContents(delta: Delta, source: string = 'api'): Delta +} ``` - 详细信息 @@ -79,7 +85,7 @@ editor.setContents([ { insert: 'Hello ' }, { insert: 'World!', attributes: { bold: true } }, { insert: '\n' }, -]); +]) ``` - 参考[内容初始化](/docs/demo/set-content) diff --git a/packages/docs/fluent-editor/docs/api/options.md b/packages/docs/fluent-editor/docs/api/options.md index 7a10722..4b60f05 100644 --- a/packages/docs/fluent-editor/docs/api/options.md +++ b/packages/docs/fluent-editor/docs/api/options.md @@ -21,19 +21,19 @@ export interface FluentEditorOptions extends QuillOptions { 'better-table'?: boolean | BetterTableOptions // 字符统计模块 - counter: boolean | CounterOption + 'counter': boolean | CounterOption // 表情模块 'emoji-toolbar'?: boolean // 文件上传模块 - file?: boolean + 'file'?: boolean // 可编辑公式模块 - mathlive: boolean + 'mathlive': boolean // @提醒模块 - mention?: boolean | MentionOptions + 'mention'?: boolean | MentionOptions } // 是否给超链接自动增加协议前缀 diff --git a/packages/docs/fluent-editor/docs/modules/header-list.md b/packages/docs/fluent-editor/docs/modules/header-list.md index 713b580..97ed899 100644 --- a/packages/docs/fluent-editor/docs/modules/header-list.md +++ b/packages/docs/fluent-editor/docs/modules/header-list.md @@ -23,8 +23,8 @@ new FluentEditor('#editor', { 'toolbar': { container: [[{ header: [null, 1, 2, 3, 4, 5, 6] }, 'header-list']], handlers: { - 'header-list': HeaderList.toolbarHandle - } + 'header-list': HeaderList.toolbarHandle, + }, }, 'header-list': { container: document.getElementById('directory'), // 指定一个元素来接收头部列表 @@ -35,16 +35,16 @@ new FluentEditor('#editor', { ## Options 配置 -| 名称 | 类型 | 描述 | 默认值 | 是否必选 | -| --------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- | ----------- | -------- | -| container | `string \| HTMLElement` | 列表容器,字符串必须是元素的id | - | `true` | -| scrollContainer | `string \| HTMLElement` | 编辑器滚动容器,默认是 `quill.root` | - | `false` | -| hideClass | `number` | 列表隐藏时的类名 | `is-hidden` | `false` | -| topOffset | `number \| () => number` | 从顶部的偏移量(单位为 `px`) | `0` | `false` | +| 名称 | 类型 | 描述 | 默认值 | 是否必选 | +| --------------- | ------------------------ | ---------------------------------------------------------------------------- | ----------- | -------- | +| container | `string \| HTMLElement` | 列表容器,字符串必须是元素的id | - | `true` | +| scrollContainer | `string \| HTMLElement` | 编辑器滚动容器,默认是 `quill.root` | - | `false` | +| hideClass | `number` | 列表隐藏时的类名 | `is-hidden` | `false` | +| topOffset | `number \| () => number` | 从顶部的偏移量(单位为 `px`) | `0` | `false` | | headerHeight | `number` | 编辑器中的头部高度,这是用于计算头部滚动高亮的,不要使h1和h6之间的高度差过大 | `36` | `false` | -| onBeforeShow | `() => boolean` | 在显示前触发,返回 `true` 将取消显示 | - | `false` | -| onBeforeHide | `() => boolean` | 在隐藏前触发,返回 `true` 将取消隐藏 | - | `false` | -| onItemClick | `(id: string) => void` | 点击列表项时触发,id是头部元素的id | - | `false` | +| onBeforeShow | `() => boolean` | 在显示前触发,返回 `true` 将取消显示 | - | `false` | +| onBeforeHide | `() => boolean` | 在隐藏前触发,返回 `true` 将取消隐藏 | - | `false` | +| onItemClick | `(id: string) => void` | 点击列表项时触发,id是头部元素的id | - | `false` | ## 其他 @@ -54,7 +54,7 @@ new FluentEditor('#editor', { new FluentEditor('#editor', { theme: 'snow', modules: { - 'toolbar': [[{ header: [null, 1, 2, 3, 4, 5, 6] }, 'header-list'],], + 'toolbar': [[{ header: [null, 1, 2, 3, 4, 5, 6] }, 'header-list']], 'header-list': { container: document.getElementById('directory'), // 指定一个元素来接收头部列表 topOffset: () => { diff --git a/packages/docs/fluent-editor/docs/used-in-framework.md b/packages/docs/fluent-editor/docs/used-in-framework.md index a6941bd..dc2cdb2 100644 --- a/packages/docs/fluent-editor/docs/used-in-framework.md +++ b/packages/docs/fluent-editor/docs/used-in-framework.md @@ -18,7 +18,6 @@ import FluentEditor from '@opentiny/fluent-editor' import { onMounted } from 'vue' onMounted(() => { - // eslint-disable-next-line no-new new FluentEditor('#editor', { theme: 'snow', }) @@ -106,7 +105,6 @@ export class AppComponent { title = 'my-app' ngAfterViewInit() { - // eslint-disable-next-line no-new new FluentEditor('#editor', { theme: 'snow', })