mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-28 09:30:07 +00:00
started work on templates...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
9d83f807da
commit
1a0e7b9d69
@ -221,6 +221,8 @@
|
||||
/* clickable things in view */
|
||||
& a,
|
||||
& pre,
|
||||
& button,
|
||||
& select,
|
||||
& input {
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
@ -309,6 +309,46 @@ var attributes = {
|
||||
}
|
||||
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// XXX make this collapsed...
|
||||
// XXX handle cursor marker...
|
||||
var templates = {
|
||||
__proto__: plugin,
|
||||
|
||||
nodeFromTemplate: function(){
|
||||
},
|
||||
|
||||
__pre_parse__: function(text, editor, elem){
|
||||
if(!text.startsWith('TEMPLATE')){
|
||||
return text }
|
||||
|
||||
text = text
|
||||
.replace(/^TEMPLATE/, '')
|
||||
var [header, ...lines] = text.split(/\n/g)
|
||||
header =
|
||||
`<button>${
|
||||
header.trim() == '' ?
|
||||
'new'
|
||||
: header.trim()
|
||||
}</button>`
|
||||
|
||||
// body...
|
||||
// XXX only do this if we have nested elements...
|
||||
elem.collapsed = true
|
||||
// XXX
|
||||
|
||||
// button...
|
||||
return header },
|
||||
// XXX focus button...
|
||||
__focusin__: function(evt, editor, elem){
|
||||
},
|
||||
// XXX handle button???
|
||||
__click__: function(evt, editor, elem){
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// XXX revise headings...
|
||||
@ -967,6 +1007,7 @@ var JSONOutline = {
|
||||
// XXX split out DOM-specific plugins into Outline.plugins...
|
||||
pre_plugins: [
|
||||
attributes,
|
||||
templates,
|
||||
blocks,
|
||||
quoted,
|
||||
],
|
||||
|
||||
@ -157,26 +157,44 @@ var setup = function(){
|
||||
- ## ToDo:
|
||||
- Item templates:
|
||||
- inline
|
||||
- [template title]
|
||||
- TEMPLATE
|
||||
text [cursor]
|
||||
- TEMPLATE title
|
||||
text [cursor]
|
||||
- sub-tree
|
||||
- [template title]
|
||||
- TEMPLATE title
|
||||
- text [cursor]
|
||||
- multi-template
|
||||
- [template title A]
|
||||
- TEMPLATE title A
|
||||
text [cursor]
|
||||
- [template title B]
|
||||
- TEMPLATE title B
|
||||
- text [cursor]
|
||||
- renders as:
|
||||
- <button>title</button>
|
||||
- <select>
|
||||
<option>title A</option>
|
||||
<option>title B</option>
|
||||
</select>
|
||||
- action
|
||||
</select><button>new</button>
|
||||
- action:
|
||||
- duplicate template text / subtree (w.o. markers)
|
||||
- select / place cursor at cursor marker
|
||||
- XXX revise syntac
|
||||
- TODO:
|
||||
- nested templates??
|
||||
- global templates -- or should this be an external macro???
|
||||
- revise syntax
|
||||
- templated lists -- a list that uses a template for it's items
|
||||
- something like:
|
||||
- or here there is an explicit item template
|
||||
- TEMPLATE new
|
||||
- [ ] [cursor]
|
||||
- [ ] A
|
||||
- [ ] B
|
||||
- [ ] C
|
||||
- and a shorthand for todo:
|
||||
- TODO in lists like this new items will be created with a todo template
|
||||
- [ ] A
|
||||
- [ ] B
|
||||
- [ ] C
|
||||
- Time to think about a standalone client -- at least to edit own notes as a test...
|
||||
- _also this would be a nice opportunity to start the move to a newer electron version_
|
||||
- Deployment:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user