madebymany / sir-trevor-js

Rich content editing entirely re-imagined for the web
http://madebymany.github.io/sir-trevor-js/
MIT License
4.51k stars 399 forks source link

Browser tab stops responding and tab CPU usage goes 100% #591

Open kullarkert opened 2 years ago

kullarkert commented 2 years ago

I have latest version v0.9.0-beta8.

When changing text to heading and back several time browser tab stops responding and tab CPU goes to 100%.

Before latest version there was same problem but with larger scale. When trying to add new block between blocks and not entering text right away then tab stops responding.

Tried with: Latest Chrome Microsoft Edge Brave Mozilla

Edit: This seems to be related with div focusing and causing tab to unrespond. In older version(not sure with version, since compiled js does not have version number) this line causes crash and I had to comment out focusing part.

focus: function focus() {
    Array.prototype.forEach.call(this.getTextBlock(), function (el) {
      //el.focus();
    });
  }

I assume that div must have tabindex and if not then browser will crash.