Type a couple of lines in the PasteCharm Bio Builder, pick Gothic, and turn off Add divider and Add emoji. Then click one of the shortcuts under Start with a template. The preview changes, and so do the words you just typed.

Now click Undo template below the editor. Your words come back. So do Gothic and the two checkboxes you turned off. If the words came back with the template's styling, you'd still have to fix your draft by hand.

Trying a template should be easy to undo

A template in PasteCharm is a sample bio with a visual style. Applying it changes the editor immediately so you can see the whole result and start editing it. A confirmation dialog would ask you to decide whether to replace your draft before you've seen the template in your preview. Undo lets you see it first.

The tricky bit was deciding what counts as a draft here. The text lives in a textarea. The style, divider, and emoji live in separate controls. Together they produce the preview. A snapshot of just the textarea would leave part of the template behind.

Save what the action replaces

Right before applying a template, PasteCharm remembers the current text, style, divider and emoji settings, and which template was active, if any. Undo restores that snapshot, updates the preview, and returns focus to the editor. That last step puts you back where you can keep typing.

This is one step of undo for template changes. If you apply a second template, Undo takes you back to the state just before that second choice. Clear ends the session's pending template undo, and the snapshot lives in memory for the current page.

Check the result the user sees

The regression test starts with a custom bio, a different style, and both decorations off. After applying a template and undoing it, the test checks the text and each control. It also checks the resulting preview and keyboard focus. The text alone could be correct while the preview still looks wrong.

For actions like this, I'd start by listing everything the user will see change. That's a better starting point for Undo than the shape of the form state.

This article was drafted with AI from PasteCharm’s implementation and test cases.