File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
src/main/kotlin/cc/unitmesh/devti/gui/component Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import com.intellij.util.ui.JBEmptyBorder
5
5
import com.intellij.util.ui.UIUtil
6
6
import javax.accessibility.AccessibleContext
7
7
import javax.swing.JEditorPane
8
+ import org.apache.commons.text.StringEscapeUtils
8
9
9
10
class DisplayComponent (question : String ) : JEditorPane() {
10
11
init {
@@ -16,8 +17,7 @@ class DisplayComponent(question: String) : JEditorPane() {
16
17
this .text = question
17
18
this .isOpaque = false
18
19
this .putClientProperty(
19
- AccessibleContext .ACCESSIBLE_NAME_PROPERTY ,
20
- StringUtil .unescapeXmlEntities(StringUtil .stripHtml(question, " " ))
20
+ AccessibleContext .ACCESSIBLE_NAME_PROPERTY , stripHtmlAndUnescapeXmlEntities(question)
21
21
)
22
22
23
23
if (this .caret != null ) {
@@ -28,4 +28,11 @@ class DisplayComponent(question: String) : JEditorPane() {
28
28
fun updateMessage (content : String ) {
29
29
this .text = content
30
30
}
31
+
32
+ private fun stripHtmlAndUnescapeXmlEntities (input : String ): String {
33
+ // 使用 Jsoup 去除HTML标签
34
+ val text = Jsoup .parse(input).text()
35
+ // 使用 Apache Commons Text 解码XML实体
36
+ return StringEscapeUtils .unescapeXml(text)
37
+ }
31
38
}
You can’t perform that action at this time.
0 commit comments