pub fn replace_range(
root: &mut Element,
from: (&[usize], usize),
to: (&[usize], usize),
with: &str,
) -> Result<(), Refused>Expand description
Replace the text from one position to another with new text, and join what is left of the last paragraph onto the first. A position is a paragraph’s path under the root and a character offset into its text.
Everything between the two goes, as a selection over it takes it: paragraphs, tables and frames the range wholly contains, and list items and lists left with nothing in them. The first paragraph keeps its style and its place, and the last one’s remaining text follows the new text in it.
§Errors
Either path does not lead to a paragraph, or the first is not before the
last; or an end is inside a table, a cell or a frame that the range does
not wholly contain (Refused::Structure), which no join takes apart.
Each is refused before anything changes.