From 8519c14c713f66f3a3756bdcd18054b32bfb2481 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 4 Mar 2013 16:48:36 +0400 Subject: [PATCH] reorganized the inline editor, still needs testing... Signed-off-by: Alex A. Naanou --- index.html | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/index.html b/index.html index 9bb5144..e207fbf 100755 --- a/index.html +++ b/index.html @@ -254,20 +254,35 @@ function setupEditor(){ function(action){ if(action == 'on'){ // make editable fields editable... - $('[contenteditable]').attr({contenteditable:"true"}) - MagazineScroller.stop() + if(togglePageView('?') == 'on'){ + toggleInlineEditor('on') + } } else { - $('[contenteditable]').attr({contenteditable:"false"}) - MagazineScroller.start() + toggleInlineEditor('off') } setCurrentPage($('.current.page')) }) + + var toggleInlineEditor = createCSSClassToggler( + '.chrome', + 'inline-edior', + function(action){ + if(action == 'on'){ + MagazineScroller.stop() + $('[contenteditable]').attr({contenteditable: 'true'}) + } else { + $('[contenteditable]') + .blur() + .attr({contenteditable: 'false'}) + MagazineScroller.start() + } + }) $('[contenteditable]') .on('focus', function(){ - if(togglePageView('?') == 'off'){ + if(toggleInlineEditor('?') == 'off'){ $(':focus').blur() - } else if(toggleEditor('?') == 'on'){ + } else { toggleInlineEditorMode('on') } }) @@ -296,15 +311,13 @@ function setupEditor(){ .on('fullScreenMode', function(){ $(':focus').blur() if(toggleEditor('?') == 'on'){ - toggleInlineEditorMode('on') - $('[contenteditable]').attr({contenteditable: 'true'}) + toggleInlineEditor('on') } }) .on('ribbonMode', function(){ $(':focus').blur() if(toggleEditor('?') == 'on'){ - toggleInlineEditorMode('off') - $('[contenteditable]').attr({contenteditable: 'false'}) + toggleInlineEditor('off') } }) }