Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Avoid setting focus on the preview window for automatic refreshes and…

… close it when the page containing the editor is unloaded
  • Loading branch information...
commit 77e6700d47011f834b3f9c01cc3aafd184260866 1 parent 52a55f5
@drslump authored
Showing with 6 additions and 3 deletions.
  1. +6 −3 markitup/jquery.markitup.js
View
9 markitup/jquery.markitup.js
@@ -414,6 +414,9 @@
if (!previewWindow || previewWindow.closed) {
if (options.previewInWindow) {
previewWindow = window.open('', 'preview', options.previewInWindow);
+ $(window).unload(function(){
+ previewWindow.close();
+ });
} else {
iFrame = $('<iframe class="markItUpPreviewFrame"></iframe>');
if (options.previewPosition == 'after') {
@@ -435,6 +438,9 @@
if (!options.previewAutoRefresh) {
refreshPreview();
}
+ if (options.previewInWindow) {
+ previewWindow.focus();
+ }
}
// refresh Preview window
@@ -478,9 +484,6 @@
previewWindow.document.close();
previewWindow.document.documentElement.scrollTop = sp;
}
- if (options.previewInWindow) {
- previewWindow.focus();
- }
}
// set keys pressed
Please sign in to comment.
Something went wrong with that request. Please try again.