Skip to content
This repository was archived by the owner on Aug 10, 2024. It is now read-only.

Commit 5a396d1

Browse files
committed
revert recent changes that seem to be causing very weird css issues, then remove .trimIndent() again
1 parent 76baa93 commit 5a396d1

File tree

12 files changed

+25
-25
lines changed

12 files changed

+25
-25
lines changed

src/main/kotlin/kweb/Element.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ open class Element(
269269
let el = document.getElementById(id);
270270
if (el.classList) el.classList.add(className);
271271
else if (!hasClass(el, className)) el.className += " " + className;
272-
""".trimIndent(), id.json, JsonPrimitive(class_)
272+
""", id.json, JsonPrimitive(class_)
273273
)
274274
}
275275
}
@@ -302,7 +302,7 @@ open class Element(
302302
var reg = new RegExp("(\\s|^)" + className + "(\\s|${'$'})");
303303
el.className = el.className.replace(reg, " ");
304304
}
305-
""".trimIndent(), id.json, JsonPrimitive(class_)
305+
""", id.json, JsonPrimitive(class_)
306306
)
307307
}
308308
}
@@ -348,7 +348,7 @@ open class Element(
348348
element.removeChild(element.firstChild);
349349
}
350350
}
351-
""".trimIndent(), id.json
351+
""", id.json
352352
)
353353
}
354354
}
@@ -383,7 +383,7 @@ open class Element(
383383
startSpan.parentNode.removeChild(startSpan.nextSibling);
384384
nextSibling = startSpan.nextSibling;
385385
}
386-
""".trimIndent(), JsonPrimitive(startSpanId), JsonPrimitive(endSpanId)
386+
""", JsonPrimitive(startSpanId), JsonPrimitive(endSpanId)
387387
)
388388
}
389389
}
@@ -405,7 +405,7 @@ open class Element(
405405
"""
406406
let element = document.getElementById({});
407407
element.removeChild(element.children[{}]);
408-
""".trimIndent(), id.json, position.json
408+
""", id.json, position.json
409409
)
410410
}
411411
}
@@ -419,7 +419,7 @@ open class Element(
419419
fun text(value: String): Element {
420420
val jsoupDoc = browser.htmlDocument.get()
421421
//language=JavaScript
422-
val setTextJS = """document.getElementById({}).textContent = {};""".trimIndent()
422+
val setTextJS = """document.getElementById({}).textContent = {};"""
423423
when {
424424
jsoupDoc != null && (browser.isCatchingOutbound() == null || browser.isCatchingOutbound() == RENDER) -> {
425425
val element = jsoupDoc.getElementById(this.id)
@@ -464,7 +464,7 @@ open class Element(
464464
val createTextNodeJs = """
465465
var ntn = document.createTextNode({});
466466
document.getElementById({}).appendChild(ntn);
467-
""".trimIndent()
467+
"""
468468
when {
469469
jsoupDoc != null && (browser.isCatchingOutbound() == null || browser.isCatchingOutbound() == RENDER) -> {
470470
val element = jsoupDoc.getElementById(this.id)
@@ -483,7 +483,7 @@ open class Element(
483483
val wrappedJS = """
484484
return document.getElementById({}).addEventListener({}, function(event) {
485485
$jsCode
486-
});""".trimIndent()
486+
});"""
487487
browser.callJsFunction(wrappedJS, id.json, JsonPrimitive(eventName))
488488
}
489489

@@ -510,7 +510,7 @@ open class Element(
510510
callbackWs({}, $eventObject);
511511
});
512512
return true;
513-
""".trimIndent()
513+
"""
514514
//Adding event listener was causing the client to send a Client2ServerMessage with a null data field. This caused an error
515515
//We make the client return true to avoid that issue.
516516
//Then on the server we only invoke our callback on eventObjects, by checking that payload is a JsonObject.
@@ -589,7 +589,7 @@ open class Element(
589589
"""
590590
let element = document.getElementById({});
591591
element.parentNode.removeChild(element);
592-
""".trimIndent(), id.json
592+
""", id.json
593593
)
594594
}
595595

@@ -607,7 +607,7 @@ open class Element(
607607
let element = document.getElementById(id);
608608
element.parentNode.removeChild(element);
609609
}
610-
""".trimIndent(), id.json
610+
""", id.json
611611
)
612612
} catch (e: IllegalStateException) {
613613

src/main/kotlin/kweb/ElementCreator.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ open class ElementCreator<out PARENT_TYPE : Element>(
116116
} else {
117117
parentElement.appendChild(newEl);
118118
}
119-
""".trimIndent()
119+
"""
120120
browser.callJsFunction(
121121
createElementJs, JsonPrimitive(tag), JsonObject(mutAttributes), id.json,
122122
JsonPrimitive(element.id), JsonPrimitive(insertBefore ?: ""), JsonPrimitive(elementsCreatedCount)
@@ -148,7 +148,7 @@ open class ElementCreator<out PARENT_TYPE : Element>(
148148
} else {
149149
parentElement.appendChild(newEl);
150150
}
151-
""".trimIndent()
151+
"""
152152
element.browser.callJsFunction(
153153
createElementJs, tag.json, JsonObject(mutAttributes), id.json,
154154
element.id.json, JsonPrimitive(insertBefore ?: ""), JsonPrimitive(elementsCreatedCount)

src/main/kotlin/kweb/Kweb.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ class Kweb private constructor(
464464
Internal Server Error.
465465
466466
Please include code $logToken in any error report to help us track it down.
467-
""".trimIndent()
467+
"""
468468
)
469469
}
470470
}

src/main/kotlin/kweb/ValueElement.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ abstract class ValueElement(
3939
const element = document.getElementById({});
4040
element.value = {};
4141
delete element.dataset.previousInput;
42-
""".trimIndent(),
42+
""",
4343
element.id.json, newValue.json
4444
)
4545
}

src/main/kotlin/kweb/WebBrowser.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ class WebBrowser(val sessionId: String, val httpRequestInfo: HttpRequestInfo, va
365365
//language=JavaScript
366366
callJsFunction("""
367367
history.pushState({ }, "", {});
368-
""".trimIndent(), JsonPrimitive(url))
368+
""", JsonPrimitive(url))
369369
}
370370

371371
/**

src/main/kotlin/kweb/html/Document.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class Document(val receiver: WebBrowser) : EventGenerator<Document> {
8282
return document.addEventListener({}, function(event) {
8383
$jsCode
8484
});
85-
""".trimIndent()
85+
"""
8686
documentScope.launch {
8787
receiver.callJsFunctionWithResult(wrappedJS, JsonPrimitive(eventName))
8888
}

src/main/kotlin/kweb/html/Window.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Window(override val browser: WebBrowser) : EventGenerator<Window> {
2424
return window.addEventListener({}, function(event) {
2525
$jsCode
2626
});
27-
""".trimIndent()
27+
"""
2828
browser.callJsFunction(wrappedJS, eventName.json)
2929
}
3030

@@ -38,7 +38,7 @@ class Window(override val browser: WebBrowser) : EventGenerator<Window> {
3838
callbackWs({}, $eventObject);
3939
});
4040
return true;
41-
""".trimIndent()
41+
"""
4242
browser.callJsFunctionWithCallback(js, callbackId, callback = { payload ->
4343
if (payload is JsonObject) {
4444
callback.invoke(payload)

src/main/kotlin/kweb/html/fileUpload/FileFormInput.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class FileFormInput {
5252
fr.onload = function(){
5353
callbackWs({}, {base64Content: fr.result, fileSize: fd.size, fileName: fd.name});
5454
}
55-
""".trimIndent()
55+
"""
5656

5757
inputElement.browser.callJsFunctionWithCallback(js, callbackId, callback = { result ->
5858
logger.info("Result is $result")

src/main/kotlin/kweb/plugins/fomanticUI/FomanticUIClasses.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,7 @@ class FomanticUIClasses : AttributeBuilder() {
12031203
error("""
12041204
The .ui getter has already been used on this SematicUIClasses object. Please ensure you are creating a
12051205
fresh FomanticUIClasses object (using the 'fomantic' getter for every element).
1206-
""".trimIndent())
1206+
""")
12071207
}
12081208
classes("ui")
12091209
uiClassAlreadyPresent = true

src/main/kotlin/kweb/plugins/specificKeyUp/SpecificKeyUp.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fun InputElement.attachKeySpecificKeyupEvent(vararg keys: String) {
4040
element.dispatchEvent(keySpecificKeyUpEvent);
4141
}
4242
});
43-
""".trimIndent(), id.json, JsonPrimitive(keys.joinToString(separator = ","))
43+
""", id.json, JsonPrimitive(keys.joinToString(separator = ","))
4444
)
4545
}
4646

src/main/kotlin/kweb/state/renderEach.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ fun <ITEM : Any, EL : Element> ElementCreator<EL>.renderEach(
5454
}
5555
parent.removeChild(start_element);
5656
parent.removeChild(end_element);
57-
""".trimIndent(), JsonPrimitive(renderHandleToRemove.startId),
57+
""", JsonPrimitive(renderHandleToRemove.startId),
5858
JsonPrimitive(renderHandleToRemove.endId)
5959
)
6060
renderHandleToRemove.delete()
@@ -80,7 +80,7 @@ fun <ITEM : Any, EL : Element> ElementCreator<EL>.renderEach(
8080
elementsToMove.forEach(function (item){
8181
listParent.insertBefore(item, endMarker);
8282
});
83-
""".trimIndent()
83+
"""
8484
browser.callJsFunction(moveItemCode, JsonPrimitive(itemStartMarker),
8585
JsonPrimitive(itemEndMarker), JsonPrimitive(newPosMarker)
8686
)

src/test/kotlin/kweb/demos/todo/TodoApp.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class TodoApp {
9999
You may find the source code for this app
100100
<a href="https://github.com/kwebio/kweb-core/tree/master/src/main/kotlin/kweb/demos/todo">here</a>.
101101
"""
102-
.trimIndent()
102+
103103
)
104104
}
105105
}

0 commit comments

Comments
 (0)