Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add a configuration option that enables WYSIWYG wiki editing. The traditional markup editor is still used unless this option is enabled. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | wysiwyg |
Files: | files | file ages | folders |
SHA1: |
ebc48bf180d84a82f7f8955d818b62d8 |
User & Date: | drh 2012-08-11 15:37:58.629 |
Context
2012-08-11
| ||
22:25 | Add confirmation dialog boxes when changing between markup and wysisyg editor mode, and before cancelling an edit. ... (check-in: cb6804a2 user: drh tags: wysiwyg) | |
15:37 | Add a configuration option that enables WYSIWYG wiki editing. The traditional markup editor is still used unless this option is enabled. ... (check-in: ebc48bf1 user: drh tags: wysiwyg) | |
15:06 | Improvements to the setup page, including a button to automatically add the <base> element to the header if it is missing. ... (check-in: bf27074c user: drh tags: wysiwyg) | |
Changes
Changes to src/setup.c.
︙ | ︙ | |||
1246 1247 1248 1249 1250 1251 1252 | @ <form action="%s(g.zTop)/setup_config" method="post"><div> login_insert_csrf_secret(); @ <hr /> entry_attribute("Project Name", 60, "project-name", "pn", ""); @ <p>Give your project a name so visitors know what this site is about. @ The project name will also be used as the RSS feed title.</p> @ <hr /> | | > > > > > > | 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 | @ <form action="%s(g.zTop)/setup_config" method="post"><div> login_insert_csrf_secret(); @ <hr /> entry_attribute("Project Name", 60, "project-name", "pn", ""); @ <p>Give your project a name so visitors know what this site is about. @ The project name will also be used as the RSS feed title.</p> @ <hr /> textarea_attribute("Project Description", 3, 80, "project-description", "pd", ""); @ <p>Describe your project. This will be used in page headers for search @ engines as well as a short RSS description.</p> @ <hr /> onoff_attribute("Enable WYSIWYG Wiki Editing", "wysiwyg-wiki", "wysiwyg-wiki", 0); @ <p>Enable what-you-see-is-what-you-get (WYSIWYG) editing of wiki pages. @ The WYSIWYG editor generates HTML instead of markup, which makes @ subsequent manual editing more difficult.</p> @ <hr /> entry_attribute("Index Page", 60, "index-page", "idxpg", "/home"); @ <p>Enter the pathname of the page to display when the "Home" menu @ option is selected and when no pathname is @ specified in the URL. For example, if you visit the url:</p> @ @ <blockquote><p>%h(g.zBaseURL)</p></blockquote> @ |
︙ | ︙ |
Changes to src/wiki.c.
︙ | ︙ | |||
183 184 185 186 187 188 189 | pWiki = manifest_get(rid, CFTYPE_WIKI); if( pWiki ){ zBody = pWiki->zWiki; } } if( !g.isHome ){ if( (rid && g.perm.WrWiki) || (!rid && g.perm.NewWiki) ){ | > | > | > | | > > | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | pWiki = manifest_get(rid, CFTYPE_WIKI); if( pWiki ){ zBody = pWiki->zWiki; } } if( !g.isHome ){ if( (rid && g.perm.WrWiki) || (!rid && g.perm.NewWiki) ){ if( db_get_boolean("wysiwyg-wiki", 0) ){ style_submenu_element("Edit", "Edit Wiki Page", "%s/wikiedit?name=%T&wysiwyg=1", g.zTop, zPageName); }else{ style_submenu_element("Edit", "Edit Wiki Page", "%s/wikiedit?name=%T", g.zTop, zPageName); } } if( rid && g.perm.ApndWiki && g.perm.Attach ){ style_submenu_element("Attach", "Add An Attachment", "%s/attachadd?page=%T&from=%s/wiki%%3fname=%T", g.zTop, zPageName, g.zTop, zPageName); } if( rid && g.perm.ApndWiki ){ |
︙ | ︙ | |||
262 263 264 265 266 267 268 269 270 271 272 273 274 275 | const char *zPageName; char *zHtmlPageName; int n; const char *z; char *zBody = (char*)P("w"); int isWysiwyg = P("wysiwyg")!=0; if( zBody ){ if( isWysiwyg ){ Blob body; blob_zero(&body); htmlTidy(zBody, &body); zBody = blob_str(&body); }else{ | > > | 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | const char *zPageName; char *zHtmlPageName; int n; const char *z; char *zBody = (char*)P("w"); int isWysiwyg = P("wysiwyg")!=0; if( P("edit-wysiwyg")!=0 ){ isWysiwyg = 1; zBody = 0; } if( P("edit-markup")!=0 ){ isWysiwyg = 0; zBody = 0; } if( zBody ){ if( isWysiwyg ){ Blob body; blob_zero(&body); htmlTidy(zBody, &body); zBody = blob_str(&body); }else{ |
︙ | ︙ | |||
357 358 359 360 361 362 363 | blob_reset(&wiki); } for(n=2, z=zBody; z[0]; z++){ if( z[0]=='\n' ) n++; } if( n<20 ) n = 20; if( n>30 ) n = 30; | | > > > > | 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | blob_reset(&wiki); } for(n=2, z=zBody; z[0]; z++){ if( z[0]=='\n' ) n++; } if( n<20 ) n = 20; if( n>30 ) n = 30; if( !isWysiwyg ){ /* Traditional markup-only editing */ @ <form method="post" action="%s(g.zTop)/wikiedit"><div> @ <textarea name="w" class="wikiedit" cols="80" @ rows="%d(n)" wrap="virtual">%h(zBody)</textarea> @ <br /> @ <input type="submit" name="preview" value="Preview Your Changes" /> if( db_get_boolean("wysiwyg-wiki", 0) ){ @ <input type="submit" name="edit-wysiwyg" value="Wysiwyg Editor" /> } }else{ /* Wysiwyg editing */ Blob html, temp; @ <form method="post" action="%s(g.zTop)/wikiedit" @ onsubmit="wysiwygSubmit()"><div> @ <input type="hidden" name="wysiwyg" value="1" /> blob_zero(&temp); wiki_convert(&wiki, &temp, 0); blob_zero(&html); htmlTidy(blob_str(&temp), &html); blob_reset(&temp); wysiwygEditor("w", blob_str(&html), 60, n); blob_reset(&html); @ <br /> @ <input type="submit" name="edit-markup" value="Markup Editor" /> } @ <input type="submit" name="submit" value="Apply These Changes" /> login_insert_csrf_secret(); @ <input type="hidden" name="name" value="%h(zPageName)" /> @ <input type="submit" name="cancel" value="Cancel" /> @ </div></form> manifest_destroy(pWiki); |
︙ | ︙ | |||
405 406 407 408 409 410 411 | login_check_credentials(); if( !g.perm.NewWiki ){ login_needed(); return; } zName = PD("name",""); if( zName[0] && wiki_name_is_wellformed((const unsigned char *)zName) ){ | > | > > > | 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | login_check_credentials(); if( !g.perm.NewWiki ){ login_needed(); return; } zName = PD("name",""); if( zName[0] && wiki_name_is_wellformed((const unsigned char *)zName) ){ if( db_get_boolean("wysiwyg-wiki", 0) ){ cgi_redirectf("wikiedit?name=%T&wysiwyg=1", zName); }else{ cgi_redirectf("wikiedit?name=%T", zName); } } style_header("Create A New Wiki Page"); @ <p>Rules for wiki page names:</p> well_formed_wiki_name_rules(); @ <form method="post" action="%s(g.zTop)/wikinew"> @ <p>Name of new wiki page: @ <input style="width: 35;" type="text" name="name" value="%h(zName)" /> |
︙ | ︙ |