Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple update tags #6507

Merged
merged 3 commits into from
Sep 7, 2024
Merged

Multiple update tags #6507

merged 3 commits into from
Sep 7, 2024

Conversation

zurfyx
Copy link
Member

@zurfyx zurfyx commented Aug 9, 2024

With history-merge being a sort of imposed tag to follow certain behavior, you're forced to trigger another editor.update to pass your own tag. This is a patchy workaround. What's more, this workaround doesn't work for discrete updates.

This diff adds support for an array of tags, I kept the tag name singular for backward compatibility.

Copy link

vercel bot commented Aug 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 24, 2024 7:06am
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 24, 2024 7:06am

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 9, 2024
Copy link

github-actions bot commented Aug 9, 2024

size-limit report 📦

Path Size
lexical - cjs 29.38 KB (0%)
lexical - esm 29.24 KB (0%)
@lexical/rich-text - cjs 37.74 KB (0%)
@lexical/rich-text - esm 31.05 KB (0%)
@lexical/plain-text - cjs 36.41 KB (0%)
@lexical/plain-text - esm 28.42 KB (0%)
@lexical/react - cjs 39.61 KB (0%)
@lexical/react - esm 32.52 KB (0%)

@etrepum
Copy link
Collaborator

etrepum commented Aug 9, 2024

FWIW there is $addUpdateTag which can be used instead of triggering multiple editor.update calls (or using the tag property at all)

Copy link
Collaborator

@etrepum etrepum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -219,6 +219,20 @@ function $normalizeAllDirtyTextNodes(
}
}

function addTags(editor: LexicalEditor, tags: undefined | string | string[]) {
if (!tags) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

be strict here

@@ -219,6 +219,20 @@ function $normalizeAllDirtyTextNodes(
}
}

function addTags(editor: LexicalEditor, tags: undefined | string | string[]) {
if (!tags) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!tags) {
if (tags === undefined || tags.length === 0) {

@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Aug 23, 2024
@etrepum etrepum added this pull request to the merge queue Sep 7, 2024
Merged via the queue into main with commit 83d3cee Sep 7, 2024
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. extended-tests Run extended e2e tests on a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants