I've put together a (mostly) working PoC to restructure the atto code.
At present, the code is based around a structure which must be aware of every editor on the page. We have to pass around an elementid, and each plugin adds buttons to their own element, but with a single click handler.
The code also does not meet the coding style guidelines.
IMO, we need to refactor this to:
- not pass around the elementid;
- comply with coding style requirements;
- include API documentation to assist plugin developers;
- have one editor instance per editor;
- have instances of the plugins on each editor rather than globally.
- make our lives far easier in the future to maintain because we'll be reducing the code duplication;
- allow people to write plugins more easily and with much less code duplication;
- which will allow for a greater diversity of plugins in a shorter period;
- give better confidence from third-party developers writing plugins for the new editor, and as a result the community as a whole (just think how much we've complained about the TinyMCE plugin structure).
Personally, I feel that this needs to be done before integration, and certainly before release.
I've been working on a PoC which is semi-functional (35% of plugins are already done and the others aren't far off) and it only took a few hours to write including appropriate API docs.