Skip to content

Commit

Permalink
v4.16.1 release
Browse files Browse the repository at this point in the history
jsPanel v4.16.1 release
  • Loading branch information
Flyer53 committed Nov 3, 2022
1 parent 4a2994b commit 010d199
Show file tree
Hide file tree
Showing 39 changed files with 1,267 additions and 2,268 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## <span style='color:#563D7C;'>CHANGELOG</span>

### <span style='color:#563D7C;'>Version 4.16.1 *2022-11-03*</span>

+ simplified internal code to process theme options and removed some obsolete code
+ fix in css file to prevent overflowing title in minimized panel replacement

### <span style='color:#563D7C;'>Version 4.16.0 *2022-07-03*</span>

+ **added** Dialog extension. This extension adds an easy-to-use interface for dialog elements to virtually any jsPanel. It also offers a `modal()` function to create modal dialogs as well as `alert()`, `confirm()` and `prompt()` functions. `jsPanel.dialog` is a Third Party Extension developed and maintained by Michael Daumling.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<img alt="NPM license" src="https://img.shields.io/npm/l/jspanel4"> <img alt="npm version" src="https://img.shields.io/npm/v/jspanel4?color=0677b8"> <img alt="npm downloads" src="https://img.shields.io/npm/dm/jspanel4?color=0677b8">


## [jsPanel 4.16.0 released 2022-07-03](#)
## [jsPanel 4.16.1 released 2022-11-03](#)

> As of v4.11.0-beta methods `jsPanel.ajax()` and `jsPanel.fetch()` are updated. That also affects options `contentAjax` and `contentFetch`. These updates might break existing code. So please check the docs on https://jspanel.de/
Expand Down
53 changes: 22 additions & 31 deletions dist/extensions/contextmenu/jspanel.contextmenu.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* jsPanel - A JavaScript library to create highly configurable multifunctional floating panels that can also be used as modal, tooltip, hint or contextmenu
* @version v4.16.0
* @version v4.16.1
* @homepage https://jspanel.de/
* @license MIT
* @author Stefan Sträßer - info@jspanel.de
Expand All @@ -24,51 +24,43 @@ if (!jsPanel.contextmenu) {
},
cmOverflow: function cmOverflow(elmt) {
var cltX = elmt.cmEvent.clientX,
cltY = elmt.cmEvent.clientY,
panelW = elmt.offsetWidth,
panelH = elmt.offsetHeight,
corrLeft = window.innerWidth - (cltX + panelW),
corrTop = window.innerHeight - (cltY + panelH);

cltY = elmt.cmEvent.clientY,
panelW = elmt.offsetWidth,
panelH = elmt.offsetHeight,
corrLeft = window.innerWidth - (cltX + panelW),
corrTop = window.innerHeight - (cltY + panelH);
if (corrLeft < 0) {
elmt.style.left = cltX + (window.scrollX || window.pageXOffset) - panelW + 'px';
}

if (corrTop < 0) {
elmt.style.top = cltY + (window.scrollY || window.pageYOffset) - panelH + 'px';
}
},
create: function create() {
var _this = this;

var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var evt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'contextmenu';
options.paneltype = 'contextmenu';
var target = options.target;

if (!target) {
return false;
}

if (typeof target === 'string') {
target = document.querySelector(target);
}

target.addEventListener(evt, function (e) {
e.preventDefault(); // close all contextmenus first

e.preventDefault();
// close all contextmenus first
document.querySelectorAll('.jsPanel-contextmenu').forEach(function (item) {
item.close();
});
var l = (e.pageX || e.touches[0].pageX) + 'px',
t = (e.pageY || e.touches[0].pageY) + 'px',
opts = options;

t = (e.pageY || e.touches[0].pageY) + 'px',
opts = options;
if (options.config) {
opts = Object.assign({}, options.config, options);
delete opts.config;
}

opts = Object.assign({}, _this.defaults, opts, {
position: false,
container: 'body'
Expand All @@ -78,34 +70,31 @@ if (!jsPanel.contextmenu) {
position: 'absolute',
left: l,
top: t
}); // check whether contextmenu is triggered from within a modal panel or panel and if so update z-index
});

// check whether contextmenu is triggered from within a modal panel or panel and if so update z-index
var closestModal = target.closest('.jsPanel-modal');

if (closestModal) {
cm.style.zIndex = closestModal.style.zIndex;
} else {
var closestPanel = target.closest('.jsPanel');

if (closestPanel) {
closestPanel.front();
}

cm.style.zIndex = jsPanel.zi.next();
} // save event object as property of cm outer div (needed in checkContextmenuOverflow())

}

cm.cmEvent = e; // update left/top values if menu overflows browser viewport
// save event object as property of cm outer div (needed in checkContextmenuOverflow())
cm.cmEvent = e;

// update left/top values if menu overflows browser viewport
jsPanel.contextmenu.cmOverflow(cm);

if (opts.closeOnMouseleave) {
cm.addEventListener('mouseleave', function () {
cm.close();
}, false);
} // don't close contextmenu on mousedown in contextmenu


}
// don't close contextmenu on mousedown in contextmenu
jsPanel.pointerdown.forEach(function (evt) {
cm.addEventListener(evt, function (e) {
e.stopPropagation();
Expand All @@ -114,14 +103,16 @@ if (!jsPanel.contextmenu) {
});
}, false);
}
}; // add overflow check to jsPanel.contentAjax always callback
};

// add overflow check to jsPanel.contentAjax always callback
jsPanel.ajaxAlwaysCallbacks.push(function (xhr, obj) {
if (obj && obj.classList && obj.classList.contains('jsPanel-contextmenu')) {
jsPanel.contextmenu.cmOverflow(obj);
}
}); // close tooltips on pointerdown in document
});

// close tooltips on pointerdown in document
jsPanel.pointerdown.forEach(function (evt) {
document.addEventListener(evt, function (e) {
document.querySelectorAll('.jsPanel-contextmenu').forEach(function (item) {
Expand Down
Loading

0 comments on commit 010d199

Please sign in to comment.