File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 41
41
<div class =" details" >
42
42
<a >
43
43
<div class =" filename" >
44
- <span class =" basename" >{{ attachment.name }}</span >
44
+ <span >{{ attachmentBasename(attachment) }}</span >
45
+ <span class =" extension" >.{{ attachmentExtension(attachment) }}</span >
45
46
</div >
46
47
<progress :value =" attachment.progress" max =" 100" />
47
48
</a >
58
59
<div class =" details" >
59
60
<a :href =" internalLink(attachment)" @click.prevent =" showViewer(attachment)" >
60
61
<div class =" filename" >
61
- <span class =" basename" >{{ attachment.data }}</span >
62
+ <span >{{ attachmentBasename(attachment) }}</span >
63
+ <span class =" extension" >.{{ attachmentExtension(attachment) }}</span >
62
64
</div >
63
65
<div v-if =" attachment.deletedAt === 0" >
64
66
<span class =" filesize" >{{ formattedFileSize(attachment.extendedData.filesize) }}</span >
@@ -200,6 +202,14 @@ export default {
200
202
return t (' deck' , ' Drop your files to upload' )
201
203
}
202
204
},
205
+ attachmentBasename () {
206
+ return (attachment ) => attachment? .extendedData ? .info .filename
207
+ ?? (attachment? .name ?? attachment .data ).replace (/ \. [^ /. ] + $ / , ' ' )
208
+ },
209
+ attachmentExtension () {
210
+ return (attachment ) => attachment? .extendedData ? .info ? .extension
211
+ ?? (attachment? .name ?? attachment .data ).split (' .' ).pop ()
212
+ },
203
213
},
204
214
watch: {
205
215
cardId: {
Original file line number Diff line number Diff line change @@ -243,15 +243,18 @@ export default {
243
243
},
244
244
addAttachment (attachment ) {
245
245
const asImage = (attachment .type === ' file' && attachment .extendedData .hasPreview ) || attachment .extendedData .mimetype .includes (' image' )
246
+ // We need to strip those as text does not support rtl yet, so we cannot insert them separately
247
+ const stripRTLO = (text ) => text .replaceAll (' \u202e ' , ' ' )
248
+ const fileName = stripRTLO (attachment .extendedData .info .filename ) + ' .' + stripRTLO (attachment .extendedData .info .extension )
246
249
if (this .editor ) {
247
250
this .editor .insertAtCursor (
248
251
asImage
249
252
? ` <a href="${ this .attachmentPreview (attachment)} "><img src="${ this .attachmentPreview (attachment)} " alt="${ attachment .data } " /></a>`
250
- : ` <a href="${ this .attachmentPreview (attachment)} ">${ attachment . data } </a>`
253
+ : ` <a href="${ this .attachmentPreview (attachment)} ">${ fileName } </a>` ,
251
254
)
252
255
return
253
256
} else {
254
- const attachmentString = (asImage ? ' !' : ' ' ) + ' [📎 ' + attachment . data + ' ](' + this .attachmentPreview (attachment) + ' )'
257
+ const attachmentString = (asImage ? ' !' : ' ' ) + ' [📎 ' + fileName + ' ](' + this .attachmentPreview (attachment) + ' )'
255
258
const descString = this .$refs .markdownEditor .easymde .value ()
256
259
const newContent = descString + ' \n ' + attachmentString
257
260
this .$refs .markdownEditor .easymde .value (newContent)
You can’t perform that action at this time.
0 commit comments