Fix eslint errors

Signed-off-by: gearnode <bryan@frimin.fr>
This commit is contained in:
gearnode
2025-03-04 12:41:39 +01:00
parent fdab9de39f
commit f99eb67958

View File

@@ -4,9 +4,10 @@ import {
$getSelection, $getSelection,
$isRangeSelection, $isRangeSelection,
FORMAT_TEXT_COMMAND, FORMAT_TEXT_COMMAND,
FORMAT_ELEMENT_COMMAND,
UNDO_COMMAND, UNDO_COMMAND,
REDO_COMMAND, REDO_COMMAND,
Point,
RangeSelection,
} from "lexical"; } from "lexical";
import { import {
$createHeadingNode, $createHeadingNode,
@@ -14,8 +15,6 @@ import {
$isHeadingNode, $isHeadingNode,
} from "@lexical/rich-text"; } from "@lexical/rich-text";
import { import {
$createListItemNode,
$createListNode,
$isListNode, $isListNode,
INSERT_ORDERED_LIST_COMMAND, INSERT_ORDERED_LIST_COMMAND,
INSERT_UNORDERED_LIST_COMMAND, INSERT_UNORDERED_LIST_COMMAND,
@@ -25,13 +24,11 @@ import {
import { $isLinkNode, TOGGLE_LINK_COMMAND } from "@lexical/link"; import { $isLinkNode, TOGGLE_LINK_COMMAND } from "@lexical/link";
import { import {
$getSelectionStyleValueForProperty, $getSelectionStyleValueForProperty,
$isParentElementRTL,
$patchStyleText, $patchStyleText,
$setBlocksType, $setBlocksType,
} from "@lexical/selection"; } from "@lexical/selection";
import { $getNearestNodeOfType } from "@lexical/utils"; import { $getNearestNodeOfType } from "@lexical/utils";
import { useCallback, useEffect, useState } from "react"; import { useCallback, useEffect, useState } from "react";
import { createPortal } from "react-dom";
import { import {
Bold, Bold,
Italic, Italic,
@@ -54,18 +51,14 @@ import {
export function ToolbarPlugin() { export function ToolbarPlugin() {
const [editor] = useLexicalComposerContext(); const [editor] = useLexicalComposerContext();
const [activeEditor, setActiveEditor] = useState(editor); const [activeEditor] = useState(editor);
const [isBold, setIsBold] = useState(false); const [isBold, setIsBold] = useState(false);
const [isItalic, setIsItalic] = useState(false); const [isItalic, setIsItalic] = useState(false);
const [isUnderline, setIsUnderline] = useState(false); const [isUnderline, setIsUnderline] = useState(false);
const [isStrikethrough, setIsStrikethrough] = useState(false); const [isStrikethrough, setIsStrikethrough] = useState(false);
const [isLink, setIsLink] = useState(false); const [isLink, setIsLink] = useState(false);
const [blockType, setBlockType] = useState("paragraph"); const [blockType, setBlockType] = useState("paragraph");
const [selectedElementKey, setSelectedElementKey] = useState<string | null>( const [, setSelectedElementKey] = useState<string | null>(null);
null
);
const [linkUrl, setLinkUrl] = useState("");
const [isLinkEditMode, setIsLinkEditMode] = useState(false);
const [textAlignment, setTextAlignment] = useState< const [textAlignment, setTextAlignment] = useState<
"left" | "center" | "right" | "justify" "left" | "center" | "right" | "justify"
>("left"); >("left");
@@ -391,7 +384,7 @@ export function ToolbarPlugin() {
); );
} }
function getSelectedNode(selection: any) { function getSelectedNode(selection: RangeSelection) {
const anchor = selection.anchor; const anchor = selection.anchor;
const focus = selection.focus; const focus = selection.focus;
const anchorNode = selection.anchor.getNode(); const anchorNode = selection.anchor.getNode();
@@ -407,6 +400,6 @@ function getSelectedNode(selection: any) {
} }
} }
function $isAtNodeEnd(point: any) { function $isAtNodeEnd(point: Point) {
return point.offset === point.getNode().getTextContentSize(); return point.offset === point.getNode().getTextContentSize();
} }