mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-18 16:02:10 +00:00
nit editors reactivity on change
This commit is contained in:
@@ -367,13 +367,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
function updateCode(): boolean {
|
||||
function updateCode() {
|
||||
const ncode = getCode()
|
||||
if (code == ncode) {
|
||||
return false
|
||||
return
|
||||
}
|
||||
code = ncode
|
||||
return true
|
||||
dispatch('change', ncode)
|
||||
}
|
||||
|
||||
export function append(code: string): void {
|
||||
@@ -1287,9 +1287,7 @@
|
||||
editor?.onDidChangeModelContent((event) => {
|
||||
timeoutModel && clearTimeout(timeoutModel)
|
||||
timeoutModel = setTimeout(() => {
|
||||
if (updateCode()) {
|
||||
dispatch('change', code)
|
||||
}
|
||||
updateCode()
|
||||
}, changeTimeout)
|
||||
|
||||
ataModel && clearTimeout(ataModel)
|
||||
|
||||
@@ -163,13 +163,13 @@
|
||||
editor?.setValue(ncode)
|
||||
}
|
||||
|
||||
function updateCode(): boolean {
|
||||
function updateCode() {
|
||||
const ncode = getCode()
|
||||
if (code == ncode) {
|
||||
return false
|
||||
return
|
||||
}
|
||||
code = ncode
|
||||
return true
|
||||
dispatch('change', ncode)
|
||||
}
|
||||
|
||||
function updatePlaceholderVisibility(value: string) {
|
||||
@@ -379,9 +379,7 @@
|
||||
suggestion = ''
|
||||
timeoutModel && clearTimeout(timeoutModel)
|
||||
timeoutModel = setTimeout(() => {
|
||||
if (updateCode()) {
|
||||
dispatch('change', { code })
|
||||
}
|
||||
updateCode()
|
||||
}, 200)
|
||||
})
|
||||
|
||||
|
||||
@@ -472,22 +472,20 @@
|
||||
editor.addCommand(KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Digit7, function () {})
|
||||
})
|
||||
|
||||
function updateCode(): boolean {
|
||||
function updateCode() {
|
||||
const ncode = getCode()
|
||||
if (code == ncode) {
|
||||
return false
|
||||
return
|
||||
}
|
||||
code = ncode
|
||||
return true
|
||||
dispatch('change', code)
|
||||
}
|
||||
|
||||
let timeoutModel: NodeJS.Timeout | undefined = undefined
|
||||
editor.onDidChangeModelContent((event) => {
|
||||
timeoutModel && clearTimeout(timeoutModel)
|
||||
timeoutModel = setTimeout(() => {
|
||||
if (updateCode()) {
|
||||
dispatch('change', { code })
|
||||
}
|
||||
updateCode()
|
||||
}, 200)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user