|
|
@@ -38,6 +38,19 @@ function getSelectedText() {
|
|
|
return null
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * 清理文本当中的em标签
|
|
|
+ * @param {string} text 文本
|
|
|
+ * @returns {string} 清理后的文本
|
|
|
+ */
|
|
|
+function purnText(text: string): string {
|
|
|
+ if (!text) {
|
|
|
+ return text
|
|
|
+ }
|
|
|
+ const re = new RegExp("</?em>", "gi");
|
|
|
+ return text.replace(re, '')
|
|
|
+}
|
|
|
+
|
|
|
function onRecordUse() {
|
|
|
emits("recordUse", props.data.id)
|
|
|
}
|
|
|
@@ -48,7 +61,7 @@ function onRecordCancel() {
|
|
|
|
|
|
function onCopy() {
|
|
|
const selectedText = getSelectedText()
|
|
|
- const text = selectedText || props.data.content
|
|
|
+ const text = purnText(selectedText || props.data.content)
|
|
|
const msg = selectedText && "复制所选内容成功" || "复制内容成功"
|
|
|
clipboard.copy(text).then(() => {
|
|
|
message.success(msg)
|
|
|
@@ -56,7 +69,7 @@ function onCopy() {
|
|
|
}
|
|
|
|
|
|
function onInsertion() {
|
|
|
- const text = getSelectedText() || props.data.content
|
|
|
+ const text = purnText(getSelectedText() || props.data.content)
|
|
|
emits("insert", text)
|
|
|
}
|
|
|
</script>
|