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.displayAccessed = true;
this.displayNote = true;
this.displayButton = true;
this.displayDateModified = true;
break;
@ -346,28 +345,24 @@
// Note editor
var noteEditor = this._id('attachment-note-editor');
if (this.displayNote) {
if (this.displayNoteIfEmpty || this.item.getNote() != '') {
Zotero.debug("setting links on top");
noteEditor.linksOnTop = true;
noteEditor.hidden = false;
// Don't make note editable (at least for now)
if (this.mode == 'merge' || this.mode == 'mergeedit') {
noteEditor.mode = 'merge';
noteEditor.displayButton = false;
}
else {
noteEditor.mode = this.mode;
}
noteEditor.parent = null;
noteEditor.item = this.item;
if (this.displayNote && (this.displayNoteIfEmpty || this.item.getNote() != '')) {
noteEditor.linksOnTop = true;
noteEditor.hidden = false;
// Don't make note editable (at least for now)
if (this.mode == 'merge' || this.mode == 'mergeedit') {
noteEditor.mode = 'merge';
noteEditor.displayButton = false;
}
else {
noteEditor.mode = this.mode;
}
noteEditor.parent = null;
noteEditor.item = this.item;
}
else {
noteEditor.hidden = true;
}
if (this.displayButton) {
selectButton.label = this.buttonCaption;
@ -572,40 +567,42 @@
<content>
<vbox id="attachment-box" flex="1" orient="vertical"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<label id="title"/>
<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);"/>
<grid>
<columns>
<column/>
<column flex="1"/>
</columns>
<rows>
<row id="fileNameRow">
<label id="fileName-label"/>
<label id="fileName" crop="end"/>
</row>
<row id="accessedRow">
<label id="accessed-label"/>
<label id="accessed"/>
</row>
<row id="pagesRow">
<label id="pages-label"/>
<label id="pages"/>
</row>
<row id="dateModifiedRow" hidden="true">
<label id="dateModified-label"/>
<label id="dateModified"/>
</row>
<row id="indexStatusRow">
<label id="index-status-label"/>
<hbox>
<label id="index-status"/>
<image id="reindex" onclick="this.hidden = true; setTimeout(function () { ZoteroPane_Local.reindexItem(); }, 50)"/>
</hbox>
</row>
</rows>
</grid>
<vbox id="metadata">
<label id="title"/>
<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);"/>
<grid>
<columns>
<column/>
<column flex="1"/>
</columns>
<rows>
<row id="fileNameRow">
<label id="fileName-label"/>
<label id="fileName" crop="end"/>
</row>
<row id="accessedRow">
<label id="accessed-label"/>
<label id="accessed"/>
</row>
<row id="pagesRow">
<label id="pages-label"/>
<label id="pages"/>
</row>
<row id="dateModifiedRow" hidden="true">
<label id="dateModified-label"/>
<label id="dateModified"/>
</row>
<row id="indexStatusRow">
<label id="index-status-label"/>
<hbox>
<label id="index-status"/>
<image id="reindex" onclick="this.hidden = true; setTimeout(function () { ZoteroPane_Local.reindexItem(); }, 50)"/>
</hbox>
</row>
</rows>
</grid>
</vbox>
<zoteronoteeditor id="attachment-note-editor" notitle="1" flex="1"/>

View file

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

View file

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

View file

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

View file

@ -24,6 +24,15 @@ html, body {
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 */
.mce-btn-small button {
padding-left: 3px !important;

View file

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