🐛 Bug fixes
This commit is contained in:
		| @@ -50,6 +50,7 @@ export default function PostEditor(props: { | |||||||
|     setAttachments(props.editing?.attachments ?? []); |     setAttachments(props.editing?.attachments ?? []); | ||||||
|     setCategories(props.editing?.categories ?? []); |     setCategories(props.editing?.categories ?? []); | ||||||
|     setTags(props.editing?.tags ?? []); |     setTags(props.editing?.tags ?? []); | ||||||
|  |     editor()?.setValue(props.editing?.content); | ||||||
|   }, [props.editing]); |   }, [props.editing]); | ||||||
|  |  | ||||||
|   async function listRealm() { |   async function listRealm() { | ||||||
| @@ -146,6 +147,7 @@ export default function PostEditor(props: { | |||||||
|  |  | ||||||
|       <div class="border-y border-base-200"> |       <div class="border-y border-base-200"> | ||||||
|         <PostEditActions |         <PostEditActions | ||||||
|  |           editing={props.editing} | ||||||
|           onInputAlias={setAlias} |           onInputAlias={setAlias} | ||||||
|           onInputPublish={setPublishedAt} |           onInputPublish={setPublishedAt} | ||||||
|           onInputAttachments={setAttachments} |           onInputAttachments={setAttachments} | ||||||
| @@ -156,20 +158,30 @@ export default function PostEditor(props: { | |||||||
|       </div> |       </div> | ||||||
|  |  | ||||||
|       <div class="pt-3 pb-7 px-7"> |       <div class="pt-3 pb-7 px-7"> | ||||||
|         <label class="form-control w-full"> |         <Show when={!props.editing} fallback={ | ||||||
|           <div class="label"> |           <label class="form-control w-full mb-3"> | ||||||
|             <span class="label-text">Publish region</span> |             <div class="label"> | ||||||
|           </div> |               <span class="label-text">Publish region</span> | ||||||
|           <select name="realm" class="select select-bordered" disabled={props.editing}> |             </div> | ||||||
|             <option value={0} selected>Global</option> |             <input readonly type="text" class="input input-bordered" | ||||||
|             <For each={realmList()}> |                    value={`You published this post in realm #${props.editing?.realm_id ?? "global"}`} /> | ||||||
|               {item => <option value={item.id}>{item.name}</option>} |           </label> | ||||||
|             </For> |         }> | ||||||
|           </select> |           <label class="form-control w-full"> | ||||||
|           <div class="label"> |             <div class="label"> | ||||||
|             <span class="label-text-alt">Will show realms you joined or created.</span> |               <span class="label-text">Publish region</span> | ||||||
|           </div> |             </div> | ||||||
|         </label> |             <select name="realm" class="select select-bordered"> | ||||||
|  |               <option value={0} selected>Global</option> | ||||||
|  |               <For each={realmList()}> | ||||||
|  |                 {item => <option value={item.id}>{item.name}</option>} | ||||||
|  |               </For> | ||||||
|  |             </select> | ||||||
|  |             <div class="label"> | ||||||
|  |               <span class="label-text-alt">Will show realms you joined or created.</span> | ||||||
|  |             </div> | ||||||
|  |           </label> | ||||||
|  |         </Show> | ||||||
|  |  | ||||||
|         <label class="form-control w-full"> |         <label class="form-control w-full"> | ||||||
|           <div class="label"> |           <div class="label"> | ||||||
|   | |||||||
| @@ -190,6 +190,7 @@ export default function PostPublish(props: { | |||||||
|  |  | ||||||
|         <div id="publish-actions" class="flex justify-between border-y border-base-200"> |         <div id="publish-actions" class="flex justify-between border-y border-base-200"> | ||||||
|           <PostEditActions |           <PostEditActions | ||||||
|  |             editing={props.editing} | ||||||
|             onInputAlias={setAlias} |             onInputAlias={setAlias} | ||||||
|             onInputPublish={setPublishedAt} |             onInputPublish={setPublishedAt} | ||||||
|             onInputAttachments={setAttachments} |             onInputAttachments={setAttachments} | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ export default function PublishPost() { | |||||||
|       headers: { "Authorization": `Bearer ${getAtk()}` } |       headers: { "Authorization": `Bearer ${getAtk()}` } | ||||||
|     }); |     }); | ||||||
|     if (res.status === 200) { |     if (res.status === 200) { | ||||||
|       setPost(await res.json()); |       setPost((await res.json())["data"]); | ||||||
|     } else { |     } else { | ||||||
|       setError(await res.text()); |       setError(await res.text()); | ||||||
|     } |     } | ||||||
| @@ -30,7 +30,7 @@ export default function PublishPost() { | |||||||
|           <i class="fa-solid fa-angle-left"></i> |           <i class="fa-solid fa-angle-left"></i> | ||||||
|         </a> |         </a> | ||||||
|         <div class="px-5 flex items-center"> |         <div class="px-5 flex items-center"> | ||||||
|           <p>Publish a new post</p> |           <p>Edit「{post()?.title ? post()?.title : "Untitled"}」</p> | ||||||
|         </div> |         </div> | ||||||
|       </div> |       </div> | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user