Skip to content

Commit 010d199

Browse files
committed
v4.16.1 release
jsPanel v4.16.1 release
1 parent 4a2994b commit 010d199

39 files changed

+1267
-2268
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
## <span style='color:#563D7C;'>CHANGELOG</span>
22

3+
### <span style='color:#563D7C;'>Version 4.16.1 *2022-11-03*</span>
4+
5+
+ simplified internal code to process theme options and removed some obsolete code
6+
+ fix in css file to prevent overflowing title in minimized panel replacement
7+
38
### <span style='color:#563D7C;'>Version 4.16.0 *2022-07-03*</span>
49

510
+ **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.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<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">
22

33

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

66
> 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/
77

dist/extensions/contextmenu/jspanel.contextmenu.js

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* jsPanel - A JavaScript library to create highly configurable multifunctional floating panels that can also be used as modal, tooltip, hint or contextmenu
3-
* @version v4.16.0
3+
* @version v4.16.1
44
* @homepage https://jspanel.de/
55
* @license MIT
66
* @author Stefan Sträßer - [email protected]
@@ -24,51 +24,43 @@ if (!jsPanel.contextmenu) {
2424
},
2525
cmOverflow: function cmOverflow(elmt) {
2626
var cltX = elmt.cmEvent.clientX,
27-
cltY = elmt.cmEvent.clientY,
28-
panelW = elmt.offsetWidth,
29-
panelH = elmt.offsetHeight,
30-
corrLeft = window.innerWidth - (cltX + panelW),
31-
corrTop = window.innerHeight - (cltY + panelH);
32-
27+
cltY = elmt.cmEvent.clientY,
28+
panelW = elmt.offsetWidth,
29+
panelH = elmt.offsetHeight,
30+
corrLeft = window.innerWidth - (cltX + panelW),
31+
corrTop = window.innerHeight - (cltY + panelH);
3332
if (corrLeft < 0) {
3433
elmt.style.left = cltX + (window.scrollX || window.pageXOffset) - panelW + 'px';
3534
}
36-
3735
if (corrTop < 0) {
3836
elmt.style.top = cltY + (window.scrollY || window.pageYOffset) - panelH + 'px';
3937
}
4038
},
4139
create: function create() {
4240
var _this = this;
43-
4441
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4542
var evt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'contextmenu';
4643
options.paneltype = 'contextmenu';
4744
var target = options.target;
48-
4945
if (!target) {
5046
return false;
5147
}
52-
5348
if (typeof target === 'string') {
5449
target = document.querySelector(target);
5550
}
56-
5751
target.addEventListener(evt, function (e) {
58-
e.preventDefault(); // close all contextmenus first
59-
52+
e.preventDefault();
53+
// close all contextmenus first
6054
document.querySelectorAll('.jsPanel-contextmenu').forEach(function (item) {
6155
item.close();
6256
});
6357
var l = (e.pageX || e.touches[0].pageX) + 'px',
64-
t = (e.pageY || e.touches[0].pageY) + 'px',
65-
opts = options;
66-
58+
t = (e.pageY || e.touches[0].pageY) + 'px',
59+
opts = options;
6760
if (options.config) {
6861
opts = Object.assign({}, options.config, options);
6962
delete opts.config;
7063
}
71-
7264
opts = Object.assign({}, _this.defaults, opts, {
7365
position: false,
7466
container: 'body'
@@ -78,34 +70,31 @@ if (!jsPanel.contextmenu) {
7870
position: 'absolute',
7971
left: l,
8072
top: t
81-
}); // check whether contextmenu is triggered from within a modal panel or panel and if so update z-index
73+
});
8274

75+
// check whether contextmenu is triggered from within a modal panel or panel and if so update z-index
8376
var closestModal = target.closest('.jsPanel-modal');
84-
8577
if (closestModal) {
8678
cm.style.zIndex = closestModal.style.zIndex;
8779
} else {
8880
var closestPanel = target.closest('.jsPanel');
89-
9081
if (closestPanel) {
9182
closestPanel.front();
9283
}
93-
9484
cm.style.zIndex = jsPanel.zi.next();
95-
} // save event object as property of cm outer div (needed in checkContextmenuOverflow())
96-
85+
}
9786

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

90+
// update left/top values if menu overflows browser viewport
10091
jsPanel.contextmenu.cmOverflow(cm);
101-
10292
if (opts.closeOnMouseleave) {
10393
cm.addEventListener('mouseleave', function () {
10494
cm.close();
10595
}, false);
106-
} // don't close contextmenu on mousedown in contextmenu
107-
108-
96+
}
97+
// don't close contextmenu on mousedown in contextmenu
10998
jsPanel.pointerdown.forEach(function (evt) {
11099
cm.addEventListener(evt, function (e) {
111100
e.stopPropagation();
@@ -114,14 +103,16 @@ if (!jsPanel.contextmenu) {
114103
});
115104
}, false);
116105
}
117-
}; // add overflow check to jsPanel.contentAjax always callback
106+
};
118107

108+
// add overflow check to jsPanel.contentAjax always callback
119109
jsPanel.ajaxAlwaysCallbacks.push(function (xhr, obj) {
120110
if (obj && obj.classList && obj.classList.contains('jsPanel-contextmenu')) {
121111
jsPanel.contextmenu.cmOverflow(obj);
122112
}
123-
}); // close tooltips on pointerdown in document
113+
});
124114

115+
// close tooltips on pointerdown in document
125116
jsPanel.pointerdown.forEach(function (evt) {
126117
document.addEventListener(evt, function (e) {
127118
document.querySelectorAll('.jsPanel-contextmenu').forEach(function (item) {

0 commit comments

Comments
 (0)