Removing an element, but retaining contents, from an external event
Posted: Wed Oct 18, 2023 11:57 pm
Hi there,
We have been using javascript to invoke built-in author mode operations based on events generated from a form outside of the embedded Oxygen XML editor. For example, we have been using "SurroundWithFragmentOperation" to add a custom element tag with attributes around the current selection in the editor, based on a user's input and action in an html form. This is working really well, but we also want to implement the inverse -- allow a user to invoke an operation that removes the element tag, but retain the contents of the tag.
We've tried several of the other built-in author mode operations, but none seem to do what we need here. It seems like this would be a pretty common use-case, though, so perhaps we're missing something obvious. (We've tried DeleteElementOperation, ToggleSurroundWithElementOperation, and some combinations of DeleteElementOperation with insert operations.)
What would be the recommended way to implement this?
Thanks,
Trent
We have been using javascript to invoke built-in author mode operations based on events generated from a form outside of the embedded Oxygen XML editor. For example, we have been using "SurroundWithFragmentOperation" to add a custom element tag with attributes around the current selection in the editor, based on a user's input and action in an html form. This is working really well, but we also want to implement the inverse -- allow a user to invoke an operation that removes the element tag, but retain the contents of the tag.
We've tried several of the other built-in author mode operations, but none seem to do what we need here. It seems like this would be a pretty common use-case, though, so perhaps we're missing something obvious. (We've tried DeleteElementOperation, ToggleSurroundWithElementOperation, and some combinations of DeleteElementOperation with insert operations.)
What would be the recommended way to implement this?
Thanks,
Trent