This commit is contained in:
2020-04-23 23:27:02 +00:00
parent 11076698e5
commit d9611763f1
2 changed files with 59 additions and 13 deletions

View File

@@ -66,17 +66,9 @@ CURRENT TODOs
@@@@@@@@@@@ ROADMAP STAGE 2:
todo: attachments - form key for hiding / showing customization
todo: clean up recently added translation keys, some are not being used and were added willy nilly
- "File" I think might be one
todo: Datadump EXPORT and RAVEN IMPORT of all attachment / wiki stuff
- v7 attached files, internal documents all handled
- Code it now
todo: drag and drop files on to attachments and have them stored and added automatically
todo: drag and drop image file on to wiki and have it added as attachment then linked automatically
todo: drag and drop image file from attachments and have it added to wiki automatically.
todo: AFTER ATTACHMENTS WIKI IMAGES
@@ -89,7 +81,7 @@ todo: AFTER ATTACHMENTS WIKI IMAGES
todo: Picture input in attachments
https://rockfish.ayanova.com/default.htm#!/rfcaseEdit/2080
todo: attached files drag and drop
todo: Look at attachment saving code on server, should it zip?
@@ -102,6 +94,9 @@ todo: careful and thorough PERF tests remotely and local
todo: after attachments - DATADUMP - v7 wiki to RAVEN markdown
- https://rockfish.ayanova.com/default.htm#!/rfcaseEdit/3468
- Need to export images and attached docs as attachments
todo: Datadump EXPORT and RAVEN IMPORT of all attachment / wiki stuff
- v7 attached files, internal documents all handled
- Code it now
todo: after attachments - integration tests update

View File

@@ -299,6 +299,9 @@
>
<div :style="editStyle()">
<v-textarea
v-cloak
@drop.prevent="onDrop"
@dragover.prevent
solo
no-resize
:height="editAreaHeight"
@@ -382,7 +385,8 @@ export default {
imageTab: null,
imageUrl: "",
imageText: "",
selectedImageAttachment: null
selectedImageAttachment: null,
dropTest: null
};
},
props: {
@@ -806,7 +810,54 @@ export default {
{ id: 1, name: "Stub attachment two" },
{ id: 2, name: "Stub attachment three" }
];
},
onDrop(ev) {
//Drop image file
var files = Array.from(ev.dataTransfer.files);
if (files.length > 0) {
//handle file drop
console.log("DROP:Possible files", files);
//if an image then put it directly in viewable, if not an image then make a link and keep as an attach
} else {
//maybe an url?
let url = ev.dataTransfer.getData("text");
if (url) {
//Attachment?
if (url.includes("Attachment/download/")) {
//it's an attachment url so fixup accordingly
//DROP:Possible url http://localhost:7575/api/v8.0/Attachment/download/4?t=CYs1xUgjdyaWmcq8rXlPpNNSaKpiMt8Xhi7mKRGeg8o wiki-control.vue:826
//cow(.*)milk
let m = url.match(/Attachment\/download\/(.*)\?t=/);
if (m.length > 1) {
url = "[ATTACH:" + m[1] + "]";
} else {
url = null;
}
if (url != null) {
//insert into textarea
let txt = this.getSelectedText();
if (txt) {
this.replaceSelectedText(
"![" + txt + "](" + url + ' "' + txt + '") \n' + txt //keep original selected text otherwise it will vanish
);
} else {
this.replaceSelectedText("![](" + url + ")");
}
}
console.log("processed url:", url);
} else {
//External url
//todo: this
console.log("STUB: Handle external url drop");
}
//handle accordingly
}
}
}
//----------end methods----------
}
};
</script>