From 91ed572a32a332bb96dc6ee3b4f4e31fe1bb646d Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 27 Nov 2023 02:16:42 +0300 Subject: [PATCH] bugfix and cleanup... Signed-off-by: Alex A. Naanou --- experiments/outline-editor/editor.js | 33 ++++++++++++-------------- experiments/outline-editor/index.html | 34 --------------------------- 2 files changed, 15 insertions(+), 52 deletions(-) diff --git a/experiments/outline-editor/editor.js b/experiments/outline-editor/editor.js index d25c42a..03ec661 100755 --- a/experiments/outline-editor/editor.js +++ b/experiments/outline-editor/editor.js @@ -288,7 +288,7 @@ var quoted = { quote: function(_, code){ return `${ this.encode(code) }` }, - pre_pattern: /(? , ... ] .split(/(<(pre|code)(?:|\s[^>]*)>((?:\n|.)*)<\/\2>)/g) // sort out the sections... @@ -934,14 +934,11 @@ var JSONOutline = { .join('') // stage: post... elem.text = run('post', text) - - + // patch for showing trailing empty lines in dom... elem.text = - // XXX POST_PRE_WHITESPACE adding a exception here feels hacky... - // ...a space after pre will force a new line but not - // adding it will hide a single empty line after... (elem.text == '' - || elem.text.endsWith('')) ? + // XXX adding a exception here feels hacky... + || elem.text.trim().endsWith('')) ? elem.text // NOTE: adding a space here is done to prevent the browser // from hiding the last newline... @@ -1930,16 +1927,16 @@ var Outline = { .clear() .outline .append(...level(data)) - // update sizes of all the textareas (transparent)... - // NOTE: this is needed to make initial clicking into multi-line - // blocks place the cursor into the clicked location. - // ...this is done by expanding the textarea to the element - // size and enabling it to intercept clicks correctly... - setTimeout(function(){ - var f = that._updateCodeSize - //var f = that._syncTextSize.bind(that) - for(var e of [...that.outline.querySelectorAll('textarea')]){ - f(e) } }, 0) + //// update sizes of all the textareas (transparent)... + //// NOTE: this is needed to make initial clicking into multi-line + //// blocks place the cursor into the clicked location. + //// ...this is done by expanding the textarea to the element + //// size and enabling it to intercept clicks correctly... + //setTimeout(function(){ + // var f = that._updateCodeSize + // //var f = that._syncTextSize.bind(that) + // for(var e of [...that.outline.querySelectorAll('textarea')]){ + // f(e) } }, 0) return this }, /*/ // XXX JSON version... load: function(data){ diff --git a/experiments/outline-editor/index.html b/experiments/outline-editor/index.html index 96006cd..c3ee5ff 100755 --- a/experiments/outline-editor/index.html +++ b/experiments/outline-editor/index.html @@ -48,40 +48,6 @@ - - ## Bugs: focused:: true - - BUG whitespace after trailing code block is not shown (see next bug for details) - - also see: `POST_PRE_WHITESPACE` - - DONE BUG horizontal whitespace after a block of code create an empty line after the `
` tag...
-    collapsed:: true
-    - ```
-      code block -- resized on block edit (`keydown` in edit mode)
-      ```
-      - this is due to `.update(..)` adding a `' '` to the text...
-  - DONE BUG leading/trailing blank lines mishandled:
-    collapsed:: true
-    - block sizing
-      - issues:
-        - 
-          blank lines above and below -- the trailing blank is not initially shown
-          
-        - the main reason for this is that we are not adding a `" "` after each generated block as we do on `.update(..)` -- move this functionality up...
-    - 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 // formatting is OK...
-          ```
-        - _...this is a resize issue (???)_
-        - running `.updateSize() and then `._updateViewSize(..)` does not fix the issue...
-        - simply replacing `._updateCodeSize(..)` with `._syncTextSize(..)` fixes this but breaks lots more stuff...
-          _...need a better sync mechanism, preferably CSS_
-      - 
-        this block also contains two lines (empty above)
-      - 
-        this block contains three lines (empty above and below)
-        
   - BUG: styling error...
     - this _seems `to` work_
     - `while` _this `does` not_