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

Commit b9f6d3f

Browse files
committed
PRJ-58 Fix Markdown and JCEF client components couldn't be shrunk
1 parent 67b2cd9 commit b9f6d3f

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ kotlinExtensionsVersion=1.0.1-pre.284-kotlin-1.6.10
4242
kotlinReactVersion=17.0.2-pre.284-kotlin-1.6.10
4343
kotlinStyledComponentsVersion=5.3.3-pre.284-kotlin-1.6.10
4444
ktorVersion=1.6.7
45-
openVersion=^8.4.0
45+
openVersion=8.4.0
4646
radiumVersion=0.26.1
4747
reactLoadingIndicatorVersion=1.0.2
4848
selenideVersion=6.1.2

projector-client-web/src/main/kotlin/org/jetbrains/projector/client/web/component/ClientComponent.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,20 @@ package org.jetbrains.projector.client.web.component
2525

2626
import kotlinx.browser.document
2727
import org.w3c.dom.HTMLIFrameElement
28+
import org.w3c.dom.events.EventListener
2829

2930
abstract class ClientComponent(
3031
protected val id: Int,
3132
) {
3233

34+
private val documentListeners = mutableMapOf<String, EventListener>()
35+
3336
val iFrame: HTMLIFrameElement = createIFrame(id)
3437

3538
var windowId: Int? = null
3639

3740
fun dispose() {
41+
documentListeners.forEach { document.removeEventListener(it.key, it.value) }
3842
iFrame.remove()
3943
}
4044

@@ -60,6 +64,15 @@ abstract class ClientComponent(
6064
}
6165

6266
contentDocument!!.oncontextmenu = { false }
67+
68+
documentListeners["mousedown"] = EventListener {
69+
style.asDynamic().pointerEvents = "none"
70+
}
71+
documentListeners["mouseup"] = EventListener {
72+
style.asDynamic().pointerEvents = "auto"
73+
}
74+
75+
documentListeners.forEach { document.addEventListener(it.key, it.value) }
6376
}
6477

6578
protected fun setLinkProcessor(linkProcessor: (String) -> Unit) {

0 commit comments

Comments
 (0)