| | @@ -148,37 +148,135 @@ |
| 148 | 148 | diff them” feature. |
| 149 | 149 | |
| 150 | 150 | [wt]: https://fossil-scm.org/fossil/timeline |
| 151 | 151 | |
| 152 | 152 | |
| 153 | | -### <a id="wedit"></a>WYSIWYG Wiki Editor |
| 154 | | - |
| 155 | | -The Admin → Wiki → “Enable WYSIWYG Wiki Editing” toggle switches the |
| 156 | | -default plaintext editor for [Fossil wiki][fw] documents to one that |
| 157 | | -works like a basic word processor. This feature requires JavaScript in |
| 158 | | -order to react to editor button clicks like the “**B**” button, meaning |
| 159 | | -“make \[selected\] text boldface.” There is no standard WYSIWYG editor |
| 160 | | -component in browsers, doubtless because it’s relatively straightforward |
| 161 | | -to create one using JavaScript. |
| 162 | | - |
| 163 | | -_Graceful Fallback:_ Edit your wiki documents in the default plain text |
| 164 | | -wiki editor. Fossil’s wiki and Markdown language processors were |
| 165 | | -designed to be edited that way. |
| 166 | | - |
| 167 | | -[fw]: ./wikitheory.wiki |
| 153 | +### <a id="wedit"></a>The New Wiki Editor |
| 154 | + |
| 155 | +As of Fossil 2.12, the [Fossil wiki][fwt] document editor requires |
| 156 | +JavaScript, for a few unavoidable reasons. |
| 157 | + |
| 158 | +First, it allows in-browser previews without losing client-side editor |
| 159 | +state, such as where your cursor is. With the old editor, you had to |
| 160 | +re-locate the place you were last editing on each preview, which would |
| 161 | +reduce the incentive to use the preview function. In the new wiki |
| 162 | +editor, you just click the Preview tab to see how Fossil interprets your |
| 163 | +markup, then click back to the Editor tab to resume work with the prior |
| 164 | +context undisturbed. |
| 165 | + |
| 166 | +Second, it continually saves your document state in client-side storage |
| 167 | +in the background while you’re editing it so that if the browser closes |
| 168 | +without saving the changes back to the Fossil repository, you can resume |
| 169 | +editing from the stored copy without losing work. This feature is not so |
| 170 | +much about saving you from crashes of various sorts, since computers are |
| 171 | +so much more reliable these days. It is far more likely to save you from |
| 172 | +the features of mobile OSes like Android and iOS which aggressively shut |
| 173 | +down and restart apps to save on RAM. That OS design philosophy assumes |
| 174 | +that there is a way for the app to restore its prior state from |
| 175 | +persistent media when it’s restarted, giving the illusion that it was |
| 176 | +never shut down in the first place. This feature of Fossil’s new wiki |
| 177 | +editor provides that. |
| 178 | + |
| 179 | +There are many other new features in the enhanced Fossil 2.12 wiki |
| 180 | +editor, but those are the ones that absolutely require JavaScript to |
| 181 | +work. |
| 182 | + |
| 183 | +With this change, we lost the old WYSIWYG wiki editor, available since |
| 184 | +Fossil version 1.24. It hadn’t been maintained for years, it was |
| 185 | +disabled by default, and no one stepped up to defend its existence when |
| 186 | +this new editor was created, replacing it. If someone rescues that |
| 187 | +feature, merging it in with the new editor, it will doubtless require |
| 188 | +JavaScript in order to react to editor button clicks like the “**B**” |
| 189 | +button, meaning “make \[selected\] text boldface.” There is no standard |
| 190 | +WYSIWYG editor component in browsers, doubtless because it’s relatively |
| 191 | +straightforward to create one using JavaScript. |
| 192 | + |
| 193 | +_Graceful Fallback:_ Unlike in the Fossil 2.11 and earlier days, there |
| 194 | +is no longer a script-free wiki editor mode. This is not from lack of |
| 195 | +desire, only because the person who wrote the new wiki editor didn’t |
| 196 | +want to maintain three different editors. (New Ajaxy editor, old |
| 197 | +script-free HTML form based editor, and old WYSIWYG JS-based editor.) If |
| 198 | +someone wants to implement a `<noscript>` alternative to the new wiki |
| 199 | +editor, we will likely accept that [contribution][cg] as long as it |
| 200 | +doensn’t interfere with the new editor. (The same goes for adding a |
| 201 | +WYSIWYG mode to the new Ajaxy wiki editor.) |
| 202 | + |
| 203 | +_Workaround:_ You don’t have to use the browser-based wiki editor to |
| 204 | +maintain your repository’s wiki at all. Fossil’s [`wiki` command][fwc] |
| 205 | +lets you manipulate wiki documents from the command line. For example, |
| 206 | +consider this `vi` based workflow: |
| 207 | + |
| 208 | +```shell |
| 209 | + $ vi 'My Article.wiki' # write, write, write... |
| 210 | + :!fossil create 'My Article' '%' # current file (%) to new article |
| 211 | + ...write, write, write some more... |
| 212 | + :w # save changes to disk copy |
| 213 | + :!fossil commit 'My Article' '%' # update article from disk |
| 214 | + :q # done writing for today |
| 215 | + |
| 216 | + ....days later... |
| 217 | + $ vi # work sans named file today |
| 218 | + :r !fossil wiki export 'My Article' - # article text into vi buffer |
| 219 | + ...write, write, write yet more... |
| 220 | + :w !fossil wiki commit - # update article with buffer |
| 221 | +``` |
| 222 | + |
| 223 | +Extending this concept to other text editors is an exercise left to the |
| 224 | +reader. |
| 225 | + |
| 226 | +[fwc]: /help?cmd=wiki |
| 227 | +[fwt]: ./wikitheory.wiki |
| 228 | + |
| 229 | + |
| 230 | +### <a id="fedit"></a>The File Editor |
| 231 | + |
| 232 | +Fossil 2.12 adds the [optional file editor feature][fedit], which works |
| 233 | +much like [the new wiki editor](#wedit), only on files committed to the |
| 234 | +repository. |
| 235 | + |
| 236 | +The original designed purpose for this feature is to allow [embedded |
| 237 | +documentation][edoc] to be interactively edited in the same way that |
| 238 | +wiki articles can be. (Indeed, the associated `fileedit-glob` feature |
| 239 | +allows you to restrict the editor to working *only* on files that can be |
| 240 | +treated as embedded documentation.) This feature operates in much the |
| 241 | +same way as the new wiki editor, so most of what we said above applies. |
| 242 | + |
| 243 | +_Workaround:_ This feature is an alternative to Fossil’s traditional |
| 244 | +mode of file management: clone the repository, open it somewhere, edit a |
| 245 | +file locally, and commit the changes. |
| 246 | + |
| 247 | +_Graceful Fallback:_ There is no technical reason why someone could not |
| 248 | +write a `<noscript>` wrapped alternative to the current JavaScript based |
| 249 | +`/fileedit` implementation. It would have all of the same downsides as |
| 250 | +the old wiki editor: the users would lose their place on each save, they |
| 251 | +would have no local backup if something crashes, etc. Still, we are |
| 252 | +likely to accept such a [contribution][cg] as long as it doesn’t |
| 253 | +interfere with the new editor. |
| 254 | + |
| 255 | +[edoc]: /doc/trunk/www/embeddeddoc.wiki |
| 256 | +[fedit]: /help?cmd=/fileedit |
| 168 | 257 | |
| 169 | 258 | |
| 170 | 259 | ### <a id="ln"></a>Line Numbering |
| 171 | 260 | |
| 172 | 261 | When viewing source files, Fossil offers to show line numbers in some |
| 173 | | -cases. Toggling them on and off is currently handled in JavaScript. |
| 174 | | -([Example][mainc].) |
| 262 | +cases. ([Example][mainc].) Toggling them on and off is currently handled |
| 263 | +in JavaScript, rather than forcing a page-reload via a button click. |
| 175 | 264 | |
| 176 | 265 | _Workaround:_ Edit the URL to give the “`ln`” query parameter per [the |
| 177 | | -`/file` docs](/help?cmd=/file), or provide a patch to reload the page |
| 178 | | -with this parameter included/excluded to implement the toggle via a |
| 179 | | -server round-trip. |
| 266 | +`/file` docs](/help?cmd=/file). Alternately, someone sufficiently |
| 267 | +interested could [provide a patch][cg] to add a `<noscript>` wrapped |
| 268 | +HTML button that would reload the page with this parameter |
| 269 | +included/excluded to implement the toggle via a server round-trip. |
| 270 | + |
| 271 | +As of Fossil 2.12, there is also a JavaScript-based interactive method |
| 272 | +for selecting a range of lines by clicking the line numbers when they’re |
| 273 | +visible, then copying the resulting URL to share your selection with |
| 274 | +others. |
| 275 | + |
| 276 | +_Workaround:_ These interactive features absolutely require JavaScript. |
| 277 | +The alternative is to manually edit the URL, per above. |
| 180 | 278 | |
| 181 | 279 | [mainc]: https://fossil-scm.org/fossil/artifact?ln&name=87d67e745 |
| 182 | 280 | |
| 183 | 281 | |
| 184 | 282 | ### <a id="sxsdiff"></a>Side-by-Side Diff Mode |
| 185 | 283 | |