ckeditor / ckeditor5

Powerful rich text editor framework with a modular architecture, modern integrations, and features like collaborative editing.
https://ckeditor.com/ckeditor-5
Other
9.47k stars 3.7k forks source link

To prevent "ResizeObserver loop limit exceeded" from chrome browser #7371

Open higty opened 4 years ago

higty commented 4 years ago

📝 Provide a description of the improvement

To prevent "ResizeObserver loop limit exceeded" from chrome browser, change internal logic of DynamicGrouping class.

` _enableGroupingOnResize() { let previousWidth;

// TODO: Consider debounce.
this.resizeObserver = new ResizeObserver( this.viewElement, entry => {
    window.requestAnimationFrame(() => {
        if (!previousWidth || previousWidth !== entry.contentRect.width || this.shouldUpdateGroupingOnNextResize) {
            this.shouldUpdateGroupingOnNextResize = false;

            this._updateGrouping();

            previousWidth = entry.contentRect.width;
        }
    });
} );

this._updateGrouping();

} ` FYI https://stackoverflow.com/questions/49384120/resizeobserver-loop-limit-exceeded

regards.

MCMicS commented 4 years ago

Same here. If someone dosn't need the auto group feature it can be disabled with:

        balloonToolbar: {
        items: [ 'bold', 'italic', 'undo', 'redo' ],
        shouldNotGroupWhenFull: true
    },

This also works for toolbar, and blockToolbar