This commit is contained in:
@@ -66,13 +66,14 @@ CURRENT TODOs
|
|||||||
|
|
||||||
@@@@@@@@@@@ ROADMAP STAGE 2:
|
@@@@@@@@@@@ ROADMAP STAGE 2:
|
||||||
|
|
||||||
todo: add to attachment object at server if it's an image or not so that can handle without downloading to see (or is it in the content type already?)
|
|
||||||
|
todo: Image toolbar component handle attachments (this is a requirement because on a phone or other browsers you might not be able to drag and drop)
|
||||||
|
todo: wiki emit input on change: currently it's manual but it should just either WATCH for changes or the replace text method should do the triggering since it's called for all ops
|
||||||
|
|
||||||
todo: drag and drop files on to attachments and have them stored and added automatically
|
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 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: Image toolbar component handle attachments (this is a requirement because on a phone or other browsers you might not be able to drag and drop)
|
|
||||||
todo: handle dropped attachment that isn't an image with an alternate link style
|
|
||||||
todo: wiki emit input on change: currently it's manual but it should just either WATCH for changes or the replace text method should do the triggering since it's called for all ops
|
|
||||||
|
|
||||||
todo: AFTER ATTACHMENTS WIKI IMAGES
|
todo: AFTER ATTACHMENTS WIKI IMAGES
|
||||||
- Go back and finish off wiki image attachment UI and code
|
- Go back and finish off wiki image attachment UI and code
|
||||||
|
|||||||
@@ -366,11 +366,8 @@ export default {
|
|||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// attempt to detect image extension name
|
// attempt to detect image extension name
|
||||||
//
|
//
|
||||||
isImageURI: function(uri) {
|
isImageAttachment: function(fileName, mimeType) {
|
||||||
if (!uri) {
|
return this.iconForFile(fileName, mimeType) == "fa-file-image";
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return this.iconForFile(uri, "") == "fa-file-image";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -245,17 +245,14 @@
|
|||||||
<v-tab-item key="file"
|
<v-tab-item key="file"
|
||||||
><div class="ma-6">
|
><div class="ma-6">
|
||||||
<v-select
|
<v-select
|
||||||
|
@click="getAttachments"
|
||||||
:label="$ay.t('Attachments')"
|
:label="$ay.t('Attachments')"
|
||||||
v-model="selectedImageAttachment"
|
v-model="selectedImageAttachment"
|
||||||
:items="availableAttachments()"
|
:items="attachments"
|
||||||
item-text="name"
|
item-text="name"
|
||||||
item-value="id"
|
item-value="id"
|
||||||
|
return-object
|
||||||
></v-select>
|
></v-select>
|
||||||
<!--
|
|
||||||
<v-file-input
|
|
||||||
:label="$ay.t('AttachFile')"
|
|
||||||
prepend-icon="fa-paperclip"
|
|
||||||
></v-file-input> -->
|
|
||||||
|
|
||||||
<v-text-field
|
<v-text-field
|
||||||
v-model="imageText"
|
v-model="imageText"
|
||||||
@@ -385,14 +382,17 @@ export default {
|
|||||||
imageTab: null,
|
imageTab: null,
|
||||||
imageUrl: "",
|
imageUrl: "",
|
||||||
imageText: "",
|
imageText: "",
|
||||||
|
attachments: [],
|
||||||
selectedImageAttachment: null,
|
selectedImageAttachment: null,
|
||||||
|
|
||||||
dropTest: null
|
dropTest: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
value: String,
|
value: String,
|
||||||
readonly: Boolean,
|
ayaType: Number,
|
||||||
attachments: Array
|
ayaId: Number,
|
||||||
|
readonly: Boolean
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
value(value) {
|
value(value) {
|
||||||
@@ -755,28 +755,35 @@ export default {
|
|||||||
case "image":
|
case "image":
|
||||||
//")
|
//")
|
||||||
{
|
{
|
||||||
|
this.imageMenu = false;
|
||||||
|
let url = null;
|
||||||
if (ex == 1) {
|
if (ex == 1) {
|
||||||
throw "Attachment mode TODO";
|
//it's an attachment
|
||||||
//todo: ATTACHEDFILEMODE//attached file mode?
|
url = this.selectedImageAttachment.url;
|
||||||
|
if (!this.imageText) {
|
||||||
|
this.imageText = this.selectedImageAttachment.name;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.imageMenu = false;
|
//it's a url paste / manual entry
|
||||||
let url = this.imageUrl;
|
url = this.imageUrl;
|
||||||
if (!url) {
|
}
|
||||||
return;
|
|
||||||
}
|
|
||||||
let txt = this.imageText;
|
|
||||||
//force it to a full url so it doesn't attempt to open it as a SPA window
|
|
||||||
if (!url.includes(":")) {
|
|
||||||
url = "https://" + url;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (txt) {
|
if (!url) {
|
||||||
this.replaceSelectedText(
|
return;
|
||||||
" \n' + txt //keep original selected text otherwise it will vanish
|
}
|
||||||
);
|
|
||||||
} else {
|
let txt = this.imageText;
|
||||||
this.replaceSelectedText("");
|
//force it to a full url so it doesn't attempt to open it as a SPA window
|
||||||
}
|
if (!url.includes(":")) {
|
||||||
|
url = "https://" + url;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (txt) {
|
||||||
|
this.replaceSelectedText(
|
||||||
|
" \n' + txt //keep original selected text otherwise it will vanish
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.replaceSelectedText("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -810,12 +817,38 @@ export default {
|
|||||||
this.imageMenu = true;
|
this.imageMenu = true;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
availableAttachments() {
|
getAttachments() {
|
||||||
return [
|
let vm = this;
|
||||||
{ id: 0, name: "Stub attachment one" },
|
vm.attachments = [];
|
||||||
{ id: 1, name: "Stub attachment two" },
|
window.$gz.api
|
||||||
{ id: 2, name: "Stub attachment three" }
|
.get("Attachment/list?ayatype=" + vm.ayaType + "&ayaid=" + vm.ayaId)
|
||||||
];
|
.then(res => {
|
||||||
|
if (res.error) {
|
||||||
|
window.$gz.errorHandler.handleFormError(res.error);
|
||||||
|
} else {
|
||||||
|
let ret = [];
|
||||||
|
for (let i = 0; i < res.data.length; i++) {
|
||||||
|
let o = res.data[i];
|
||||||
|
|
||||||
|
if (
|
||||||
|
window.$gz.util.isImageAttachment(
|
||||||
|
o.displayFileName,
|
||||||
|
o.contentType
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
ret.push({
|
||||||
|
id: o.id,
|
||||||
|
url: window.$gz.api.downloadUrl(o.id, o.contentType),
|
||||||
|
name: o.displayFileName
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vm.attachments = ret;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(function handleGetListError(error) {
|
||||||
|
window.$gz.errorHandler.handleFormError(error);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onDrop(ev) {
|
onDrop(ev) {
|
||||||
@@ -829,7 +862,7 @@ export default {
|
|||||||
//maybe an url?
|
//maybe an url?
|
||||||
let url = ev.dataTransfer.getData("text");
|
let url = ev.dataTransfer.getData("text");
|
||||||
let isImageUrl = false;
|
let isImageUrl = false;
|
||||||
console.log(ev.dataTransfer);
|
//console.log(ev.dataTransfer);
|
||||||
//todo: use alternate to "text" to look for url specifically
|
//todo: use alternate to "text" to look for url specifically
|
||||||
//if not an url then can just drop as plain text
|
//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
|
//todo: handle both internal and external urls in the same block, because the only diff is the url itself, the rest is identical
|
||||||
@@ -848,7 +881,7 @@ export default {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//External url, sniff out if it's an image
|
//External url, sniff out if it's an image
|
||||||
isImageUrl = window.$gz.util.isImageURI(url);
|
isImageUrl = window.$gz.util.isImageAttachment(url);
|
||||||
}
|
}
|
||||||
if (url != null) {
|
if (url != null) {
|
||||||
//insert into textarea
|
//insert into textarea
|
||||||
|
|||||||
@@ -207,6 +207,8 @@
|
|||||||
|
|
||||||
<v-col v-if="form().showMe(this, 'Wiki')" cols="12">
|
<v-col v-if="form().showMe(this, 'Wiki')" cols="12">
|
||||||
<gz-wiki
|
<gz-wiki
|
||||||
|
:ayaType="ayType"
|
||||||
|
:ayaId="obj.id"
|
||||||
ref="wiki"
|
ref="wiki"
|
||||||
v-model="obj.wiki"
|
v-model="obj.wiki"
|
||||||
:readonly="formState.readOnly"
|
:readonly="formState.readOnly"
|
||||||
|
|||||||
Reference in New Issue
Block a user