mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
Bug 1728566 - Make the HTMLEditor::InsertParagraphSeparatorAsSubAction
callers compute the editing host no limited in the <body>
r=m_kato
While handling an "insertParagraph" command, it's closed at least in the editing host. Therefore, it's file to use editing host outside `<body>` because it won't make the tree messy outside the editing host. Differential Revision: https://phabricator.services.mozilla.com/D213376
This commit is contained in:
parent
9e46b7e834
commit
ae22ac0c53
@ -1521,7 +1521,8 @@ NS_IMETHODIMP HTMLEditor::InsertLineBreak() {
|
||||
return EditorBase::ToGenericNSResult(rv);
|
||||
}
|
||||
|
||||
const RefPtr<Element> editingHost = ComputeEditingHost();
|
||||
const RefPtr<Element> editingHost =
|
||||
ComputeEditingHost(LimitInBodyElement::No);
|
||||
if (!editingHost) {
|
||||
return NS_SUCCESS_DOM_NO_OPERATION;
|
||||
}
|
||||
@ -1568,7 +1569,8 @@ nsresult HTMLEditor::InsertParagraphSeparatorAsAction(
|
||||
return EditorBase::ToGenericNSResult(rv);
|
||||
}
|
||||
|
||||
const RefPtr<Element> editingHost = ComputeEditingHost();
|
||||
const RefPtr<Element> editingHost =
|
||||
ComputeEditingHost(LimitInBodyElement::No);
|
||||
if (!editingHost) {
|
||||
return NS_SUCCESS_DOM_NO_OPERATION;
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
const dl = document.createElement("dl");
|
||||
const dd = document.createElement("dd");
|
||||
const p = document.createElement("p");
|
||||
dd.appendChild(p);
|
||||
dl.appendChild(dd);
|
||||
document.documentElement.appendChild(dl);
|
||||
dl.contentEditable = true;
|
||||
getSelection().collapse(p, 0);
|
||||
document.execCommand("insertParagraph");
|
||||
}, {once: true});
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user