Fix clipboard monitor not persisting (#1315)
* Add optionsUpdated event to Display * Update this._clipboardMonitorEnabled * Update settings to ensure no unexpected behaviour
This commit is contained in:
parent
981f73b562
commit
34fed22ccb
@ -670,6 +670,7 @@ class OptionsUtil {
|
||||
// Updated global.useSettingsV2 to be true (opt-out).
|
||||
// Added audio.customSourceType.
|
||||
// Added general.autoSearchClipboardContent.
|
||||
// Forced general.enableClipboardMonitor to false due to a bug which caused its value to not be read.
|
||||
await this._addFieldTemplatesToOptions(options, '/bg/data/anki-field-templates-upgrade-v8.handlebars');
|
||||
options.global.useSettingsV2 = true;
|
||||
for (const profile of options.profiles) {
|
||||
@ -730,6 +731,7 @@ class OptionsUtil {
|
||||
};
|
||||
profile.options.audio.customSourceType = 'audio';
|
||||
profile.options.general.autoSearchClipboardContent = true;
|
||||
profile.options.general.enableClipboardMonitor = false;
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ class DisplaySearch extends Display {
|
||||
await this.updateOptions();
|
||||
yomichan.on('optionsUpdated', this._onOptionsUpdated.bind(this));
|
||||
|
||||
this.on('optionsUpdated', this._onDisplayOptionsUpdated.bind(this));
|
||||
this.on('contentUpdating', this._onContentUpdating.bind(this));
|
||||
this.on('modeChange', this._onModeChange.bind(this));
|
||||
|
||||
@ -76,6 +77,7 @@ class DisplaySearch extends Display {
|
||||
this.hotkeyHandler.on('keydownNonHotkey', this._onKeyDown.bind(this));
|
||||
|
||||
this._onModeChange();
|
||||
this._onDisplayOptionsUpdated();
|
||||
|
||||
this.initializeState();
|
||||
|
||||
@ -123,6 +125,11 @@ class DisplaySearch extends Display {
|
||||
}
|
||||
}
|
||||
|
||||
_onDisplayOptionsUpdated({options}) {
|
||||
this._clipboardMonitorEnabled = options.general.enableClipboardMonitor;
|
||||
this._updateClipboardMonitorEnabled();
|
||||
}
|
||||
|
||||
_onContentUpdating({type, content, source}) {
|
||||
let animate = false;
|
||||
let valid = false;
|
||||
|
@ -313,6 +313,8 @@ class Display extends EventDispatcher {
|
||||
|
||||
this._updateNestedFrontend(options);
|
||||
this._updateDefinitionTextScanner(options);
|
||||
|
||||
this.trigger('optionsUpdated', {options});
|
||||
}
|
||||
|
||||
clearAutoPlayTimer() {
|
||||
|
Loading…
Reference in New Issue
Block a user