Browse Source

Merge pull request #28 from Callino/10.0-add_draggable_support-WP

[ADD] Added draggable support for preview window
10.0
Mathias Markl 6 years ago
committed by GitHub
parent
commit
6a2eb4ea85
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      muk_web_preview/static/src/js/preview_dialog.js

10
muk_web_preview/static/src/js/preview_dialog.js

@ -57,6 +57,10 @@ var PreviewDialog = Widget.extend({
open: function() { open: function() {
var self = this; var self = this;
$('.tooltip').remove(); $('.tooltip').remove();
this.$modal.draggable({
handle: '.modal-header',
helper: false
});
this.replace(this.$modal.find(".modal-body")).then(function() { this.replace(this.$modal.find(".modal-body")).then(function() {
self.$modal.modal('show'); self.$modal.modal('show');
self._opened.resolve(); self._opened.resolve();
@ -97,6 +101,10 @@ var PreviewDialog = Widget.extend({
} }
}, },
close: function() { close: function() {
var draggable = this.$modal.draggable( "instance" );
if (draggable) {
this.$modal.draggable("destroy");
}
this.$modal.modal('hide'); this.$modal.modal('hide');
}, },
destroy: function(reason) { destroy: function(reason) {
@ -124,4 +132,4 @@ PreviewDialog.createPreviewDialog = function (parent, url, mimetype, extension,
return PreviewDialog; return PreviewDialog;
});
});
Loading…
Cancel
Save