mirror of
https://github.com/facebook/lexical.git
synced 2025-08-06 16:39:33 +08:00
A basic $dfs (#1351)
This commit is contained in:
@ -9,11 +9,10 @@
|
||||
|
||||
import type {LexicalEditor, LexicalNode} from 'lexical';
|
||||
|
||||
import {$dfs__DEPRECATED} from '@lexical/helpers/nodes';
|
||||
import {$dfs} from '@lexical/helpers/nodes';
|
||||
import {$textContentCurry} from '@lexical/helpers/root';
|
||||
import withSubscriptions from '@lexical/react/withSubscriptions';
|
||||
import {
|
||||
$getRoot,
|
||||
$getSelection,
|
||||
$isLeafNode,
|
||||
$isRangeSelection,
|
||||
@ -127,15 +126,10 @@ function findOffset(
|
||||
}
|
||||
|
||||
function $wrapOverflowedNodes(offset: number): void {
|
||||
const root = $getRoot();
|
||||
const dfsNodes = $dfs();
|
||||
const dfsNodesLength = dfsNodes.length;
|
||||
let accumulatedLength = 0;
|
||||
|
||||
const dfsNodes = [];
|
||||
$dfs__DEPRECATED(root, (node: LexicalNode) => {
|
||||
dfsNodes.push(node);
|
||||
return node;
|
||||
});
|
||||
for (let i = 0; i < dfsNodes.length; i += 1) {
|
||||
for (let i = 0; i < dfsNodesLength; i += 1) {
|
||||
const node = dfsNodes[i];
|
||||
if ($isOverflowNode(node)) {
|
||||
const previousLength = accumulatedLength;
|
||||
|
Reference in New Issue
Block a user