Browse Source

[editor] Allow selection from the history without replacing the current query

Johan Ahlen 10 years ago
parent
commit
b4318b413b

+ 1 - 1
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -426,7 +426,7 @@ ${ require.config() }
           </tr>
         </thead>
         <tbody data-bind="foreach: $parent.history">
-          <tr class="pointer" data-bind="click: function(){ $parent.ace().setValue(query); history.pushState(null, null, url); $('.right-panel').animate({ scrollTop: '0px' }); }">
+          <tr class="pointer" data-bind="click: function() { if (getSelection().toString().length == 0) { $parent.ace().setValue(query); history.pushState(null, null, url); $('.right-panel').animate({ scrollTop: '0px' }); } }">
             <td><code data-bind="text: query" style="white-space: normal"></code></td>
             <td style="width: 200px" class="muted"><span data-bind="text: moment(lastExecuted).format('LLL')"></span></td>
           </tr>