mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-29 01:50:07 +00:00
basic templating functional -- still needs work...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
7d45f89dfe
commit
debb98faa1
@ -348,14 +348,28 @@ var templates = {
|
|||||||
// XXX restrict this to the button???
|
// XXX restrict this to the button???
|
||||||
__click__: function(evt, editor, elem){
|
__click__: function(evt, editor, elem){
|
||||||
if(evt.target.tagName == 'BUTTON'){
|
if(evt.target.tagName == 'BUTTON'){
|
||||||
//var node = editor.get(elem)
|
// get template data...
|
||||||
//
|
var data = editor.data(elem)
|
||||||
// XXX get the template data...
|
// subtree...
|
||||||
var data = {}
|
if(data.children.length > 0){
|
||||||
|
data = data.children[0]
|
||||||
|
// text...
|
||||||
|
} else {
|
||||||
|
data.text = data.text
|
||||||
|
.split(/\n/)
|
||||||
|
.slice(1)
|
||||||
|
.join('\n') }
|
||||||
|
|
||||||
|
// XXX handle cursor placement / selection...
|
||||||
|
// XXX
|
||||||
|
|
||||||
|
// XXX how do we get this???
|
||||||
var direction = 'next'
|
var direction = 'next'
|
||||||
|
|
||||||
editor.focus(elem)
|
editor.focus(elem)
|
||||||
editor.edit(
|
editor.edit(
|
||||||
|
// XXX BUG? currently this only creates a single node,
|
||||||
|
// should be recursive...
|
||||||
editor.Block(data, direction)) } },
|
editor.Block(data, direction)) } },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user