text: optimize value update when there's no icon to draw
This commit is contained in:
parent
92c6f15fab
commit
acf90ff0ca
2 changed files with 8 additions and 1 deletions
|
|
@ -12,6 +12,7 @@
|
|||
- widgets:
|
||||
- **new** `menu` widget, circular alternative to the dropdown & switch widgets
|
||||
- file: allow selecting folders
|
||||
- text: optimize value update when there's no icon to draw
|
||||
- editor:
|
||||
- convert invalid quote characters automatically to avoid errors
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,13 @@ module.exports = class Text extends Widget {
|
|||
setValue(v, options={}) {
|
||||
|
||||
this.value = v==null ? this.defaultValue : v
|
||||
this.widget.innerHTML = iconify(String(this.value).replace(/</g, '<').replace(/>/g, '>').replace(/\n/g,'<br/>'))
|
||||
|
||||
var s = String(this.value)
|
||||
if (s.indexOf('^') > -1) {
|
||||
this.widget.innerHTML = iconify(s.replace(/</g, '<').replace(/>/g, '>').replace(/\n/g,'<br/>'))
|
||||
} else {
|
||||
this.widget.textContent = s.replace(/\n/g,'\r\n')
|
||||
}
|
||||
|
||||
if (options.sync) this.changed(options)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue