keyboard shortcut to edit a tiddler using keyboard widget in ViewTemplate

583 views
Skip to first unread message

harsha

unread,
Apr 3, 2016, 2:05:03 AM4/3/16
to TiddlyWiki
Hello,

In trying to get a shortcut to edit a tiddler, I inserted the following into the view template
<$keyboard key="ctrl+enter" message="tm-edit-tiddler">...</$keyboard> where the ... refers to portion of view template <$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!has[draft.of]]" variable="listItem"><$transclude tiddler=<<listItem>>/></$list>

I selected some text in a tiddler and typed the shortcut. But it didn't enter edit mode. Is the problem that keyboard events dont enter the widget?

Thanks,
Harsha

Knut Franke

unread,
Apr 3, 2016, 8:32:32 AM4/3/16
to TiddlyWiki
Hello Harsha,


On Sunday, April 3, 2016 at 8:05:03 AM UTC+2, harsha wrote:
I selected some text in a tiddler and typed the shortcut. But it didn't enter edit mode. Is the problem that keyboard events dont enter the widget?

Probably. As far as I know, only DOM elements with a tabindex attribute get keyboard events, and you probably don't have any of those in the rendering of your tiddler.

I've also been experimenting with similar keyboard shortcuts, and I got it mostly working. Head over to http://nome.github.io/TiddlyPlugins/ and press F2 to edit a tiddler. You can't select the tiddler to edit with the mouse though, you have to use Ctrl+Up/Down. It's still a bit rough, and behaves weirdly sometimes, but the basics are there.

Cheers,
Knut

harsha

unread,
Apr 3, 2016, 11:12:42 AM4/3/16
to TiddlyWiki
Thanks for the helpful reply, I was able to get it to work by adding a tabindex="1" to the div element in the ViewTemplate and enclosing the div inside a keyboard widget. Your website also had some good plugins.


<$keyboard key="ctrl+enter" message="tm-edit-tiddler"><div tabindex="1" class=<<frame-classes>>><$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!has[draft.of]]" variable="listItem"><$transclude tiddler=<<listItem>>/></$list>
</div>
</$keyboard>


Harsha.
Reply all
Reply to author
Forward
0 new messages