[WEB-3489] improvement: add support to disable extensions in rich and lite text editor#6721
Conversation
WalkthroughThe changes introduce an optional property, Changes
Sequence Diagram(s)sequenceDiagram
participant C as Caller
participant R as RichTextEditor
participant W as RichTextEditorWithRef
C->>R: Call with props (including additionalDisabledExtensions)
R->>R: Retrieve default disabledExtensions
R->>R: Merge default with additionalDisabledExtensions
R->>W: Pass merged disabledExtensions
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches
🪧 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 (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
web/core/components/editor/lite-text-editor/lite-text-editor.tsx (1)
53-53: Good approach for combining default and custom disabled extensions.The renaming of
disabledExtensionstoadditionalDisabledExtensionsin the destructuring and the merging of both arrays of disabled extensions is a good approach, allowing users to add their own extensions on top of the default ones fromuseEditorFlagging.Note: This implementation is slightly different from the other editor components where the prop is still called
disabledExtensionsand there's no array merging. Consider standardizing this approach across all editor components if they should behave consistently.Also applies to: 86-86
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
packages/types/src/utils.d.ts(1 hunks)space/core/components/editor/lite-text-editor.tsx(4 hunks)space/core/components/editor/lite-text-read-only-editor.tsx(1 hunks)space/core/components/editor/rich-text-editor.tsx(1 hunks)space/core/components/editor/rich-text-read-only-editor.tsx(1 hunks)web/core/components/editor/lite-text-editor/lite-text-editor.tsx(4 hunks)web/core/components/editor/lite-text-editor/lite-text-read-only-editor.tsx(3 hunks)web/core/components/editor/rich-text-editor/rich-text-editor.tsx(4 hunks)web/core/components/editor/rich-text-editor/rich-text-read-only-editor.tsx(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- web/core/components/editor/rich-text-editor/rich-text-editor.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Analyze (javascript)
🔇 Additional comments (22)
packages/types/src/utils.d.ts (1)
7-7: Good addition of a useful type utility.The
MakeOptionaltype utility is a well-crafted helper that allows making specific properties of a type optional while keeping others required. This is a clean implementation using TypeScript's built-in utility types.space/core/components/editor/lite-text-read-only-editor.tsx (2)
4-4: Appropriate use of MakeOptional type.Good job using the new
MakeOptionalutility type to make thedisabledExtensionsproperty optional while keeping other properties required. This improves the flexibility of the component.Also applies to: 11-14
20-23: Proper handling of optional disabledExtensions prop.The component now correctly handles the optional
disabledExtensionsprop using the nullish coalescing operator (??) to default to an empty array when undefined.space/core/components/editor/rich-text-read-only-editor.tsx (2)
4-4: Appropriate use of MakeOptional type.Good job using the new
MakeOptionalutility type to make thedisabledExtensionsproperty optional while keeping other properties required. This improves the flexibility of the component.Also applies to: 11-14
20-23: Proper handling of optional disabledExtensions prop.The component now correctly handles the optional
disabledExtensionsprop using the nullish coalescing operator (??) to default to an empty array when undefined.web/core/components/editor/lite-text-editor/lite-text-editor.tsx (1)
9-9: Appropriate use of MakeOptional type.Good job using the new
MakeOptionalutility type to make thedisabledExtensionsproperty optional while keeping other properties required. This improves the flexibility of the component's API.Also applies to: 22-24
space/core/components/editor/lite-text-editor.tsx (4)
4-4: Nice addition of MakeOptional utilityGood use of the MakeOptional utility type from @plane/types to make specific properties optional without affecting others.
12-13: Clean type definition updateThe interface has been properly updated to make only the
disabledExtensionsproperty optional while keeping the type safety for other properties.
29-29: Good addition of disabledExtensions to destructured propsCorrectly extracting the new property from props.
43-43: Property handling with nullish coalescingWell-implemented fallback using the nullish coalescing operator to provide an empty array when the property is not specified.
space/core/components/editor/rich-text-editor.tsx (4)
4-4: Consistent import of MakeOptionalGood use of the MakeOptional utility type, consistent with other editor components.
10-11: Clean type definition updateThe interface properly uses MakeOptional to make just the disabledExtensions property optional.
18-18: Properly destructured disabledExtensions propGood extraction of the new property from props.
26-26: Consistent handling of optional disabledExtensionsThe nullish coalescing operator is used appropriately to provide a default empty array.
web/core/components/editor/rich-text-editor/rich-text-read-only-editor.tsx (4)
4-4: Consistent import of MakeOptionalAppropriate import of the MakeOptional utility type, consistent with other editor components.
14-17: Well-structured type definitionGood use of MakeOptional in type definition, making just the disabledExtensions property optional.
24-24: Thoughtful prop renamingExcellent approach to rename disabledExtensions to additionalDisabledExtensions, which clarifies its purpose when merging with existing disabled extensions.
33-33: Smart extension merging approachWell-implemented merging of extensions from the hook and the additional extensions from props, providing flexibility in disabling extensions from multiple sources.
web/core/components/editor/lite-text-editor/lite-text-read-only-editor.tsx (4)
4-4: Consistent import of MakeOptionalAppropriate import of the MakeOptional utility type, consistent with other editor components.
14-17: Well-structured type definitionGood use of MakeOptional in type definition, making just the disabledExtensions property optional.
24-24: Thoughtful prop renamingExcellent approach to rename disabledExtensions to additionalDisabledExtensions, which clarifies its purpose when merging with existing disabled extensions.
33-33: Smart extension merging approachWell-implemented merging of extensions from the hook and the additional extensions from props, providing flexibility in disabling extensions from multiple sources.
… lite text editor (#6721) * [WEB-3489] improvement: add support to disable extensions in rich text editor * improvements: disabled extensions prop for all editor components
Description
In this PR, I have added an option to disable rich text editor extensions.
Type of Change
References
WEB-3489
Summary by CodeRabbit
disabledExtensionsproperty to be optional.disabledExtensionsprop in the RichTextReadOnlyEditor, allowing for a dynamic configuration of disabled extensions.