Bulk processing on selected blocks, and only the expanded ones. For now:
Find and replace (can be used to remove some string), supporting now Regular Expressions (and variables for formating)
Append or/and Prepend string
Change block format: heading, alignment, view type (bulleted, document, numebered) (this command is also launched in the Command Palette)
Undo last bulk processing (Warning! Undo with Ctrl+z isn't reliable, it's why i've made this function. Use it if you have made a mistake, blocks are saved in memory until the browser tab is refreshed. It reload them exactly in their original state).
Redo last bulk processing (if you want apply the same processing to different blocks selections or on different pages, without re-entering the parameters).
Collapsed child blocks are not processed. If you want apply the processing to a whole page, expand all before.
▶ How to run the commands:
After selecting some blocks, open the workBench command box with Ctrl + ; (or Ctrl + $ on french Azerty keyboard), then enter somme letters of the command, like 'fre' or 'app', then Enter. That's it!
The main commands are:
Find & Replace (supporting RegEx) (fre)
Append or/and Prepend to seleted blocks
Bulk change format of selected blocks (bcf)
This commands are only displayed when you select multi-blocks (or just one block, with Shift + Down + Down). Only "Undo" command is always displayed. It is one of the great ability of workBench to link commands to different types of context.
Regular Expressions are an advanced user feature, you must learn and experiment with their logic before using it (you can learn and test your formulas here) !
The most accessible feature is using the variable $RegEx for formating the replacement of matching strings:
In Replace prompt, you can insert $RegEx in the replacing string, for ex., to add bold, enter: $RegEx
There is 4 possible formating of the main variable:
$RegEx leaves the machting string in its initial case.
$REGEX capitalizes all letters.
$regex set to lower case all letters.
$Regex capitalize first letter.
Capture groups $1 and $2 can also be (multi-) used, assuming that the RegEx formula includes groups in parenthesis.
⚠ Be careful, these operations are not trivial !
They change directly and potentially massively your data, in particular with the use of Regex! (undo is only for last bulk processing, and is lost if you refresh the tab)
Please inform me quickly of any issue that could affect other users!
📅 Version log
v 0.7 (6 August, 2021)
Added: new command for bulk changing format (heading, alignment, view type)
Adjustment: UI has been improved, the input forms are clearer and are gathered in one popup instead of two
Fixex: prompts now work on Roam desktop app.
v 0.6 (22 april, 2021)
Added: Undo Button which automatically appears at the bottom right after each operation and disappears after 6 seconds.
v 0.51 (22 april, 2021)
Fixe: Cancel buttons (when you are prompted to enter the string to search, replace or add) now works properly and stops the process (with 'Append/Prepend' function, cancelling had the effect of adding 'null' to each block)
Adjustment: countdown before loading the script (when Roam is opened or tab refreshed) is now set to 15 seconds (10 before) to give more time to Roam42 to load first (it can be slowed down under certain circumstances: a lot of JS to load, CPU overload...). If the script still does not load properly, you can increase the loading time manually by changing the last line of code (in milliseconds)).
v 0.5 (18 april, 2021)
Fixe: Important issue fixed on undo command and memory clearing, now very stable and reliable.
Added: Find & Replace Case-Insensitive, and case formating of the matching string replacement.
Added: Find & Research supporting Regular Expressions (& 2 groups capture)
✅ Prerequisites or dependencies that are required for this Extension
The loading of javascripts can be quite long at the opening of your graph, that's why there is a timer to wait for the opening of Roam42. It is currently set to 15000 (15 seconds) (last line of the code), you can increase it if the commands do not load properly.
Read description and important instructions below. You can download the JSON file (in .zip file below) and import to your graph, or simply copy/paste code below. Bulk processing - Find & Replace - Append & Prepend v 0.7.zip
📋 Descritpion and instructions
Bulk processing on selected blocks, and only the expanded ones. For now:
▶ How to run the commands: After selecting some blocks, open the workBench command box with
Ctrl + ;
(orCtrl + $
on french Azerty keyboard), then enter somme letters of the command, like 'fre' or 'app', then Enter. That's it! The main commands are:Regular Expressions are an advanced user feature, you must learn and experiment with their logic before using it (you can learn and test your formulas here) ! The most accessible feature is using the variable $RegEx for formating the replacement of matching strings: In Replace prompt, you can insert $RegEx in the replacing string, for ex., to add bold, enter: $RegEx There is 4 possible formating of the main variable:
⚠ Be careful, these operations are not trivial !
They change directly and potentially massively your data, in particular with the use of Regex! (undo is only for last bulk processing, and is lost if you refresh the tab)
Please inform me quickly of any issue that could affect other users!
📅 Version log
v 0.7 (6 August, 2021)
v 0.6 (22 april, 2021)
v 0.51 (22 april, 2021)
v 0.5 (18 april, 2021)
✅ Prerequisites or dependencies that are required for this Extension
It's not a SmartBlock but a Javascript using workBench commands from Roam42 (click here for informations and instruction to install it). Roam42 and workBench need to be activated in your graph. The code above must be pasted in a javascript block, below a {{[[roam/js]]}} block.
The loading of javascripts can be quite long at the opening of your graph, that's why there is a timer to wait for the opening of Roam42. It is currently set to 15000 (15 seconds) (last line of the code), you can increase it if the commands do not load properly.
💡 Additional Info
Bulk blocks format change (v 0.7): https://user-images.githubusercontent.com/74436347/128583971-c91ee268-9006-4cf0-b75f-007c4706aec2.mp4
Advanced features (v 0.5): https://user-images.githubusercontent.com/74436347/115165547-a3ee7700-a0ae-11eb-8fb5-4907b79b0335.mp4
Most common features: Video: https://www.youtube.com/watch?v=T6aYwSsiIoQ
https://user-images.githubusercontent.com/74436347/115165602-def0aa80-a0ae-11eb-8514-d2bf999a8d60.mp4
✂️ Code of the JavaScript to Copy/Paste