From 3a7d189d88747d119ab475c96e067b86c4cd2957 Mon Sep 17 00:00:00 2001 From: bptato Date: Thu, 31 Aug 2023 22:52:28 +0200 Subject: buffer: basic click event support Mostly a proof of concept. Just bubble it unconditionally for now and never prevent default. Also, fix fromJSFunction by Dup'ing its closure JSValue. --- src/buffer/buffer.nim | 52 +++++++++++++++++++++++++++++++++++++++++++++++---- src/html/event.nim | 22 +++++++++++++++------- src/js/fromjs.nim | 17 ++++++++++++++--- src/js/javascript.nim | 2 +- src/js/tojs.nim | 4 +++- 5 files changed, 81 insertions(+), 16 deletions(-) diff --git a/src/buffer/buffer.nim b/src/buffer/buffer.nim index c53641e9..0b3c5d95 100644 --- a/src/buffer/buffer.nim +++ b/src/buffer/buffer.nim @@ -20,6 +20,7 @@ import css/values import html/chadombuilder import html/dom import html/env +import html/event import img/png import io/connecterror import io/loader @@ -111,6 +112,7 @@ type tasks: array[BufferCommand, int] #TODO this should have arguments savetask: bool hovertext: array[HoverType, string] + estream: Stream # error stream InterfaceOpaque = ref object stream: Stream @@ -329,10 +331,23 @@ func getClickHover(styledNode: StyledNode): string = return "