Compare commits

..

2 Commits

Author SHA1 Message Date
50c52ec88d bugfix...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-11-14 18:00:04 +03:00
d39568df77 notes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-11-14 16:45:53 +03:00
2 changed files with 22 additions and 7 deletions

View File

@ -1120,13 +1120,15 @@ var JSONOutline = {
attrs.splice(i, 1) attrs.splice(i, 1)
: undefined } } : undefined } }
var children = data.children var children = (data.children ?? [])
.map(function(data){ .map(function(data){
return that.htmlBlock(data) }) return that.htmlBlock(data) })
.join('') .join('')
// NOTE: the '\n' at the start of the textarea body below helps
// preserve whitespace when parsing HTML...
return ( return (
`<div class="block ${ cls.join(' ') }" tabindex="0" ${ attrs.join(' ') }>\ `<div class="block ${ cls.join(' ') }" tabindex="0" ${ attrs.join(' ') }>\
<textarea class="code text" value="${ data.text }">${ data.text }</textarea>\ <textarea class="code text" value="${ data.text }">\n${ data.text }</textarea>\
<span class="view text">${ parsed.text }</span>\ <span class="view text">${ parsed.text }</span>\
<div class="children">${ children }</div>\ <div class="children">${ children }</div>\
</div>`) }, </div>`) },

View File

@ -48,27 +48,38 @@ var setup = function(){
- -
- ## Bugs: - ## Bugs:
focused:: true focused:: true
- BUG: styling error...
- this _seems `to` work_
- `while` _this `does` not_
- _seems to be connected with quoting..._
- BUG leading/trailing blank lines mishandled: - BUG leading/trailing blank lines mishandled:
- blank line at end of block is initially not shown - blank line at end of block is initially not shown
- this block contains two lines (empty below) - this block contains two lines (empty below)
- `editor.Block(editor.data(editor.get())).querySelector('.view').innerHTML` -- '\n' present
- _...is this a resize issue???_
- -
this block also contains two lines (empty above) this block also contains two lines (empty above)
- -
this block contains three lines (empty above and below) this block contains three lines (empty above and below)
- blank line at start of block is shown but removed on edit - DONE blank line at start of block is shown but removed on edit
collapsed:: true
- -
this block also contains two lines (empty above) this block also contains two lines (empty above)
- `editor.data(editor.get()).text` -- no `\n` at start...
- `editor.get().querySelector('.code').value` -- no `\n` at start...
- ```
d = document.createElement('div')
d.innerHTML = editor.htmlBlock({text: '\nabc\n'}) // -> '\n' exists...
d.querySelector('.code').value // -> no '\n' at start...
```
...seems that the `\n` is lost on html parse...
- -
this block contains three lines (empty above and below) this block contains three lines (empty above and below)
- _this seams to be a problem only on the initial render -- edit/exit fixes the issue..._ - _this seams to be a problem only on the initial render -- edit/exit fixes the issue..._
- _Q: are we using different code paths for initial render and element render???_ - _Q: are we using different code paths for initial render and element render???_
- BUG: styling error...
- this _seems `to` work_
- `while` _this `does` not_
- _seems to be connected with quoting..._
- BUG: can't move down out of a code block - BUG: can't move down out of a code block
- edit this line, then move down - edit this line, then move down
- ``` - ```
@ -144,6 +155,8 @@ var setup = function(){
``` ```
- -
- ## ToDo: - ## ToDo:
- `.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... - 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_
- Q: Make the heading level depend on its depth?? - Q: Make the heading level depend on its depth??