Skip to content

Commit

Permalink
dimensions removed
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwechner committed Sep 19, 2014
1 parent 78baadf commit 990cc1a
Showing 1 changed file with 1 addition and 69 deletions.
Expand Up @@ -11,34 +11,6 @@
/*global tinymce:true */

tinymce.PluginManager.add('help', function(editor) {
function getImageSize(url, callback) {
var img = document.createElement('img');

function done(width, height) {
if (img.parentNode) {
img.parentNode.removeChild(img);
}

callback({width: width, height: height});
}

img.onload = function() {
done(img.clientWidth, img.clientHeight);
};

img.onerror = function() {
done();
};

var style = img.style;
style.visibility = 'hidden';
style.position = 'fixed';
style.bottom = style.left = 0;
style.width = style.height = 'auto';

document.body.appendChild(img);
img.src = url;
}

function buildListItems(inputList, itemCallback, startItems) {
function appendItems(values, output) {
Expand Down Expand Up @@ -84,7 +56,7 @@ tinymce.PluginManager.add('help', function(editor) {

function showDialog(helpList) {
var win, data = {}, dom = editor.dom, imgElm = editor.selection.getNode();
var width, height, helpListCtrl, classListCtrl, helpDimensions = editor.settings.help_dimensions !== false;
var width, height, helpListCtrl, classListCtrl;

function recalcSize() {
var widthCtrl, heightCtrl, newWidth, newHeight;
Expand Down Expand Up @@ -124,17 +96,6 @@ tinymce.PluginManager.add('help', function(editor) {
}
}

imgElm.onload = function() {
if (!data.width && !data.height && helpDimensions) {
dom.setAttribs(imgElm, {
width: imgElm.clientWidth,
height: imgElm.clientHeight
});
}

selectImage();
};

imgElm.onerror = selectImage;
}

Expand Down Expand Up @@ -212,18 +173,6 @@ tinymce.PluginManager.add('help', function(editor) {
tinymce.each(meta, function(value, key) {
win.find('#' + key).value(value);
});

if (!meta.width && !meta.height) {
getImageSize(this.value(), function(data) {
if (data.width && data.height && helpDimensions) {
width = data.width;
height = data.height;

win.find('#width').value(width);
win.find('#height').value(height);
}
});
}
}

width = dom.getAttrib(imgElm, 'width');
Expand Down Expand Up @@ -303,23 +252,6 @@ tinymce.PluginManager.add('help', function(editor) {
generalFormItems.push({name: 'alt', type: 'textbox', label: 'Image description'});
}

if (helpDimensions) {
generalFormItems.push({
type: 'container',
label: 'Dimensions',
layout: 'flex',
direction: 'row',
align: 'center',
spacing: 5,
items: [
{name: 'width', type: 'textbox', maxLength: 5, size: 3, onchange: recalcSize, ariaLabel: 'Width'},
{type: 'label', text: 'x'},
{name: 'height', type: 'textbox', maxLength: 5, size: 3, onchange: recalcSize, ariaLabel: 'Height'},
{name: 'constrain', type: 'checkbox', checked: true, text: 'Constrain proportions'}
]
});
}

generalFormItems.push(classListCtrl);

function updateStyle() {
Expand Down

0 comments on commit 990cc1a

Please sign in to comment.