-
{
if (node.nodeName == "#text") {
- sendText = document.getElementById("inputText").innerHTML;
+ sendText += this.html2Escape(node.textContent);
} else if (node.nodeName == "SPAN") {
sendText += node.innerText;
} else if (node.nodeName == "IMG") {
@@ -230,6 +230,16 @@
})
return sendText;
},
+ html2Escape(strHtml) {
+ return strHtml.replace(/[<>&"]/g, function(c) {
+ return {
+ '<': '<',
+ '>': '>',
+ '&': '&',
+ '"': '"'
+ }[c];
+ });
+ },
createAtUserIds() {
let ids = [];
this.$refs.editBox.childNodes.forEach((node) => {
diff --git a/im-uniapp/package.json b/im-uniapp/package.json
index 91b9952..6e7405d 100644
--- a/im-uniapp/package.json
+++ b/im-uniapp/package.json
@@ -6,7 +6,7 @@
"browser":"chrome",
"env": {
"UNI_PLATFORM": "h5",
- "BASE_URL": "http://127.0.0.1:8888",
+ "BASE_URL": "/api",
"WS_URL": "ws://127.0.0.1:8878/im"
}
},
diff --git a/im-uniapp/vite.config.js b/im-uniapp/vite.config.js
new file mode 100644
index 0000000..0c46ed6
--- /dev/null
+++ b/im-uniapp/vite.config.js
@@ -0,0 +1,19 @@
+import { defineConfig } from "vite"
+import uni from "@dcloudio/vite-plugin-uni";
+
+export default defineConfig({
+ plugins: [
+ uni()
+ ],
+ server: {
+ proxy: {
+ '/api': {
+ rewrite: path => path.replace(/^\/api/, ''),
+ logLevel: 'debug',
+ target: 'http://localhost:8888',
+ changeOrigin: true
+ },
+
+ }
+ }
+})
\ No newline at end of file