bugfix...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-10-19 16:59:06 +03:00
parent 4cefc92faf
commit ca216df605
2 changed files with 7 additions and 16 deletions

View File

@ -48,12 +48,6 @@ function clickPoint(x,y){
// XXX it would be a better idea to do a binary search instead of a liner
// pass... but at this point this is not critical (unless we get
// gigantic blocks)
// XXX this misbehaves on boondies between text/node elements...
// Example:
// '# Heading with _Italics_'
// ^ ^
// clicking in the marked areas will either land the cursor at
// the last char of one block or after the first in the second...
// XXX HACK -- is there a better way to do this???
var getCharOffset = function(elem, x, y, c){
c = c ?? 0
@ -1121,8 +1115,8 @@ var Outline = {
sync: function(){
var code = this.code
code
&& (code.innerHTML = this.text())
if(code){
code.value = this.text() }
return this },
@ -1355,7 +1349,6 @@ var Outline = {
elem.selectionEnd = elem.value.length
} else {
var m = getMarkdownOffset(elem.value, view.innerText, c)
console.log('---', c, m)
elem.focus()
elem.selectionStart = c + m
elem.selectionEnd = c + m } } })
@ -1492,10 +1485,10 @@ var Outline = {
var code = this.code
if(code){
var t = Date.now()
this.load(code.innerHTML
this.load(code.value
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>'))
console.log(`Parse: ${Date.now() - t}ms`)}
console.log(`Parse: ${Date.now() - t}ms`) }
this.runPlugins('__setup__', this)

View File

@ -33,7 +33,7 @@ var setup = function(){
<body onload="setup()">
<div class="editor">
<!-- code -->
<pre class="code">
<textarea class="code">
- # Outline editor prototype
- An outline-based markdown editor experiment
- ### Infuences::
@ -45,13 +45,11 @@ var setup = function(){
-
- ## Bugs:
- BUG: editor: FF seems to update the style every other key press -- should be live...
- BUG: last node seems to get trash tags added to it's end...
-
- ## ToDo:
- ASAP: scroll into view is bad...
- ASAP: mobile browsers behave quite chaotically ignoring parts of the styling...
- ASAP: `getCharOffset(..)` needs more tuning...
- gaps between nested nodes and text are off -- see code for notes...
- ASAP: call `.sync()` on all changes...
- FEATURE: read-only mode
- export html
- embed css
@ -278,7 +276,7 @@ var setup = function(){
- This is a set
text lines
- Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text Lots of text
- </pre>
- </textarea>
<!-- outline -->
<div class="outline"></div>
<!-- toolbar (optional) -->