From 7d5f6cdbfdf6fdeae216ff92288dffb50dea0af5 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 19 Jul 2019 23:09:54 -0400 Subject: [PATCH] Transform Short Title case as well when transforming Title --- chrome/content/zotero/bindings/itembox.xml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/bindings/itembox.xml b/chrome/content/zotero/bindings/itembox.xml index b1b2c81342..cb9cccc4e7 100644 --- a/chrome/content/zotero/bindings/itembox.xml +++ b/chrome/content/zotero/bindings/itembox.xml @@ -2085,7 +2085,17 @@ throw ("Invalid transform mode '" + mode + "' in zoteroitembox.textTransform()"); } this._setFieldValue(label, newVal); - this._modifyField(label.getAttribute('fieldname'), newVal); + var fieldName = label.getAttribute('fieldname'); + this._modifyField(fieldName, newVal); + + // If this is a title field, convert the Short Title too + var isTitle = Zotero.ItemFields.getBaseIDFromTypeAndField( + this.item.itemTypeID, fieldName) == Zotero.ItemFields.getID('title'); + var shortTitleVal = this.item.getField('shortTitle'); + if (isTitle && newVal.toLowerCase().startsWith(shortTitleVal.toLowerCase())) { + this._modifyField('shortTitle', newVal.substr(0, shortTitleVal.length)); + } + if (this.saveOnEdit) { // If a field is open, blur it, which will trigger a save and cause // the saveTx() to be a no-op