Simplify getting rangesToUpdate (#192079)

This commit is contained in:
Mikhail 2023-09-11 18:47:03 +03:00 committed by GitHub
parent 0c5c400ea5
commit 05673dfd1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,8 +25,8 @@ export async function updateTag(tagName: string | undefined): Promise<boolean |
return;
}
const rangesToUpdate = Array.from(editor.selections).reverse()
.reduce<TagRange[]>((prev, selection) =>
const rangesToUpdate = editor.selections
.reduceRight<TagRange[]>((prev, selection) =>
prev.concat(getRangesToUpdate(document, selection, rootNode)), []);
if (!rangesToUpdate.length) {
return;