Fix a race condition causing the preview part to be empty
This commit is contained in:
@@ -27,19 +27,6 @@ define([
|
|||||||
|
|
||||||
var toolbar;
|
var toolbar;
|
||||||
var editor;
|
var editor;
|
||||||
var $iframe = $('#pad-iframe').contents();
|
|
||||||
var $previewContainer = $iframe.find('#previewContainer');
|
|
||||||
var $preview = $iframe.find('#preview');
|
|
||||||
$preview.click(function (e) {
|
|
||||||
if (!e.target) { return; }
|
|
||||||
var $t = $(e.target);
|
|
||||||
if ($t.is('a') || $t.parents('a').length) {
|
|
||||||
e.preventDefault();
|
|
||||||
var $a = $t.is('a') ? $t : $t.parents('a').first();
|
|
||||||
var href = $a.attr('href');
|
|
||||||
window.open(href);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var secret = Cryptpad.getSecrets();
|
var secret = Cryptpad.getSecrets();
|
||||||
var readOnly = secret.keys && !secret.keys.editKeyStr;
|
var readOnly = secret.keys && !secret.keys.editKeyStr;
|
||||||
@@ -52,6 +39,20 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
var andThen = function (CMeditor) {
|
var andThen = function (CMeditor) {
|
||||||
|
var $iframe = $('#pad-iframe').contents();
|
||||||
|
var $previewContainer = $iframe.find('#previewContainer');
|
||||||
|
var $preview = $iframe.find('#preview');
|
||||||
|
$preview.click(function (e) {
|
||||||
|
if (!e.target) { return; }
|
||||||
|
var $t = $(e.target);
|
||||||
|
if ($t.is('a') || $t.parents('a').length) {
|
||||||
|
e.preventDefault();
|
||||||
|
var $a = $t.is('a') ? $t : $t.parents('a').first();
|
||||||
|
var href = $a.attr('href');
|
||||||
|
window.open(href);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
var CodeMirror = Cryptpad.createCodemirror(CMeditor, ifrw, Cryptpad);
|
var CodeMirror = Cryptpad.createCodemirror(CMeditor, ifrw, Cryptpad);
|
||||||
$iframe.find('.CodeMirror').addClass('fullPage');
|
$iframe.find('.CodeMirror').addClass('fullPage');
|
||||||
editor = CodeMirror.editor;
|
editor = CodeMirror.editor;
|
||||||
|
|||||||
Reference in New Issue
Block a user