зеркало из https://github.com/mozilla/pjs.git
bug 321000 - search bar should replace newlines in pasted text with spaces. r=gavin a=mconnor
This commit is contained in:
Родитель
1b54d23061
Коммит
eec27c5313
|
@ -283,7 +283,8 @@
|
|||
<toolbaritem id="search-container" title="&searchItem.title;"
|
||||
align="center" class="chromeclass-toolbar-additional"
|
||||
flex="100" persist="width">
|
||||
<searchbar id="searchbar" flex="1" chromedir="&locale.dir;"/>
|
||||
<searchbar id="searchbar" flex="1" chromedir="&locale.dir;"
|
||||
newlines="replacewithspaces"/>
|
||||
</toolbaritem>
|
||||
|
||||
<toolbarbutton id="print-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
|
||||
|
|
|
@ -98,7 +98,7 @@
|
|||
completeselectedindex="true"
|
||||
showcommentcolumn="true"
|
||||
tabscrolling="true"
|
||||
xbl:inherits="disabled,disableautocomplete,searchengine,src">
|
||||
xbl:inherits="disabled,disableautocomplete,searchengine,src,newlines">
|
||||
</xul:textbox>
|
||||
</xul:hbox>
|
||||
|
||||
|
|
|
@ -113,29 +113,34 @@
|
|||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_setNewlineHandling">
|
||||
<body><![CDATA[
|
||||
var str = this.getAttribute("newlines");
|
||||
if (str) {
|
||||
const nsIPlaintextEditor = Components.interfaces.nsIPlaintextEditor;
|
||||
for (var x in nsIPlaintextEditor) {
|
||||
if (/^eNewlines/.test(x)) {
|
||||
if (str == RegExp.rightContext.toLowerCase()) {
|
||||
this.editor.QueryInterface(nsIPlaintextEditor)
|
||||
.newlineHandling = nsIPlaintextEditor[x];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<constructor><![CDATA[
|
||||
var str = this.boxObject.getProperty("value");
|
||||
if (str) {
|
||||
this.inputField.value = str;
|
||||
this.boxObject.removeProperty("value");
|
||||
}
|
||||
#ifndef MOZILLA_1_8_BRANCH
|
||||
# bug 253481
|
||||
|
||||
str = this.getAttribute("newlines");
|
||||
if (str) {
|
||||
const nsIPlaintextEditor = Components.interfaces.nsIPlaintextEditor;
|
||||
for (var x in nsIPlaintextEditor) {
|
||||
if (/^eNewlines/.test(x)) {
|
||||
if (str == RegExp.rightContext.toLowerCase()) {
|
||||
this.editor.QueryInterface(nsIPlaintextEditor)
|
||||
.newlineHandling = nsIPlaintextEditor[x];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// this.editor may not be initialized yet in
|
||||
// bindings that inherit from xul:textbox, so
|
||||
// do this after construction
|
||||
setTimeout(function (a) { a._setNewlineHandling(); }, 0, this);
|
||||
]]></constructor>
|
||||
|
||||
<destructor>
|
||||
|
|
Загрузка…
Ссылка в новой задаче