Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MINOR Removed custom TinyMCE image resizer logic, presumably added du…

…e to lack of support for retaining aspect ratio in earlier versions of the editor
  • Loading branch information...
commit e59976bb6420648dd8957363dd9f1e8e442cdc10 1 parent a96429c
@chillu chillu authored
Showing with 0 additions and 93 deletions.
  1. +0 −93 javascript/tiny_mce_improvements.js
View
93 javascript/tiny_mce_improvements.js
@@ -337,99 +337,6 @@ FlashThumbnail.applyTo('#Form_EditorToolbarFlashForm div.thumbnailstrip a');
SideFormAction.applyTo('#Form_EditorToolbarFlashForm .Actions input');
/**
- * Image resizing
- */
-MCEImageResizer = Class.create();
-MCEImageResizer.prototype = {
- initialize: function() {
- //TinyMCE.prototype.addEvent(this, 'click', this._onclick);
- },
- _onclick: function() {
- var form = $('Form_EditorToolbarMediaForm');
- if(form) {
- form.elements.AltText.value = this.alt;
- form.elements.ImageTitle.value = this.title;
- form.elements.CSSClass.value = this.className;
- }
- },
- onresizestart: function() {
- this.prepareForResize();
- this.heightDiff = 0;
- },
- onresizeend: function() {
- this.resizeTo(this.style.width, this.style.height);
- },
- onmouseup: function() {
- if(this.parentNode.parentNode.className.match(/(^|\b)specialImage($|\b)/)) {
- this.ownerDoc().setActive();
- this.parentNode.parentNode.setActive();
- }
- },
- prepareForResize: function() {
- if(this.aspectRatio == null) {
- this.aspectRatio = this.height / this.width;
- }
-
- this.originalWidth = this.width;
- this.originalHeight = this.height;
- },
-
- ownerDoc: function() {
- var f =this.parentNode;
- while(f && f.tagName.toLowerCase() != 'body') f = f.parentNode;
- return f;
- },
-
- resizeTo: function(width, height) {
- var newWidth = parseInt(height);
- var newHeight = parseInt(height) - this.heightDiff;
- if(isNaN(newWidth)) newWidth = this.width;
- if(isNaN(newHeight)) newHeight = this.height;
-
- // Constrain to width of the window
- if((this.offsetLeft + this.offsetWidth + 20) > this.ownerDoc().offsetWidth)
- newWidth += (this.ownerDoc().offsetWidth - this.offsetLeft - this.offsetWidth - 20);
-
- if(this.aspectRatio) {
- // Figure out which dimension we have altered more
- var heightChange = this.originalHeight / this.height;
- if(heightChange < 1) heightChange = 1/heightChange;
-
- var widthChange = this.originalWidth / this.width;
- if(widthChange < 1) widthChange = 1/widthChange;
-
- // Scale by the more constant dimension (so if you edit the height, change width to suit)
- if(widthChange > heightChange)
- newHeight = newWidth * this.aspectRatio;
- else
- newWidth = newHeight / this.aspectRatio;
- }
-
- this.style.width = newWidth + 'px';
- this.style.height = newHeight + 'px';
- this.width = newWidth;
- this.height = newHeight;
-
- // Auto-size special image holders
- if(this.parentNode.parentNode.className.match(/(^|\b)specialImage($|\b)/)) {
- this.parentNode.parentNode.style.width = newWidth + 'px';
- }
- }
-}
-
-MCEDLResizer = Class.extend('MCEImageResize');
-MCEDLResizer.prototype = {
- onresizestart: function() {
- var img = this.getElementsByTagName('img')[0];
- img.prepareForResize();
- img.heightDiff = this.offsetHeight - img.height;
- },
- onresizeend: function() {
- this.getElementsByTagName('img')[0].resizeTo(this.style.width, this.style.height);
- }
-}
-
-/**
* These callback hook it into tinymce. They need to be referenced in the TinyMCE config.
*/
function sapphiremce_setupcontent(editor_id, body, doc) {
Please sign in to comment.
Something went wrong with that request. Please try again.