This commit is contained in:
@@ -235,7 +235,7 @@ export default {
|
||||
ret.push({
|
||||
id: o.id,
|
||||
concurrencyToken: o.concurrencyToken,
|
||||
url: window.$gz.api.downloadUrl(o.id),
|
||||
url: window.$gz.api.downloadUrl(o.id,o.contentType),
|
||||
name: o.displayFileName,
|
||||
date: window.$gz.locale.utcDateToShortDateAndTimeLocalized(
|
||||
o.lastModified,
|
||||
|
||||
@@ -828,36 +828,53 @@ export default {
|
||||
} else {
|
||||
//maybe an url?
|
||||
let url = ev.dataTransfer.getData("text");
|
||||
let isImageUrl = false;
|
||||
console.log(ev.dataTransfer);
|
||||
//todo: use alternate to "text" to look for url specifically
|
||||
//if not an url then can just drop as plain text
|
||||
//todo: handle both internal and external urls in the same block, because the only diff is the url itself, the rest is identical
|
||||
|
||||
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
|
||||
//i paramter added by gzapi::downloadUrl function
|
||||
isImageUrl = url.includes("&i=");
|
||||
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) {
|
||||
} else {
|
||||
//External url, sniff out if it's an image
|
||||
isImageUrl = window.$gz.util.isImageURI(url);
|
||||
}
|
||||
if (url != null) {
|
||||
//insert into textarea
|
||||
let txt = this.getSelectedText();
|
||||
if (txt) {
|
||||
if (isImageUrl) {
|
||||
this.replaceSelectedText(
|
||||
" \n' + txt //keep original selected text otherwise it will vanish
|
||||
);
|
||||
} else {
|
||||
this.replaceSelectedText("");
|
||||
//regular url not image
|
||||
this.replaceSelectedText(
|
||||
"[" + txt + "](" + url + ' "' + txt + '")\n'
|
||||
);
|
||||
}
|
||||
} else {
|
||||
//No selected text
|
||||
if (isImageUrl) {
|
||||
this.replaceSelectedText("\n");
|
||||
} else {
|
||||
//regular no text non image url
|
||||
this.replaceSelectedText("<" + url + ">\n");
|
||||
}
|
||||
//trigger dirty change
|
||||
this.handleInput(this.localVal);
|
||||
}
|
||||
console.log("processed url:", url);
|
||||
} else {
|
||||
//External url
|
||||
//todo: this
|
||||
console.log("STUB: Handle external url drop");
|
||||
//trigger dirty change
|
||||
this.handleInput(this.localVal);
|
||||
}
|
||||
|
||||
//handle accordingly
|
||||
|
||||
Reference in New Issue
Block a user