Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

feat: support pre-fill forms on the ask page

hgaol8bdc43a435b5
diff --git a/ui/src/pages/Questions/Ask/index.tsx b/ui/src/pages/Questions/Ask/index.tsx
index 2b370de0..fb3b46ae 100644
--- a/ui/src/pages/Questions/Ask/index.tsx
+++ b/ui/src/pages/Questions/Ask/index.tsx
@@ -137,8 +137,16 @@ const Ask = () => {
useEffect(() => {
if (!qid) {
+ // order: 1. tags query. 2. prefill query. 3. draft
initQueryTags();
- const draft = storageExpires.get(DRAFT_QUESTION_STORAGE_KEY);
+ let draft;
+ const prefill = searchParams.get('prefill');
+ if (prefill) {
+ draft = JSON.parse(decodeURIComponent(prefill));
+ } else {
+ draft = storageExpires.get(DRAFT_QUESTION_STORAGE_KEY);
+ }
+
if (draft) {
formData.title.value = draft.title;
formData.content.value = draft.content;