This commit is contained in:
2020-04-19 19:41:50 +00:00
parent be3126136f
commit 2eba3a1828

View File

@@ -212,42 +212,44 @@
> >
<v-card> <v-card>
<v-card-title>{{ $ay.t("InsertImage") }}</v-card-title> <v-card-title>{{ $ay.t("InsertImage") }}</v-card-title>
<div>
<v-tabs grow color="primary">
<v-tab>URL</v-tab>
<v-tab>{{ $ay.t("Attachments") }}</v-tab>
<v-tab-item <div>
><div class="ma-6"> <v-tabs v-model="imageTab" grow color="primary">
<v-text-field <v-tab key="url">URL</v-tab>
v-model="imageUrl" <v-tab key="file">{{ $ay.t("Attachments") }}</v-tab>
:label="$ay.t('ImageUrl')" <v-tabs-items v-model="imageTab">
></v-text-field> <v-tab-item key="url"
<v-text-field ><div class="ma-6">
v-model="imageText" <v-text-field
:label="$ay.t('ImageDescription')" v-model="imageUrl"
></v-text-field></div :label="$ay.t('ImageUrl')"
></v-tab-item> ></v-text-field>
<v-tab-item <v-text-field
><div class="ma-6"> v-model="imageText"
<v-select :label="$ay.t('ImageDescription')"
:label="$ay.t('Attachments')" ></v-text-field></div
v-model="selectedImageAttachment" ></v-tab-item>
:items="availableAttachments()" <v-tab-item key="file"
item-text="name" ><div class="ma-6">
item-value="id" <v-select
></v-select> :label="$ay.t('Attachments')"
<!-- v-model="selectedImageAttachment"
:items="availableAttachments()"
item-text="name"
item-value="id"
></v-select>
<!--
<v-file-input <v-file-input
:label="$ay.t('AttachFile')" :label="$ay.t('AttachFile')"
prepend-icon="fa-paperclip" prepend-icon="fa-paperclip"
></v-file-input> --> ></v-file-input> -->
<v-text-field <v-text-field
v-model="imageText" v-model="imageText"
:label="$ay.t('ImageDescription')" :label="$ay.t('ImageDescription')"
></v-text-field></div ></v-text-field></div
></v-tab-item> ></v-tab-item>
</v-tabs-items>
</v-tabs> </v-tabs>
</div> </div>
<v-card-actions> <v-card-actions>
@@ -256,9 +258,12 @@
<v-btn text @click="imageMenu = false">{{ <v-btn text @click="imageMenu = false">{{
$ay.t("Cancel") $ay.t("Cancel")
}}</v-btn> }}</v-btn>
<v-btn color="primary" text @click="editClick('image')">{{ <v-btn
$ay.t("OK") color="primary"
}}</v-btn> text
@click="editClick('image', imageTab)"
>{{ $ay.t("OK") }}</v-btn
>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</v-menu> </v-menu>
@@ -362,6 +367,7 @@ export default {
linkUrl: "", linkUrl: "",
linkText: "", linkText: "",
imageMenu: false, imageMenu: false,
imageTab: null,
imageUrl: "", imageUrl: "",
imageText: "", imageText: "",
selectedImageAttachment: null selectedImageAttachment: null
@@ -727,24 +733,28 @@ export default {
case "image": case "image":
//![alttexthere](https://www.ayanova.com/images/AyaNovaIcon256.png "title text here (tooltip)") //![alttexthere](https://www.ayanova.com/images/AyaNovaIcon256.png "title text here (tooltip)")
{ {
//todo: ATTACHEDFILEMODE if (ex == 1) {
this.imageMenu = false; throw "Attachment mode TODO";
let url = this.imageUrl; //todo: ATTACHEDFILEMODE//attached file mode?
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) {
this.replaceSelectedText(
"![" + txt + "](" + url + ' "' + txt + '") \n' + txt //keep original selected text otherwise it will vanish
);
} else { } else {
this.replaceSelectedText("![](" + url + ")"); this.imageMenu = false;
let 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) {
this.replaceSelectedText(
"![" + txt + "](" + url + ' "' + txt + '") \n' + txt //keep original selected text otherwise it will vanish
);
} else {
this.replaceSelectedText("![](" + url + ")");
}
} }
} }
break; break;