You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 function
Additional context
The text was updated successfully, but these errors were encountered:
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: