1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 22:38:00 +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", { var CommandWidgets = Class("CommandWidgets", {
init: function () { init: function () {
let _commandline = "if (window.dactyl) return dactyl.modules.commandline";
let _status = "dactyl-statusline-field-"; let _status = "dactyl-statusline-field-";
util.overlayWindow(window, { util.overlayWindow(window, {
@@ -38,21 +37,21 @@ var CommandWidgets = Class("CommandWidgets", {
<iframe id="dactyl-multiline-output" src="chrome://dactyl/content/buffer.xhtml" <iframe id="dactyl-multiline-output" src="chrome://dactyl/content/buffer.xhtml"
flex="1" hidden="false" collapsed="false" flex="1" hidden="false" collapsed="false"
contextmenu="dactyl-contextmenu" contextmenu="dactyl-contextmenu"
onclick={_commandline + ".onMultilineOutputEvent(event)"}/> onclick="dactyl.modules.commandline.onMultilineOutputEvent(event)"/>
</vbox> </vbox>
<vbox class="dactyl-container" hidden="false" collapsed="true"> <vbox class="dactyl-container" hidden="false" collapsed="true">
<iframe class="dactyl-completions" id="dactyl-completions-dactyl-commandline" src="chrome://dactyl/content/buffer.xhtml" <iframe class="dactyl-completions" id="dactyl-completions-dactyl-commandline" src="chrome://dactyl/content/buffer.xhtml"
contextmenu="dactyl-contextmenu" contextmenu="dactyl-contextmenu"
flex="1" hidden="false" collapsed="false" flex="1" hidden="false" collapsed="false"
onclick={_commandline + ".onMultilineOutputEvent(event)"}/> onclick="dactyl.modules.commandline.onMultilineOutputEvent(event)"/>
</vbox> </vbox>
<vbox id={"dactyl-completions-" + _status + "commandline-container"} class="dactyl-container" hidden="false" collapsed="true" insertbefore="addon-bar,status-bar"> <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" <iframe class="dactyl-completions" id={"dactyl-completions-" + _status + "commandline"} src="chrome://dactyl/content/buffer.xhtml"
contextmenu="dactyl-contextmenu" contextmenu="dactyl-contextmenu"
flex="1" hidden="false" collapsed="false" flex="1" hidden="false" collapsed="false"
onclick={_commandline + ".onMultilineOutputEvent(event)"}/> onclick="dactyl.modules.commandline.onMultilineOutputEvent(event)"/>
</vbox> </vbox>
<stack orient="horizontal" align="stretch" class="dactyl-container" id="dactyl-container" highlight="CmdLine CmdCmdLine"> <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"> <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"/> <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" <textbox id="dactyl-commandline-command" class="dactyl-commandline-command plain" flex="1" type="input" timeout="100"
oninput={_commandline + ".onEvent(event);"} onkeyup={_commandline + ".onEvent(event);"} oninput="dactyl.modules.commandline.onEvent(event);"
onfocus={_commandline + ".onEvent(event);"} onblur={_commandline + ".onEvent(event);"}/> onkeyup="dactyl.modules.commandline.onEvent(event);"
onfocus="dactyl.modules.commandline.onEvent(event);"
onblur="dactyl.modules.commandline.onEvent(event);"/>
</hbox> </hbox>
</stack> </stack>
<vbox class="dactyl-container" hidden="false" collapsed="false" highlight="CmdLine"> <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" <textbox id="dactyl-multiline-input" class="plain" flex="1" rows="1" hidden="false" collapsed="true" multiline="true"
highlight="Normal" highlight="Normal"
onkeypress={_commandline + ".onMultilineInputEvent(event);"} oninput={_commandline + ".onMultilineInputEvent(event);"} onkeypress="dactyl.modules.commandline.onMultilineInputEvent(event);"
onblur={_commandline + ".onMultilineInputEvent(event);"}/> oninput="dactyl.modules.commandline.onMultilineInputEvent(event);"
onblur="dactyl.modules.commandline.onMultilineInputEvent(event);"/>
</vbox> </vbox>
</vbox> </vbox>
</e4x>.elements() </e4x>.elements()

View File

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

View File

@@ -1129,7 +1129,7 @@ var Hints = Module("hints", {
"XPath strings of hintable elements for extended hint modes", "XPath strings of hintable elements for extended hint modes",
"regexpmap", "[iI]:" + xpath(["img"]) + "regexpmap", "[iI]:" + xpath(["img"]) +
",[OTivVWy]:" + xpath(["{a,area}[@href]", "{img,iframe}[@src]"]) + ",[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"]), ",[S]:" + xpath(["input[not(@type='hidden')]", "textarea", "button", "select"]),
{ validator: Option.validateXPath }); { validator: Option.validateXPath });