Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: chrome/content/ui/filters-filteractions.js

Issue 4834220086132736: Issue 256 - Home/End keys are broken when editing a filter (Closed)
Patch Set: Created May 8, 2014, 6:59 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 15 matching lines...) Expand all
26 */ 26 */
27 init: function() 27 init: function()
28 { 28 {
29 let me = this; 29 let me = this;
30 this.treeElement.parentNode.addEventListener("keypress", function(event) 30 this.treeElement.parentNode.addEventListener("keypress", function(event)
31 { 31 {
32 me.keyPress(event); 32 me.keyPress(event);
33 }, true); 33 }, true);
34 this.treeElement.view = FilterView; 34 this.treeElement.view = FilterView;
35 35
36 this.treeElement.inputField.addEventListener("keypress", function(event) 36 // Work around https://bugzilla.mozilla.org/show_bug.cgi?id=777832, don't
37 // allow the tree to receive keypress/keydown events triggered by cursor
38 // keys pressed in the editor, it will call preventDefault() on them.
39 let propagationStopper = function(event)
37 { 40 {
38 // Prevent the tree from capturing cursor keys pressed in the input field
39 if (event.keyCode >= event.DOM_VK_PAGE_UP && event.keyCode <= event.DOM_VK _DOWN) 41 if (event.keyCode >= event.DOM_VK_PAGE_UP && event.keyCode <= event.DOM_VK _DOWN)
40 event.stopPropagation(); 42 event.stopPropagation();
41 }, false); 43 };
44
45 this.treeElement.inputField.addEventListener("keypress", propagationStopper, false);
46 this.treeElement.inputField.addEventListener("keydown", propagationStopper, false);
42 47
43 // Create a copy of the view menu 48 // Create a copy of the view menu
44 function fixId(node, newId) 49 function fixId(node, newId)
45 { 50 {
46 if (node.nodeType == node.ELEMENT_NODE) 51 if (node.nodeType == node.ELEMENT_NODE)
47 { 52 {
48 if (node.hasAttribute("id")) 53 if (node.hasAttribute("id"))
49 node.setAttribute("id", node.getAttribute("id").replace(/\d+$/, newId) ); 54 node.setAttribute("id", node.getAttribute("id").replace(/\d+$/, newId) );
50 55
51 for (let i = 0, len = node.childNodes.length; i < len; i++) 56 for (let i = 0, len = node.childNodes.length; i < len; i++)
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 return; 552 return;
548 553
549 this.deleteItems(this.dragItems); 554 this.deleteItems(this.dragItems);
550 } 555 }
551 }; 556 };
552 557
553 window.addEventListener("load", function() 558 window.addEventListener("load", function()
554 { 559 {
555 FilterActions.init(); 560 FilterActions.init();
556 }, false); 561 }, false);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld