mirror of
https://github.com/flynx/pWiki.git
synced 2025-12-16 16:11:39 +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()
|
||||
})
|
||||
.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...
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
21
wiki.js
21
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 $('<span>')
|
||||
.addClass('include')
|
||||
.attr('src', page.path)
|
||||
.html(page.parse({ slots: state.slots }, true))[0]
|
||||
.outerHTML
|
||||
return $('<span/>')
|
||||
.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 = {
|
||||
+'<hr>\n'
|
||||
+'<h1 class="title" contenteditable tabindex="0">@include(../title)</h1>\n'
|
||||
+'<br>\n'
|
||||
+'<div class="text" tabindex="0">@include(..)</div>\n'
|
||||
+'<div class="text" tabindex="0"> @include(..) </div>\n'
|
||||
+'<hr>\n'
|
||||
+'<a href="#">home</a>\n'
|
||||
+'<a href="#/">home</a>\n'
|
||||
+'\n',
|
||||
},
|
||||
'Templates/_edit': {
|
||||
@ -474,9 +476,10 @@ var data = {
|
||||
+'<hr>\n'
|
||||
+'<h1 class ="title" contenteditable>@include(../title)</h1>\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'
|
||||
+'\t$(".text").text($(".text").html())\n'
|
||||
+'\t$(".raw").text($(".raw").html())\n'
|
||||
+'</script>\n'
|
||||
+'',
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user