mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-29 18:10:09 +00:00
working on attributes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
d5950dc742
commit
7a7ac49432
@ -216,7 +216,7 @@ var attributes = {
|
|||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
// XXX convert auto-heading to markdown heading level and back...
|
// XXX revise headings...
|
||||||
var blocks = {
|
var blocks = {
|
||||||
__proto__: plugin,
|
__proto__: plugin,
|
||||||
|
|
||||||
@ -1155,6 +1155,9 @@ var JSONOutline = {
|
|||||||
: undefined
|
: undefined
|
||||||
} else if(type == 'attr'
|
} else if(type == 'attr'
|
||||||
|| type == undefined){
|
|| type == undefined){
|
||||||
|
// special case: dataset attrs...
|
||||||
|
if(type == undefined){
|
||||||
|
attr = 'data-'+ attr }
|
||||||
typeof(value) == 'boolean'?
|
typeof(value) == 'boolean'?
|
||||||
(value ?
|
(value ?
|
||||||
attrs.push(attr)
|
attrs.push(attr)
|
||||||
@ -1602,16 +1605,20 @@ var Outline = {
|
|||||||
value ?
|
value ?
|
||||||
node.classList.add(attr)
|
node.classList.add(attr)
|
||||||
: node.classList.remove(attr)
|
: node.classList.remove(attr)
|
||||||
|
} else if(type == 'attr'){
|
||||||
} else if(type == 'attr'
|
|
||||||
|| type == undefined){
|
|
||||||
typeof(value) == 'boolean'?
|
typeof(value) == 'boolean'?
|
||||||
(value ?
|
(value ?
|
||||||
node.setAttribute(attr, '')
|
node.setAttribute(attr, '')
|
||||||
: node.removeAttribute(attr))
|
: node.removeAttribute(attr))
|
||||||
: value != null ?
|
: value != null ?
|
||||||
node.setAttribute(attr, value)
|
node.setAttribute(attr, value)
|
||||||
: node.removeAttribute(attr) } }
|
: node.removeAttribute(attr)
|
||||||
|
// dataset...
|
||||||
|
} else {
|
||||||
|
if(value == null){
|
||||||
|
delete node.dataset[attr]
|
||||||
|
} else {
|
||||||
|
node.dataset[attr] = value } } }
|
||||||
this.__change__()
|
this.__change__()
|
||||||
return node },
|
return node },
|
||||||
|
|
||||||
@ -1861,6 +1868,8 @@ var Outline = {
|
|||||||
var attrs = this.__block_attrs__
|
var attrs = this.__block_attrs__
|
||||||
var cls_attrs = ['focused']
|
var cls_attrs = ['focused']
|
||||||
return {
|
return {
|
||||||
|
// NOTE: this is first to prevent it from overriding system attrs...
|
||||||
|
...elem.dataset,
|
||||||
text: elem.querySelector('.code').value,
|
text: elem.querySelector('.code').value,
|
||||||
...(Object.entries(attrs)
|
...(Object.entries(attrs)
|
||||||
.reduce(function(res, [attr, type]){
|
.reduce(function(res, [attr, type]){
|
||||||
|
|||||||
@ -143,13 +143,19 @@ 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?
|
||||||
- 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...
|
- DONE TOC: headings that do not show up in toc -- `# ...` shows up while `@ ...` does not...
|
||||||
- TOC: tweaking: add args like depth, ...
|
- 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...
|
||||||
- plugin callback on save...
|
- add plugin callback on `.text(..)` / ...
|
||||||
- Time to think about a standalone client -- at least to edit own notes as a test...
|
- 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_
|
- _also this would be a nice opportunity to start the move to a newer electron version_
|
||||||
- Might be a good idea to think how to avoid the constant selections on focus...
|
- Might be a good idea to think how to avoid the constant selections on focus...
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user