UI fixes for read-only notes

- Don't show toolbar in read-only note editor
- Get rid of "undefined" button in CR window
- Better padding/alignment in CR window
This commit is contained in:
Dan Stillman 2017-05-12 19:59:27 -04:00
parent be7cc45c0e
commit eb42152c42
6 changed files with 81 additions and 63 deletions

View File

@ -99,7 +99,6 @@
this.displayFileName = true; this.displayFileName = true;
this.displayAccessed = true; this.displayAccessed = true;
this.displayNote = true; this.displayNote = true;
this.displayButton = true;
this.displayDateModified = true; this.displayDateModified = true;
break; break;
@ -346,9 +345,7 @@
// Note editor // Note editor
var noteEditor = this._id('attachment-note-editor'); var noteEditor = this._id('attachment-note-editor');
if (this.displayNote) { if (this.displayNote && (this.displayNoteIfEmpty || this.item.getNote() != '')) {
if (this.displayNoteIfEmpty || this.item.getNote() != '') {
Zotero.debug("setting links on top");
noteEditor.linksOnTop = true; noteEditor.linksOnTop = true;
noteEditor.hidden = false; noteEditor.hidden = false;
@ -363,12 +360,10 @@
noteEditor.parent = null; noteEditor.parent = null;
noteEditor.item = this.item; noteEditor.item = this.item;
} }
}
else { else {
noteEditor.hidden = true; noteEditor.hidden = true;
} }
if (this.displayButton) { if (this.displayButton) {
selectButton.label = this.buttonCaption; selectButton.label = this.buttonCaption;
selectButton.hidden = false; selectButton.hidden = false;
@ -572,6 +567,7 @@
<content> <content>
<vbox id="attachment-box" flex="1" orient="vertical" <vbox id="attachment-box" flex="1" orient="vertical"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<vbox id="metadata">
<label id="title"/> <label id="title"/>
<label id="url" crop="end" <label id="url" crop="end"
ondragstart="var dt = event.dataTransfer; dt.setData('text/x-moz-url', this.value); dt.setData('text/uri-list', this.value); dt.setData('text/plain', this.value);"/> ondragstart="var dt = event.dataTransfer; dt.setData('text/x-moz-url', this.value); dt.setData('text/uri-list', this.value); dt.setData('text/plain', this.value);"/>
@ -606,6 +602,7 @@
</row> </row>
</rows> </rows>
</grid> </grid>
</vbox>
<zoteronoteeditor id="attachment-note-editor" notitle="1" flex="1"/> <zoteronoteeditor id="attachment-note-editor" notitle="1" flex="1"/>

View File

@ -308,13 +308,13 @@
this._data = val; this._data = val;
var button = this._id('choose-button'); var button = this._id('choose-button');
if (this.showButton) {
button.label = Zotero.getString('sync.conflict.chooseThisVersion'); button.label = Zotero.getString('sync.conflict.chooseThisVersion');
if (this.showButton) {
button.onclick = () => this.parent.choosePane(this); button.onclick = () => this.parent.choosePane(this);
button.hidden = false; button.style.visibility = 'visible';
} }
else { else {
button.hidden = true; button.style.visibility = 'hidden';
} }
if (val.deleted) { if (val.deleted) {
@ -418,7 +418,7 @@
<xul:label value="&zotero.merge.deleted;"/> <xul:label value="&zotero.merge.deleted;"/>
</xul:hbox> </xul:hbox>
</xul:groupbox> </xul:groupbox>
<xul:button anonid="choose-button" hidden="true"/> <xul:button anonid="choose-button"/>
</xul:vbox> </xul:vbox>
</content> </content>
</binding> </binding>

View File

@ -1,16 +1,16 @@
#metadata {
padding: 5px 2px 2px 2px;
}
#title #title
{ {
font-weight: bold; font-weight: bold;
margin: 4px 5px 1px 5px !important;
padding: 0 2px 0 2px;
/* Don't collapse blank attachment titles, since it prevents renaming */ /* Don't collapse blank attachment titles, since it prevents renaming */
min-height: 1.25em; min-height: 1.25em;
} }
#url #metadata > label {
{ margin: 6px 10px 4px !important;
margin: 1px 5px 2px 5px !important;
padding: 0 2px 0 2px !important;
} }
#index-box #index-box

View File

@ -74,6 +74,10 @@ zoteromergepane *[anonid="delete-box"] {
-moz-box-pack: center; -moz-box-pack: center;
} }
zoteromergepane .groupbox-body {
padding: 0;
}
zoteromergepane[selected=true] groupbox caption { zoteromergepane[selected=true] groupbox caption {
color: red; color: red;
font-weight: bold; font-weight: bold;
@ -96,3 +100,7 @@ zoteromergepane div[anonid=parent-row] {
zoteromergepane div[anonid=parent-row] span { zoteromergepane div[anonid=parent-row] span {
font-weight: bold; font-weight: bold;
} }
zoteromergepane zoteronoteeditor {
margin: 10px 0 0;
}

View File

@ -24,6 +24,15 @@ html, body {
right: 0; right: 0;
} }
/* Adjustments for read-only mode */
.mce-container.readonly .mce-container-body .mce-edit-area {
top: 0;
}
.mce-container.readonly .mce-panel {
border: 0;
}
/* Shrink the buttons a bit */ /* Shrink the buttons a bit */
.mce-btn-small button { .mce-btn-small button {
padding-left: 3px !important; padding-left: 3px !important;

View File

@ -11,15 +11,19 @@
content_css: "css/note-content.css", content_css: "css/note-content.css",
entity_encoding: "raw", entity_encoding: "raw",
fix_list_elements: true, fix_list_elements: true,
readonly: true,
toolbar: false,
menubar: false, menubar: false,
resize: false, resize: false,
statusbar: false, statusbar: false,
init_instance_callback: function (ed) { init_instance_callback: function (ed) {
ed.setMode('readonly');
setLocale(ed); setLocale(ed);
zoteroInit(ed); zoteroInit(ed);
ed.getContainer().classList.add('readonly');
}, },
// More restrictive version of default set, with JS/etc. removed // More restrictive version of default set, with JS/etc. removed