Bug 894715 - Part 2 - Fix trimming issue. r=ally

This commit is contained in:
Jonathan Wilde 2013-08-09 22:42:55 -07:00
Родитель 5457da45c5
Коммит d7dfa04b5f
3 изменённых файлов: 13 добавлений и 10 удалений

Просмотреть файл

@ -37,8 +37,9 @@ var ContextCommands = {
cut: function cc_cut() {
let target = ContextMenuUI.popupState.target;
if (!target)
if (!target) {
return;
}
if (target.localName === "browser") {
// content
@ -49,7 +50,7 @@ var ContextCommands = {
}
} else {
// chrome
target.editor.cut();
CommandUpdater.doCommand("cmd_cut");
}
target.focus();
@ -58,8 +59,9 @@ var ContextCommands = {
copy: function cc_copy() {
let target = ContextMenuUI.popupState.target;
if (!target)
if (!target) {
return;
}
if (target.localName == "browser") {
// content
@ -72,7 +74,7 @@ var ContextCommands = {
this.clipboard.copyString(ContextMenuUI.popupState.string, this.docRef);
} else {
// chrome
target.editor.copy();
CommandUpdater.doCommand("cmd_copy");
}
target.focus();
@ -80,6 +82,11 @@ var ContextCommands = {
paste: function cc_paste() {
let target = ContextMenuUI.popupState.target;
if (!target) {
return;
}
if (target.localName == "browser") {
// content
let x = ContextMenuUI.popupState.x;
@ -89,7 +96,7 @@ var ContextCommands = {
SelectionHelperUI.closeEditSession();
} else {
// chrome
target.editor.paste(Ci.nsIClipboard.kGlobalClipboard);
CommandUpdater.doCommand("cmd_paste");
target.focus();
}
},

Просмотреть файл

@ -260,10 +260,6 @@
if (selectionStart != selectionEnd) {
json.types.push("cut");
json.types.push("copy");
json.string = aTextbox.value.slice(selectionStart, selectionEnd);
} else if (aTextbox.value) {
json.types.push("copy-all");
json.string = aTextbox.value;
}
if (selectionStart > 0 || selectionEnd < aTextbox.textLength)

Просмотреть файл

@ -157,7 +157,7 @@
<![CDATA[
// Grab the actual input field's value, not our value, which could include moz-action:
let inputVal = this.inputField.value;
let selectedVal = inputVal.substring(this.selectionStart, this.electionEnd);
let selectedVal = inputVal.substring(this.selectionStart, this.selectionEnd);
// If the selection doesn't start at the beginning or doesn't span the full domain or
// the URL bar is modified, nothing else to do here.