WordPress.org

Make WordPress Core

Opened 9 months ago

Closed 8 months ago

Last modified 8 months ago

#24946 closed defect (bug) (invalid)

Missing TinyMCE ed.onMouseUp event in Wordpress 3.6

Reported by: bmodesign2 Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.6
Component: Editor Keywords:
Focuses: Cc:

Description (last modified by ocean90)

Hi,
as part of a wp plugin I developd a own tinymce plugin.
In the init function

tinymce.create('tinymce.plugins.BMoExpoTinyMCEButton', {
		url: '',
		editor: {},
		init : function(ed, url) {
...

I use the events "ed.onMouseUp" and "ed.onNodeChange" to prevent a img node from resizing.

With version 3.6. "ed.onMouseUp" it's not called anymore when resizing a img node.

Change History (6)

comment:1 ocean909 months ago

  • Description modified (diff)

comment:2 azaozz9 months ago

  • Keywords close added

Image resizing works differently in the different browsers in contenteditable mode:

  • WebKit and Opera don't resize images at all. TinyMCE can add it but is turned off by default in WordPress.
  • Firefox has built-in resizing that can be turned off by adding 'object_resizing' => false, to the TinyMCE init options. Note: this will also turn off resizing of tables.
  • IE has built-in resizing that cannot be turned off.

The built-in resizing in IE and Firefox is not controllable from JS. What events are fired and when depends on the browsers. I see 'ed.onMouseUp' fired in both IE and FIrefox but with different target elements depending on which direction the user is resizing the image. Perhaps try this in your plugin:

ed.onMouseUp.add( function( editor, event ) {
    console.log( event.target.nodeName );
});

comment:3 bmodesign29 months ago

Hi azaozz,

thank you for the fast answer. My code, depending on http://code.google.com/p/tinymce-plugin-advimagescale/source/browse/trunk/editor_plugin_src.js worked very well until I updated to verison 3.6.

I already added a console.log and figured out that ed.onMouseUp.add is never fired (in FF).

comment:4 azaozz9 months ago

...ed.onMouseUp.add is never fired (in FF).

That's strange. There are very few differences between TinyMCE in 3.5 and 3.6, and ed.onMouseUp.add() seems to work properly when calling it from any TinyMCE plugin. Perhaps delete the browser cache again, then add some basic console.log() to make sure the whole plugin is not crashing (TinyMCE silences errors in plugins).

In any case you can disable image resizing in Firefox with 'object_resizing' => false, there's no need of a plugin.

comment:5 c3mdigital8 months ago

  • Keywords close removed
  • Resolution set to invalid
  • Status changed from new to closed

See comment:2

comment:6 SergeyBiryukov8 months ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.