Feather Wiki Updates
Feather Wiki Updates
Today I updated my Feather Wiki personal brain dump tool (which I have written about here) to the latest version (Goldfinch v1.9.1).
During this process I checked if there was anything new in the extensions, and noticed a nice upgrade to the editor called SunEditor. It claims to be “A lightweight, flexible WYSIWYG editor with zero dependencies.” which sounds really appealing to me.
Editor Extension
The Feather Wiki SunEditor-Replacement plugin was made by @jcoder. I tried installing it but it threw a lot of errors in the console. Luckily it didn’t take too long for me to notice there’s breaking changes from SunEditor v2 > v3, so by pinning the version to the last updated legacy version (v2.47.12) instead of @latest and everything worked!
So if you’re okay with using v2 (legacy SunEditor version), change the source of the CSS and JS.
For example: css.href="https://cdn.jsdelivr.net/npm/suneditor@latest/dist/css/suneditor.min.css"; to https://cdn.jsdelivr.net/npm/suneditor@2.47.12/dist/css/suneditor.min.css.
But I wanted to see if I could get the latest v3.3.3 working as a Feather Wiki plugin. I was about to give up actually, but I got it to work in the end! There’s a handy v2 > v3 migration tool on SunEditor and also a reference table for renamed variables.
V3 SunEditor Now Supported
What changed:
v2 uses a direct assignment for the event handler:
editor.onChange = function (contents, core) { state.edits.content = contents; }. v3 uses a nested object block:Js 1events: { 2 onChange: function (contents) { ... } 3}Add memory cleanup and deleting removed elements step.
Use
contents.data || contentsto extract the content correctly so Feather Wiki can save the content typed into the SunEditor textarea.I added word and character count to the SunEditor status bar, which means I don’t need to have an extra Feather Wiki extension: Word Count.
Instead of CDN/third-party calls, I downloaded the v3.3.3 CSS and JS files to be used offline.
Feeling Content
I will make a PR later this week and tell Robbie about pinning the v2 version on @jcoder’s version and a v3 version for those who want the update. (Will link to the plugin code here when it’s up.) ⁂
Hope I am not the only one who gets to benefit from my troubleshooting session! It’s always a nice feeling to get something to work.
Have a great week and see you later this week if you’re into personal websites and the IndieWeb as HWC:AP is on this Wednesday!
—Naty

