Replace deprecated String.prototype.substr()

.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
This commit is contained in:
Tobias Speicher
2022-03-24 15:47:29 +01:00
parent bba6e48257
commit daf6442c13
4 changed files with 6 additions and 6 deletions

View File

@@ -46,7 +46,7 @@ window.addEventListener('DOMContentLoaded', () => {
icon: 'icon-deck',
async callback({ message: { message, actorDisplayName }, metadata: { name: conversationName, token: conversationToken } }) {
const shortenedMessageCandidate = message.replace(/^(.{255}[^\s]*).*/, '$1')
const shortenedMessage = shortenedMessageCandidate === '' ? message.substr(0, 255) : shortenedMessageCandidate
const shortenedMessage = shortenedMessageCandidate === '' ? message.slice(0, 255) : shortenedMessageCandidate
try {
await buildSelector(CardCreateDialog, {
props: {