Plugin Directory

Changeset 896779


Ignore:
Timestamp:
04/17/2014 09:40:42 PM (12 years ago)
Author:
mihaivalentin
Message:

0.33 - Made compatible with WordPress 3.9

Location:
image-pro-wordpress-image-media-management-and-resizing-done-right/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • image-pro-wordpress-image-media-management-and-resizing-done-right/trunk/imagepro.php

    r892409 r896779  
    55Description: WordPress media & images management done right!
    66Author: Mihai Valentin
    7 Version: 0.32
     7Version: 0.33
    88Author URI: http://www.mihaivalentin.com/
    99*/
  • image-pro-wordpress-image-media-management-and-resizing-done-right/trunk/readme.txt

    r892409 r896779  
    44Tags: post, plugin, image, images, pictures, editor, upload, management
    55Requires at least: 3.0.0
    6 Tested up to: 3.8
    7 Stable tag: 0.32
     6Tested up to: 3.9
     7Stable tag: 0.33
    88
    99Upload, resize, add, change images instantly. Manage your media collection with ease and use it for any post or page. A new way of managing content!
     
    7070
    7171== Changelog ==
     72
     73= 0.33 =
     74* Made compatible with WordPress 3.9
    7275
    7376= 0.32 =
  • image-pro-wordpress-image-media-management-and-resizing-done-right/trunk/src/js/editor.js

    r849545 r896779  
    4040            /* tinyMCE will start initialization soon */
    4141            var tinymceInitTimer = setInterval(function() {
    42                 if (window.tinymce && window.tinymce.getInstanceById('content')) {
     42                if (window.tinymce && getTinyMCE()) {
    4343                    clearInterval(tinymceInitTimer);
    4444
     
    4747
    4848                    /* initialize the editor */
    49                     onEditorInit(window.tinymce.getInstanceById('content'));
     49                    onEditorInit(getTinyMCE());
    5050                }
    5151            }, 300);
     
    5656
    5757    var getTinyMCE = function() {
    58         return tinymce.getInstanceById('content');
     58        return tinymce.get('content');
    5959    };
    6060
     
    6969                setTinyMCEInteractions($body, getTinyMCE());
    7070
    71                 /* if we are re on Chrome or Safari, try to simulate the resize handles */
    72                 if (window.tinymce.isWebKit) {
     71                /* if we are re on Chrome or Safari, try to simulate the resize handles,
     72                but only if we're still on TinyMCE 3.X.
     73                TinyMCE 4 implemented it in the editor for Webkit */
     74                if (window.tinymce.isWebKit && window.tinymce.majorVersion != 4) {
    7375                    impro.fakeImageResize();
    7476                }
    7577            }
    7678        }, 300);
     79    };
     80
     81    /**
     82     * starting with TinyMCE 4, in WebKit browsers and IE, it becomes
     83     * harder to drop images over the TinyMCE editor.
     84     * the reason is that the body does not have a fixed height
     85     * and if the post is empty or with very few content, the drop zone
     86     * exists only over that content.
     87     * this function attempts to fix this issue by ensuring that the
     88     * min-height of the body is just like the height of it's container
     89     * so that the drop zone is maximized.
     90     * TODO also get called on panel resize
     91     */
     92    var updateTinyMCEBodyToOuterIframeContainerHeight = function() {
     93        var $editorIframe = $(getTinyMCE().contentAreaContainer).find('iframe');
     94        var $body = $editorIframe.contents().find('body');
     95        var iframeHeight = $editorIframe.height();
     96
     97        if (!isNaN(parseInt(iframeHeight))) {
     98            /* trying -25 to prevent vertical scrolling - may need special tuning later */
     99            $body.css('min-height', (iframeHeight - 25) + 'px');
     100        }
    77101    };
    78102
     
    86110        } else {
    87111            $('#impro-editor-maxwidth-info').html($('#impro-editor-maxwidth-info').html().replace('%maxwidth%', themeMaxWidth));
     112        }
     113
     114        /* update tinymce iframe body height */
     115        updateTinyMCEBodyToOuterIframeContainerHeight();
     116
     117        /* hide image toolbar buttons for tinymce 4 */
     118        if (window.tinymce.majorVersion == 4) {
     119            try {
     120                // TODO replace with editor_styles later
     121                $(tinymce.get('content').dom.doc.head).append('<style>#wp-image-toolbar { display: none !important; }</style>');
     122            } catch(e) {}
    88123        }
    89124
     
    139174            if (target.is('img')) {
    140175                showEditor(target);
    141             } else {
     176            } else if (!(target.is('body') && target.find('img[data-mce-selected]').length > 0)) {
     177                /* on Chrome, when resizing an image, the selected image panel closes
     178                that's because it is similar to clicking outside it.
     179                for this, before closing the panel, we check if the image is still selected.
     180                if it is, do nothing (keep it open), if not, close the panel */
    142181                closeEditor();
    143182            }
     
    348387
    349388        /* update the resizing rectangle to match the new image dimension */
    350         if (window.tinymce.isWebKit) {
     389        if (window.tinymce.isWebKit && window.tinymce.majorVersion != 4) {
    351390            impro.updateResizeRect();
    352391        }
Note: See TracChangeset for help on using the changeset viewer.