Skip to content

Commit

Permalink
Fixes for resizers (data-ko-height and extresizable binding)
Browse files Browse the repository at this point in the history
  • Loading branch information
bago committed May 19, 2022
1 parent a1bd793 commit 2cf3589
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
11 changes: 11 additions & 0 deletions src/css/style_mosaico_content.less
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@
}
#main-edit-area .ui-resizable-container {
position: relative;
.ui-resizable-handle {
display: none !important;
}
&:hover .ui-resizable-handle {
display: block !important;
}
}
#main-edit-area .ui-resizable.ui-resizing-div {
position: absolute;
Expand All @@ -141,6 +147,11 @@
right: 0;
bottom: 0;

&.ui-resizable-resizing {
z-index: 1000;
background-color: #ffffffcc;
}

&.ui-resizable-resizing:before {
display: block;
}
Expand Down
17 changes: 8 additions & 9 deletions src/js/bindings/extresizable.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@
//get reference to drop method
value = "data" in value ? value.data : valueAccessor();


// TODO questi devono venire da parametri
// TODO we probably should get this from parameters
options.minHeight = 2;
options.maxHeight = 1000;
options.autoHide = true;
options.autoHide = false;
// options.helper = $("<div/>");
// options.ghost = true;
options.start = function(event, ui) {
console.log("start");
// console.log("start");
if (typeof options.resizing == 'function') options.resizing(true);
ko.utils.toggleDomNodeCssClass(element, "resizable-resizing", true);
/*
Expand All @@ -53,7 +52,7 @@
*/
};
options.stop = function(event, ui) {
console.log("stop");
// console.log("stop");
if (typeof options.resizing == 'function') options.resizing(false);
ko.utils.toggleDomNodeCssClass(element, "resizable-resizing", false);
event.target.style.height = "auto";
Expand All @@ -65,7 +64,7 @@
*/
};
options.resize = function(event, ui) {
console.log("resize", ui.size.height, ui.originalSize.height, value());
// console.log("resize", ui.size.height, ui.originalSize.height, value());
value(ui.size.height);
ui.size.height = value();
};
Expand All @@ -75,14 +74,14 @@

//initialize resizable
$(element).resizable(resizableOptions);
console.log(element, "resizable init");
// console.log(element, "resizable init");

//handle enabling/disabling resizable
if (isEnabled !== undefined) {
ko.computed({
read: function() {
$(element).resizable(unwrap(isEnabled) ? "enable": "disable");
console.log(element, "resizable enabled read");
// console.log(element, "resizable enabled read");
},
disposeWhenNodeIsRemoved: element
});
Expand All @@ -91,7 +90,7 @@
//handle disposal
ko.utils.domNodeDisposal.addDisposeCallback(element, function() {
$(element).resizable("destroy");
console.log(element, "resizable destroy");
// console.log(element, "resizable destroy");
});

}
Expand Down

0 comments on commit 2cf3589

Please sign in to comment.