mirror of
https://github.com/flynx/PortableMag.git
synced 2025-10-31 20:10:13 +00:00
some more refactoring, preparing to move the editor to editor.js...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
8519c14c71
commit
84f84f9c4f
23
index.html
23
index.html
@ -208,6 +208,7 @@
|
|||||||
|
|
||||||
// XXX need better separation between full screen and ribbon modes...
|
// XXX need better separation between full screen and ribbon modes...
|
||||||
function setupEditor(){
|
function setupEditor(){
|
||||||
|
function setupEditorToolbars(){
|
||||||
var indicator = $('<div class="current-page-indicator"/>')
|
var indicator = $('<div class="current-page-indicator"/>')
|
||||||
.appendTo($('.magazine'))
|
.appendTo($('.magazine'))
|
||||||
|
|
||||||
@ -243,8 +244,13 @@ function setupEditor(){
|
|||||||
.appendTo(left_bar)
|
.appendTo(left_bar)
|
||||||
.click(function(){
|
.click(function(){
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
function clearEdiorToolbars(){
|
||||||
|
var indicator = $('.current-page-indicator').remove()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// general editor mode...
|
||||||
window.toggleEditor = createCSSClassToggler(
|
window.toggleEditor = createCSSClassToggler(
|
||||||
'.chrome',
|
'.chrome',
|
||||||
'editor',
|
'editor',
|
||||||
@ -262,10 +268,16 @@ function setupEditor(){
|
|||||||
}
|
}
|
||||||
setCurrentPage($('.current.page'))
|
setCurrentPage($('.current.page'))
|
||||||
})
|
})
|
||||||
|
// inline editor switcher...
|
||||||
var toggleInlineEditor = createCSSClassToggler(
|
window.toggleInlineEditor = createCSSClassToggler(
|
||||||
'.chrome',
|
'.chrome',
|
||||||
'inline-edior',
|
'inline-edior',
|
||||||
|
function(action){
|
||||||
|
// prevent switching on while not in editor mode...
|
||||||
|
if(toggleEditor('?') == 'off' && action == 'on'){
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
},
|
||||||
function(action){
|
function(action){
|
||||||
if(action == 'on'){
|
if(action == 'on'){
|
||||||
MagazineScroller.stop()
|
MagazineScroller.stop()
|
||||||
@ -278,6 +290,7 @@ function setupEditor(){
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// editable focus...
|
||||||
$('[contenteditable]')
|
$('[contenteditable]')
|
||||||
.on('focus', function(){
|
.on('focus', function(){
|
||||||
if(toggleInlineEditor('?') == 'off'){
|
if(toggleInlineEditor('?') == 'off'){
|
||||||
@ -290,9 +303,9 @@ function setupEditor(){
|
|||||||
toggleInlineEditorMode('off')
|
toggleInlineEditorMode('off')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
$('.viewer')
|
||||||
// move the page indicator...
|
// move the page indicator...
|
||||||
// NOTE: this is to be used for page-specific toolbars etc.
|
// NOTE: this is to be used for page-specific toolbars etc.
|
||||||
$('.viewer')
|
|
||||||
.on('pageChanged', function(){
|
.on('pageChanged', function(){
|
||||||
var cur = $('.current.page')
|
var cur = $('.current.page')
|
||||||
var indicator = $('.current-page-indicator')
|
var indicator = $('.current-page-indicator')
|
||||||
@ -307,7 +320,7 @@ function setupEditor(){
|
|||||||
top: 0,
|
top: 0,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
// switch between editor modes...
|
||||||
.on('fullScreenMode', function(){
|
.on('fullScreenMode', function(){
|
||||||
$(':focus').blur()
|
$(':focus').blur()
|
||||||
if(toggleEditor('?') == 'on'){
|
if(toggleEditor('?') == 'on'){
|
||||||
@ -320,6 +333,8 @@ function setupEditor(){
|
|||||||
toggleInlineEditor('off')
|
toggleInlineEditor('off')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
setupEditorToolbars()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user