[TW5] Auto suggestion plugin for textareas

279 views
Skip to first unread message

Albert Riedinger

unread,
Oct 9, 2016, 11:05:30 AM10/9/16
to TiddlyWikiDev
Hi all,

after using and "hacking" TWC for several years now, I decided to move to TW5. It's great (!!!), but I have to learn a lot of new stuff, as it seems to be a complete different approach, especially when it comes to develop extensions.

First, I'm not a developer at all. I learned a bit of HTML, CSS and JS while extending my TWC the last few years with some small plugins, themes and other tweaks ... so please be patient ;) For my first attempt to learn a bit more about TW5, I decided to include an autosuggest library[1] into TW5, like I have done with my TWC plugin AutoSuggestPlugin[2] two years ago.

What I have done so far? Not much actually. First I looked into some other plugins and core modules in order to grasp a bit about the plugin mechanism and core functions. I read some articles on TiddlyWiki Dev for a basic understanding of TW5 internals. I searched this group for some tutorials and guides regarding editarea handling, but I have not found any good starting points. After reading and trying to code something that works, I had to give up realizing that I have no clue where to start. It was much easier with TWC as I can remember. I've put AutoSuggestPlugin[2] together in just a few days. And tadaa, it worked with some quirks ... but it worked! It seems to be much more difficult with TW5.

What I have done successfully(?) is to include textcomplete[1] library into a new tiddler called: "$:/.ar/library/textcomplete.min.js" as "application/javascript" and the custom field "module-type" with value "library". Is this correct? Now, my next step could be writing a first test script in a new "application/javascript" tiddler with module-type: ??? in order to test some functions provided by textcomplete.js (maybe with a textarea div created in another tiddler) ... You see, I don't really know, what to do next.

My (first) goal with such a plugin would be to have an automatic suggestions mechanism in tiddler edit mode, so for example typing two square brackets would call autocomplete that shows a list with suggestions for internal wiki links (list with all non-system tiddlers).

Maybe such a plugin is too complicated and to ambitious as a first project? Including such a library into TWC was very easy, even with my little knowledge of JS. But TW5 seems to have a steeper learning curve.

Could anybody give me some hints and tips or just point me to a similar plugin/module?

Kind regards,
Albert

[1] GitHub: https://github.com/yuku-t/textcomplete / Demo: https://yuku-t.com/textcomplete/
[2] http://autosuggest.tiddlyspace.com/ (not latest version)

PMario

unread,
Oct 10, 2016, 3:16:45 AM10/10/16
to TiddlyWikiDev
Hi Albert,

Yes. Tiddlywiki 5 has a completely different approach. I don't know textcomplete, so I can't say anything about it. ... But IMO Jeremy's new Toolbar handling may be a starting point. And there is an autocomplete plugin already, but I cant find the link atm. I'll be back :)

-m

Mat

unread,
Oct 10, 2016, 12:54:07 PM10/10/16
to TiddlyWikiDev
Yes, there is an autocomplete made by fellow Alain Dutech link

<:-)

PMario

unread,
Oct 10, 2016, 1:42:59 PM10/10/16
to TiddlyWikiDev
thx Mat,

That's the one I thought of.

-m

Albert Riedinger

unread,
Oct 14, 2016, 6:04:15 AM10/14/16
to TiddlyWikiDev
Thanks to both of you! I'll look into it and try to learn from his approach.

@PMario: You mentioned the new toolbar handling. Could you point me to the appropriate core module or code on github? Please appologize my noobiness :)

Reply all
Reply to author
Forward
0 new messages