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

Commit

Permalink
PRJ-58 Fix Markdown and JCEF client components couldn't be shrunk
Browse files Browse the repository at this point in the history
  • Loading branch information
ARTI1208 committed Mar 23, 2022
1 parent 67b2cd9 commit b9f6d3f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ kotlinExtensionsVersion=1.0.1-pre.284-kotlin-1.6.10
kotlinReactVersion=17.0.2-pre.284-kotlin-1.6.10
kotlinStyledComponentsVersion=5.3.3-pre.284-kotlin-1.6.10
ktorVersion=1.6.7
openVersion=^8.4.0
openVersion=8.4.0
radiumVersion=0.26.1
reactLoadingIndicatorVersion=1.0.2
selenideVersion=6.1.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,20 @@ package org.jetbrains.projector.client.web.component

import kotlinx.browser.document
import org.w3c.dom.HTMLIFrameElement
import org.w3c.dom.events.EventListener

abstract class ClientComponent(
protected val id: Int,
) {

private val documentListeners = mutableMapOf<String, EventListener>()

val iFrame: HTMLIFrameElement = createIFrame(id)

var windowId: Int? = null

fun dispose() {
documentListeners.forEach { document.removeEventListener(it.key, it.value) }
iFrame.remove()
}

Expand All @@ -60,6 +64,15 @@ abstract class ClientComponent(
}

contentDocument!!.oncontextmenu = { false }

documentListeners["mousedown"] = EventListener {
style.asDynamic().pointerEvents = "none"
}
documentListeners["mouseup"] = EventListener {
style.asDynamic().pointerEvents = "auto"
}

documentListeners.forEach { document.addEventListener(it.key, it.value) }
}

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

0 comments on commit b9f6d3f

Please sign in to comment.