LoginSignup
1
0

More than 3 years have passed since last update.

Quillでペースト時にスクロール位置がジャンプしてしまう問題

Last updated at Posted at 2020-07-06

エディタライブラリのQuillで、テキストのペースト時などにスクロール位置がジャンプしてしまうことがある。
https://github.com/quilljs/quill

原因

どうやら、ペースト操作時にエディタがフォーカスを一瞬失うのが原因らしい。
テキストカラーなどの、ピッカー系の操作でも同じ現象が起こることがある。

解決策

この問題は、github上でも活発に議論されているようだが、私としてはこの方法がベストな解決策だと思う。

Quillの初期化時のオプションに scrollingContainer: document.documentElement を指定する。

const editor = new Quill('#editor', {
  modules: {
    toolbar: ['bold', 'italic', 'underline', 'strike'],
  },
  scrollingContainer: document.documentElement,
  theme: 'bubble'
});

参考

いくつか他の対応策も提示されています。
https://github.com/quilljs/quill/issues/1374

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0