Undo mechanism during text editing

Hi,

When editing a tiddler and the bullet list formatting is selected (or any other format choices) repeat clicking on the button reverses the change.

What is the mechanism /code behind that action?

-kp

for bullet points the code is in the tiddler $:/core/modules/editor/operations/text/prefix-lines.js

It seems the code removes the prefix if it exists, and only adds it when none existed .

1 Like

Right — it’s not so much an “undo” but a “toggle” button.

For what it’s worth, as long as you’re within the same tiddler-edit session, browsers themselves usually allow something like an undo keystroke within a text-entry window…3

Thanks.

Is it safe to say if I clone the button for bullet points and modify the action, it is not straightforward to replicate the ‘toggle’ behavior. (i.e. revert the modification)?

There is no undo in the standard editor. There is in this plugin https://unieditor.tiddlyhost.com/

Most of the Editor toolbar buttons are using the edit-text-operations which were designed for purpose, and this click to reverse occurs.

Have a look at the items with the tag $:/tags/EditorToolbar in particular $:/core/ui/EditorToolbar/list-number keep in mind you can have more than one action in these tiddlers.