[FIX] web_editor: prevent crash when inserting empty string
Before this commit, when unsing the function `insert()` with data being an empty string, the function crashed but shouldn't. task-2833740 X-original-commit: d44302550ddc027d4891ad04bf16c364e171e5ad Part-of: odoo/odoo#89932
This commit is contained in:
@@ -46,6 +46,9 @@ const TEXT_CLASSES_REGEX = /\btext-[^\s]*\b/g;
|
||||
const BG_CLASSES_REGEX = /\bbg-[^\s]*\b/g;
|
||||
|
||||
function insert(editor, data, isText = true) {
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
const selection = editor.document.getSelection();
|
||||
const range = selection.getRangeAt(0);
|
||||
let currentNode;
|
||||
|
||||
Reference in New Issue
Block a user