Retrieved from #687 which had a lot more discussion points that are mostly resolved now
Importing an SVG should update the underlying SVG text and clear the undo history. Except, if the file is the same as the current one, don't clear the history. Moreover, if the text would also be unchanged, throw a dialog like "Note: The imported SVG is identical to the currently edited one." and don't create any UndoRedo actions.
If importing or resetting makes it so the new text gives parser errors, don't par
When not focused, the SVG Code Editor should always reflect the underlying SVG text. Any changes to the text while it's not focused clear its undo history.
When focused, the text should only change how the user edits it. It would no longer reflect the underlying SVG text. Every time the user edits the text, it would be passed to the SVG Parser. If there's an error, don't change the underlying SVG text, keep the old one. If there's no error, feed the TagSVG representation back into the SVG Parser and use the returned text as an underlying SVG text.
When you click away, the SVG Code Editor should go back to reflecting the underlying SVG text. If this change resulted in any difference, that should count as a single UndoRedo action, and should be the only kind of external change that doesn't clear the SVG Code Editor's undo history.
Retrieved from #687 which had a lot more discussion points that are mostly resolved now
Importing an SVG should update the underlying SVG text and clear the undo history. Except, if the file is the same as the current one, don't clear the history. Moreover, if the text would also be unchanged, throw a dialog like "Note: The imported SVG is identical to the currently edited one." and don't create any UndoRedo actions.
If importing or resetting makes it so the new text gives parser errors, don't par
When not focused, the SVG Code Editor should always reflect the underlying SVG text. Any changes to the text while it's not focused clear its undo history.
When focused, the text should only change how the user edits it. It would no longer reflect the underlying SVG text. Every time the user edits the text, it would be passed to the SVG Parser. If there's an error, don't change the underlying SVG text, keep the old one. If there's no error, feed the TagSVG representation back into the SVG Parser and use the returned text as an underlying SVG text.
When you click away, the SVG Code Editor should go back to reflecting the underlying SVG text. If this change resulted in any difference, that should count as a single UndoRedo action, and should be the only kind of external change that doesn't clear the SVG Code Editor's undo history.