working on attrs...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-12-18 17:08:20 +03:00
parent 1e6e888b2d
commit e4a1d538ef
3 changed files with 31 additions and 5 deletions

View File

@ -414,6 +414,18 @@
} }
/*----------------------------------------------------------- TOC ---*/
:host .outline,
.editor .outline {
.toc>.view,
.TOC>.view {
padding-top: 0px;
padding-bottom: 0px;
}
}
/*--------------------------------------------------------- Quote ---*/ /*--------------------------------------------------------- Quote ---*/
:host .outline .quote>.text, :host .outline .quote>.text,

View File

@ -920,6 +920,7 @@ var JSONOutline = {
// block render... // block render...
// XXX PRE_POST_NEWLINE can we avoid explicitly patching for empty lines after pre??? // XXX PRE_POST_NEWLINE can we avoid explicitly patching for empty lines after pre???
__view_attrs__: false,
__code2html__: function(code, elem={}){ __code2html__: function(code, elem={}){
var that = this var that = this
@ -937,7 +938,7 @@ var JSONOutline = {
}[stage] }[stage]
return that.threadPlugins(meth, text, that, elem) } return that.threadPlugins(meth, text, that, elem) }
elem = this.parseBlockAttrs(code, elem) elem = this.parseBlockAttrs(code, this.__view_attrs__, elem)
code = elem.text code = elem.text
// stage: pre... // stage: pre...
@ -1012,12 +1013,14 @@ var JSONOutline = {
// .parseBlockAttrs(<text>, 'all'[, <elem>]) // .parseBlockAttrs(<text>, 'all'[, <elem>])
// -> <elem> // -> <elem>
// //
parseBlockAttrs: function(text, keep=false, elem={}){ // XXX move to config...
__code_attrs__: true,
parseBlockAttrs: function(text, keep=!!this.__code_attrs__, elem={}){
if(typeof(keep) == 'object'){ if(typeof(keep) == 'object'){
elem = keep elem = keep
keep = typeof(elem) == 'boolean' ? keep = typeof(elem) == 'boolean' ?
elem elem
: false } : this.__code_attrs__ }
var system = this.__block_attrs__ var system = this.__block_attrs__
var clean = text var clean = text
// XXX for some reason changing the first group into (?<= .. ) // XXX for some reason changing the first group into (?<= .. )
@ -1568,6 +1571,8 @@ var Outline = {
: this._updateViewSize(view, code) }, : this._updateViewSize(view, code) },
//*/ //*/
// Update node from data...
//
// NOTE: this does not internally handle undo as it would be too // NOTE: this does not internally handle undo as it would be too
// granular... // granular...
// NOTE: to remove an attribute set it's value to null, undefined, // NOTE: to remove an attribute set it's value to null, undefined,

View File

@ -144,9 +144,15 @@ var setup = function(){
- -
- ## ToDo: - ## ToDo:
- attributes: need to show/hide the attributes -- option? - attributes: need to show/hide the attributes -- option?
- TOC: Q: should we have both manual and auto headings??? attr::value
- IMHO: no... - `.parseBlockAttrs(..)` -- add hook to plugins to handle output...
- _plugin will need to get the call context -- can be called when handling for view or code_
- `.parseBlockAttrs(..)` render (code) attrs in data but not in code...
- do we need `.__code_attrs__` / `.__view_attrs__`???
- handle attr delete correctly -- i.e. sown attr removed from code -> delete attr...
- BUG? can't set '' as attr value -- parser??
- TOC: tweaking: add args like depth, ... -- as attributes... - TOC: tweaking: add args like depth, ... -- as attributes...
- TOC: should it be persistently generated as code and be serializable?
- ASAP: expand sub-tree on follow link... - ASAP: expand sub-tree on follow link...
- export auto-headings as normal/manual markdown headings... - export auto-headings as normal/manual markdown headings...
- add plugin callback on `.text(..)` / ... - add plugin callback on `.text(..)` / ...
@ -267,6 +273,9 @@ var setup = function(){
- `<editable/>` -- field marker - `<editable/>` -- field marker
- each child node will copy the template and allow editing of only fields - each child node will copy the template and allow editing of only fields
- not clear how to handle template changes... - not clear how to handle template changes...
- DONE TOC: Q: should we have both manual and auto headings???
collapsed:: true
- IMHO: no...
- DONE attributes: need a way to remove attributes from editor -- `null` or `undefined` special values?? - DONE attributes: need a way to remove attributes from editor -- `null` or `undefined` special values??
- DONE attributes: `.data(..)`: read in element attributes... - DONE attributes: `.data(..)`: read in element attributes...
collapsed:: true collapsed:: true