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

WIP: Add WIP feature support for w:moveTo and w:moveFrom #795

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fonskip
Copy link

@fonskip fonskip commented Jan 9, 2025

fix #794

This should be a good start for w:moveTo and w:moveFrom operations support. Currently, it allows to display moved elements using Paragraph::raw_text() without duplicating the text

What does this change?

Added moveTo and moveFrom enum variants for XMLElement and Paragraph with the needed refactor. Most changes are copy/pasted from Delete equivalents.

Changed Paragraph::raw_text() so that it displays moved elements correctly.

WIP

This is WIP, some additional tests need to be written. For example, it should not be allowed to add a moveFrom element without adding a moveTo element and vice versa. Also, there is some duplicated code that could probably be avoided with traits.

I made this change as a quick fix for my needs for my work. As this change is enough for me to work, I cannot continue working on this project on my "working time", and I am not sure if I have enough free time to keep working on it.

Also, I’m not super familiar with the .docx format :

  • is this change applicable to other DocumentChild variants such as Table ?
  • Are there other MoveFromChild and MoveToChild variants that should be taken into account ?

Consider this a starter for a new feature implementation.

This should be a good start for w:moveTo and w:moveFrom operations support. Currently, it allows to display moved elements using Paragraph::raw_text() without duplicating the text
@fonskip
Copy link
Author

fonskip commented Jan 9, 2025

PS: I did not run the docx-wasm tests as I do not have and cannot install the pnpm command on my company laptop.

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.

Moved text in tracked changes is duplicated when using paragraph.raw_text()
1 participant