added dataset attr removal...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-12-18 01:51:58 +03:00
parent 7a7ac49432
commit 1e6e888b2d
2 changed files with 11 additions and 7 deletions

View File

@ -1570,6 +1570,8 @@ var Outline = {
// 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,
// 'null', or 'undefined'
update: function(node='focused', data){ update: function(node='focused', data){
var node = this.get(node) var node = this.get(node)
data ??= this.data(node, false) data ??= this.data(node, false)
@ -1615,7 +1617,9 @@ var Outline = {
: node.removeAttribute(attr) : node.removeAttribute(attr)
// dataset... // dataset...
} else { } else {
if(value == null){ if(value == null
|| value == 'null'
|| value == 'undefined'){
delete node.dataset[attr] delete node.dataset[attr]
} else { } else {
node.dataset[attr] = value } } } node.dataset[attr] = value } } }

View File

@ -143,15 +143,9 @@ var setup = function(){
|text|text|text| |text|text|text|
- -
- ## ToDo: - ## ToDo:
- attributes: `.data(..)`: read in element attributes...
- would be logical to store system attrs (`.__block_attrs__`) as attrs while the rest as data-attrs - this would bot simplify retrieval and avoid shadowing html attrs...
- TEST: this item has attr `moo` with value `"foo"`
moo::foo
- need a way to remove attributes from editor -- `null` or `undefined` special values??
- 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??? - TOC: Q: should we have both manual and auto headings???
- IMHO: no... - IMHO: no...
- DONE TOC: headings that do not show up in toc -- `# ...` shows up while `@ ...` does not...
- TOC: tweaking: add args like depth, ... -- as attributes... - TOC: tweaking: add args like depth, ... -- as attributes...
- 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...
@ -273,6 +267,12 @@ 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 attributes: need a way to remove attributes from editor -- `null` or `undefined` special values??
- DONE attributes: `.data(..)`: read in element attributes...
collapsed:: true
- TEST: this item has attr `moo` with value `"foo"`
moo::foo
- DONE TOC: headings that do not show up in toc -- `# ...` shows up while `@ ...` does not...
- DONE \TOC global/local - DONE \TOC global/local
- DONE FEATURE dynamic headings -- level depends on number of headings above... - DONE FEATURE dynamic headings -- level depends on number of headings above...
- DONE Experimental syntax: - DONE Experimental syntax: