Restore custom note styling

Fixes #2560
This commit is contained in:
Martynas Bagdonas 2022-04-21 13:17:04 +07:00
parent f91ca9c18a
commit a8cb9bfddd
2 changed files with 15 additions and 3 deletions

View file

@ -76,6 +76,7 @@ class EditorInstance {
this._prefObserverIDs = [
Zotero.Prefs.registerObserver('note.fontSize', this._handleFontChange),
Zotero.Prefs.registerObserver('note.fontFamily', this._handleFontChange),
Zotero.Prefs.registerObserver('note.css', this._handleStyleChange),
Zotero.Prefs.registerObserver('layout.spellcheckDefault', this._handleSpellCheckChange, true)
];
@ -99,6 +100,12 @@ class EditorInstance {
this._iframeWindow.document.execCommand('enableObjectResizing', false, 'false');
this._iframeWindow.document.execCommand('enableInlineTableEditing', false, 'false');
let style = Zotero.Prefs.get('note.css');
if (style) {
Zotero.debug('Using a custom CSS style:');
Zotero.debug(style);
}
this._postMessage({
action: 'init',
value: this._state || this._item.note,
@ -112,6 +119,7 @@ class EditorInstance {
placeholder: options.placeholder,
dir: Zotero.dir,
font: this._getFont(),
style,
localizedStrings: {
// Figure out a better way to pass this
'zotero.appName': Zotero.appName,
@ -209,8 +217,12 @@ class EditorInstance {
}
_handleFontChange = () => {
this._postMessage({ action: 'updateFont', font: this._getFont() });
}
this._postMessage({ action: 'setFont', font: this._getFont() });
};
_handleStyleChange = () => {
this._postMessage({ action: 'setStyle', style: Zotero.Prefs.get('note.css') });
};
_handleSpellCheckChange = () => {
try {

@ -1 +1 @@
Subproject commit d23f45a0cf6502eacb583b6667add5c97e29c8e7
Subproject commit c0140fbc7b9f44aa6f63d371c53615cb234a6b51