Get the tiddlers in the story to be in full edit state, all confirmed state

This greatly improved productivity when I optimized tiddlers in bulk, and greatly reduced the number of clicks on the edit and confirm buttons

Any reply would be greatly appreciated

You can make a button that will switch all the story tiddlers into edit mode by nesting an $action-sendmessage widget with the tm-edit-tiddler message inside a $list like the one used to display the list of tiddlers in the Open tab. (A side tip: you can drag the Link to Tabs plugin directly into tiddlywiki.com to open any tab and easily inspect its contents.)

\procedure edit-all()
<$list filter="[list<tv-story-list>]" history=<<tv-history-list>> storyview="pop">
	<$action-sendmessage $message=tm-edit-tiddler $param={{!!title}} />
</$list>
\end

<$button
	class="tc-btn-invisible"
	actions=<<edit-all>>
	tooltip="Edit all open tiddlers"
>
	{{$:/core/images/edit-button}}
</$button>

You can put this in a new tiddler and transclude it wherever you want—or tag it $:/tags/PageControls if you’d like it to show up with the other buttons in the sidebar.

Caution: If you have a large number of tiddlers open at once, you may experience some lag when using this button. I’d probably try to avoid using it for more than 10-12 tiddlers at a time.

Alternately, you may want to consider making your own bespoke “form”, as I often do when editing a number of tiddlers at once. Here’s a quick example you can test on tiddlywiki.com:

<$list filter="[tag[HelloThere]]">

!! <$link/>
<<tag-picker>>
<$edit-text field="caption" tag=input class="tc-max-width" placeholder="caption" />
<$edit-text field="text" tag=textarea class="tc-max-width" />

</$list>

The $list widget defines the set of tiddlers you want to edit; you can use either a filter or a title list like filter="a b c". Inside the $list, you can use any combination of the field-editing widgets to modify the tiddlers in real time, without entering edit mode.

  • I used a couple of $edit-text widgets in my sample, along with the <<tag-picker>> core macro; I also frequently build forms with $select, $checkbox, and $radio widgets, and use buttons for more complicated operations.
  • Note that since you’re not in edit mode, you won’t have the “safety net” of a draft tiddler. You can use your “undo” hotkey to revert changes on a per-field basis, but there’s no easy way to revert everything at once (other than reloading your wiki without saving).
  • I build a lot of ad hoc batch-edit forms that I never bother to save, but if you do expect to need a similar tool in the future, you can save the form tiddler and change the filter/title-list as needed.
2 Likes

Thanks for the ideas, they are very easy to use

These are the two schemes I came up with. Is there anything we need to improve

Enter the following code in the browser console

All in edit state

// 选择所有符合条件的按钮
var buttons = document.querySelectorAll('[title="Edit this tiddler"][aria-label="edit"]');

// 遍历按钮元素并点击
buttons.forEach(function(button) {
  button.click();
});

All in a definite state

// 选择所有符合条件的按钮
var buttons = document.querySelectorAll('[title="Confirm changes to this tiddler"][aria-label="ok"]');

// 遍历按钮元素并点击
buttons.forEach(function(button) {
  button.click();
});