mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-05-21 23:08:06 +00:00
notes view: make opening the editor on double-click opt-in
One can get some smart-selection behavior when double clicking text in browsers, e.g., whole-word selection, and the notes view is generally for having some text that is often copied, like hostnames or IP addresses. Opening the notes editor on double click is interfering with that select+copy workflow, so instead of hard-coding that make it opt-in, controlled by a setting from the browser-local storage. Add some handling to cope with live-changes to that setting, as having to re-open a panel to make it take effect is annoying and might make people believe that this is buggy. This new setting has (currently) to be handled by the per-product UI. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
bb5cc876ef
commit
f646c22a67
@ -112,7 +112,23 @@ Ext.define('Proxmox.panel.NotesView', {
|
||||
listeners: {
|
||||
render: function(c) {
|
||||
let me = this;
|
||||
let sp = Ext.state.Manager.getProvider();
|
||||
// to cover live changes to the browser setting
|
||||
me.mon(sp, 'statechange', function(provider, key, value) {
|
||||
if (value === null || key !== 'edit-notes-on-double-click') {
|
||||
return;
|
||||
}
|
||||
if (value) {
|
||||
me.getEl().on('dblclick', me.run_editor, me);
|
||||
} else {
|
||||
// there's only the me.run_editor listener, and removing just that did not work
|
||||
me.getEl().clearListeners();
|
||||
}
|
||||
});
|
||||
// to cover initial setting value
|
||||
if (sp.get('edit-notes-on-double-click', false)) {
|
||||
me.getEl().on('dblclick', me.run_editor, me);
|
||||
}
|
||||
},
|
||||
afterlayout: function() {
|
||||
let me = this;
|
||||
|
Loading…
Reference in New Issue
Block a user