refactoring and cleanup...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-11-23 22:50:39 +03:00
parent 78f07cea45
commit 3f6de30013
4 changed files with 23 additions and 12 deletions

View File

@ -44,9 +44,11 @@
display: block; display: block;
position: relative; position: relative;
/* XXX do we need this???
.code { .code {
display: none; display: none;
} }
*/
/* header */ /* header */
.header { .header {
@ -152,7 +154,8 @@
&>.code { &>.code {
position: absolute; position: absolute;
top: 0; top: 0;
height: calc(2 * var(--item-padding) + 1em); height: 100%;
/*height: calc(2 * var(--item-padding) + 1em);*/
overflow: hidden; overflow: hidden;
resize: none; resize: none;
opacity: 0; opacity: 0;

View File

@ -1487,13 +1487,17 @@ var Outline = {
focused: 'cls', focused: 'cls',
}, },
// XXX UPDATE_CODE_SIZE this is a no-op at this point -- do we need this...
_updateCodeSize: function(code, view){ _updateCodeSize: function(code, view){
// XXX UPDATE_CODE_SIZE
return this
code.style.height = code.style.height =
getComputedStyle( getComputedStyle(
view view
?? code.nextSibling) ?? code.nextSibling)
.height .height
return this }, return this },
/* XXX not used...
_updateViewSize: function(view, code){ _updateViewSize: function(view, code){
view.style.height = view.style.height =
getComputedStyle( getComputedStyle(
@ -1512,6 +1516,7 @@ var Outline = {
return view.offsetHeight > code.offsetHeight ? return view.offsetHeight > code.offsetHeight ?
this._updateCodeSize(code, view) this._updateCodeSize(code, view)
: this._updateViewSize(view, code) }, : this._updateViewSize(view, code) },
//*/
// 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...

View File

@ -54,7 +54,9 @@ HTMLElement.decode = function(str){
//--------------------------------------------------------------------- //---------------------------------------------------------------------
HTMLTextAreaElement.prototype.updateSize = function(){ HTMLTextAreaElement.prototype.updateSize = function(){
this.style.height = '' // NOTE: this is set to 0px to negate the effects of external/inherited
// height settings...
this.style.height = '0px'
this.style.height = this.scrollHeight + 'px' this.style.height = this.scrollHeight + 'px'
return this } return this }
HTMLTextAreaElement.prototype.autoUpdateSize = function(){ HTMLTextAreaElement.prototype.autoUpdateSize = function(){

View File

@ -54,20 +54,20 @@ var setup = function(){
- -
blank lines above and below -- the trailing blank is not initially shown blank lines above and below -- the trailing blank is not initially shown
- _not sure about this yet..._
- ``` - ```
code block -- resized on block edit (`keydown` in edit mode) code block -- resized on block edit (`keydown` in edit mode)
``` ```
- the problem\: - _this seems to be because of a stray `\n` after re-render + `white-space: ...` in the `.view` element..._
- we need to keep both the `.view` and `.code` elements' height in sync
- Q: should the sizes be equal? which is the master size?
- ways to fix: - ways to fix:
- active (current): - semi-active (current):
- _need to rework the logic..._ - active mode currently disabled (see: `UPDATE_CODE_SIZE`)
- TEST
- passive (preferred): - passive (preferred):
- try `display:flex` on `.block` and position one elem over the other... - REJECT try `display:flex` on `.block` and position one elem over the other...
- _...not sure how to deal with `.children` yet_ - REJECT another way to go is to wrap `.text` stuff in a div and style that...
- another way to go is to wrap `.text` stuff in a div and style that... - active:
- not sure if this is possible -- things like tables/graphs/... will break things (still investigating) - ...
- 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)
@ -103,7 +103,8 @@ var setup = function(){
- _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: can't move down out of a code block (_directly connected to the above_) - DONE BUG: can't move down out of a code block (_directly connected to the above_)
collapsed:: true
- edit this line, then move down - edit this line, then move down
- ``` - ```
code code