mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-28 17:40:07 +00:00
refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
5cd04af9f2
commit
a308f32b14
@ -1776,7 +1776,17 @@ var Outline = {
|
||||
|
||||
// serialization...
|
||||
data: function(elem, deep=true){
|
||||
elem = this.get(elem)
|
||||
var that = this
|
||||
// all elements...
|
||||
elem =
|
||||
(elem == 'all' || elem == 'root' || elem == '*') ?
|
||||
[...this.outline.children]
|
||||
: this.get(elem)
|
||||
if(elem instanceof Array){
|
||||
return elem
|
||||
.map(function(elem){
|
||||
return that.data(elem) }) }
|
||||
// single element...
|
||||
// XXX move these to config...
|
||||
var attrs = this.__block_attrs__
|
||||
var cls_attrs = ['focused']
|
||||
@ -1795,17 +1805,21 @@ var Outline = {
|
||||
&& (res[attr] = true) }
|
||||
return res }, {})),
|
||||
...(deep ?
|
||||
{children: this.json(elem)}
|
||||
//{children: this.json(elem)}
|
||||
{children: [...elem.lastChild.children]
|
||||
.map(function(elem){
|
||||
return that.data(elem) })}
|
||||
: {}),
|
||||
} },
|
||||
json: function(node){
|
||||
var that = this
|
||||
var children = [...(node ?
|
||||
node.lastChild.children
|
||||
: this.outline.children)]
|
||||
return children
|
||||
.map(function(elem){
|
||||
return that.data(elem) }) },
|
||||
// XXX do we need both this and data???
|
||||
// ...the only difference is the default behavior -- node vs all...
|
||||
// XXX should this always return a list???
|
||||
json: function(node='all'){
|
||||
return [this.data(...(
|
||||
arguments.length == 0 ?
|
||||
['all']
|
||||
: arguments))]
|
||||
.flat() },
|
||||
|
||||
// XXX should this handle children???
|
||||
// XXX revise name...
|
||||
|
||||
@ -144,8 +144,6 @@ var setup = function(){
|
||||
- add loading spinner -- `.loading` class set on `.load(..)` and unset when done...
|
||||
- DONE set/unset class
|
||||
- add animation
|
||||
- `.json(..)`, `.data(..)`, ... should be signature compatible with `.get(..)` (???)
|
||||
- _current state causes constant confusion..._
|
||||
- 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_
|
||||
- Q: Make the heading level depend on its depth??
|
||||
@ -258,6 +256,7 @@ var setup = function(){
|
||||
- `<editable/>` -- field marker
|
||||
- each child node will copy the template and allow editing of only fields
|
||||
- not clear how to handle template changes...
|
||||
- DONE `.json(..)`, `.data(..)`, ... should be signature compatible with `.get(..)` (???)
|
||||
- DONE Q: Should we use `HTMLTextAreaElement.autoUpdateSize(..)` or handle it globally in setup???
|
||||
collapsed:: true
|
||||
- _...I'm leaning towards the later..._
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user