Alanaktion / lwrte

Automatically exported from code.google.com/p/lwrte
0 stars 0 forks source link

No support for CTRL+KEY shortcuts #35

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Load a page with lwrte enabled for a textarea.
2. Type in some text, select it and hold down CTRL and press the B key.

What is the expected output? What do you see instead?
The selected text should become bold.  Instead, the bookmark (at least in
FF) view is opened.

What version of the product are you using? On what operating system?
v 1.2
Win XP pro

Please provide any additional information below.
I realize that this may add bloat, but these RTE controls are meant to be
used primarily by non-techie type people who don't understand HTML but know
how to use MS Word.  I think CTRL+B (bold), CTRL+I (italics), CTRL+U
(underline) should be implemented.

Original issue reported on code.google.com by cfxcha...@gmail.com on 3 Jun 2009 at 7:23

GoogleCodeExporter commented 8 years ago
I had this same issue (not really an issue, just a desired funtionality) and 
was able
to add some basic styling (bold, italic, underline).

First I included the small js-hotkeys jquery plugin in my js files
(http://code.google.com/p/js-hotkeys/).  Then I added this code in 
enable_design_mode
function:

$(self.iframe_doc).bind('keydown', 'Ctrl+b',function (evt){ 
self.editor_cmd("bold");
return false; });
$(self.iframe_doc).bind('keydown', 'Ctrl+i',function (evt){
self.editor_cmd("italic"); return false; });
$(self.iframe_doc).bind('keydown', 'Ctrl+u',function (evt){
self.editor_cmd("underline"); return false; });

This binds keydown events to the rte iframe.  The self.editor_cmd("bold") bit 
applies
the style, and 'return false;' stops normal action from happening (the Bookmarks
sidebar, etc.)

My code just does bold, italic, and underline, but you could easily add more 
basic
functions (strikethrough, justifyright, indent, subscript, etc.) just using the 
basic
execCommand values (here's a good list: 
http://www.quirksmode.org/dom/execCommand.html).

I would like, however, to be able to call up the link function (lwrte_link) on a
Ctrl+L keypess, but haven't yet figure out how to do that.  If anyone could 
advise me
on this it'd be appreciated.  

Original comment by CharlieK...@gmail.com on 25 Nov 2009 at 1:20