Edit-CompText Demo

a demo of the Edit-CompText plugin for TiddlyWiki5

About the Edit-CompText plugin

Updated to match version 5.1.13+ of TiddlyWiki

In editarea of the 'text' field, some trigger pattern (by default [[) enters the completion mode and any subsequent alphanumeric character suggests completion possibilities in overlay. The completion is looked over all Tiddlers with a title that matches the pattern entered, according to the filter operation of the completion template ([all[tiddlers]!is[system]] by default) and, possibly, a mask. When a completion has been selected, the title (or sometimes the body) of the selected Tiddler replaces the pattern. By default, it is surrounded by [[ and ]].

  • The pattern taken into account is the text between the trigger ([[) and the cursor.
  • ENTER, when only one possible completion, completes the link
  • when a popup window is visible, UP/DOWN allow to choose a link that is selected with ENTER.
  • CTRL+SPACE takes you into completion mode (if possible)
  • ESC takes you out of completion mode
  • you can use BACKSPACE, DEL, LEFT, RIGHT when in completion mode.
  • you can also click or touch to select a completion choice

In this new version, you can define your own 'completion template'. See $:/plugins/snowgoon88/edit-comptext/usage and $:/plugins/snowgoon88/edit-comptext/examples

Try it editing this or any new Tiddler.

FYI, a list of already created tiddlers : hisOne, hisTwo, myOne, myTwo, myThree, myFor, myFive, mySix, so in edit mode, [[hisO+ENTER should do just fine...

I have also created a global macro named pnjin and tagged some tiddlers with PNJ, so in edit mode, <phisO+ENTER should also complete to <<pnjin "hisOne">>. (yeah, my main motivation was dealing with a huge amount of PNJs when I use TW5 as a RPG campaign aid.)

And, as an added bonus, various stamp tiddlers have been defined and tagged with $:stamp. They all have titles that begins with $:/config/stamp/. That way, you can try stamping. The trigger is << and then you have 'macro', 'list1', 'list2'.

Install

To add the bare plugin to your own TiddlyWiki5, just drag this link to the browser window:

$:/plugins/snowgoon88/edit-comptext

Sometime, a small configuration step is then needed

in $:/ControlPanel -> Advanced -> Editor Type -> text/vnd.tiddlywiki you must chose comptext instead of text.

Reload and « voilà »...

You can also configure the various completion templates. See

Contact

Do not hesitate to critic, ask, inform or yell at : snowgoon88ATgmailDOTcom

Under the hood

I think the concept is quite mature now, but everything can still be revised/altered if needed.

What I think still needs to be done :

  • new options
    • in defining template, the filter could be replaced by a list of allowed completion.
  • testing in various environment
    • Linux+Firefox : ok
    • Linux+Chromium : ???
    • MacOS+Firefox : ???
    • Safari : ???
    • Win7+Firefox : ???
    • Virtual keyboard of Win10 poses problems
  • TW5 spirit
    • Create the popupNode using more appropriate $tw5 methods ?
    • WHERE in the DOM should I add the popup window ? Only one popup or one popup for each tidder ?
    • Should I take care of removing the popup from the DOM ? When ? How ?

All this is available at https://github.com/snowgoon88/TW5-extendedit