Skip to content

Commit

Permalink
[FIX] web_editor: prevent crash when dropping snippets
Browse files Browse the repository at this point in the history
For some unknown reasons, the editor sometimes crashes when dropping a
snippet. As a temporary fix, the non-critical line that causes the
problem is try/catch protected by this commit.
  • Loading branch information
qsm-odoo committed Jan 25, 2018
1 parent d29c2db commit 78a5566
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion addons/web_editor/static/src/js/rte.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,15 @@ var RTE = Widget.extend({
} else {
rng = $editable.data('range') || rng;
}
rng.select();
try {
// TODO this line might break for unknown reasons. I suppose that
// the created range is an invalid one. As it might be tricky to
// adapt that line and that it is not a critical one, temporary fix
// is to ignore the errors that this generates.
rng.select();
} catch (e) {
console.log('error', e);
}
history.recordUndo($editable, event, internal_history);
},
/**
Expand Down

0 comments on commit 78a5566

Please sign in to comment.