[WEB-2494] feat: text color and highlight options for all editors (#5653)

* feat: add text color and highlight options to pages

* style: rich text editor floating toolbar

* chore: remove unused function

* refactor: slash command components

* chore: move default text and background options to the top

* fix: sections filtering logic
This commit is contained in:
Aaryan Khandelwal 2024-10-08 18:42:47 +05:30 committed by GitHub
parent 5afc576dec
commit c3c1ea727d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 1166 additions and 542 deletions

View file

@ -1,6 +1,6 @@
import React from "react";
// editor
import { EditorRefApi, ILiteTextEditor, LiteTextEditorWithRef } from "@plane/editor";
import { EditorRefApi, ILiteTextEditor, LiteTextEditorWithRef, TNonColorEditorCommands } from "@plane/editor";
// components
import { IssueCommentToolbar } from "@/components/editor";
// helpers
@ -56,7 +56,9 @@ export const LiteTextEditor = React.forwardRef<EditorRefApi, LiteTextEditorWrapp
<IssueCommentToolbar
executeCommand={(key) => {
if (isMutableRefObject<EditorRefApi>(ref)) {
ref.current?.executeMenuItemCommand(key);
ref.current?.executeMenuItemCommand({
itemKey: key as TNonColorEditorCommands,
});
}
}}
isSubmitting={isSubmitting}

View file

@ -2,7 +2,7 @@
import React, { useEffect, useState, useCallback } from "react";
// editor
import { EditorRefApi, TEditorCommands } from "@plane/editor";
import { EditorRefApi, TEditorCommands, TNonColorEditorCommands } from "@plane/editor";
// ui
import { Button, Tooltip } from "@plane/ui";
// constants
@ -34,7 +34,9 @@ export const IssueCommentToolbar: React.FC<Props> = (props) => {
.flat()
.forEach((item) => {
// Assert that editorRef.current is not null
newActiveStates[item.key] = (editorRef.current as EditorRefApi).isMenuItemActive(item.key);
newActiveStates[item.key] = (editorRef.current as EditorRefApi).isMenuItemActive({
itemKey: item.key as TNonColorEditorCommands,
});
});
setActiveStates(newActiveStates);
}