jhollingworth / bootstrap-wysihtml5

Simple, beautiful wysiwyg editor
http://jhollingworth.github.com/bootstrap-wysihtml5/
MIT License
4.14k stars 1.01k forks source link

Error: Failed to execute focus - on chrome v64 #391

Open mchabou opened 6 years ago

mchabou commented 6 years ago

Hello, We have a bug with chrome browser v64.0 when we click on buttons "insert link" or "insert image" : bootstrap-wysihtml5.min.js Uncaught TypeError: Failed to execute 'focus' on 'HTMLElement': parameter 1 ('options') is not an object.

capture du 2018-02-14 16-22-38 capture du 2018-02-14 16-24-14

To fix temporarily this, we had to make the following changes at lines 279 and 341

if (!activeButton) {
    self.editor.currentView.element.focus();    // instead of ...element.focus(false);
    caretBookmark = self.editor.composer.selection.getBookmark();

Can you do the necessary to fix this bug.

thank you

mchabou

lsarni commented 6 years ago

I created an issue #390 but when we updated to the latest version and this was fixed. We use this gem bootstrap-wysihtml5-rails and upgraded from 0.3.1.23 to 0.3.3.8.

michalmarek-sk commented 6 years ago

Hi guys, I patched it by inserting empty object instead of boolean value. self.editor.currentView.element.focus({});

MasterAlchemist commented 6 years ago

@michalmarek-sk Thank you very much! It solved my problem! :)