1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 20:27:58 +01:00

Check <pre/> and <code/> elements in ;F.

--HG--
branch : bootstrapped
This commit is contained in:
Kris Maglione
2010-12-27 09:28:40 -05:00
parent fff482a539
commit eed4ddb74b
3 changed files with 23 additions and 13 deletions

View File

@@ -10,7 +10,6 @@
var CommandWidgets = Class("CommandWidgets", {
init: function () {
let _commandline = "if (window.dactyl) return dactyl.modules.commandline";
let _status = "dactyl-statusline-field-";
util.overlayWindow(window, {
@@ -38,21 +37,21 @@ var CommandWidgets = Class("CommandWidgets", {
<iframe id="dactyl-multiline-output" src="chrome://dactyl/content/buffer.xhtml"
flex="1" hidden="false" collapsed="false"
contextmenu="dactyl-contextmenu"
onclick={_commandline + ".onMultilineOutputEvent(event)"}/>
onclick="dactyl.modules.commandline.onMultilineOutputEvent(event)"/>
</vbox>
<vbox class="dactyl-container" hidden="false" collapsed="true">
<iframe class="dactyl-completions" id="dactyl-completions-dactyl-commandline" src="chrome://dactyl/content/buffer.xhtml"
contextmenu="dactyl-contextmenu"
flex="1" hidden="false" collapsed="false"
onclick={_commandline + ".onMultilineOutputEvent(event)"}/>
onclick="dactyl.modules.commandline.onMultilineOutputEvent(event)"/>
</vbox>
<vbox id={"dactyl-completions-" + _status + "commandline-container"} class="dactyl-container" hidden="false" collapsed="true" insertbefore="addon-bar,status-bar">
<iframe class="dactyl-completions" id={"dactyl-completions-" + _status + "commandline"} src="chrome://dactyl/content/buffer.xhtml"
contextmenu="dactyl-contextmenu"
flex="1" hidden="false" collapsed="false"
onclick={_commandline + ".onMultilineOutputEvent(event)"}/>
onclick="dactyl.modules.commandline.onMultilineOutputEvent(event)"/>
</vbox>
<stack orient="horizontal" align="stretch" class="dactyl-container" id="dactyl-container" highlight="CmdLine CmdCmdLine">
@@ -63,16 +62,19 @@ var CommandWidgets = Class("CommandWidgets", {
<hbox id="dactyl-commandline" hidden="false" class="dactyl-container" highlight="Normal CmdNormal" collapsed="true">
<label id="dactyl-commandline-prompt" class="dactyl-commandline-prompt plain" flex="0" crop="end" value="" collapsed="true"/>
<textbox id="dactyl-commandline-command" class="dactyl-commandline-command plain" flex="1" type="input" timeout="100"
oninput={_commandline + ".onEvent(event);"} onkeyup={_commandline + ".onEvent(event);"}
onfocus={_commandline + ".onEvent(event);"} onblur={_commandline + ".onEvent(event);"}/>
oninput="dactyl.modules.commandline.onEvent(event);"
onkeyup="dactyl.modules.commandline.onEvent(event);"
onfocus="dactyl.modules.commandline.onEvent(event);"
onblur="dactyl.modules.commandline.onEvent(event);"/>
</hbox>
</stack>
<vbox class="dactyl-container" hidden="false" collapsed="false" highlight="CmdLine">
<textbox id="dactyl-multiline-input" class="plain" flex="1" rows="1" hidden="false" collapsed="true" multiline="true"
highlight="Normal"
onkeypress={_commandline + ".onMultilineInputEvent(event);"} oninput={_commandline + ".onMultilineInputEvent(event);"}
onblur={_commandline + ".onMultilineInputEvent(event);"}/>
onkeypress="dactyl.modules.commandline.onMultilineInputEvent(event);"
oninput="dactyl.modules.commandline.onMultilineInputEvent(event);"
onblur="dactyl.modules.commandline.onMultilineInputEvent(event);"/>
</vbox>
</vbox>
</e4x>.elements()

View File

@@ -398,20 +398,19 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
},
focus: function focus(elem, flags) {
util.dump("focus(" + (elem instanceof Element ? util.objectToString(elem) : elem) + ")");
flags = flags || services.focus.FLAG_BYMOUSE;
try {
if (elem instanceof Document)
elem = elem.defaultView;
if (elem instanceof Window)
services.focus.focusedWindow = elem;
elem.focus();
else
services.focus.setFocus(elem, flags);
} catch (e) {
util.dump(elem);
util.reportError(e);
}
if (services.focus.focusedWindow == null)
util.dumpStack("focusedWindow == null");
},
/**
@@ -421,7 +420,10 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
* element.
*/
focusContent: function focusContent(clearFocusedElement) {
if (window != services.windowWatcher.activeWindow)
util.dump("focusContent(" + clearFocusedElement + ") " +
(window == services.focus.activeWindow));
if (window != services.focus.activeWindow)
return;
let win = document.commandDispatcher.focusedWindow;
@@ -443,10 +445,16 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
catch (e) {}
if (clearFocusedElement) {
util.dump("blur(" + (dactyl.focusedElement instanceof Element ? util.objectToString(dactyl.focusedElement)
: dactyl.focusedElement) +
")");
if (dactyl.focusedElement)
dactyl.focusedElement.blur();
if (win && Editor.getEditor(win)) {
util.dump("blur(" + win + ")");
win.blur();
if (win.frameElement)
util.dump("blur(" + util.objectToString(win.frameElement) + ")");
if (win.frameElement)
win.frameElement.blur();
}

View File

@@ -1129,7 +1129,7 @@ var Hints = Module("hints", {
"XPath strings of hintable elements for extended hint modes",
"regexpmap", "[iI]:" + xpath(["img"]) +
",[OTivVWy]:" + xpath(["{a,area}[@href]", "{img,iframe}[@src]"]) +
",[F]:" + xpath(["div", "span", "p", "body", "html"]) +
",[F]:" + xpath(["body", "code", "div", "html", "p", "pre", "span"]) +
",[S]:" + xpath(["input[not(@type='hidden')]", "textarea", "button", "select"]),
{ validator: Option.validateXPath });