type="arrow" to anchor reference panel (#4629)
Some checks are pending
CI / Build, Upload, Test (push) Waiting to run
Some checks are pending
CI / Build, Upload, Test (push) Waiting to run
And remove no longer needed JS logic hiding and displaying the panel to keep it next to the dialog
This commit is contained in:
parent
671577e35e
commit
15f9a84060
2 changed files with 1 additions and 52 deletions
|
@ -291,7 +291,6 @@ var Zotero_QuickFormat = new function () {
|
||||||
_updateItemList({ citedItems: [] });
|
_updateItemList({ citedItems: [] });
|
||||||
});
|
});
|
||||||
refocusInput();
|
refocusInput();
|
||||||
_initWindowDragTracker();
|
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
Zotero.logError(e);
|
Zotero.logError(e);
|
||||||
|
@ -1269,46 +1268,6 @@ var Zotero_QuickFormat = new function () {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* FX115.
|
|
||||||
* Keep track when the window is being dragged and if so - hide reference panel.
|
|
||||||
* Reopen it when the window stops being dragged.
|
|
||||||
* This is to handle the <panel> not following the window as it is moved across the screen.
|
|
||||||
* -moz-window-drag interferes with mouseup/down events on windows, so this is an alternative
|
|
||||||
* to those listeners.
|
|
||||||
*/
|
|
||||||
function _initWindowDragTracker() {
|
|
||||||
const CHECK_FREQUENCY = 100;
|
|
||||||
let windowTop = window.screenTop;
|
|
||||||
let windowLeft = window.screenLeft;
|
|
||||||
let checksWithoutMovement = 0;
|
|
||||||
let checkWindowsPosition = () => {
|
|
||||||
// Don't let the counter increase indefinitely
|
|
||||||
if (checksWithoutMovement > 1000000) {
|
|
||||||
checksWithoutMovement = 10;
|
|
||||||
}
|
|
||||||
setTimeout(() => {
|
|
||||||
// If the window's positioning changed, the window is being dragged. Hide the reference panel
|
|
||||||
if (windowTop !== window.screenTop || windowLeft !== window.screenLeft) {
|
|
||||||
referencePanel.hidePopup();
|
|
||||||
windowTop = window.screenTop;
|
|
||||||
windowLeft = window.screenLeft;
|
|
||||||
checksWithoutMovement = 0;
|
|
||||||
checkWindowsPosition();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// If the position hasn't changed for a while, make sure the panel is reopened.
|
|
||||||
if (checksWithoutMovement == 2 && isInput(document.activeElement) && referencePanel.state !== "open") {
|
|
||||||
_resizeReferencePanel();
|
|
||||||
}
|
|
||||||
checksWithoutMovement += 1;
|
|
||||||
// Keep checking every once in a while
|
|
||||||
checkWindowsPosition();
|
|
||||||
}, CHECK_FREQUENCY);
|
|
||||||
};
|
|
||||||
checkWindowsPosition();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the editor's width so that it fills up all remaining space in the window.
|
// Set the editor's width so that it fills up all remaining space in the window.
|
||||||
// It should be window.width - padding - icon wrappers width. The is needed to be explicitly set
|
// It should be window.width - padding - icon wrappers width. The is needed to be explicitly set
|
||||||
// so that the editor's height expands/shrinks vertically without going outside of the
|
// so that the editor's height expands/shrinks vertically without going outside of the
|
||||||
|
@ -1341,16 +1300,6 @@ var Zotero_QuickFormat = new function () {
|
||||||
// Need to wait a moment for the css change above to take effect (mainly for mac)
|
// Need to wait a moment for the css change above to take effect (mainly for mac)
|
||||||
await Zotero.Promise.delay(5);
|
await Zotero.Promise.delay(5);
|
||||||
window.resizeTo(width, height);
|
window.resizeTo(width, height);
|
||||||
// If the editor height changes, the panel will remain where it was.
|
|
||||||
// Check if the panel is not next to the dialog, and if so - close and reopen it
|
|
||||||
// to position references panel properly
|
|
||||||
let dialogBottom = dialog.getBoundingClientRect().bottom;
|
|
||||||
let panelTop = referencePanel.getBoundingClientRect().top;
|
|
||||||
if (Math.abs(dialogBottom - panelTop) > 5 && referencePanel.state == "open") {
|
|
||||||
referencePanel.hidePopup();
|
|
||||||
// Skip a tick, otherwise the panel may just remain open where it was
|
|
||||||
setTimeout(_openReferencePanel);
|
|
||||||
}
|
|
||||||
if (Zotero.isMac && Zotero.platformMajorVersion >= 60) {
|
if (Zotero.isMac && Zotero.platformMajorVersion >= 60) {
|
||||||
document.children[0].setAttribute('drawintitlebar', 'false');
|
document.children[0].setAttribute('drawintitlebar', 'false');
|
||||||
document.children[0].setAttribute('drawintitlebar', 'true');
|
document.children[0].setAttribute('drawintitlebar', 'true');
|
||||||
|
|
|
@ -85,7 +85,7 @@
|
||||||
<html:div id="input-description" class="aria-hidden" role="tooltip" data-l10n-id="quickformat-aria-input"></html:div>
|
<html:div id="input-description" class="aria-hidden" role="tooltip" data-l10n-id="quickformat-aria-input"></html:div>
|
||||||
<html:div id="item-description" class="aria-hidden" role="tooltip" data-l10n-id="quickformat-aria-item"></html:div>
|
<html:div id="item-description" class="aria-hidden" role="tooltip" data-l10n-id="quickformat-aria-item"></html:div>
|
||||||
<panel class="citation-dialog reference-panel" noautofocus="true" norestorefocus="true"
|
<panel class="citation-dialog reference-panel" noautofocus="true" norestorefocus="true"
|
||||||
height="0" width="0" flip="none">
|
height="0" width="0" flip="none" type="arrow">
|
||||||
<richlistbox class="citation-dialog reference-list" flex="1" seltype="multiple"/>
|
<richlistbox class="citation-dialog reference-list" flex="1" seltype="multiple"/>
|
||||||
</panel>
|
</panel>
|
||||||
<panel id="citation-properties" type="arrow" orient="vertical"
|
<panel id="citation-properties" type="arrow" orient="vertical"
|
||||||
|
|
Loading…
Reference in a new issue