Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

[WIP] Attempt to make extension work with notebook 5.6 #317

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ env: ## Make a dev environment
pip install -e . && \
jupyter dashboards quick-setup --sys-prefix && \
jupyter nbextension enable --py widgetsnbextension --sys-prefix
#jupyter declarativewidgets quick-setup --sys-prefix

js: ## Make JavaScript assets
npm install
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"tests"
],
"dependencies": {
"gridstack": "0.2.4",
"gridstack": "0.4.0",
"requirejs": "~2.1.20",
"requirejs-text": "~2.0.14"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,29 @@ define(['jquery', 'Gridstack'], function($, Gridstack) {
GridstackCustom.prototype = Object.create(Gridstack.prototype);
GridstackCustom.prototype.constructor = GridstackCustom;

GridstackCustom.prototype.__destroy = Gridstack.prototype.destroy;
GridstackCustom.prototype.destroy = function(detach_node) {
detach_node = typeof detach_node === 'undefined' ? true : detach_node;
// GridstackCustom.prototype.__destroy = Gridstack.prototype.destroy;
// GridstackCustom.prototype.destroy = function(detach_node) {
// detach_node = typeof detach_node === 'undefined' ? true : detach_node;

if (!detach_node) {
// Gridstack.destroy() removes the container from the DOM. Hack around it to make it
// a no-op if `detach_node` is false.
var $container = this.container;
var oldRemove = $.fn.remove;
$.fn.remove = function() {
if (!this.is($container)) {
return oldRemove.apply(this, arguments);
}
return this;
};
}
// if (!detach_node) {
// // Gridstack.destroy() removes the container from the DOM. Hack around it to make it
// // a no-op if `detach_node` is false.
// var $container = this.container;
// var oldRemove = $.fn.remove;
// $.fn.remove = function() {
// if (!this.is($container)) {
// return oldRemove.apply(this, arguments);
// }
// return this;
// };
// }

this.__destroy();
// this.__destroy();

if (!detach_node) {
$.fn.remove = oldRemove;
}
};
// if (!detach_node) {
// $.fn.remove = oldRemove;
// }
// };

/**
* Generates cell styles which depend on margin (which is a layout option).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,8 @@ define([
GridLayout.prototype._hideCell = function($cell) {
var self = this;
this.$container.one('change', function() {
$cell.resizable('destroy');
$cell.draggable('destroy');
$cell.resizable(false);
$cell.draggable(false);
Metadata.hideCell($cell);
// Temporarily set 'top' *before* removing 'grid-stack-item' class. This makes it so
// cell animates when moving from dashboard to hidden cells area.
Expand Down Expand Up @@ -665,7 +665,7 @@ define([
});

$('.grid-stack-item')
.resizable('destroy').draggable('destroy')
.resizable(false).draggable(false)
.removeClass('ui-resizable-autohide'); // jquery bug, cannot remove class using API

$('.dashboard-item-background').remove();
Expand Down
Loading