Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#24946 closed defect (bug) (invalid)

Missing TinyMCE ed.onMouseUp event in Wordpress 3.6

Reported by: bmodesign2's profile 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)

#1 @ocean90
11 years ago

  • Description modified (diff)

#2 @azaozz
11 years 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 );
});

#3 @bmodesign2
11 years 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).

#4 @azaozz
11 years 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.

#5 @c3mdigital
11 years ago

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

See comment:2

#6 @SergeyBiryukov
11 years ago

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