Skip to content

Commit

Permalink
Increase timeout for parsing the syntax tree when it's done for the f…
Browse files Browse the repository at this point in the history
…irst time
  • Loading branch information
heyman committed Dec 27, 2023
1 parent 1d2f164 commit 9e750e7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/editor/block/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import { emptyBlockSelected } from "./select-all.js";
// tracks the size of the first delimiter
let firstBlockDelimiterSize

export function getBlocks(state) {
export function getBlocks(state, timeout=50) {
const blocks = [];
const tree = ensureSyntaxTree(state, state.doc.length)
const tree = ensureSyntaxTree(state, state.doc.length, timeout)
if (tree) {
tree.iterate({
enter: (type) => {
Expand Down Expand Up @@ -57,7 +57,7 @@ export function getBlocks(state) {

export const blockState = StateField.define({
create(state) {
return getBlocks(state);
return getBlocks(state, 1000);
},
update(blocks, transaction) {
// if blocks are empty it likely means we didn't get a parsed syntax tree, and then we want to update
Expand Down

0 comments on commit 9e750e7

Please sign in to comment.