Skip to content

fix: Rename both tags when one is being edited - #3925

Open
Nishthajain7 wants to merge 2 commits into
processing:develop-codemirror-v6from
Nishthajain7:Auto-rename-tag
Open

Nishthajain7 wants to merge 2 commits into
processing:develop-codemirror-v6from
Nishthajain7:Auto-rename-tag

Conversation

@Nishthajain7

Copy link
Copy Markdown
Contributor

Issue:

Fixes #3873

Demo:

Screencast.from.2026-02-22.21-24-21.webm

Changes:

I used syntaxTree from codemirror to traverse through an html tree and find the corresponding closing tag of the opening tag that is being edited.

I have verified that this pull request:

  • has no linting errors (npm run lint)
  • has no test errors (npm run test)
  • has no typecheck errors (npm run typecheck)
  • is from a uniquely-named feature branch and is up to date with the develop branch.
  • is descriptively named and links to an issue number, i.e. Fixes #123
  • meets the standards outlined in the accessibility guidelines

@Jatin24062005

Jatin24062005 commented Feb 22, 2026 •

Copy link
Copy Markdown
Contributor

The overall approach looks solid and CM6-native
Using the syntax tree to sync opening and closing tags (with an annotation guard to avoid recursion) seems like a good fit for this regression.
One small process note: for changes of this size, it’s usually helpful to comment on the issue and wait for maintainer confirmation or assignment before opening a PR.

@yugalkaushik

Copy link
Copy Markdown
Contributor

Looks good but for instance where I have not provided a closing tag and I'll rename the current tag then won't it affect the next closing tag. If not please show the demo.

@Nishthajain7

Copy link
Copy Markdown
Contributor Author

I made a new commit to handle the no closing tag case

Screencast.from.2026-02-23.22-47-44.webm

@Nishthajain7

Copy link
Copy Markdown
Contributor Author

Thank you for your suggestions @yugalkaushik I've made the changes

@khanniie khanniie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you so much for working on this! It's looking great, just a few comments. Apologies for the very late review.

margin: #{math.div(10, $base-font-size)}rem;
height: #{math.div(72, $base-font-size)}rem;
font-size: #{math.div(16, $base-font-size)}rem;
text-decoration: underline;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What's the reason for this line?

const tree = syntaxTree(update.state);
const { doc } = update.state;

tr.changes.iterChanges((_fromA, _toA, fromB, _toB) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is the reason for the underscores to indicate that it's "private"? I think we should avoid this type of naming as we are moving towards typescript and most typescript style guides recommend against this type of naming (https://google.github.io/styleguide/tsguide.html#naming-style)

closeOnBlur: false
};

const tagSyncAnnotation = Annotation.define();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could we make a new file for this? Maybe called tagSyncAnnotaiton.js? The stateutils file is getting a bit large

@khanniie

khanniie commented Jun 4, 2026

Copy link
Copy Markdown
Member

Hi! Just FYI I recently did a rather large file cleanup so there may be merge conflicts to address. For this one in particular i still think we should make another file, but the stateUtils.js file has moved to utils/fileState.js

@ksen0

ksen0 commented Jun 26, 2026

Copy link
Copy Markdown
Member

Hi @Nishthajain7 ! Can you check the reviews above and resolve the merge conflicts please? thanks for your patience and work

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants