diff --git a/ui/src/editor/plugins/fix-ios-korean-issue/index.tsx b/ui/src/editor/plugins/fix-ios-korean-issue/index.tsx index 25265824..01f91984 100644 --- a/ui/src/editor/plugins/fix-ios-korean-issue/index.tsx +++ b/ui/src/editor/plugins/fix-ios-korean-issue/index.tsx @@ -1,7 +1,7 @@ // This plugin is a workaround for utilizing default backspace behavior on iOS Korean keyboards. // https://github.com/facebook/lexical/pull/4814#issuecomment-2037716048 import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'; -import { $getNearestBlockElementAncestorOrThrow } from '@lexical/utils'; +import { $getNearestBlockElementAncestorOrThrow, IS_IOS } from '@lexical/utils'; import { $getNearestNodeFromDOMNode, $getSelection, @@ -14,7 +14,6 @@ import { } from 'lexical'; import { useEffect } from 'react'; -// TODO: remove eslint-disables after https://github.com/facebook/lexical/pull/5833 is released export function FixIOSKoreanIssuePlugin() { const [editor] = useLexicalComposerContext(); @@ -32,12 +31,9 @@ export function FixIOSKoreanIssuePlugin() { } const { anchor } = selection; - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const anchorNode = anchor.getNode(); - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument if (selection.isCollapsed() && anchor.offset === 0 && !$isRootNode(anchorNode)) { - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument const element = $getNearestBlockElementAncestorOrThrow(anchorNode); if (element.getIndent() > 0) { event.preventDefault(); @@ -65,18 +61,3 @@ function $isTargetWithinDecorator(target: HTMLElement): boolean { const node = $getNearestNodeFromDOMNode(target); return $isDecoratorNode(node); } - -// TODO: remove below after https://github.com/facebook/lexical/pull/5831 is released -declare global { - interface Window { - MSStream?: unknown; - } -} - -const CAN_USE_DOM: boolean = - typeof window !== 'undefined' && - typeof window.document !== 'undefined' && - typeof window.document.createElement !== 'undefined'; - -const IS_IOS: boolean = - CAN_USE_DOM && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; diff --git a/ui/src/editor/plugins/list-max-indent-level/index.tsx b/ui/src/editor/plugins/list-max-indent-level/index.tsx index 252e7fc3..9d5d2501 100644 --- a/ui/src/editor/plugins/list-max-indent-level/index.tsx +++ b/ui/src/editor/plugins/list-max-indent-level/index.tsx @@ -13,9 +13,8 @@ import { useEffect } from 'react'; function getElementNodesInSelection(selection: RangeSelection): Set { const nodesInSelection = selection.getNodes(); - // TODO: Remove this type assertion once the lexical types are updated. facebook#5710 - const anchor = selection.anchor.getNode() as ElementNode; - const focus = selection.focus.getNode() as ElementNode; + const anchor = selection.anchor.getNode(); + const focus = selection.focus.getNode(); if (nodesInSelection.length === 0) { return new Set([anchor.getParentOrThrow(), focus.getParentOrThrow()]); @@ -41,8 +40,7 @@ function shouldPreventIndent(maxDepth: number) { if ($isListNode(elementNode)) { listNode = elementNode; } else if ($isListItemNode(elementNode)) { - // TODO: Remove this type assertion once the lexical types are updated. - const parent = elementNode.getParent() as ElementNode; + const parent = elementNode.getParent(); if (!$isListNode(parent)) { throw new Error(