witten
/
luminotes
Archived
1
0
Fork 0

New keyboard shortcuts for switching to next open note and previous open note: Page down and page up.

Also fixed visual bug that caused switching notes to flash when focusing.
The fix involved calling Editor.reposition() at the top of resize() instead of at the end.
This commit is contained in:
Dan Helfman 2009-01-27 11:53:50 -08:00
parent 941feb1dbf
commit fdebb1061b
3 changed files with 34 additions and 1 deletions

2
NEWS
View File

@ -1,5 +1,7 @@
1.6.0: January ??, 2009
* Switching between notebooks and loading notebooks is now much faster.
* New keyboard shortcuts for switching to next open note and previous open
note: Page down and page up.
* Fixed various bugs related to the subscription page.
1.5.12: December 30, 2008

View File

@ -100,6 +100,7 @@ Editor.prototype.create_div = function ( position_after ) {
this.holder = getElement( "note_holder_" + this.id );
this.connect_note_controls( true );
this.div = static_note_div;
this.div.editor = this;
static_contents = getFirstElementByTagAndClassName( "span", "static_note_contents", this.div );
if ( static_contents && static_contents.innerHTML != this.initial_text )
static_contents.innerHTML = this.initial_text;
@ -615,6 +616,9 @@ Editor.prototype.query_command_value = function ( command ) {
// resize the editor's frame to fit the dimensions of its content
Editor.prototype.resize = function ( get_height_from_div ) {
if ( !this.document ) return;
this.reposition();
var height = null;
var width = elementDimensions( this.div.parentNode ).w;
@ -642,10 +646,11 @@ Editor.prototype.resize = function ( get_height_from_div ) {
setElementDimensions( this.div, size );
var self = this;
this.reposition();
}
Editor.prototype.reposition = function ( repeat ) {
if ( !this.iframe ) return;
// give the iframe the exact same position as the div it replaces. subtract the position of the
// center_content_area container, which is relatively positioned
var position = getElementPosition( this.div );

View File

@ -1140,6 +1140,32 @@ Wiki.prototype.editor_key_pressed = function ( editor, event ) {
editor.exec_command( "indent" );
event.stop();
// page up: previous note
} else if ( code == 33 ) {
event.stop();
if ( !this.focused_editor ) return;
var previous_holder = this.focused_editor.holder.previousSibling;
if ( !previous_holder ) return;
if ( !hasElementClass( previous_holder, "note_holder" ) )
previous_holder = previous_holder.previousSibling;
if ( !previous_holder || !hasElementClass( previous_holder, "note_holder" ) ) return;
var div = getFirstElementByTagAndClassName( "div", "static_note_div", previous_holder );
if ( !div || !div.editor ) return;
div.editor.highlight();
// page down: next note
} else if ( code == 34 ) {
event.stop();
if ( !this.focused_editor ) return;
var next_holder = this.focused_editor.holder.nextSibling;
if ( !next_holder ) return;
if ( !hasElementClass( next_holder, "note_holder" ) )
next_holder = next_holder.nextSibling;
if ( !next_holder || !hasElementClass( next_holder, "note_holder" ) ) return;
var div = getFirstElementByTagAndClassName( "div", "static_note_div", next_holder );
if ( !div || !div.editor ) return;
div.editor.highlight();
// IE: hitting space while making a link shouldn't end the link
} else if ( code == 32 && editor.document.selection && editor.state_enabled( "a" ) ) {
var range = editor.document.selection.createRange();