minor fix...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-08-02 04:21:17 +03:00
parent 1e790df062
commit a65cf13db5
2 changed files with 12 additions and 4 deletions

View File

@ -49,17 +49,25 @@ var reload = () => {
var update_editor = function(){
// XXX make this update on enter...
// XXX account for title of edited page...
$('.title')
.focus(function(){
$(this).text(Wiki.title)
var to = $(this).attr('saveto') || '.'
$(this).text(Wiki.get(to).title)
})
.blur(function(){
var to = $(this).attr('saveto') || '.'
var text = $(this).text().trim()
var page = Wiki.get(to)
if(text[0] == '/'){
Wiki.path = text
page.path = text
} else {
Wiki.title = text
page.title = text
}
// XXX need to account for changed path sufixes...
Wiki.path = page.path
reload()
})

View File

@ -726,7 +726,7 @@ var data = {
+'</div>\n'
+'\n'
+'<hr>\n'
+'<h1 class="title" contenteditable tabindex="0">'
+'<h1 class="title" contenteditable tabindex="0" saveto="..">'
+'<slot name="title">'
+'@source(../title)'
+'</slot>'