Fix width transition when dragging preview

pull/1/head
yflory 8 years ago
parent 3ff3eac283
commit 5d6a0dcc1b

@ -18,11 +18,13 @@ body {
display: inline-block; display: inline-block;
height: 100%; height: 100%;
width: 50%; width: 50%;
transition: width 500ms, min-width 500ms, max-width 500ms;
min-width: 20%; min-width: 20%;
max-width: 80%; max-width: 80%;
resize: horizontal; resize: horizontal;
} }
.CodeMirror.transition {
transition: width 500ms, min-width 500ms, max-width 500ms;
}
.CodeMirror.fullPage { .CodeMirror.fullPage {
min-width: 100%; min-width: 100%;
max-width: 100%; max-width: 100%;

@ -22,7 +22,9 @@ body {
display: inline-block; display: inline-block;
height: 100%; height: 100%;
width: 50%; width: 50%;
transition: width @slideTime, min-width @slideTime, max-width @slideTime; &.transition {
transition: width @slideTime, min-width @slideTime, max-width @slideTime;
}
min-width: 20%; min-width: 20%;
max-width: 80%; max-width: 80%;
resize: horizontal; resize: horizontal;

@ -144,6 +144,11 @@ define([
var onModeChanged = function (mode) { var onModeChanged = function (mode) {
var $codeMirror = $iframe.find('.CodeMirror'); var $codeMirror = $iframe.find('.CodeMirror');
window.clearTimeout(APP.previewTo);
$codeMirror.addClass('transition');
APP.previewTo = window.setTimeout(function () {
$codeMirror.removeClass('transition');
}, 500);
if (mode === "markdown") { if (mode === "markdown") {
APP.$previewButton.show(); APP.$previewButton.show();
Cryptpad.getPadAttribute('previewMode', function (e, data) { Cryptpad.getPadAttribute('previewMode', function (e, data) {
@ -244,6 +249,11 @@ define([
$previewButton.attr('title', Messages.previewButtonTitle); $previewButton.attr('title', Messages.previewButtonTitle);
$previewButton.click(function () { $previewButton.click(function () {
var $codeMirror = $iframe.find('.CodeMirror'); var $codeMirror = $iframe.find('.CodeMirror');
window.clearTimeout(APP.previewTo);
$codeMirror.addClass('transition');
APP.previewTo = window.setTimeout(function () {
$codeMirror.removeClass('transition');
}, 500);
if (CodeMirror.highlightMode !== 'markdown') { if (CodeMirror.highlightMode !== 'markdown') {
$previewContainer.show(); $previewContainer.show();
} }

Loading…
Cancel
Save