New gzip compressor for TinyMCE
|Reported by:||azaozz||Owned by:||anonymous|
The default gzip compressor for TinyMCE works good, but half of what it does seems pointless.
- It starts with the server generating some js with php (the init array), then sends it to the browser.
- The browser runs it through couple of js functions, and sends most of it back to the server as a GET request.
- The server then uses the GET vars (that are exactly the same it generated in step 1), gathers the different pieces of TMCE, compresses them and sends them back to the browser.
I don't see the point of sending the init array back and forth, as all the settings the compressor needs to gather TMCE's pieces are available in the beginning. I've put together a script that does all in one step (merged tiny_mce_config and tiny_mce_gzip). It's a bit faster, a bit more reliable (eliminates possible errors in the first two steps), and will eliminate some of the problems with TMCE when the browser uses cached copy of the init array.
To implement this in WordPress we will have to change two actions into filters. This will break a few plugins, so I've made compatibility function that capture the output (the actions are outputting js) and insert it into the gzipped file.
It also includes new filter for adding external plugins to TinyMCE and has option to save the gzipped file to disk for faster processing.