Add word break

This commit is contained in:
Hepatica
2024-01-29 22:05:15 +01:00
parent dead4e8c2a
commit ff80ad7185
2 changed files with 13 additions and 12 deletions

View File

@@ -18,6 +18,7 @@
.chat { .chat {
margin: 1% 3.2% 0 0; margin: 1% 3.2% 0 0;
word-break: break-all;
} }
.chat__content { .chat__content {

View File

@@ -42,21 +42,21 @@ export default {
} }
}, },
SendmsgData() { SendmsgData() {
const formattedWord = this.InsertSpaceEvery24Chars(this.msg); // const formattedWord = this.InsertSpaceEvery24Chars(this.msg);
this.$emit("send", [formattedWord, this.username, this.icon]); this.$emit("send", [this.msg, this.username, this.icon]);
this.msg = ""; this.msg = "";
}, },
InsertSpaceEvery24Chars(text) { // InsertSpaceEvery24Chars(text) {
let result = ""; // let result = "";
for (let i = 0; i < text.length; i++) { // for (let i = 0; i < text.length; i++) {
if (i > 0 && i % 24 === 0) { // if (i > 0 && i % 24 === 0) {
result += " "; // result += " ";
} // }
result += text[i]; // result += text[i];
} // }
return result; // return result;
}, // },
}, },
}; };
</script> </script>