diff --git a/index.html b/index.html
index 2fdb382..8d90c73 100755
--- a/index.html
+++ b/index.html
@@ -51,17 +51,35 @@ var update_editor = function(){
//reload()
})
- .on('keyup', () => {
- console.log('SAVING:', Wiki.path)
- //if($(this).prop('contenteditable') == 'true'){
+ .on('keyup', function(){
+ if($(this).prop('contenteditable') == 'true'){
+ var to = $(this).attr('saveto') || '.'
+ console.log('SAVING:', Wiki.get(to).path)
// Wiki.raw = clearWikiWords($('.text').clone()).html()
- //}
+ }
})
// XXX do this live, but on a timeout after user input...
// XXX need to place the cursor in the same position...
.blur(() => {
- $(this).removeAttr('contenteditable')
- //reload()
+ $(this)
+ .removeAttr('contenteditable')
+ reload()
+ })
+
+ $('.raw')
+ .focus(function(){
+ var to = $(this).attr('saveto') || '.'
+ console.log('EDITING:', Wiki.get(to).path)
+ })
+ .on('keyup', function(){
+ var to = Wiki.get($(this).attr('saveto') || '.').path
+ console.log('SAVING:', to)
+ Wiki.get(to).raw = $(this).text()
+ })
+ // XXX do this live, but on a timeout after user input...
+ // XXX need to place the cursor in the same position...
+ .blur(() => {
+ reload()
})
}
@@ -111,10 +129,17 @@ $(() => {
path = hash.shift()
hash = hash.pop() || ''
- go(path)
+ // expand the path...
+ if(Wiki.get(path).path != path){
+ location.hash = Wiki.get(path).path
- if(hash.length > 0){
- // XXX focus anchor...
+ // open page...
+ } else {
+ go(path)
+
+ if(hash.length > 0){
+ // XXX focus anchor...
+ }
}
})
})
diff --git a/wiki.js b/wiki.js
index d312ed5..b348779 100755
--- a/wiki.js
+++ b/wiki.js
@@ -324,11 +324,11 @@ var macro = {
// included html from messing up the outer structure with
// things like unclosed tags and stuff...
// XXX can this be anything other than html?
- return $('')
- .addClass('include')
- .attr('src', page.path)
- .html(page.parse({ slots: state.slots }, true))[0]
- .outerHTML
+ return $('')
+ .addClass('include')
+ .attr('src', page.path)
+ .html(page.parse({ slots: state.slots }, true))[0]
+ .outerHTML
})
// post macro...
@@ -336,6 +336,8 @@ var macro = {
text = _parse(context, text, this.post_macro)
}
+ window.t = text
+
return text
},
}
@@ -461,9 +463,9 @@ var data = {
+'
\n'
+'@include(../title)
\n'
+'
\n'
- +'@include(..)
\n'
+ +' @include(..)
\n'
+'
\n'
- +'home\n'
+ +'home\n'
+'\n',
},
'Templates/_edit': {
@@ -474,9 +476,10 @@ var data = {
+'
\n'
+'@include(../title)
\n'
+'
\n'
- +'@source(../raw)
\n'
+ +'@source(../raw)
\n'
+ // XXX avoid this...
+'\n'
+'',
},