
The addition of formatting in comments broke a variety of things having to do with the copying logic. This change updates the logic and tests to reflect the new DOM. This issue arose because of a lack of integration tests for copying and selection. That test is coming in a descendant change. Bug: Issue 4969 Change-Id: I4e1994ab07947506c77b07877a46a9369d666d50
53 lines
1.6 KiB
HTML
53 lines
1.6 KiB
HTML
<!--
|
|
Copyright (C) 2016 The Android Open Source Project
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
-->
|
|
<link rel="import" href="../bower_components/polymer/polymer.html">
|
|
<link rel="import" href="../bower_components/iron-a11y-keys-behavior/iron-a11y-keys-behavior.html">
|
|
|
|
<script>
|
|
(function(window) {
|
|
'use strict';
|
|
|
|
var getKeyboardEvent = function(e) {
|
|
return Polymer.dom(e.detail ? e.detail.keyboardEvent : e).event;
|
|
};
|
|
|
|
var KeyboardShortcutBehaviorImpl = {
|
|
modifierPressed: function(e) {
|
|
e = getKeyboardEvent(e);
|
|
return e.altKey || e.ctrlKey || e.metaKey || e.shiftKey;
|
|
},
|
|
|
|
shouldSuppressKeyboardShortcut: function(e) {
|
|
e = getKeyboardEvent(e);
|
|
if (e.path[0].tagName === 'INPUT' || e.path[0].tagName === 'TEXTAREA') {
|
|
return true;
|
|
}
|
|
for (var i = 0; i < e.path.length; i++) {
|
|
if (e.path[i].tagName === 'GR-OVERLAY') { return true; }
|
|
}
|
|
return false;
|
|
},
|
|
};
|
|
|
|
window.Gerrit = window.Gerrit || {};
|
|
/** @polymerBehavior Gerrit.KeyboardShortcutBehavior */
|
|
window.Gerrit.KeyboardShortcutBehavior = [
|
|
Polymer.IronA11yKeysBehavior,
|
|
KeyboardShortcutBehaviorImpl,
|
|
];
|
|
})(window);
|
|
</script>
|