leibler / dokuwiki-plugin-todo

DokuWiki ToDo Plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to assign a keyboard shortcut or accesskey for adding a todo?

Whyglobaleyes opened this issue · comments

Hello,

First off thank you. The plugin is a daily staple and essential for me - like millions of others I'm sure.

I'd like to be able to use some sort of short key sequence instead of using the mouse to click on the toolbar button or typing out <todo> </todo> when I want to add tasks. I've tried using entities.local.conf but not had any success. Could anyone tell me if there's any way to do this please? I posted the same Q, with some probably irrelevant detail, https://forum.dokuwiki.org/d/20579-new-or-custom-accesskey-to-mark-a-todo-task.

The other thing is that I often write out lists of todo's. I usually create them as an unordered list. I'd like the <todo> </todo> tags to appear on the newline the same way that the list marker asterix is automatically generated. Is that already possible or is there some way I can achieve that please?

I should say that I'm not a programmer and though I'd love to test out scripts/ work arounds, I can't do anything but the simplest of cut&paste editing of scripts.
thanks in advance

Look here in <DOKUWIKI_BASE>/lib/plugin/todo/action.php . Chose a letter you'd like to use and remove the //-comment for the second line... Then you can, depending on your OS use shift+alt+<letter> (Windows usually) or the corresponding Linux or Mac modifier-combination for web page hot keys...

Automatically generating like with (un)sorted lists will take more effort...

That's just incredible! thank you!! Thank you ever so much!!!

I set it to j for job, had to disable then enable the plugin to get it to activate but now it's perfect!!

The auto-generate seems a bit irrelevant and lazy now - I'm so happy with the accesskey shortcut.

EDIT

May I suggest that this is (set to a free accesskey and) uncommented by default? or perhaps made really prominent in the readme documentation?

I just went back to https://www.dokuwiki.org/plugin:todo and can see that it says:

QuickButton
A quickbutton for inserting todo syntax is available in the editor toolbar. You can click the button (which is pictured as a checked-checkbox) or you can use the keyboard shortcut of [T].

But I wouldn't have figured it out without Einhirn's guidance.

Apologies,
For interest's sake, in case it means more to the programmers on here ... I just got an answer on the dokuwiki forum with a different solution: https://forum.dokuwiki.org/d/20579-new-or-custom-accesskey-to-mark-a-todo-task :: on 24/10/22 Dodotori wrote:

I figured out how to do it:
open this file dokuwiki/lib/plugins/todo/script.js
then add this script into it

if (typeof window.toolbar !== 'undefined') {
toolbar[toolbar.length] = {
type: "format",
title: "Todo Button",
icon: "../../plugins/todo/todo.png", // located in lib/images/toolbar/
key: "6",
open: "",
sample: "Text between the tags",
close: "",
block: "false"
};
}
it will create a new toolbar button same as todo but with an accesskey 6

I just tested it and it works on my set-up ... so I have 2 ways of doing it!

thks, little + to add current date and user assign:

if (typeof window.toolbar !== 'undefined') {
var dateObj = new Date();
var month = dateObj.getUTCMonth() + 1; //months from 1-12
var day = dateObj.getUTCDate();
var year = dateObj.getUTCFullYear();
newdate = year + "-" + month + "-" + day;
toolbar[toolbar.length] = {
type: "format",
title: "Todo Button",
icon: "../../plugins/todo/todo.png", // located in lib/images/toolbar/
key: "6",
open: "\n<todo due:"+newdate+" @your_dw_username>",
sample: "todo",
close: "\n",
block: "false"
};
}

shall we close this or would a PR be welcome?

I'm not sure why the docs mention an access key and why there's commented out code for it, but it has to have a reason - probably because there are only so many letters available for access keys and other plugins also need some. Maybe the way to go would be to have an access key manager on dokuwiki level, so you can assign whatever access keys you like to whatever plugins you use - just like Thunderbird and/or Firefox seem to do it now. But that would be out of scope for this particular plugin.

I marked this one as a Question and think we should just leave it open for now.