-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: add api/modules docs #200
Conversation
Warning Rate limit exceeded@kagol has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 18 minutes and 46 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (6)
WalkthroughThis pull request focuses on enhancing the documentation for the Fluent Editor package. The changes involve updating the sidebar configuration, adding comprehensive documentation for various modules and APIs, and reorganizing the documentation structure. New sections have been introduced for API references, module ecosystems, and detailed explanations of features like toolbar tips, header lists, internationalization, and screenshot functionality. Changes
Possibly related PRs
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
WalkthroughThis pull request introduces new documentation for the API and modules of the Fluent Editor. It updates the sidebar links to point to new demo paths and adds detailed API references for Fluent Editor classes, instances, and configuration options. Changes
|
], | ||
}, | ||
{ | ||
text: '模块生态', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure that the new links added to the sidebar are correctly pointing to the intended documentation paths. Incorrect links can lead to navigation issues.
0c4f604
to
8ebe5eb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caution
Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments.
Actionable comments posted: 7
🧹 Nitpick comments (8)
packages/docs/fluent-editor/.vitepress/sidebar.ts (1)
8-27
: LGTM! Well-organized documentation structure.The documentation sections are logically organized, with a clear progression from basic usage to advanced features. The consistent use of the
/docs/demo/
prefix improves navigation predictability.Consider adding English translations for the section titles to improve accessibility for non-Chinese users. For example:
- text: '使用示例', + text: '使用示例 (Usage Examples)',packages/docs/fluent-editor/docs/api/options.md (2)
46-56
: Improve type definitions and documentation for upload options.The upload configuration could benefit from more specific types and better documentation:
uploadOption?: { - imageUpload?: ({ file, callback, editor }) => void + imageUpload?: (params: { + file: File; + callback: (url: string) => void; + editor: FluentEditor; + }) => void; - imageAccept?: Array<string>[] | string + imageAccept?: string[] | string; - fileAccept?: Array<string>[] | string + fileAccept?: string[] | string; fileUpload: ({ file, callback, editor }) => void isVideoPlay?: boolean - maxSize?: number + maxSize?: number; // Maximum file size in bytes success?: (file: File) => void fail?: (file: File) => void multiple?: boolean }
62-65
: Document i18n configuration options.Add more detailed descriptions for the internationalization options:
i18n?: { - lang?: string + lang?: string; // Language code (e.g., 'en-US', 'zh-CN') - langText?: Record<string, string> + langText?: Record<string, string>; // Custom translation overrides }packages/docs/fluent-editor/docs/modules/toolbar-tip.md (2)
15-43
: Consider using TypeScript consistently in code examplesThe code example uses TypeScript for imports but lacks type annotations for variables. Consider adding type annotations for better documentation:
-const QuillToolbarTipOption = { +const QuillToolbarTipOption: Record<string, any> = { tipTextMap: defaultToolbarTip["en-US"], }; -const editor = new FluentEditor("#editor", { +const editor: FluentEditor = new FluentEditor("#editor", {
120-124
: Enhance configuration table with examplesConsider adding an "Example" column to the configuration table to provide concrete examples for each option.
packages/docs/fluent-editor/docs/demo/screenshot.md (2)
7-12
: Add security and performance considerationsConsider adding sections about:
- Security implications of using screenshots (e.g., data privacy)
- Performance impact of html2canvas
- Browser compatibility matrix
21-21
: Add error handling guidanceThe documentation should include guidance on handling potential errors during screenshot creation and upload.
packages/docs/fluent-editor/docs/modules/header-list.md (1)
38-48
: Add accessibility considerationsConsider adding documentation about:
- Keyboard navigation in the header list
- Screen reader compatibility
- ARIA attributes support
🛑 Comments failed to post (7)
packages/docs/fluent-editor/docs/api/fluent-editor-instance.md (3)
45-47:
⚠️ Potential issueFix TypeScript syntax error and improve return type documentation.
Add a semicolon and document the Delta type:
-getContents(index: number = 0, length: number = remaining): Delta +getContents(index: number = 0, length: number = remaining): Delta;Consider importing and documenting the Delta type:
import { Delta } from 'quill-delta';🧰 Tools
🪛 GitHub Actions: autofix.ci
[error] 46-46: Parsing error: ',' expected
22-24:
⚠️ Potential issueFix TypeScript syntax error.
Add a semicolon to the type definition to resolve the parsing error:
-getModule(name: string): any +getModule(name: string): any;🧰 Tools
🪛 GitHub Actions: autofix.ci
[error] 23-23: Parsing error: ',' expected
67-69:
⚠️ Potential issueFix TypeScript syntax error and clarify source parameter.
Add a semicolon and document the source parameter options:
-setContents(delta: Delta, source: string = 'api'): Delta +setContents(delta: Delta, source: 'user' | 'api' | 'silent' = 'api'): Delta;🧰 Tools
🪛 GitHub Actions: autofix.ci
[error] 68-68: Parsing error: ',' expected
packages/docs/fluent-editor/docs/api/fluent-editor-class.md (2)
54-57:
⚠️ Potential issueFix TypeScript syntax errors in type definitions.
Add semicolons and improve type documentation:
-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) +Quill.register(format: Attributor | BlotDefinition, suppressWarning: boolean = false); +Quill.register(path: string, def: any, suppressWarning: boolean = false); +Quill.register(defs: { [path: string]: any }, suppressWarning: boolean = false);Also note the typo corrections:
BlotDefinintion
→BlotDefinition
supressWarning
→suppressWarning
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.Quill.register(format: Attributor | BlotDefinition, suppressWarning: boolean = false); Quill.register(path: string, def: any, suppressWarning: boolean = false); Quill.register(defs: { [path: string]: any }, suppressWarning: boolean = false);
🧰 Tools
🪛 GitHub Actions: autofix.ci
[error] 54-54: Parsing error: ',' expected
38-40:
⚠️ Potential issueFix duplicate variable declaration and incorrect import.
There's a duplicate
Mention
variable declaration and an incorrect theme import:const Toolbar = FluentEditor.import('modules/toolbar') const Mention = FluentEditor.import('modules/mention') -const Mention = FluentEditor.import('themes/snow') +const Snow = FluentEditor.import('themes/snow')Committable suggestion skipped: line range outside the PR's diff.
packages/docs/fluent-editor/docs/modules/header-list.md (2)
20-34:
⚠️ Potential issueAddress linting issues and add error handling
- The linting error "Do not use 'new' for side effects" should be addressed.
- Add error handling documentation for common scenarios.
-new FluentEditor('#editor', { +const editor = new FluentEditor('#editor', { // ... configuration ... });Also applies to: 54-70
🧰 Tools
🪛 GitHub Check: lint
[failure] 20-20:
Do not use 'new' for side effects🪛 GitHub Actions: autofix.ci
[error] 20-20: Do not use 'new' for side effects (no-new)
62-62: 🛠️ Refactor suggestion
Add null check for querySelector
The current code might throw if the selector doesn't match any elements. Consider adding a more robust null check:
-const navOffset = document.querySelector('.fixed')?.getBoundingClientRect().height || 0 +const fixedElement = document.querySelector('.fixed') +const navOffset = fixedElement ? fixedElement.getBoundingClientRect().height : 0📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.const fixedElement = document.querySelector('.fixed') const navOffset = fixedElement ? fixedElement.getBoundingClientRect().height : 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (1)
packages/docs/fluent-editor/docs/modules/header-list.md (1)
38-47
: Improve table formatting for better readabilityThe table's column alignment and escape characters could be improved.
Apply these changes to the table:
-| 名称 | 类型 | 描述 | 默认值 | 是否必选 | -| --------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- | ----------- | -------- | +| 名称 | 类型 | 描述 | 默认值 | 是否必选 | +| --------------- | ----------------------- | ------------------------------------------------------------------ | ----------- | --------- |
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
packages/docs/fluent-editor/.vitepress/sidebar.ts
(1 hunks)packages/docs/fluent-editor/docs/api/fluent-editor-class.md
(1 hunks)packages/docs/fluent-editor/docs/api/fluent-editor-instance.md
(1 hunks)packages/docs/fluent-editor/docs/api/options.md
(1 hunks)packages/docs/fluent-editor/docs/modules/header-list.md
(1 hunks)packages/docs/fluent-editor/docs/modules/toolbar-tip.md
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/docs/fluent-editor/docs/api/options.md
🧰 Additional context used
🪛 LanguageTool
packages/docs/fluent-editor/docs/api/fluent-editor-class.md
[uncategorized] ~61-~61: 您的意思是“"不"全”?
Context: ...false) ``` - 详细信息 注册格式只需要直接传入格式类,内部会自动补全 path。 注册模块和主题需要手动传入 path 和对应的模块类、主题类。...
(BU)
🪛 GitHub Actions: autofix.ci
packages/docs/fluent-editor/docs/api/fluent-editor-class.md
[error] 22-22: Parsing error: ';' expected
[error] 54-54: Parsing error: ',' expected
packages/docs/fluent-editor/docs/api/fluent-editor-instance.md
[error] 23-23: Parsing error: ',' expected
[error] 46-46: Parsing error: ',' expected
[error] 68-68: Parsing error: ',' expected
packages/docs/fluent-editor/docs/modules/header-list.md
[error] 20-20: Do not use 'new' for side effects (no-new)
🪛 GitHub Check: lint
packages/docs/fluent-editor/docs/modules/header-list.md
[failure] 20-20:
Do not use 'new' for side effects
[failure] 54-54:
Do not use 'new' for side effects
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: test
🔇 Additional comments (2)
packages/docs/fluent-editor/.vitepress/sidebar.ts (1)
33-35
: Verify the documentation pathsEnsure that all the new API reference paths (
/docs/api/options
,/docs/api/fluent-editor-instance
,/docs/api/fluent-editor-class
) exist and are accessible.Run this script to verify the paths:
#!/bin/bash # Description: Verify that all documentation files exist fd -e md -p "docs/api/(options|fluent-editor-instance|fluent-editor-class).md$"packages/docs/fluent-editor/docs/modules/toolbar-tip.md (1)
1-201
: Documentation looks comprehensive and well-structured!The documentation provides clear installation instructions, usage examples, and detailed configuration options. The code examples are accurate and helpful.
- 类型 | ||
|
||
```typescript | ||
getModule(name: string): any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix TypeScript syntax errors in type definitions
The TypeScript type definitions are missing commas at the end of parameter lists.
Apply these fixes:
-getModule(name: string): any
+getModule(name: string,): any
-getContents(index: number = 0, length: number = remaining): Delta
+getContents(index: number = 0, length: number = remaining,): Delta
-setContents(delta: Delta, source: string = 'api'): Delta
+setContents(delta: Delta, source: string = 'api',): Delta
Also applies to: 46-46, 68-68
🧰 Tools
🪛 GitHub Actions: autofix.ci
[error] 23-23: Parsing error: ',' expected
```typescript | ||
const toolbar = quill.getModule('toolbar') | ||
const i18n = quill.getModule('i18n') | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect variable name in code example
The example uses quill
instead of editor
which is inconsistent with the instance name shown in the initialization example.
Apply this fix:
-const toolbar = quill.getModule('toolbar')
-const i18n = quill.getModule('i18n')
+const toolbar = editor.getModule('toolbar')
+const i18n = editor.getModule('i18n')
const Mention = FluentEditor.import('modules/mention') | ||
const Mention = FluentEditor.import('themes/snow') | ||
const Link = FluentEditor.import('formats/link') | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix duplicate variable declaration
The variable Mention
is declared twice, with the second declaration actually being for the Snow theme.
Apply this fix:
const Toolbar = FluentEditor.import('modules/toolbar')
const Mention = FluentEditor.import('modules/mention')
-const Mention = FluentEditor.import('themes/snow')
+const Snow = FluentEditor.import('themes/snow')
const Link = FluentEditor.import('formats/link')
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const Mention = FluentEditor.import('modules/mention') | |
const Mention = FluentEditor.import('themes/snow') | |
const Link = FluentEditor.import('formats/link') | |
``` | |
const Mention = FluentEditor.import('modules/mention') | |
const Snow = FluentEditor.import('themes/snow') | |
const Link = FluentEditor.import('formats/link') |
8ebe5eb
to
c9406f1
Compare
* docs: add api docs * docs: add modules docs
PR
主要增加以下文档:
效果如下:
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit
Documentation
New Features