[FIX] web_editor: can't unquote on firefox
Firefox when asked to block format (formatting over a block with blockquote, h1, ...) has a special case for blockquote (it is documented in https://developer.mozilla.org/docs/Web/API/Document/execCommand at formatBlock command) and will wrap any element instead of replacing existing block formatting. Thus the code not expecting it was not able to remove a blockquote in firefox once introduced. opw-1903735 closes #28587
This commit is contained in:
@@ -1913,6 +1913,10 @@ $.summernote.pluginEvents.formatBlock = function (event, editor, layoutInfo, sTa
|
||||
for (var i=0; i<nodes.length; i++) {
|
||||
if (dom.isBR(nodes[i]) || (dom.isText(nodes[i]) && dom.isVisibleText(nodes[i])) || dom.isB(nodes[i]) || dom.isU(nodes[i]) || dom.isS(nodes[i]) || dom.isI(nodes[i]) || dom.isFont(nodes[i])) {
|
||||
var ancestor = dom.ancestor(nodes[i], isFormatNode);
|
||||
if ($(ancestor).parent().is('blockquote')) {
|
||||
// firefox may wrap formatting block in blockquote
|
||||
$(ancestor).unwrap();
|
||||
}
|
||||
if (!ancestor) {
|
||||
dom.wrap(nodes[i], sTagName);
|
||||
} else if (ancestor.tagName.toLowerCase() !== sTagName) {
|
||||
|
||||
Reference in New Issue
Block a user