From: Dan Brown Date: Wed, 3 May 2023 23:41:07 +0000 (+0100) Subject: Added wysiwyg footnotes hack X-Git-Url: http://source.bookstackapp.com/hacks/commitdiff_plain/1e8f50e355c78d80598bf13db189d0411db3a7a2 Added wysiwyg footnotes hack --- diff --git a/content/wysiwyg-footnotes/head.html b/content/wysiwyg-footnotes/head.html new file mode 100644 index 0000000..1b1e2f6 --- /dev/null +++ b/content/wysiwyg-footnotes/head.html @@ -0,0 +1,126 @@ + \ No newline at end of file diff --git a/content/wysiwyg-footnotes/index.md b/content/wysiwyg-footnotes/index.md new file mode 100644 index 0000000..0bbca11 --- /dev/null +++ b/content/wysiwyg-footnotes/index.md @@ -0,0 +1,31 @@ ++++ +title = "WYSIWYG Editor Footnotes" +author = "@ssddanbrown" +date = 2023-05-03T23:00:00Z +updated = 2023-05-03T23:00:00Z +tested = "v23.05" ++++ + +This hack adds some level of "footnote" support to the WYSIWYG editor. +A new "Footnote" button is added to the toolbar, next to the "Italic" button, that allows you to +insert a new footnote reference. Footnotes will automatically be listed at the bottom of the page content. +The reference numbering is automatic, chronologically from page top to bottom. +New references will change existing numbering if inserted before. + +This hack provides significant examples of TinyMCE (The library used for the WYSIWYG) content manipulation and extension. +The code is heavily commented to assist as a helpful example. +For significant alterations, you'll likely want to review the [TinyMCE documentation](https://www.tiny.cloud/docs/tinymce/6/custom-toolbarbuttons/) +to understand the full set of available capabilities and actions within the TinyMCE editor API. + +#### Considerations + +- This heavily relies on internal methods of TinyMCE, which may change upon any BookStack release as we update the editor libraries. +- All logic is within the WYSIWYG editor, and therefore you won't get the same functionality via the API or other editors. +- The syntax & code used likely won't be cross-compatible with the markdown editor. +- The footnotes list will be generated when content is saved from the editor, so is not updated live but should always be auto-updated before save. +- This has been tested to some degree but there's a reasonable chance of bugs or side affects, since there's quite a lot going on here. +- There's a lot of custom code here. You could instead put this code (without the HTML `` within the custom head setting. + +#### Code + +{{}}