Fossil SCM

Fix editing of a thread title in the new editor.

stephan 2026-06-08 11:09 UTC forum-editor-2026
Commit 14abbc4d469c18eb2908bc1465789c33947b13f34144de89a4a94f4f32a28095
1 file changed +28 -17
--- src/fossil.page.forumpost.js
+++ src/fossil.page.forumpost.js
@@ -98,11 +98,11 @@
9898
if( this.#draft ){
9999
e.title.addEventListener('blur', ()=>{
100100
this.#draft.title = e.title.value;
101101
this.#storeDraft();
102102
});
103
- e.title.value = opt.edit?.H || this.#draft.title || '';
103
+ e.title.value = this.#draft.title || opt.edit?.H || '';
104104
}else if( opt.edit?.H ){
105105
e.title.value = opt.edit.H;
106106
}
107107
wrapper.append(e.titleBar);
108108
}
@@ -492,11 +492,11 @@
492492
fd.append(f.name, f.value);
493493
}
494494
let v;
495495
if( this.#opt.inReplyTo ){
496496
fd.append( 'firt', this.#opt.inReplyTo );
497
- }else if( (v = this.#e.title?.trim?.() ?? this.#opt.edit?.H) ){
497
+ }else if( (v = (this.#e.title?.value?.trim?.() || this.#opt.edit?.H)) ){
498498
fd.append('title', v);
499499
}
500500
fd.append('mimetype', this.mimetype);
501501
fd.append('content', addThisContent || this.editorContent.trim());
502502
if( this.#e.captcha ){
@@ -958,31 +958,43 @@
958958
a Cancel button.
959959
960960
- When cancelled or submitted, restore the reply button and
961961
ePost position.
962962
*/
963
- restoreEditReplyElement(ePost, eBtnReply, eToDisable);
963
+ fetchPost(fpid)
964
+ .then(artifact=>{
965
+ const ondone = (fpe)=>{
966
+ restoreEditReplyElement(ePost, eBtnReply, eToDisable);
967
+ //console.debug("ondiscard/onsubmit", fpe, eToDisable);
968
+ if( fpe/*onsubmit*/ ){
969
+ if( fpe.widget.parentNode ){
970
+ fpe.widget.remove();
971
+ }
972
+ }
973
+ };
974
+ const fpe = new F.ForumPostEditor({
975
+ hiddenFields: form.querySelectorAll('input[type=hidden]'),
976
+ ondiscard: ondone,
977
+ onsubmit: ondone,
978
+ draftKey: 'draft-forumedit-'+(fEditHead || fpid).substr(0,12),
979
+ hideTitle: true/*fixme: only show if this is the root post*/,
980
+ edit: artifact,
981
+ inReplyTo: firt
982
+ });
983
+ const w = fpe.widget;
984
+ w.style.borderTop = '2px dotted';
985
+ /* Adding an "Editing..." <h3> here adds way too much space */
986
+ ePost.append(w);
987
+ w.scrollIntoView();
988
+ });
964989
}/*replyClicked()*/;
965990
966991
const editClicked = (form, ePost, eBtnEdit, eToDisable)=>{
967992
const fpid = setupEditReplyElement(ePost, eBtnEdit, eToDisable);
968993
const firt = ePost.dataset.firt;
969994
const fEditHead = ePost.dataset.fedithead;
970995
eBtnEdit.innerText = "Editing...";
971
- /*
972
- TODOs include:
973
-
974
- - Disable editButton.
975
-
976
- - Shift ePost to the left edge.
977
-
978
- - Pop up a ForumPostEditor immediately under ePost. It needs
979
- a Cancel button.
980
-
981
- - When cancelled or submitted, restore the edit button and
982
- ePost position.
983
- */
984996
fetchPost(fpid)
985997
.then(artifact=>{
986998
const ondone = (fpe)=>{
987999
restoreEditReplyElement(ePost, eBtnEdit, eToDisable);
9881000
//console.debug("ondiscard/onsubmit", fpe, eToDisable);
@@ -999,11 +1011,10 @@
9991011
const fpe = new F.ForumPostEditor({
10001012
hiddenFields: form.querySelectorAll('input[type=hidden]'),
10011013
ondiscard: ondone,
10021014
onsubmit: ondone,
10031015
draftKey: 'draft-forumedit-'+(fEditHead || fpid).substr(0,12),
1004
- hideTitle: true/*fixme: only show if this is the root post*/,
10051016
edit: artifact,
10061017
status: eStatusSelect?.value,
10071018
inReplyTo: firt
10081019
});
10091020
const w = fpe.widget;
10101021
--- src/fossil.page.forumpost.js
+++ src/fossil.page.forumpost.js
@@ -98,11 +98,11 @@
98 if( this.#draft ){
99 e.title.addEventListener('blur', ()=>{
100 this.#draft.title = e.title.value;
101 this.#storeDraft();
102 });
103 e.title.value = opt.edit?.H || this.#draft.title || '';
104 }else if( opt.edit?.H ){
105 e.title.value = opt.edit.H;
106 }
107 wrapper.append(e.titleBar);
108 }
@@ -492,11 +492,11 @@
492 fd.append(f.name, f.value);
493 }
494 let v;
495 if( this.#opt.inReplyTo ){
496 fd.append( 'firt', this.#opt.inReplyTo );
497 }else if( (v = this.#e.title?.trim?.() ?? this.#opt.edit?.H) ){
498 fd.append('title', v);
499 }
500 fd.append('mimetype', this.mimetype);
501 fd.append('content', addThisContent || this.editorContent.trim());
502 if( this.#e.captcha ){
@@ -958,31 +958,43 @@
958 a Cancel button.
959
960 - When cancelled or submitted, restore the reply button and
961 ePost position.
962 */
963 restoreEditReplyElement(ePost, eBtnReply, eToDisable);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
964 }/*replyClicked()*/;
965
966 const editClicked = (form, ePost, eBtnEdit, eToDisable)=>{
967 const fpid = setupEditReplyElement(ePost, eBtnEdit, eToDisable);
968 const firt = ePost.dataset.firt;
969 const fEditHead = ePost.dataset.fedithead;
970 eBtnEdit.innerText = "Editing...";
971 /*
972 TODOs include:
973
974 - Disable editButton.
975
976 - Shift ePost to the left edge.
977
978 - Pop up a ForumPostEditor immediately under ePost. It needs
979 a Cancel button.
980
981 - When cancelled or submitted, restore the edit button and
982 ePost position.
983 */
984 fetchPost(fpid)
985 .then(artifact=>{
986 const ondone = (fpe)=>{
987 restoreEditReplyElement(ePost, eBtnEdit, eToDisable);
988 //console.debug("ondiscard/onsubmit", fpe, eToDisable);
@@ -999,11 +1011,10 @@
999 const fpe = new F.ForumPostEditor({
1000 hiddenFields: form.querySelectorAll('input[type=hidden]'),
1001 ondiscard: ondone,
1002 onsubmit: ondone,
1003 draftKey: 'draft-forumedit-'+(fEditHead || fpid).substr(0,12),
1004 hideTitle: true/*fixme: only show if this is the root post*/,
1005 edit: artifact,
1006 status: eStatusSelect?.value,
1007 inReplyTo: firt
1008 });
1009 const w = fpe.widget;
1010
--- src/fossil.page.forumpost.js
+++ src/fossil.page.forumpost.js
@@ -98,11 +98,11 @@
98 if( this.#draft ){
99 e.title.addEventListener('blur', ()=>{
100 this.#draft.title = e.title.value;
101 this.#storeDraft();
102 });
103 e.title.value = this.#draft.title || opt.edit?.H || '';
104 }else if( opt.edit?.H ){
105 e.title.value = opt.edit.H;
106 }
107 wrapper.append(e.titleBar);
108 }
@@ -492,11 +492,11 @@
492 fd.append(f.name, f.value);
493 }
494 let v;
495 if( this.#opt.inReplyTo ){
496 fd.append( 'firt', this.#opt.inReplyTo );
497 }else if( (v = (this.#e.title?.value?.trim?.() || this.#opt.edit?.H)) ){
498 fd.append('title', v);
499 }
500 fd.append('mimetype', this.mimetype);
501 fd.append('content', addThisContent || this.editorContent.trim());
502 if( this.#e.captcha ){
@@ -958,31 +958,43 @@
958 a Cancel button.
959
960 - When cancelled or submitted, restore the reply button and
961 ePost position.
962 */
963 fetchPost(fpid)
964 .then(artifact=>{
965 const ondone = (fpe)=>{
966 restoreEditReplyElement(ePost, eBtnReply, eToDisable);
967 //console.debug("ondiscard/onsubmit", fpe, eToDisable);
968 if( fpe/*onsubmit*/ ){
969 if( fpe.widget.parentNode ){
970 fpe.widget.remove();
971 }
972 }
973 };
974 const fpe = new F.ForumPostEditor({
975 hiddenFields: form.querySelectorAll('input[type=hidden]'),
976 ondiscard: ondone,
977 onsubmit: ondone,
978 draftKey: 'draft-forumedit-'+(fEditHead || fpid).substr(0,12),
979 hideTitle: true/*fixme: only show if this is the root post*/,
980 edit: artifact,
981 inReplyTo: firt
982 });
983 const w = fpe.widget;
984 w.style.borderTop = '2px dotted';
985 /* Adding an "Editing..." <h3> here adds way too much space */
986 ePost.append(w);
987 w.scrollIntoView();
988 });
989 }/*replyClicked()*/;
990
991 const editClicked = (form, ePost, eBtnEdit, eToDisable)=>{
992 const fpid = setupEditReplyElement(ePost, eBtnEdit, eToDisable);
993 const firt = ePost.dataset.firt;
994 const fEditHead = ePost.dataset.fedithead;
995 eBtnEdit.innerText = "Editing...";
 
 
 
 
 
 
 
 
 
 
 
 
 
996 fetchPost(fpid)
997 .then(artifact=>{
998 const ondone = (fpe)=>{
999 restoreEditReplyElement(ePost, eBtnEdit, eToDisable);
1000 //console.debug("ondiscard/onsubmit", fpe, eToDisable);
@@ -999,11 +1011,10 @@
1011 const fpe = new F.ForumPostEditor({
1012 hiddenFields: form.querySelectorAll('input[type=hidden]'),
1013 ondiscard: ondone,
1014 onsubmit: ondone,
1015 draftKey: 'draft-forumedit-'+(fEditHead || fpid).substr(0,12),
 
1016 edit: artifact,
1017 status: eStatusSelect?.value,
1018 inReplyTo: firt
1019 });
1020 const w = fpe.widget;
1021

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button