WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#5807 closed enhancement (fixed)

New gzip compressor for TinyMCE

Reported by: azaozz Owned by:
Milestone: 2.5 Priority: normal
Severity: normal Version:
Component: TinyMCE Keywords: 2nd-opinion has-patch
Focuses: Cc:

Description

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.

Attachments (1)

new-mce-compressor.patch (27.6 KB) - added by azaozz 6 years ago.

Download all attachments as: .zip

Change History (6)

azaozz6 years ago

comment:1 ev3rywh3re6 years ago

I haven't tested this patch, but I did want to comment that this does look like a good start to cleanup the TinyMCE init sequence. I was pleased to see the addition of an filter for external plugins since this may help to standardize the method used by plugin authors that want to add buttons and functions to the editor.

comment:2 andy6 years ago

Looks good.

comment:3 ryan6 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [6789]) New gzip compressor for TinyMCE from azaozz. fixes #5807

comment:4 ryan6 years ago

(In [6790]) tinyMCE compressor additions and deletion of unused lang files. Props azaozz. see #5807

comment:5 ryan6 years ago

(In [6791]) tinyMCE compressor update from azaozz. see #5807

Note: See TracTickets for help on using tickets.