Bug fixing

This commit is contained in:
Alexei Anoshenko 2024-05-16 11:13:45 +03:00
parent b1628023f7
commit fd516af017
2 changed files with 11 additions and 17 deletions

View File

@ -41,12 +41,14 @@ div:focus {
*/ */
input { input {
box-sizing: border-box;
margin: 2px; margin: 2px;
padding: 1px; padding: 1px;
font-size: inherit; font-size: inherit;
} }
select { select {
box-sizing: border-box;
margin: 2px; margin: 2px;
font-size: inherit; font-size: inherit;
} }
@ -56,6 +58,7 @@ button {
} }
textarea { textarea {
box-sizing: border-box;
margin: 2px; margin: 2px;
padding: 4px; padding: 4px;
overflow: auto; overflow: auto;

View File

@ -208,13 +208,9 @@ func (edit *editViewData) set(tag string, value any) bool {
if text = GetText(edit); oldText != text { if text = GetText(edit); oldText != text {
edit.textChanged(text, oldText) edit.textChanged(text, oldText)
if edit.created { if edit.created {
if GetEditViewType(edit) == MultiLineText {
updateInnerHTML(edit.htmlID(), edit.Session())
} else {
edit.session.callFunc("setInputValue", edit.htmlID(), text) edit.session.callFunc("setInputValue", edit.htmlID(), text)
} }
} }
}
return true return true
} }
return false return false
@ -442,6 +438,9 @@ func (edit *editViewData) htmlProperties(self View, buffer *strings.Builder) {
if strings.ContainsRune(text, '"') { if strings.ContainsRune(text, '"') {
text = strings.ReplaceAll(text, `"`, `"`) text = strings.ReplaceAll(text, `"`, `"`)
} }
if strings.ContainsRune(text, '\n') {
text = strings.ReplaceAll(text, "\n", `\n`)
}
return text return text
} }
@ -458,19 +457,11 @@ func (edit *editViewData) htmlProperties(self View, buffer *strings.Builder) {
buffer.WriteByte('"') buffer.WriteByte('"')
} }
if editType != MultiLineText {
if text := GetText(edit); text != "" { if text := GetText(edit); text != "" {
buffer.WriteString(` value="`) buffer.WriteString(` value="`)
buffer.WriteString(convertText(text)) buffer.WriteString(convertText(text))
buffer.WriteByte('"') buffer.WriteByte('"')
} }
}
}
func (edit *editViewData) htmlSubviews(self View, buffer *strings.Builder) {
if GetEditViewType(edit) == MultiLineText {
buffer.WriteString(GetText(edit))
}
} }
func (edit *editViewData) handleCommand(self View, command string, data DataObject) bool { func (edit *editViewData) handleCommand(self View, command string, data DataObject) bool {