Fossil SCM

Add confirmation dialog boxes when changing between markup and wysisyg editor mode, and before cancelling an edit.

drh 2012-08-11 22:25 UTC wysiwyg
Commit cb6804a2e3f7ca4db601acd8819e87274adf0e19
1 file changed +7 -4
+7 -4
--- src/wiki.c
+++ src/wiki.c
@@ -372,14 +372,15 @@
372372
/* Traditional markup-only editing */
373373
@ <form method="post" action="%s(g.zTop)/wikiedit"><div>
374374
@ <textarea name="w" class="wikiedit" cols="80"
375375
@ rows="%d(n)" wrap="virtual">%h(zBody)</textarea>
376376
@ <br />
377
- @ <input type="submit" name="preview" value="Preview Your Changes" />
378377
if( db_get_boolean("wysiwyg-wiki", 0) ){
379
- @ <input type="submit" name="edit-wysiwyg" value="Wysiwyg Editor" />
378
+ @ <input type="submit" name="edit-wysiwyg" value="Wysiwyg Editor"
379
+ @ onclick='return confirm("Switching to WYSIWYG-mode\nwill erase your markup\nedits. Continue?")' />
380380
}
381
+ @ <input type="submit" name="preview" value="Preview Your Changes" />
381382
}else{
382383
/* Wysiwyg editing */
383384
Blob html, temp;
384385
@ <form method="post" action="%s(g.zTop)/wikiedit"
385386
@ onsubmit="wysiwygSubmit()"><div>
@@ -390,16 +391,18 @@
390391
htmlTidy(blob_str(&temp), &html);
391392
blob_reset(&temp);
392393
wysiwygEditor("w", blob_str(&html), 60, n);
393394
blob_reset(&html);
394395
@ <br />
395
- @ <input type="submit" name="edit-markup" value="Markup Editor" />
396
+ @ <input type="submit" name="edit-markup" value="Markup Editor"
397
+ @ onclick='return confirm("Switching to markup-mode\nwill erase your WYSIWYG\nedits. Continue?")' />
396398
}
397399
@ <input type="submit" name="submit" value="Apply These Changes" />
398400
login_insert_csrf_secret();
399401
@ <input type="hidden" name="name" value="%h(zPageName)" />
400
- @ <input type="submit" name="cancel" value="Cancel" />
402
+ @ <input type="submit" name="cancel" value="Cancel"
403
+ @ onclick='confirm("Abandon your changes?")' />
401404
@ </div></form>
402405
manifest_destroy(pWiki);
403406
blob_reset(&wiki);
404407
style_footer();
405408
}
406409
--- src/wiki.c
+++ src/wiki.c
@@ -372,14 +372,15 @@
372 /* Traditional markup-only editing */
373 @ <form method="post" action="%s(g.zTop)/wikiedit"><div>
374 @ <textarea name="w" class="wikiedit" cols="80"
375 @ rows="%d(n)" wrap="virtual">%h(zBody)</textarea>
376 @ <br />
377 @ <input type="submit" name="preview" value="Preview Your Changes" />
378 if( db_get_boolean("wysiwyg-wiki", 0) ){
379 @ <input type="submit" name="edit-wysiwyg" value="Wysiwyg Editor" />
 
380 }
 
381 }else{
382 /* Wysiwyg editing */
383 Blob html, temp;
384 @ <form method="post" action="%s(g.zTop)/wikiedit"
385 @ onsubmit="wysiwygSubmit()"><div>
@@ -390,16 +391,18 @@
390 htmlTidy(blob_str(&temp), &html);
391 blob_reset(&temp);
392 wysiwygEditor("w", blob_str(&html), 60, n);
393 blob_reset(&html);
394 @ <br />
395 @ <input type="submit" name="edit-markup" value="Markup Editor" />
 
396 }
397 @ <input type="submit" name="submit" value="Apply These Changes" />
398 login_insert_csrf_secret();
399 @ <input type="hidden" name="name" value="%h(zPageName)" />
400 @ <input type="submit" name="cancel" value="Cancel" />
 
401 @ </div></form>
402 manifest_destroy(pWiki);
403 blob_reset(&wiki);
404 style_footer();
405 }
406
--- src/wiki.c
+++ src/wiki.c
@@ -372,14 +372,15 @@
372 /* Traditional markup-only editing */
373 @ <form method="post" action="%s(g.zTop)/wikiedit"><div>
374 @ <textarea name="w" class="wikiedit" cols="80"
375 @ rows="%d(n)" wrap="virtual">%h(zBody)</textarea>
376 @ <br />
 
377 if( db_get_boolean("wysiwyg-wiki", 0) ){
378 @ <input type="submit" name="edit-wysiwyg" value="Wysiwyg Editor"
379 @ onclick='return confirm("Switching to WYSIWYG-mode\nwill erase your markup\nedits. Continue?")' />
380 }
381 @ <input type="submit" name="preview" value="Preview Your Changes" />
382 }else{
383 /* Wysiwyg editing */
384 Blob html, temp;
385 @ <form method="post" action="%s(g.zTop)/wikiedit"
386 @ onsubmit="wysiwygSubmit()"><div>
@@ -390,16 +391,18 @@
391 htmlTidy(blob_str(&temp), &html);
392 blob_reset(&temp);
393 wysiwygEditor("w", blob_str(&html), 60, n);
394 blob_reset(&html);
395 @ <br />
396 @ <input type="submit" name="edit-markup" value="Markup Editor"
397 @ onclick='return confirm("Switching to markup-mode\nwill erase your WYSIWYG\nedits. Continue?")' />
398 }
399 @ <input type="submit" name="submit" value="Apply These Changes" />
400 login_insert_csrf_secret();
401 @ <input type="hidden" name="name" value="%h(zPageName)" />
402 @ <input type="submit" name="cancel" value="Cancel"
403 @ onclick='confirm("Abandon your changes?")' />
404 @ </div></form>
405 manifest_destroy(pWiki);
406 blob_reset(&wiki);
407 style_footer();
408 }
409

Keyboard Shortcuts

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