Issue #737💬 AnsweredOpened January 10, 2018by austinbiggs0 reactions

While dragging, increase the "range" of the auto-scrolling

快速解答by austinbiggs

I was able to accomplish this by changing the value of the variable limitTop.

Read full answer below ↓

Question

Is it possible to increase the "range" of the vertical auto-scrolling.

Already, when a user is in the top x% of the window (while dragging) the editor will scroll up. The same is true for scrolling down of course.

What I'm curious about, is where this is controlled? I'm not sure what to search besides "scroll" or potentially "scrolltop". Both of which didn't help me find what I'm looking for.

Does anyone know on what lines the code for this is on?

Answers (2)

austinbiggsJanuary 10, 2018

I was able to accomplish this by changing the value of the variable limitTop.

      e.preventDefault();
      if (this.dragging) {
        var frameWindow = this.getFrameEl().contentWindow;
        var actualTop = frameWindow.document.body.scrollTop;
        var nextTop = actualTop;
        var clientY = e.clientY;
        var limitTop = 150;
        var limitBottom = frameRect.height - limitTop;

        if (clientY < limitTop) {
          nextTop -= limitTop - clientY;
        }

        if (clientY > limitBottom) {
          nextTop += clientY - limitBottom;
        }

        //console.log(`actualTop: ${actualTop} clientY: ${clientY} nextTop: ${nextTop} frameHeigh: ${frameRect.height}`);
        frameWindow.scrollTo(0, nextTop);
      }
    },```
lock[bot]September 18, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.