# HG changeset patch # User David Barts # Date 1579678690 28800 # Node ID 17296054c103e57a1769764cf3dc44c37f4562ab # Parent 5e0d1fe61da95369bea0b9cde13ddd44517835e7 HTMLEditorKit shares all stylesheets. How unbelievably braindamaged. diff -r 5e0d1fe61da9 -r 17296054c103 src/name/blackcap/clipman/Main.kt --- 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 {