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

View File

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