Feature Request: Insert Link

24 views
Skip to first unread message

tdho...@gmail.com

unread,
Jun 19, 2013, 3:02:30 PM6/19/13
to write...@googlegroups.com
In Gmail, Microsoft Office, and other products, you can quickly insert a link on highlighted text using Ctrl - K (http://blogs.office.com/b/microsoft-word/archive/2011/10/20/link-like-lightning-ctrl-k.aspx). I would love to see functionality like this in WriteMonkey!!

josip

unread,
Jun 19, 2013, 4:41:58 PM6/19/13
to write...@googlegroups.com, tdho...@gmail.com
WM is a plain text editor. For such a feature to be possible wm would have to save in html or something like that. 
i.

Tim Hopper

unread,
Jun 19, 2013, 4:43:46 PM6/19/13
to josip, write...@googlegroups.com
Hi -

I was referring to a Markdown link. For example: you have a link in the clipboard, you highlight some text, press Ctrl - K, and the text URL is included with that text as a Markdown URL.

Possible?


Tim

josip

unread,
Jun 19, 2013, 4:52:28 PM6/19/13
to write...@googlegroups.com, josip, tdho...@gmail.com
That is possible and not hard to achieve with the new plugin api.
i.

Tim Hopper

unread,
Jun 19, 2013, 4:56:30 PM6/19/13
to josip, write...@googlegroups.com
Cool. Hadn't come across plugin functionality yet. Will explore. 

Thanks for the awesome software.


Tim

josip

unread,
Jun 19, 2013, 5:14:30 PM6/19/13
to write...@googlegroups.com, josip, tdho...@gmail.com
You must use the latest preview to run plugins. The quick&dirty solution for what you proposed is:

// Entry point event / use ctrl+E,L to fire
monkey.add_extendedShortcutFiredE(function(object, eventargs) {
if (eventargs.extendedKey == "L") {
insertLink();
}
});

insertLink = function() {
if (monkey.selectionLength > 0) {
var text = monkey.selectedText.Trim();
var link = System.Windows.Forms.Clipboard.GetText(); // no checking if there is a valid link in a clipboard
monkey.selectedText = "[" + text + "](" + link + ")"; 
}
}; 


You should create new folder "Link" under the plugins dir, create file named "exe_Link.js" and copy the code in it. Re-run wm. Use CTRL+E,L to fire it up.
i.
Reply all
Reply to author
Forward
0 new messages