editor: preserve scroll position in code editor when validating

This commit is contained in:
jean-emmanuel 2023-03-10 10:33:18 +01:00
parent e36e4cfdc8
commit 79c67a2bbb
2 changed files with 13 additions and 7 deletions

View file

@ -6,6 +6,11 @@
- linkId not working between two encoder widgets
- fader: `gradient` breakpoints not positioned correctly
- editor
- when focusing the label property with `F2`, select all text in the text area
- preserve scroll position in code editor when validating
- scripting
- expose file browser (from the file widget) as a scripting function
@ -14,7 +19,7 @@
- misc
- add polish locales (@ Manz4rk)
- add css classes to some notification popups to allow targetting them with css themes
- add css classes to some notification popups to allow targetting them with css themes
## 1.22.0

View file

@ -121,7 +121,10 @@ class CodeEditor {
editor.setValue(input.value)
editor.textarea.osc_input = input
editor.selection.setRange({start:0,end:0})
editor.gotoLine(0)
if (!this.widget || widget.hash !== this.widget.hash) {
// preserve active line if widget is the same
editor.gotoLine(0)
}
editor.removeAllListeners('focus')
this.editor.on('focus', (e)=>{
if (this.middledown) {
@ -192,16 +195,14 @@ class CodeEditor {
field.appendChild(this.helpBtn)
field.appendChild(this.fsBtn)
setTimeout(()=>{
editor.getSession().getUndoManager().reset()
editor.resize()
})
editor.getSession().getUndoManager().reset()
editor.resize()
}
fullscreen() {


this.editor.fullscreen = this.field.classList.toggle('fullscreen')
this.editor.setOptions({maxLines: this.editor.fullscreen ? 0 : 30})
this.field.style.setProperty('--prefix', this.editor.fullscreen ? '"' + this.widget.getProp('id') + '."' : '')