Skip to content

Commit

Permalink
Ticket #160 - Replaced manual editor resizing with new public reflow …
Browse files Browse the repository at this point in the history
…method
  • Loading branch information
OscarGodson committed Oct 4, 2012
1 parent 93e606c commit f11ce60
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 53 deletions.
31 changes: 5 additions & 26 deletions epiceditor/js/epiceditor.js
Expand Up @@ -421,8 +421,6 @@
, _HtmlTemplates
, iframeElement
, baseTag
, widthDiff
, heightDiff
, utilBtns
, utilBar
, utilBarTimer
Expand All @@ -431,7 +429,6 @@
, _elementStates
, _isInEdit
, nativeFs = false
, elementsToResize
, fsElement
, isMod = false
, isCtrl = false
Expand Down Expand Up @@ -473,21 +470,6 @@
, previewer: '<div id="epiceditor-preview"></div>'
};

// Used to setup the initial size of the iframes
function setupIframeStyles(el) {
for (var x = 0; x < el.length; x++) {
el[x].style.width = self.element.offsetWidth - widthDiff + 'px';
el[x].style.height = self.element.offsetHeight - heightDiff + 'px';
}
}

// Used for resetting the width of EE mainly for fluid width containers
function resetWidth(el) {
widthDiff = _outerWidth(self.element) - self.element.offsetWidth;
for (var x = 0; x < el.length; x++) {
el[x].style.width = self.element.offsetWidth - widthDiff + 'px';
}
}
// Write an iframe and then select it for the editor
self.element.innerHTML = '<iframe scrolling="no" frameborder="0" id= "' + self._instanceId + '"></iframe>';
iframeElement = document.getElementById(self._instanceId);
Expand Down Expand Up @@ -524,12 +506,7 @@

self.previewerIframeDocument.close();

// Set the default styles for the iframe
widthDiff = _outerWidth(self.element) - self.element.offsetWidth;
heightDiff = _outerHeight(self.element) - self.element.offsetHeight;
elementsToResize = [self.iframeElement, self.editorIframe, self.previewerIframe];

setupIframeStyles(elementsToResize);
self.reflow();

// Insert Base Stylesheet
_insertCSSLink(self.settings.basePath + self.settings.theme.base, self.iframe, 'theme');
Expand Down Expand Up @@ -649,6 +626,8 @@
, 'height': windowInnerHeight + 'px'
});

console.log(_elementStates)

This comment has been minimized.

Copy link
@OscarGodson

OscarGodson Oct 4, 2012

Author Owner

FUCK


// ...Oh, and hide the buttons and prevent scrolling
utilBtns.style.visibility = 'hidden';

Expand Down Expand Up @@ -694,7 +673,7 @@
self.preview();
}

resetWidth(elementsToResize);
self.reflow();

self.emit('fullscreenexit');
};
Expand Down Expand Up @@ -873,7 +852,7 @@
}
// Makes the editor support fluid width when not in fullscreen mode
else if (!self.is('fullscreen')) {
resetWidth(elementsToResize);
self.reflow();
}
});

Expand Down

0 comments on commit f11ce60

Please sign in to comment.