mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-20 23:36:21 +08:00
Fix inline image attachment support
This commit is contained in:
parent
3cdc3c27c6
commit
69c7a7aea7
|
@ -533,7 +533,7 @@ export default class ComposerView extends React.Component {
|
|||
return;
|
||||
}
|
||||
|
||||
match.contentId = Utils.generateTempId();
|
||||
match.contentId = Utils.generateContentId();
|
||||
session.changes.add({
|
||||
files: [].concat(draft.files),
|
||||
});
|
||||
|
|
|
@ -147,12 +147,12 @@ export default class InlineImageUploadContainer extends Component {
|
|||
return <span />;
|
||||
}
|
||||
if (isPreview) {
|
||||
return <img src={`cid:${file.id}`} alt={file.name} />;
|
||||
return <img src={`cid:${file.contentId}`} alt={file.name} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
data-src={`cid:${file.id}`}
|
||||
data-src={`cid:${file.contentId}`}
|
||||
className="inline-image-upload-container"
|
||||
onDoubleClick={this._onGoEdit}
|
||||
>
|
||||
|
|
|
@ -155,6 +155,11 @@ Utils =
|
|||
Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1)
|
||||
'local-' + s4() + s4() + '-' + s4()
|
||||
|
||||
generateContentId: ->
|
||||
s4 = ->
|
||||
Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1)
|
||||
'mcid-' + s4() + s4() + '-' + s4()
|
||||
|
||||
isTempId: (id) ->
|
||||
return false unless id and _.isString(id)
|
||||
id[0..5] is 'local-'
|
||||
|
|
|
@ -436,7 +436,7 @@ class AttachmentStore extends MailspringStore {
|
|||
size: stats.size,
|
||||
contentType: null,
|
||||
messageId: null,
|
||||
contentId: inline ? Utils.generateTempId() : null,
|
||||
contentId: inline ? Utils.generateContentId() : null,
|
||||
});
|
||||
|
||||
await mkdirpAsync(path.dirname(this.pathForFile(file)));
|
||||
|
|
|
@ -59,7 +59,7 @@ class DraftHelpers {
|
|||
|
||||
async pruneRemovedInlineFiles(draft) {
|
||||
draft.files = draft.files.filter(f => {
|
||||
return !(f.contentId && !draft.body.includes(`cid:${f.id}`));
|
||||
return !(f.contentId && !draft.body.includes(`cid:${f.contentId}`));
|
||||
});
|
||||
|
||||
return draft;
|
||||
|
|
2
mailsync
2
mailsync
|
@ -1 +1 @@
|
|||
Subproject commit f5625c3c8d102856a2c4b838e9d40f751b1df216
|
||||
Subproject commit d4b6bdc8b9ef6fec0023d59c94e9f71de72f99ef
|
Loading…
Reference in a new issue