mirror of
https://github.com/flynx/pWiki.git
synced 2025-12-18 09:01:40 +00:00
tweaking/fixing bugs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
82d9cb4d8a
commit
5003e63ecb
43
index.html
43
index.html
@ -51,17 +51,35 @@ var update_editor = function(){
|
|||||||
|
|
||||||
//reload()
|
//reload()
|
||||||
})
|
})
|
||||||
.on('keyup', () => {
|
.on('keyup', function(){
|
||||||
console.log('SAVING:', Wiki.path)
|
if($(this).prop('contenteditable') == 'true'){
|
||||||
//if($(this).prop('contenteditable') == 'true'){
|
var to = $(this).attr('saveto') || '.'
|
||||||
|
console.log('SAVING:', Wiki.get(to).path)
|
||||||
// Wiki.raw = clearWikiWords($('.text').clone()).html()
|
// Wiki.raw = clearWikiWords($('.text').clone()).html()
|
||||||
//}
|
}
|
||||||
})
|
})
|
||||||
// XXX do this live, but on a timeout after user input...
|
// XXX do this live, but on a timeout after user input...
|
||||||
// XXX need to place the cursor in the same position...
|
// XXX need to place the cursor in the same position...
|
||||||
.blur(() => {
|
.blur(() => {
|
||||||
$(this).removeAttr('contenteditable')
|
$(this)
|
||||||
//reload()
|
.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()
|
path = hash.shift()
|
||||||
hash = hash.pop() || ''
|
hash = hash.pop() || ''
|
||||||
|
|
||||||
go(path)
|
// expand the path...
|
||||||
|
if(Wiki.get(path).path != path){
|
||||||
|
location.hash = Wiki.get(path).path
|
||||||
|
|
||||||
if(hash.length > 0){
|
// open page...
|
||||||
// XXX focus anchor...
|
} else {
|
||||||
|
go(path)
|
||||||
|
|
||||||
|
if(hash.length > 0){
|
||||||
|
// XXX focus anchor...
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
21
wiki.js
21
wiki.js
@ -324,11 +324,11 @@ var macro = {
|
|||||||
// included html from messing up the outer structure with
|
// included html from messing up the outer structure with
|
||||||
// things like unclosed tags and stuff...
|
// things like unclosed tags and stuff...
|
||||||
// XXX can this be anything other than html?
|
// XXX can this be anything other than html?
|
||||||
return $('<span>')
|
return $('<span/>')
|
||||||
.addClass('include')
|
.addClass('include')
|
||||||
.attr('src', page.path)
|
.attr('src', page.path)
|
||||||
.html(page.parse({ slots: state.slots }, true))[0]
|
.html(page.parse({ slots: state.slots }, true))[0]
|
||||||
.outerHTML
|
.outerHTML
|
||||||
})
|
})
|
||||||
|
|
||||||
// post macro...
|
// post macro...
|
||||||
@ -336,6 +336,8 @@ var macro = {
|
|||||||
text = _parse(context, text, this.post_macro)
|
text = _parse(context, text, this.post_macro)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.t = text
|
||||||
|
|
||||||
return text
|
return text
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -461,9 +463,9 @@ var data = {
|
|||||||
+'<hr>\n'
|
+'<hr>\n'
|
||||||
+'<h1 class="title" contenteditable tabindex="0">@include(../title)</h1>\n'
|
+'<h1 class="title" contenteditable tabindex="0">@include(../title)</h1>\n'
|
||||||
+'<br>\n'
|
+'<br>\n'
|
||||||
+'<div class="text" tabindex="0">@include(..)</div>\n'
|
+'<div class="text" tabindex="0"> @include(..) </div>\n'
|
||||||
+'<hr>\n'
|
+'<hr>\n'
|
||||||
+'<a href="#">home</a>\n'
|
+'<a href="#/">home</a>\n'
|
||||||
+'\n',
|
+'\n',
|
||||||
},
|
},
|
||||||
'Templates/_edit': {
|
'Templates/_edit': {
|
||||||
@ -474,9 +476,10 @@ var data = {
|
|||||||
+'<hr>\n'
|
+'<hr>\n'
|
||||||
+'<h1 class ="title" contenteditable>@include(../title)</h1>\n'
|
+'<h1 class ="title" contenteditable>@include(../title)</h1>\n'
|
||||||
+'<br>\n'
|
+'<br>\n'
|
||||||
+'<code><pre class="text" contenteditable>@source(../raw)</pre></code>\n'
|
+'<code><pre class="raw" saveto=".." contenteditable>@source(../raw)</pre></code>\n'
|
||||||
|
// XXX avoid this...
|
||||||
+'<script>\n'
|
+'<script>\n'
|
||||||
+'\t$(".text").text($(".text").html())\n'
|
+'\t$(".raw").text($(".raw").html())\n'
|
||||||
+'</script>\n'
|
+'</script>\n'
|
||||||
+'',
|
+'',
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user