Fossil SCM
Add confirmation dialog boxes when changing between markup and wysisyg editor mode, and before cancelling an edit.
Commit
cb6804a2e3f7ca4db601acd8819e87274adf0e19
Parent
ebc48bf180d84a8…
1 file changed
+7
-4
+7
-4
| --- src/wiki.c | ||
| +++ src/wiki.c | ||
| @@ -372,14 +372,15 @@ | ||
| 372 | 372 | /* Traditional markup-only editing */ |
| 373 | 373 | @ <form method="post" action="%s(g.zTop)/wikiedit"><div> |
| 374 | 374 | @ <textarea name="w" class="wikiedit" cols="80" |
| 375 | 375 | @ rows="%d(n)" wrap="virtual">%h(zBody)</textarea> |
| 376 | 376 | @ <br /> |
| 377 | - @ <input type="submit" name="preview" value="Preview Your Changes" /> | |
| 378 | 377 | 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?")' /> | |
| 380 | 380 | } |
| 381 | + @ <input type="submit" name="preview" value="Preview Your Changes" /> | |
| 381 | 382 | }else{ |
| 382 | 383 | /* Wysiwyg editing */ |
| 383 | 384 | Blob html, temp; |
| 384 | 385 | @ <form method="post" action="%s(g.zTop)/wikiedit" |
| 385 | 386 | @ onsubmit="wysiwygSubmit()"><div> |
| @@ -390,16 +391,18 @@ | ||
| 390 | 391 | htmlTidy(blob_str(&temp), &html); |
| 391 | 392 | blob_reset(&temp); |
| 392 | 393 | wysiwygEditor("w", blob_str(&html), 60, n); |
| 393 | 394 | blob_reset(&html); |
| 394 | 395 | @ <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?")' /> | |
| 396 | 398 | } |
| 397 | 399 | @ <input type="submit" name="submit" value="Apply These Changes" /> |
| 398 | 400 | login_insert_csrf_secret(); |
| 399 | 401 | @ <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?")' /> | |
| 401 | 404 | @ </div></form> |
| 402 | 405 | manifest_destroy(pWiki); |
| 403 | 406 | blob_reset(&wiki); |
| 404 | 407 | style_footer(); |
| 405 | 408 | } |
| 406 | 409 |
| --- 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 |