mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-28 17:40: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???
|
||||
__click__: function(evt, editor, elem){
|
||||
if(evt.target.tagName == 'BUTTON'){
|
||||
//var node = editor.get(elem)
|
||||
//
|
||||
// XXX get the template data...
|
||||
var data = {}
|
||||
// get template data...
|
||||
var data = editor.data(elem)
|
||||
// subtree...
|
||||
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'
|
||||
|
||||
editor.focus(elem)
|
||||
editor.edit(
|
||||
// XXX BUG? currently this only creates a single node,
|
||||
// should be recursive...
|
||||
editor.Block(data, direction)) } },
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user