| | @@ -69,27 +69,30 @@ |
| 69 | 69 | }); |
| 70 | 70 | e.title.value = F.storage.get(key,''); |
| 71 | 71 | } |
| 72 | 72 | wrapper.append(e.titleBar); |
| 73 | 73 | } |
| 74 | | - e.mimetype.wrapper = D.addClass(D.div(), 'mimetype-wrapper'); |
| 75 | | - e.mimetype.select = D.addClass(D.select(), 'mimetype-select'); |
| 76 | | - this.#toDisable.push(e.mimetype.select); |
| 77 | | - e.mimetype.label = D.span(); |
| 78 | | - e.mimetype.label.append( |
| 79 | | - D.a(F.repoUrl('markup_help'), 'Markup style'), |
| 80 | | - ':' |
| 81 | | - ); |
| 82 | | - e.mimetype.wrapper.append(e.mimetype.label, e.mimetype.select); |
| 83 | | - let i = 0; |
| 84 | | - for(const [k,v] of Object.entries({ |
| 85 | | - 'text/x-markdown': 'Markdown', |
| 86 | | - 'text/x-fossil-wiki': 'Fossil Wiki', |
| 87 | | - 'text/plain': 'Plain text' |
| 88 | | - })) { |
| 89 | | - const o = D.option(e.mimetype.select, k, v); |
| 90 | | - if( !i++ ) o.setAttribute('selected', ''); |
| 74 | + |
| 75 | + { /* Mimetype bits... */ |
| 76 | + e.mimetype.wrapper = D.addClass(D.div(), 'mimetype-wrapper'); |
| 77 | + e.mimetype.select = D.addClass(D.select(), 'mimetype-select'); |
| 78 | + this.#toDisable.push(e.mimetype.select); |
| 79 | + let i = 0; |
| 80 | + for(const [k,v] of Object.entries({ |
| 81 | + 'text/x-markdown': 'Markdown', |
| 82 | + 'text/x-fossil-wiki': 'Fossil Wiki', |
| 83 | + 'text/plain': 'Plain text' |
| 84 | + })) { |
| 85 | + const o = D.option(e.mimetype.select, k, v); |
| 86 | + if( !i++ ) o.setAttribute('selected', ''); |
| 87 | + } |
| 88 | + e.mimetype.label = D.span(); |
| 89 | + e.mimetype.label.append( |
| 90 | + D.a(F.repoUrl('markup_help'), 'Markup style'), |
| 91 | + ':' |
| 92 | + ); |
| 93 | + e.mimetype.wrapper.append(e.mimetype.label, e.mimetype.select); |
| 91 | 94 | } |
| 92 | 95 | |
| 93 | 96 | e.button.preview = D.button("Preview", e=>this.#preview()); |
| 94 | 97 | e.button.submit = D.button("Submit"); |
| 95 | 98 | if( 1 ){ |
| | @@ -161,10 +164,41 @@ |
| 161 | 164 | e.debug.append(lbl); |
| 162 | 165 | } |
| 163 | 166 | this.#tabs.addTab(e.debug); |
| 164 | 167 | } |
| 165 | 168 | e.buttons.append(e.mimetype.wrapper); |
| 169 | + |
| 170 | + if( 0 ){ |
| 171 | + /* |
| 172 | + Status selection. We probably don't _really_ want this in |
| 173 | + the editor because people will open the editor, change the |
| 174 | + status, and tap submit, resulting in a whole new, unedited |
| 175 | + copy of the post, differing only in the new 'status' tag |
| 176 | + added to it. |
| 177 | + */ |
| 178 | + let i = 0; |
| 179 | + for(const [k,v] of Object.entries({ |
| 180 | + 'text/x-markdown': 'Markdown', |
| 181 | + 'text/x-fossil-wiki': 'Fossil Wiki', |
| 182 | + 'text/plain': 'Plain text' |
| 183 | + })) { |
| 184 | + const o = D.option(e.mimetype.select, k, v); |
| 185 | + if( !i++ ) o.setAttribute('selected', ''); |
| 186 | + } |
| 187 | + if( F.config.forumStatuses?.length>0 ){ |
| 188 | + const sel = e.status = D.select(); |
| 189 | + D.option(sel, "", "- Status -").disabled = true; |
| 190 | + for( const status of F.config.forumStatuses ){ |
| 191 | + D.option(sel, status.value, status.label); |
| 192 | + } |
| 193 | + e.buttons.append(sel); |
| 194 | + if( opt.status ){ |
| 195 | + sel.value = opt.status; |
| 196 | + } |
| 197 | + } |
| 198 | + } |
| 199 | + |
| 166 | 200 | if( F.user.mayAttachForum ){ |
| 167 | 201 | this.#att = new F.Attacher({ |
| 168 | 202 | reverse: true |
| 169 | 203 | }); |
| 170 | 204 | //e.buttons.append( e.button.addAttach = this.#att.takeAddButton() ); |
| | @@ -250,10 +284,14 @@ |
| 250 | 284 | } |
| 251 | 285 | |
| 252 | 286 | set editorContent(v){ |
| 253 | 287 | this.#e.editor.value = v; |
| 254 | 288 | } |
| 289 | + |
| 290 | + get status(){ |
| 291 | + return this.#e.status?.value; |
| 292 | + } |
| 255 | 293 | |
| 256 | 294 | /** Clears any draft state. */ |
| 257 | 295 | clearDraft(){ |
| 258 | 296 | const k = this.#opt.draftKey; |
| 259 | 297 | if( k ){ |
| | @@ -396,10 +434,13 @@ |
| 396 | 434 | const e = this.#e; |
| 397 | 435 | D.disable(e.button.submit); |
| 398 | 436 | this.reportError("Submit is TODO."); |
| 399 | 437 | const fd = this.#newFormData(); |
| 400 | 438 | this.#att.populateFormData(fd); |
| 439 | + if( this.#e.status ){ |
| 440 | + fd.append( "status", this.status ); |
| 441 | + } |
| 401 | 442 | console.warn("Ready to submit",fd); |
| 402 | 443 | /* |
| 403 | 444 | TODO: save it, set #isWaiting=false, then handle error or |
| 404 | 445 | redirect to the post (if this is a new post) or, if replying |
| 405 | 446 | inline, replace this object with a static rendering from the |
| 406 | 447 | |