mirror of https://github.com/anoshenko/rui.git
Bug fixing
This commit is contained in:
parent
6fda42f014
commit
162f6dab33
|
|
@ -211,6 +211,14 @@ function appendToInnerHTML(elementId, content) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function appendElement(elementId, content) {
|
||||||
|
const element = document.getElementById(elementId);
|
||||||
|
if (element) {
|
||||||
|
element.insertAdjacentHTML("beforeend", content);
|
||||||
|
scanElementsSize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function appendToInputValue(elementId, content) {
|
function appendToInputValue(elementId, content) {
|
||||||
const element = document.getElementById(elementId);
|
const element = document.getElementById(elementId);
|
||||||
if (element) {
|
if (element) {
|
||||||
|
|
|
||||||
2
popup.go
2
popup.go
|
|
@ -1704,7 +1704,7 @@ func (manager *popupManager) showPopup(popup Popup) {
|
||||||
|
|
||||||
session := popup.Session()
|
session := popup.Session()
|
||||||
session.callFunc("blurCurrent")
|
session.callFunc("blurCurrent")
|
||||||
session.appendToInnerHTML(popupLayerID, popup.html(false))
|
session.callFunc("appendElement", popupLayerID, popup.html(false))
|
||||||
|
|
||||||
session.updateCSSProperty("ruiTooltipLayer", "visibility", "hidden")
|
session.updateCSSProperty("ruiTooltipLayer", "visibility", "hidden")
|
||||||
session.updateCSSProperty("ruiTooltipLayer", "opacity", "0")
|
session.updateCSSProperty("ruiTooltipLayer", "opacity", "0")
|
||||||
|
|
|
||||||
12
session.go
12
session.go
|
|
@ -17,7 +17,6 @@ type bridge interface {
|
||||||
callFunc(funcName string, args ...any) bool
|
callFunc(funcName string, args ...any) bool
|
||||||
localStorageRequest(funcName string, args ...any)
|
localStorageRequest(funcName string, args ...any)
|
||||||
updateInnerHTML(htmlID, html string)
|
updateInnerHTML(htmlID, html string)
|
||||||
appendToInnerHTML(htmlID, html string)
|
|
||||||
updateCSSProperty(htmlID, property, value string)
|
updateCSSProperty(htmlID, property, value string)
|
||||||
updateProperty(htmlID, property string, value any)
|
updateProperty(htmlID, property string, value any)
|
||||||
removeProperty(htmlID, property string)
|
removeProperty(htmlID, property string)
|
||||||
|
|
@ -172,7 +171,6 @@ type Session interface {
|
||||||
writeInitScript()
|
writeInitScript()
|
||||||
callFunc(funcName string, args ...any)
|
callFunc(funcName string, args ...any)
|
||||||
updateInnerHTML(htmlID, html string)
|
updateInnerHTML(htmlID, html string)
|
||||||
appendToInnerHTML(htmlID, html string)
|
|
||||||
updateCSSProperty(htmlID, property, value string)
|
updateCSSProperty(htmlID, property, value string)
|
||||||
updateProperty(htmlID, property string, value any)
|
updateProperty(htmlID, property string, value any)
|
||||||
removeProperty(htmlID, property string)
|
removeProperty(htmlID, property string)
|
||||||
|
|
@ -489,16 +487,6 @@ func (session *sessionData) updateInnerHTML(htmlID, html string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (session *sessionData) appendToInnerHTML(htmlID, html string) {
|
|
||||||
if !session.ignoreViewUpdates() {
|
|
||||||
if session.bridge != nil {
|
|
||||||
session.bridge.appendToInnerHTML(htmlID, html)
|
|
||||||
} else {
|
|
||||||
ErrorLog("No connection")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (session *sessionData) updateCSSProperty(htmlID, property, value string) {
|
func (session *sessionData) updateCSSProperty(htmlID, property, value string) {
|
||||||
if !session.ignoreViewUpdates() {
|
if !session.ignoreViewUpdates() {
|
||||||
if session.bridge != nil {
|
if session.bridge != nil {
|
||||||
|
|
|
||||||
|
|
@ -677,7 +677,7 @@ func (layout *stackLayoutData) Append(view View) {
|
||||||
if count > 0 {
|
if count > 0 {
|
||||||
session.updateCSSProperty(layout.views[count-1].htmlID()+"page", "visibility", "hidden")
|
session.updateCSSProperty(layout.views[count-1].htmlID()+"page", "visibility", "hidden")
|
||||||
}
|
}
|
||||||
session.appendToInnerHTML(stackID, buffer.String())
|
session.callFunc("appendElement", stackID, buffer.String())
|
||||||
|
|
||||||
layout.runChangeListener(Content)
|
layout.runChangeListener(Content)
|
||||||
}
|
}
|
||||||
|
|
@ -713,7 +713,7 @@ func (layout *stackLayoutData) Insert(view View, index int) {
|
||||||
buffer.WriteString(`</div>`)
|
buffer.WriteString(`</div>`)
|
||||||
|
|
||||||
session := layout.Session()
|
session := layout.Session()
|
||||||
session.appendToInnerHTML(stackID, buffer.String())
|
session.callFunc("appendElement", stackID, buffer.String())
|
||||||
|
|
||||||
layout.runChangeListener(Content)
|
layout.runChangeListener(Content)
|
||||||
}
|
}
|
||||||
|
|
@ -805,7 +805,7 @@ func (layout *stackLayoutData) Push(view View, onPushFinished ...func()) {
|
||||||
viewHTML(view, buffer, "")
|
viewHTML(view, buffer, "")
|
||||||
buffer.WriteString(`</div>`)
|
buffer.WriteString(`</div>`)
|
||||||
|
|
||||||
session.appendToInnerHTML(layout.htmlID(), buffer.String())
|
session.callFunc("appendElement", layout.htmlID(), buffer.String())
|
||||||
|
|
||||||
if prevPeek != "" {
|
if prevPeek != "" {
|
||||||
mirror := transformMirror(transform, session)
|
mirror := transformMirror(transform, session)
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ func (container *viewsContainerData) Append(view View) {
|
||||||
defer freeStringBuilder(buffer)
|
defer freeStringBuilder(buffer)
|
||||||
|
|
||||||
viewHTML(view, buffer, "")
|
viewHTML(view, buffer, "")
|
||||||
container.Session().appendToInnerHTML(container.htmlID(), buffer.String())
|
container.Session().callFunc("appendElement", container.htmlID(), buffer.String())
|
||||||
container.runChangeListener(Content)
|
container.runChangeListener(Content)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,19 +79,6 @@ func (bridge *wasmBridge) updateInnerHTML(htmlID, html string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bridge *wasmBridge) appendToInnerHTML(htmlID, html string) {
|
|
||||||
if ProtocolInDebugLog {
|
|
||||||
DebugLog(fmt.Sprintf("%s.innerHTML += '%s'", htmlID, html))
|
|
||||||
}
|
|
||||||
|
|
||||||
element := js.Global().Get("document").Call("getElementById", htmlID)
|
|
||||||
if !element.IsUndefined() && !element.IsNull() {
|
|
||||||
oldHtml := element.Get("innerHTML").String()
|
|
||||||
element.Set("innerHTML", oldHtml+html)
|
|
||||||
js.Global().Call("scanElementsSize")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (bridge *wasmBridge) updateCSSProperty(htmlID, property, value string) {
|
func (bridge *wasmBridge) updateCSSProperty(htmlID, property, value string) {
|
||||||
if ProtocolInDebugLog {
|
if ProtocolInDebugLog {
|
||||||
DebugLog(fmt.Sprintf("%s.style[%s] = '%s'", htmlID, property, value))
|
DebugLog(fmt.Sprintf("%s.style[%s] = '%s'", htmlID, property, value))
|
||||||
|
|
|
||||||
|
|
@ -265,10 +265,6 @@ func (bridge *webBridge) updateInnerHTML(htmlID, html string) {
|
||||||
bridge.callFunc("updateInnerHTML", htmlID, html)
|
bridge.callFunc("updateInnerHTML", htmlID, html)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bridge *webBridge) appendToInnerHTML(htmlID, html string) {
|
|
||||||
bridge.callFunc("appendToInnerHTML", htmlID, html)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (bridge *webBridge) updateCSSProperty(htmlID, property, value string) {
|
func (bridge *webBridge) updateCSSProperty(htmlID, property, value string) {
|
||||||
if buffer, ok := bridge.updateScripts[htmlID]; ok {
|
if buffer, ok := bridge.updateScripts[htmlID]; ok {
|
||||||
buffer.WriteString(`element.style['`)
|
buffer.WriteString(`element.style['`)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue