diff src/name/blackcap/clipman/Main.kt @ 20:17296054c103

HTMLEditorKit shares all stylesheets. How unbelievably braindamaged.
author David Barts <n5jrn@me.com>
date Tue, 21 Jan 2020 23:38:10 -0800
parents 5e0d1fe61da9
children c10a447b9e1b
line wrap: on
line diff
--- a/src/name/blackcap/clipman/Main.kt	Tue Jan 21 16:42:32 2020 -0800
+++ b/src/name/blackcap/clipman/Main.kt	Tue Jan 21 23:38:10 2020 -0800
@@ -67,6 +67,21 @@
     }
 }
 
+/* HTMLEditorKit shares all stylesheets. How unbelievably braindamaged. */
+class MyEditorKit: HTMLEditorKit() {
+    private var _styleSheet = defaultStyleSheet
+    override fun getStyleSheet() = _styleSheet
+    override fun setStyleSheet(value: StyleSheet) {
+        _styleSheet = value
+    }
+
+    val defaultStyleSheet: StyleSheet
+    get() {
+        return super.getStyleSheet()
+    }
+}
+
+
 /* the updating thread */
 class UpdateIt(val queue: PasteboardQueue, val interval: Int): Thread() {
     @Volatile var enabled = true
@@ -111,8 +126,8 @@
                         widget.run {
                             add(stdLabel("Styled text"))
                             val (dhtml, style) = preproc(html)
-                            val hek = HTMLEditorKit().apply {
-                                style.addStyleSheet(styleSheet)
+                            val hek = MyEditorKit().apply {
+                                style.addStyleSheet(defaultStyleSheet)
                                 styleSheet = style
                             }
                             add(ClipText().apply {