From bda241f7adc7ebe90c639d3b4592c1616038a234 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sun, 1 Dec 2013 05:58:12 +0400 Subject: [PATCH] some cleanup... Signed-off-by: Alex A. Naanou --- ui/TODO.otl | 7 +++++++ ui/editor.js | 5 +++-- ui/keybindings.js | 18 +++++++++--------- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/ui/TODO.otl b/ui/TODO.otl index a2a50ac6..ed040696 100755 --- a/ui/TODO.otl +++ b/ui/TODO.otl @@ -110,6 +110,13 @@ Roadmap [_] 30% Gen 3 current todo [_] 60% High priority + [_] BUG: editor also affects the image background and border... + | to view just set invert to 1 + | - background turns white... + | - red border turns blue... + | + | need to either compensate or figure out a way to work around + | this without adding ne tags... [_] BUG: OSX: unable to load absolute paths... [_] OSX: add alternatives to function buttons... [_] Feature: basic editor... diff --git a/ui/editor.js b/ui/editor.js index 4097afcd..6fc13930 100755 --- a/ui/editor.js +++ b/ui/editor.js @@ -9,7 +9,9 @@ /*********************************************************************/ -var toggleEditor = createCSSClassToggler('.viewer', '.editor-visible', +var toggleEditor = createCSSClassToggler( + '.viewer', + '.editor-visible', function(action){ var ed = $('.panel') @@ -25,7 +27,6 @@ var toggleEditor = createCSSClassToggler('.viewer', '.editor-visible', $('.panel :focus').blur() } })) - // setup the event to update the editor... .on('focusingImage', function(){ if(toggleEditor('?') == 'on'){ diff --git a/ui/keybindings.js b/ui/keybindings.js index 15bea3b7..15e9e10d 100755 --- a/ui/keybindings.js +++ b/ui/keybindings.js @@ -118,6 +118,8 @@ var KEYBOARD_CONFIG = { // dialogs... // + // NOTE: editor effects are not documented, but should be obvious... + // XXX is this the case? '.viewer.overlay .overlay-block.dialog, .panel :focus': { title: 'Dialog', doc: 'NOTE: to close a dialog, in addition to the keyaboard '+ @@ -128,11 +130,12 @@ var KEYBOARD_CONFIG = { 'insert-return': doc('Insert return'), Enter: { - default: doc('Accept dialog / input', + default: doc('Accept dialog', function(){ var f = $(':focus') - // trigger the default button action... + // trigger the default button/summary action... + // NOTE: for some reason checkboxes in dialogs do not work (not a biggie)... if(f.length > 0 && (/button|summary/i.test(f[0].tagName) || /button|checkbox/i.test(f.attr('type')))){ @@ -140,7 +143,7 @@ var KEYBOARD_CONFIG = { // prevent the key from propagating to the viewer... return false - // accept the input... + // accept the input -- e.g. remove focus from it... } else if(toggleEditor('?') == 'on'){ f.blur() // prevent the key from propagating to the viewer... @@ -157,18 +160,15 @@ var KEYBOARD_CONFIG = { }, Esc: doc('Close dialog', function(){ + // hide the overlay... if(isOverlayVisible('.viewer')){ //getOverlay($('.viewer')).trigger('close') hideOverlay($('.viewer')) return false + // blur focused element, if nothing focused close... } else if(toggleEditor('?') == 'on'){ - var f = $(':focus') - if(f.length > 0){ - f.blur() - } else { - toggleEditor('off') - } + $(':focus').blur() } }), },