diff options
Diffstat (limited to 'web_src/js/features/comp/ImagePaste.js')
-rw-r--r-- | web_src/js/features/comp/ImagePaste.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/web_src/js/features/comp/ImagePaste.js b/web_src/js/features/comp/ImagePaste.js index 13c1a17c25..79aeffa02b 100644 --- a/web_src/js/features/comp/ImagePaste.js +++ b/web_src/js/features/comp/ImagePaste.js @@ -65,7 +65,7 @@ export function initCompImagePaste($target) { for (const textarea of this.querySelectorAll('textarea')) { textarea.addEventListener('paste', async (e) => { for (const img of clipboardPastedImages(e)) { - const name = img.name.substr(0, img.name.lastIndexOf('.')); + const name = img.name.slice(0, img.name.lastIndexOf('.')); insertAtCursor(textarea, `![${name}]()`); const data = await uploadFile(img, uploadUrl); replaceAndKeepCursor(textarea, `![${name}]()`, `![${name}](/attachments/${data.uuid})`); @@ -81,7 +81,7 @@ export function initEasyMDEImagePaste(easyMDE, dropzone, files) { const uploadUrl = dropzone.getAttribute('data-upload-url'); easyMDE.codemirror.on('paste', async (_, e) => { for (const img of clipboardPastedImages(e)) { - const name = img.name.substr(0, img.name.lastIndexOf('.')); + const name = img.name.slice(0, img.name.lastIndexOf('.')); const data = await uploadFile(img, uploadUrl); const pos = easyMDE.codemirror.getCursor(); easyMDE.codemirror.replaceRange(`![${name}](/attachments/${data.uuid})`, pos); |