Addresses #283, Minefield compatibility

Closes #285, Hitting Esc should close tags popup

Fixes various UI issues and problems adding tags on Minefield

Still getting autocomplete self-destruction
This commit is contained in:
Dan Stillman 2007-10-31 00:03:06 +00:00
parent 1159de39f6
commit 34ea8ced85
7 changed files with 27 additions and 12 deletions

View File

@ -36,6 +36,8 @@ locale zotero zh-TW chrome/locale/zh-TW/zotero/
skin zotero default chrome/skin/default/zotero/ skin zotero default chrome/skin/default/zotero/
overlay chrome://browser/content/browser.xul chrome://zotero/content/overlay.xul overlay chrome://browser/content/browser.xul chrome://zotero/content/overlay.xul
overlay chrome://browser/content/browser.xul chrome://zotero/content/itemPane.xul
style chrome://browser/content/browser.xul chrome://zotero/skin/zotero.css style chrome://browser/content/browser.xul chrome://zotero/skin/zotero.css
style chrome://global/content/customizeToolbar.xul chrome://zotero/skin/zotero.css style chrome://global/content/customizeToolbar.xul chrome://zotero/skin/zotero.css

View File

@ -286,7 +286,7 @@
Note: Code in tagsbox.xml is dependent on the DOM path between the Note: Code in tagsbox.xml is dependent on the DOM path between the
tagsbox and tagsLabel above, so be sure to update fixPopup() if it changes tagsbox and tagsLabel above, so be sure to update fixPopup() if it changes
--> -->
<xul:popup id="tagsPopup" ignorekeys="true" width="300" <xul:popup id="tagsPopup" ignorekeys="true"
onpopupshown="if (!document.commandDispatcher.focusedElement || document.commandDispatcher.focusedElement.tagName=='xul:label'){ /* DEBUG: it would be nice to make this work -- if (this.firstChild.count==0){ this.firstChild.new(); } */ this.setAttribute('showing', 'true'); }" onpopupshown="if (!document.commandDispatcher.focusedElement || document.commandDispatcher.focusedElement.tagName=='xul:label'){ /* DEBUG: it would be nice to make this work -- if (this.firstChild.count==0){ this.firstChild.new(); } */ this.setAttribute('showing', 'true'); }"
onpopuphidden="if (!document.commandDispatcher.focusedElement || document.commandDispatcher.focusedElement.tagName=='xul:label'){ this.setAttribute('showing', 'false'); }"> onpopuphidden="if (!document.commandDispatcher.focusedElement || document.commandDispatcher.focusedElement.tagName=='xul:label'){ this.setAttribute('showing', 'false'); }">
<xul:tagsbox id="tags" flex="1"/> <xul:tagsbox id="tags" flex="1"/>

View File

@ -265,8 +265,8 @@
<method name="closePopup"> <method name="closePopup">
<body> <body>
<![CDATA[ <![CDATA[
if (this.parentNode.getAttribute('showing')=='true') { if (this.parentNode.hidePopup) {
this.parentNode.setAttribute('showing', false); this.parentNode.hidePopup()
} }
]]> ]]>
</body> </body>
@ -283,7 +283,7 @@
<xul:scrollbox xbl:inherits="flex" orient="vertical" style="overflow:auto"> <xul:scrollbox xbl:inherits="flex" orient="vertical" style="overflow:auto">
<xul:hbox align="center"> <xul:hbox align="center">
<xul:label id="tagsNum"/> <xul:label id="tagsNum"/>
<xul:button label="&zotero.item.add;" oncommand="this.parentNode.parentNode.parentNode.new();"/> <xul:button label="&zotero.item.add;" oncommand="document.getBindingParent(this).new();"/>
</xul:hbox> </xul:hbox>
<xul:grid> <xul:grid>
<xul:columns> <xul:columns>

View File

@ -1006,7 +1006,7 @@ var ZoteroItemPane = new function()
_dynamicFields.focus(); _dynamicFields.focus();
} }
//Zotero.debug('Showing editor'); Zotero.debug('Showing editor');
var fieldName = elem.getAttribute('fieldname'); var fieldName = elem.getAttribute('fieldname');
var tabindex = elem.getAttribute('ztabindex'); var tabindex = elem.getAttribute('ztabindex');
@ -1167,6 +1167,9 @@ var ZoteroItemPane = new function()
switch (event.keyCode) switch (event.keyCode)
{ {
case event.DOM_VK_RETURN: case event.DOM_VK_RETURN:
// Prevent blur on textbox above
event.preventDefault();
var fieldname = target.getAttribute('fieldname'); var fieldname = target.getAttribute('fieldname');
// Use shift-enter as the save action for the larger fields // Use shift-enter as the save action for the larger fields
if ((fieldname == 'abstractNote' || fieldname == 'extra') if ((fieldname == 'abstractNote' || fieldname == 'extra')
@ -1220,8 +1223,15 @@ var ZoteroItemPane = new function()
case event.DOM_VK_ESCAPE: case event.DOM_VK_ESCAPE:
// Reset field to original value // Reset field to original value
target.value = target.getAttribute('value'); target.value = target.getAttribute('value');
var tagsbox = Zotero.getAncestorByTagName(focused, 'tagsbox');
focused.blur(); focused.blur();
if (tagsbox) {
tagsbox.closePopup();
}
// Return focus to items pane // Return focus to items pane
var tree = document.getElementById('zotero-items-tree'); var tree = document.getElementById('zotero-items-tree');
if (tree) { if (tree) {
@ -1243,12 +1253,13 @@ var ZoteroItemPane = new function()
function hideEditor(t, saveChanges) function hideEditor(t, saveChanges)
{ {
//Zotero.debug('Hiding editor'); Zotero.debug('Hiding editor');
var textbox = Zotero.getAncestorByTagName(t, 'textbox'); var textbox = Zotero.getAncestorByTagName(t, 'textbox');
if (!textbox){ if (!textbox){
Zotero.debug('Textbox not found in hideEditor'); Zotero.debug('Textbox not found in hideEditor');
return; return;
} }
var fieldName = textbox.getAttribute('fieldname'); var fieldName = textbox.getAttribute('fieldname');
var tabindex = textbox.getAttribute('ztabindex'); var tabindex = textbox.getAttribute('ztabindex');
@ -1349,10 +1360,7 @@ var ZoteroItemPane = new function()
if (existingTypes && existingTypes.indexOf(1) != -1) { if (existingTypes && existingTypes.indexOf(1) != -1) {
_lastTabIndex--; _lastTabIndex--;
} }
var id = tagsbox.add(value); var id = tagsbox.add(value);
// DEBUG: why does this need to continue if added?
} }
} }
@ -1370,6 +1378,7 @@ var ZoteroItemPane = new function()
} }
catch (e) {} catch (e) {}
tagsbox.fixPopup(); tagsbox.fixPopup();
tagsbox.closePopup();
_tabDirection = false; _tabDirection = false;
return; return;

View File

@ -22,6 +22,7 @@
--> -->
<?xml-stylesheet href="chrome://zotero/skin/itemPane.css" type="text/css"?> <?xml-stylesheet href="chrome://zotero/skin/itemPane.css" type="text/css"?>
<?xml-stylesheet href="chrome://zotero-platform/content/itemPane.css" type="text/css"?> <?xml-stylesheet href="chrome://zotero-platform/content/itemPane.css" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd"> <!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd">
<overlay <overlay

View File

@ -29,7 +29,6 @@
<overlay id="zotero" <overlay id="zotero"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<?xul-overlay href="itemPane.xul" ?>
<!-- Include the global XPCOM object --> <!-- Include the global XPCOM object -->
<script src="include.js"/> <script src="include.js"/>

View File

@ -8,3 +8,7 @@
{ {
cursor: pointer !important; cursor: pointer !important;
} }
#tagsPopup {
min-width: 300px;
}