bugfix...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-11-14 18:00:04 +03:00
parent d39568df77
commit 50c52ec88d
2 changed files with 16 additions and 3 deletions

View File

@ -1120,13 +1120,15 @@ var JSONOutline = {
attrs.splice(i, 1)
: undefined } }
var children = data.children
var children = (data.children ?? [])
.map(function(data){
return that.htmlBlock(data) })
.join('')
// NOTE: the '\n' at the start of the textarea body below helps
// preserve whitespace when parsing HTML...
return (
`<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>\
<div class="children">${ children }</div>\
</div>`) },

View File

@ -52,14 +52,25 @@ var setup = function(){
- blank line at end of block is initially not shown
- 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 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)
- `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)