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 22, 2022
1 parent 67b2cd9 commit 30fd072
Showing 1 changed file with 13 additions and 0 deletions.
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 30fd072

Please sign in to comment.