soccerloway / quill-better-table

Module for better table in Quill, more useful features are supported.
MIT License
316 stars 119 forks source link

Insert row in table causes page to jump to top #63

Open JennyZYBai opened 4 years ago

JennyZYBai commented 4 years ago

when insert row up/down inside a table will take the scroll bar to top.

https://codepen.io/soccerloway/pen/WWJowj Try inset multiple table to have a scroll bar shown on the right, scroll to the bottom table then click inside a table cell and select insert row up. It insets a new row but will take the view to top of the page.

Any one have idea how to stop the page jump?

akkayaburak commented 1 year ago
document.querySelectorAll(".ql-picker").forEach(tool => {
      tool.addEventListener("mousedown", function (event) {
        event.preventDefault();
        event.stopPropagation();
      });
    });

add this to your componentDidMount and componentDidUpdate

huarse commented 7 months ago
document.addEventListener('mousedown', e => {
  const composedPath = e.composedPath();
  for (let i = 0, j = composedPath.length; i < j; i++) {
    const item = composedPath[i];
    if (item === document.body || item === document) return;
    if (item.classList && item.classList.contains('qlbt-operation-menu-item')) {
      e.preventDefault();
    }
  }
});