-
-
Notifications
You must be signed in to change notification settings - Fork 699
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
Feature request for replace node #571
Comments
can i see the code u used to accomplish this your function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
I needed to implement the functionality of replacing node A with node B, but craft.js didn't provide a function like
replaceNodes
. So, I created a function that first deletes node A and then adds node B, and I was using it quite well.However, I encountered a problem when using the 'undo' feature. Craft.js stacks separate actions for deleting and adding nodes in the history. When I perform an 'undo,' it doesn't revert to the state before the replacement (I mean node A to node B) but goes back to before the addition. If I 'undo' again, it goes back to before the deletion.
What I want is to go from node B back to node A with a single 'undo.' So, in conclusion, I'd like to replace my previous method of using a combination of 'add' and 'delete' for replacement with the actual 'replace' functionality.
I check craft.js's source code and find
replaceNodes
but it is a private function and I can't use it.Would it be possible to make it a public function?
Or, Is there other way to implement replace node?
Describe the solution you'd like
support
replaceNodes
as public functionAdditional context
The text was updated successfully, but these errors were encountered: