Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Added named anchors in the /fileedit doc page. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
66851cd6bc9091f26280331ceddbf76c |
| User & Date: | wyoung 2020-11-22 06:54:18.054 |
Context
|
2020-11-22
| ||
| 12:35 | Add support for the pikchr-scale and pikchr-fontscale variables in the details.txt of skins. Use these values to adjust the sizes of Pikchr images to better match alternative font sizes in the skin. check-in: 08fe2bdc0d user: drh tags: trunk | |
| 06:54 | Added named anchors in the /fileedit doc page. check-in: 66851cd6bc user: wyoung tags: trunk | |
|
2020-11-21
| ||
| 21:04 | Performance optimization in the htmlize() utility routine. check-in: 4c1d38f97b user: drh tags: trunk | |
Changes
Changes to www/fileedit-page.md.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # The fileedit Page This document describes the limitations of, caveats for, and disclaimers for the [](/fileedit) page, which provides users with [checkin privileges](./caps/index.md) basic editing features for files via the web interface. # Important Caveats and Disclaimers Predictably, the ability to edit files in a repository from a web browser halfway around the world comes with several obligatory caveats and disclaimers... | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | # The fileedit Page This document describes the limitations of, caveats for, and disclaimers for the [](/fileedit) page, which provides users with [checkin privileges](./caps/index.md) basic editing features for files via the web interface. # Important Caveats and Disclaimers Predictably, the ability to edit files in a repository from a web browser halfway around the world comes with several obligatory caveats and disclaimers... ## <a id="cap"></a> `/fileedit` Does *Nothing* by Default. In order to "activate" it, a user with [the "setup" permission](./caps/index.md) must set the [fileedit-glob](/help?cmd=fileedit-glob) repository setting to a comma- or newline-delimited list of globs representing a whitelist of files which may be edited online. Any user with commit access may then edit files matching one of those globs. Certain pages within the UI get an "edit" link added to them when the current user's permissions and the whitelist both permit editing of that file. ## <a id="csrf"></a> CSRF & HTTP Referrer Headers In order to protect against [Cross-site Request Forgery (CSRF)][csrf] attacks, Fossil UI features which write to the database require that the browser send the so-called [HTTP `Referer` header][referer] (noting that the misspelling of "referrer" is a historical accident which has long-since been standardized!). Modern browsers, by default, include such information automatically for *interactive* actions which |
| ︙ | ︙ | |||
51 52 53 54 55 56 57 | connections. Fossil does not offer a way to disable its CSRF protections. [referer]: https://en.wikipedia.org/wiki/HTTP_referer [csrf]: https://en.wikipedia.org/wiki/Cross-site_request_forgery [xhr]: https://en.wikipedia.org/wiki/XMLHttpRequest | | | | | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | connections. Fossil does not offer a way to disable its CSRF protections. [referer]: https://en.wikipedia.org/wiki/HTTP_referer [csrf]: https://en.wikipedia.org/wiki/Cross-site_request_forgery [xhr]: https://en.wikipedia.org/wiki/XMLHttpRequest ## <a id="commit"></a> `/fileedit` **Works by Creating Commits** Thus any edits made via that page become a normal part of the repository. ## <a id="intent"></a> `/fileedit` is *Intended* for use with Embedded Docs ... and similar text files, and is most certainly **not intended for editing code**. Editing files with unusual syntax requirements, e.g. hard tabs in makefiles, may break them. *You Have Been Warned.* Similarly, though every effort is made to retain the end-of-line style used by being-edited files, the round-trip through an HTML textarea element may change the EOLs. The Commit section of the page offers three different options for how to treat newlines when saving changes. **Files with mixed EOL styles** *will be normalized to a single EOL style* when modified using `/fileedit`. When "inheriting" the EOL style from a previous version which has mixed styles, the first EOL style detected in the previous version of the file is used. ## <a id="checkout"></a> `/fileedit` **is Not a Replacement for a Checkout** A full-featured checkout allows far more possibilities than this basic online editor permits, and the feature scope of `/fileedit` is intentionally kept small, implementing only the bare necessities needed for performing basic edits online. It *is not, and will never be, a replacement for a checkout.* |
| ︙ | ︙ | |||
106 107 108 109 110 111 112 | Similarly, some *potential* features have significant downsides, abuses, and/or implementation hurdles which make the decision of whether or not to implement them subject to notable contributor debate. e.g. the ability to add new files or remove/rename older files. | | | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | Similarly, some *potential* features have significant downsides, abuses, and/or implementation hurdles which make the decision of whether or not to implement them subject to notable contributor debate. e.g. the ability to add new files or remove/rename older files. ## <a id="storage"></a> `/fileedit` **Stores Only Limited Local Edits While Working** When changes are made to a given checkin/file combination, `/fileedit` will, if possible, store them in [`window.localStorage` or `window.sessionStorage`][html5storage], if available, but... - Which storage is used is unspecified and may differ across environments. |
| ︙ | ︙ | |||
140 141 142 143 144 145 146 | across reloads of the same tab. If `/filepage` determines that no peristent storage is available a warning is displayed on the editor page. [html5storage]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API | | | | | | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | across reloads of the same tab. If `/filepage` determines that no peristent storage is available a warning is displayed on the editor page. [html5storage]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API ## <a id="power"></a> The Power is Yours, but... > "With great power comes great responsibility." **Use this feature judiciously, *if at all*.** Now, with those warnings and caveats out of the way... ----- # <a id="tips"></a> Tips and Tricks ## <a id="global-js"></a> `fossil` Global-scope JS Object `/fileedit` is largely implemented in JavaScript, and makes heavy use of the global-scope `fossil` object, which provides infrastructure-level features intended for use by Fossil UI pages. (That said, that infrastructure was introduced with `/fileedit`, and most pages do not use it.) The `fossil.page` object represents the UI's current page (on pages which make use of this API - most do not). That object supports listening to page-specific events so that JS code installed via [client-side edits to the site skin's footer](customskin.md) may react to those changes somehow. The next section describes one such use for such events... ## <a id="syn-hl"></a> Integrating Syntax Highlighting Assuming a repository has integrated a 3rd-party syntax highlighting solution, it can probably (depending on its API) be told how to highlight `/fileedit`'s wiki/markdown-format previews. Here are instructions for doing so with [highlightjs](https://highlightjs.org/): At the very bottom of the [site skin's footer](customskin.md), add a |
| ︙ | ︙ | |||
221 222 223 224 225 226 227 | by Fossil (by its file extension). The event listener callback shown above doesn't use the `mimetype`, but makes used of the other two. It fishes all `code` blocks out of the preview which explicitly have a CSS class named `language-`something, and then asks highlightjs to highlight them. | | | 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | by Fossil (by its file extension). The event listener callback shown above doesn't use the `mimetype`, but makes used of the other two. It fishes all `code` blocks out of the preview which explicitly have a CSS class named `language-`something, and then asks highlightjs to highlight them. ## <a id="editor"></a> Integrating a Custom Editor Widget (These instructions also work for the `/wikiedit` page by eplacing "fileedit" with "wikiedit" in any strings or symbol names!) It is possible to replace `/filepage`'s basic text-editing widget (a `textarea` element) with a fancy 3rd-party editor widget by following these instructions... |
| ︙ | ︙ |