mirror of
https://github.com/flynx/PortableMag.git
synced 2025-10-29 11:10:08 +00:00
updated editor...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
ad1dcf7616
commit
0dbf94195b
9
TODO.otl
9
TODO.otl
@ -6,7 +6,7 @@
|
|||||||
[_] BUG: no drag threshold on excludedElements (TouchSwipe)
|
[_] BUG: no drag threshold on excludedElements (TouchSwipe)
|
||||||
| stalled...
|
| stalled...
|
||||||
[_] 75% general todo
|
[_] 75% general todo
|
||||||
[_] 0% add two main page themes:
|
[_] 0% add two main page themes (global/local applicable):
|
||||||
[_] light
|
[_] light
|
||||||
[_] dark
|
[_] dark
|
||||||
[_] JSON: add page URLs as an alternative to direct content...
|
[_] JSON: add page URLs as an alternative to direct content...
|
||||||
@ -56,6 +56,13 @@
|
|||||||
[_] BUG: href to existing anchors will mess up layout...
|
[_] BUG: href to existing anchors will mess up layout...
|
||||||
| need to find out how can we disable anchor links from actually
|
| need to find out how can we disable anchor links from actually
|
||||||
| going to the anchor...
|
| going to the anchor...
|
||||||
|
[X] 100% templates
|
||||||
|
[X] page number
|
||||||
|
[X] current page
|
||||||
|
| this is not really a template...
|
||||||
|
|
|
||||||
|
| XXX should this be a real template...
|
||||||
|
[X] magazine title
|
||||||
[X] Editor: decide weather to make the editor toolbar oriented or floating bars around context...
|
[X] Editor: decide weather to make the editor toolbar oriented or floating bars around context...
|
||||||
[X] add in-page live templates...
|
[X] add in-page live templates...
|
||||||
| elements that will get generated content, like page numbers etc.
|
| elements that will get generated content, like page numbers etc.
|
||||||
|
|||||||
16
editor.html
16
editor.html
@ -52,6 +52,10 @@ $(document).ready(function(){
|
|||||||
.on('pageMoved articleMoved', resetNavigator)
|
.on('pageMoved articleMoved', resetNavigator)
|
||||||
.on('pageRemoved articleRemoved', resetNavigator)
|
.on('pageRemoved articleRemoved', resetNavigator)
|
||||||
|
|
||||||
|
// templates...
|
||||||
|
.on('pageCreated articleCreated magazineCreated ' +
|
||||||
|
'pageMoved pageRemoved articleMoved articleRemoved', runMagazineTemplates)
|
||||||
|
|
||||||
// user interactions...
|
// user interactions...
|
||||||
.swipe({
|
.swipe({
|
||||||
swipeStatus: swipeHandler,
|
swipeStatus: swipeHandler,
|
||||||
@ -167,7 +171,9 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
<div class="top-toolbar">
|
<div class="top-toolbar">
|
||||||
<div class="left-set">
|
<div class="left-set">
|
||||||
<div class="button cover title"><a href="#home">PortableMag Editor</a></div>
|
<div class="button cover title">
|
||||||
|
<a href="#home"><span class="magazine-title-text">PortableMag</span> <small>(editor)</small></a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="right-set">
|
<div class="right-set">
|
||||||
<div class="button prev-bookmark">
|
<div class="button prev-bookmark">
|
||||||
@ -271,6 +277,12 @@ $(document).ready(function(){
|
|||||||
<div class="cover page">
|
<div class="cover page">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<h1 name="basics" style="color:gray;font-size:100px;">Templates...</h1>
|
<h1 name="basics" style="color:gray;font-size:100px;">Templates...</h1>
|
||||||
|
|
||||||
|
Magazine title: <span class="magazine-title-text">[MAGAZINE NAME]</span><br>
|
||||||
|
|
||||||
|
<div class="article-index">[ARTICLE INDEX]</div>
|
||||||
|
|
||||||
|
<div class="page-number-text">[PAGE NUMBER]</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="page">
|
<div class="page">
|
||||||
@ -282,6 +294,8 @@ $(document).ready(function(){
|
|||||||
<div contenteditable="true" style="float:left; width: 45%; height: 100%; padding: 10px;">
|
<div contenteditable="true" style="float:left; width: 45%; height: 100%; padding: 10px;">
|
||||||
Column 2
|
Column 2
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="page-number-text">[PAGE NUMBER]</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
24
magazine.js
24
magazine.js
@ -1172,6 +1172,8 @@ function createCoverPage(data){
|
|||||||
|
|
||||||
/*********************************************** editor: templates ***/
|
/*********************************************** editor: templates ***/
|
||||||
|
|
||||||
|
// NOTE: for these to be self-aplicable they must only replace the content
|
||||||
|
// of the matched elements and not touch the element itself.
|
||||||
var MagazineTemplates = {
|
var MagazineTemplates = {
|
||||||
|
|
||||||
// setup titles...
|
// setup titles...
|
||||||
@ -1181,7 +1183,15 @@ var MagazineTemplates = {
|
|||||||
|| 'PortableMag')
|
|| 'PortableMag')
|
||||||
},
|
},
|
||||||
|
|
||||||
// index...
|
// setup page numbers...
|
||||||
|
'.page-number-text': function(elem){
|
||||||
|
elem.each(function(_, e){
|
||||||
|
var e = $(e)
|
||||||
|
e.text(getPageNumber(e.parents('.page')))
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// magazine index...
|
||||||
'.article-index': function(elem){
|
'.article-index': function(elem){
|
||||||
var list = $('<ul/>')
|
var list = $('<ul/>')
|
||||||
var mag = $('.magazine')
|
var mag = $('.magazine')
|
||||||
@ -1207,20 +1217,14 @@ var MagazineTemplates = {
|
|||||||
|| 'Magazine')))
|
|| 'Magazine')))
|
||||||
root.append(list)
|
root.append(list)
|
||||||
elem
|
elem
|
||||||
|
// remove the original content...
|
||||||
.html('')
|
.html('')
|
||||||
// cover...
|
// cover...
|
||||||
.append(root)
|
.append(root)
|
||||||
},
|
}
|
||||||
|
|
||||||
// setup page numbers...
|
|
||||||
'.page-number-text': function(elem){
|
|
||||||
elem.each(function(_, e){
|
|
||||||
var e = $(e)
|
|
||||||
e.text(getPageNumber(e.parents('.page')))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// XXX call this on page edits...
|
// XXX call this on page edits...
|
||||||
function runMagazineTemplates(){
|
function runMagazineTemplates(){
|
||||||
for(var tpl in MagazineTemplates){
|
for(var tpl in MagazineTemplates){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user