Skip to content

Commit

Permalink
CreateSodanのボタンを変更
Browse files Browse the repository at this point in the history
  • Loading branch information
shota973 committed Aug 29, 2024
1 parent 3c1776f commit 439f65e
Showing 1 changed file with 57 additions and 48 deletions.
105 changes: 57 additions & 48 deletions src/components/MarkDownEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -528,24 +528,8 @@ watch(contentHistory,() =>{
);
const Update = async() =>{
// if(type.value == 2){
// console.log("sodan");
// const response = await fetch('/api/sodan', {
// method: 'PATCH',
// headers: {
// 'Content-Type': 'application/json'
// },
// body: JSON.stringify({
// title: title.value,
// content: Content.value,
// ownerTraqId: "test"})
// }).catch((e) => console.log(e))
// if(response && response.ok){
// const wikiAbstract = await response.json();
// router.push("/memo/" + wikiAbstract.id)
// }
// return response
// }else if(type == 1){
if(type.value == 1){
// 自分のメモであるかを確認!!!!!!!!!!!!!!!!!
const response = await fetch('/api/memo', {
method: 'PATCH',
headers: {
Expand All @@ -569,34 +553,16 @@ const Update = async() =>{
})
}
return response;
// }
}
}
const Create = async(CreateButtonDown: boolean) =>{
if(title.value == "" || Content.value == ""){
$toast.info("please enter the title and content", {
duration: 1200,
position: 'top-right'
})
// 自分のメモであるかを確認!!!!!!!!!!!!!!!!!
}else{
if(type.value == 2){
console.log("sodan");
// const response = await fetch('/api/sodan', {
// method: 'POST',
// headers: {
// 'Content-Type': 'application/json'
// },
// body: JSON.stringify({
// title: title.value,
// content: Content.value,
// ownerTraqId: "test"})
// }).catch((e) => console.log(e))
// if(response && response.ok){
// const wikiAbstract = await response.json();
// wikiId.value = wikiAbstract.id;
// if(CreateButtonDown)router.push("/sodan/" + wikiAbstract.id);
// }
}else if(type.value == 1){
if(type.value == 1){
const response = await fetch('/api/memo', {
method: 'POST',
headers: {
Expand Down Expand Up @@ -646,12 +612,38 @@ const SendReply = () =>{
duration: 1200,
position: 'top-right'
})
Content.value = "";
sendToRoom.value = undefined;
}else{
$toast.info("please enter the room number and content", {
duration: 1200,
position: 'top-right'
})
}
}
const SendSodan = () =>{
if(Content.value != ""){
// contentsをsodanに送る
$toast.success("send!!", {
duration: 1200,
position: 'top-right'
})
Content.value = "";
selectTags.value = []
}else{
$toast.info("please enter the content", {
duration: 1200,
position: 'top-right'
})
}
}
const Send = () =>{
if(type.value == 3){
SendReply();
}else if(type.value == 2){
SendSodan();
}
}
const Show = async() =>{
Expand Down Expand Up @@ -702,13 +694,13 @@ onMounted(async() =>{
})
</script>
<template>
<div :class="$style.buttons" v-if="type == 1 || type == 2">
<div :class="$style.buttons" v-if="type == 1">
<button type="button" @click="Save">save</button>
<button type="button" @click="Create(true)" v-if="wikiId < 0">create</button>
<button type="button" @click="Show" v-if="wikiId >= 0">show</button>
</div>
<div :class="$style.buttons" v-if="type == 3">
<button type="button" @click="SendReply">send</button>
<div :class="$style.buttons" v-if="type == 2 || type == 3">
<button type="button" @click="Send">send</button>
</div>
<div :class="$style.editors">
<div :class="$style.content">
Expand All @@ -734,11 +726,28 @@ onMounted(async() =>{
:items="[1, 2, 3, 4, 5, 6]"
v-model="sendToRoom"
variant="underlined"
v-on:keydown.ctrl.prevent.s="SendReply"
v-on:keydown.meta.prevent.s="SendReply"
v-on:keydown.ctrl.prevent.s="Send"
v-on:keydown.meta.prevent.s="Send"
></v-select>
</div>
<div v-if="type == 1 || type == 2">
<div v-if="type == 2">
<h3>tags</h3>
<v-combobox
chips
clearable
deletable-chips
multiple
small-chips
:items="tags"
v-model="selectTags"
label="tags"
:loading="isLoading"
variant="underlined"
v-on:keydown.ctrl.prevent.s="Send"
v-on:keydown.meta.prevent.s="Send"
></v-combobox>
</div>
<div v-if="type == 1">
<h3>tags</h3>
<v-combobox
chips
Expand Down Expand Up @@ -768,7 +777,7 @@ onMounted(async() =>{
<button type="button" @click="ToBolds('[', true)"><font-awesome-icon :icon="['fas', 'link']" transform="shrink-3" /></button>
<button type="button" @click="ToBolds('![', true)"><font-awesome-icon :icon="['fas', 'image']" transform="shrink-2" /></button>
</div>
<v-textarea v-if="type == 1 || type == 2"
<v-textarea v-if="type == 1"
name="input-7-1"
filled
label="Contents"
Expand All @@ -784,7 +793,7 @@ onMounted(async() =>{
v-on:keydown.ctrl.prevent.s="Save"
v-on:keydown.meta.prevent.s="Save"
></v-textarea>
<v-textarea v-else-if="type == 3"
<v-textarea v-else-if="type == 2 || type == 3"
name="input-7-1"
filled
label="Contents"
Expand All @@ -797,8 +806,8 @@ onMounted(async() =>{
v-on:keydown.ctrl.shift.prevent.z="controlshiftzDown"
v-on:keydown.meta.prevent.z.exact="controlzDown"
v-on:keydown.meta.shift.prevent.z="controlshiftzDown"
v-on:keydown.ctrl.prevent.s="SendReply"
v-on:keydown.meta.prevent.s="SendReply"
v-on:keydown.ctrl.prevent.s="Send"
v-on:keydown.meta.prevent.s="Send"
></v-textarea>
</div>
<div :class="$style.content">
Expand Down

0 comments on commit 439f65e

Please sign in to comment.