Hi everybody,

lately I found an issue with the TextSelection functionality of the simple
API.

My use-case is to have a template where I'm searching for specific String
and I'm then going to use the TextSelection.replaceWith(String) method in
order to replace the searched String. Problem is, that the formatting is
not preserved if the format for the searched String was defined at Span
level. The reason for this is that the TextNavigation is only interested in
paragraphs and heading elements as containers for changes. In an replace it
is deleting the old text and attaching a new sibling to the old span but
not duplicating the format.

I think the better behavior would be to not only remember paragraphs and
headings as containers, but also spans. If the replace code (or any other
code) sees that the container is of type span, it should leverage that
container element rather than creating a new span.

What do you guys think?


Regards


Oliver

Reply via email to