mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-05 22:05:40 +00:00
Bug 741734 - Fire the paste event when pasting without formatting; r=roc
This commit is contained in:
parent
82fdcd0c8e
commit
4625beffc7
@ -1624,6 +1624,9 @@ NS_IMETHODIMP nsHTMLEditor::PasteTransferable(nsITransferable *aTransferable)
|
||||
//
|
||||
NS_IMETHODIMP nsHTMLEditor::PasteNoFormatting(PRInt32 aSelectionType)
|
||||
{
|
||||
if (!FireClipboardEvent(NS_PASTE))
|
||||
return NS_OK;
|
||||
|
||||
ForceCompositionEnd();
|
||||
|
||||
// Get Clipboard Service
|
||||
|
@ -21,6 +21,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=410986
|
||||
|
||||
/** Test for Bug 410986 **/
|
||||
|
||||
var gPasteEvents = 0;
|
||||
document.getElementById("editor").addEventListener("paste", function() {
|
||||
++gPasteEvents;
|
||||
}, false);
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.waitForFocus(function() {
|
||||
getSelection().selectAllChildren(document.getElementById("contents"));
|
||||
@ -37,6 +42,7 @@ SimpleTest.waitForFocus(function() {
|
||||
synthesizeKey("V", {accelKey: true, shiftKey: true});
|
||||
}
|
||||
is(ed.innerHTML, "green text", "Content should be pasted in plaintext format");
|
||||
is(gPasteEvents, 1, "One paste event must be fired");
|
||||
|
||||
ed.innerHTML = "";
|
||||
ed.blur();
|
||||
@ -51,6 +57,7 @@ SimpleTest.waitForFocus(function() {
|
||||
synthesizeKey("V", {accelKey: true});
|
||||
isnot(ed.innerHTML.indexOf("<span style=\"color: green;\">green text</span>"), -1,
|
||||
"Content should be pasted in HTML format");
|
||||
is(gPasteEvents, 2, "Two paste events must be fired");
|
||||
|
||||
SimpleTest.finish();
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user