The zero white-space plugin should now be working (all files contained in
lib/plugins/zws), displaying zero whitespace in the text editing area and on the revision comparison page:
There is a button to insert a zws at the current position in the text:
Otherwise no changes in user interface.
The way it works is like this:
There is a font (
lib/plugins/zws/zws2.ttf) with only one character, for the unicode code point
E000 (written as '\ue000' in JavaScript and PHP), because a character for the actual ZWS code point
200B ('\u200b') would not be displayed in browsers.
This font is referenced in
lib/plugins/zws/zws.css and applied only to the text editing area and the revision comparison table. (It does not matter that the font has only a symbol for one character. All other characters will be displayed by the next fonts on the "chain".)
During editing of a page, all ZWS characters are replaced by the placeholder
E000, which is displayed by the font. When saving, the
E000 character is replaced again by
200B (normal ZWS).
Very simple on principle, but some tricks were needed, because browser APIs are sometimes complicated when dealing with unusual cases.
So I hope that everything really works now. Feedback is of course very welcome.
Some possible improvements:
Maybe the ZWS placeholder could be thicker? (Would be quick and easy.) Maybe colored? (Not sure how to make fonts that are colored by default. I think it is possible somehow.)
Maybe a button to turn ZWS display on and off? For now, it is always turned on (in the editor). Maybe somewhere on the normal page UI, a switch to use the ZWS font everywhere when reading would be good, but might need some tricks again.