mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-02 14:07:04 +03:00
Draft code to share Nextcloud files as links #569
This commit is contained in:
parent
14bd9720e9
commit
6c276b9b03
3 changed files with 144 additions and 52 deletions
|
|
@ -7,33 +7,30 @@
|
|||
view.nextcloudAttach = () => {
|
||||
rl.nextcloud.selectFiles().then(files => {
|
||||
files && files.forEach(file => {
|
||||
let attachment = view.addAttachmentHelper(
|
||||
Jua?.randomId(),
|
||||
file.name.replace(/^.*\/([^/]+)$/, '$1'),
|
||||
file.size
|
||||
);
|
||||
attachment
|
||||
.waiting(false)
|
||||
.uploading(true)
|
||||
.complete(false);
|
||||
if (file.name) {
|
||||
let attachment = view.addAttachmentHelper(
|
||||
Jua?.randomId(),
|
||||
file.name.replace(/^.*\/([^/]+)$/, '$1'),
|
||||
file.size
|
||||
);
|
||||
|
||||
rl.pluginRemoteRequest(
|
||||
(iError, data) => {
|
||||
attachment
|
||||
.uploading(false)
|
||||
.complete(true);
|
||||
if (iError) {
|
||||
attachment.error(data?.Result?.error || 'failed');
|
||||
} else {
|
||||
attachment.tempName(data.Result.tempName);
|
||||
rl.pluginRemoteRequest(
|
||||
(iError, data) => {
|
||||
attachment.uploading(false).complete(true);
|
||||
if (iError) {
|
||||
attachment.error(data?.Result?.error || 'failed');
|
||||
} else {
|
||||
attachment.tempName(data.Result.tempName);
|
||||
}
|
||||
},
|
||||
'NextcloudAttachFile',
|
||||
{
|
||||
'file': file.name
|
||||
}
|
||||
},
|
||||
'NextcloudAttachFile',
|
||||
{
|
||||
'file': file.name
|
||||
}
|
||||
);
|
||||
|
||||
);
|
||||
} else if (file.url) {
|
||||
view.oEditor.editor.squire.makeLink(file.url);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue