In a Vue app, the Quill Editor experiences a slight scroll upwards when pasting large amounts of content

My editor.vue file is causing some issues

I attempted to recreate the auto-grow example from their playground

Even after adding a scrolling container and setting heights for elements, the problem persists.

<template>
  <div ref="scrollingContainer" class="scrolling-container">
    <div ref="editorNode" class="editor-node" :style="editorStyle" />
  </div>
</template>

<script>
import Quill from "quill";
export default {
  name: "App",
  props: {
    minHeight: {
      type: String,
      default: "450px",
    },
    scrollable: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      editorInstance: null,
      editorOpts: {
        modules: {
          toolbar: [
            [{ header: [1, 2, 3, false] }],
            ["bold", "italic", "underline"],
          ],
        },
        theme: "snow",
      },
    };
  },
  computed: {
    editorStyle() {
      var style = "min-height: " + this.minHeight + ";";
      if (this.scrollable) {
        style += "overflow-y:auto;";
        style += "max-height: " + this.minHeight + ";";
      }
      return style;
    },
  },
  mounted() {
    this.editorOpts["scrollingContainer"] = this.$refs.scrollingContainer;
    this.editorInstance = new Quill(this.$refs.editorNode, this.editorOpts);
    // Setup handler for whenever things change inside Quill
    this.$emit("instance-created", this.editorInstance);
  },
};
</script>

<style lang="scss">
.editor-node {
  height: auto;
}
.scrolling-container {
  height: 100%;
  min-height: 100%;
  overflow-y: auto;
}
.ql-editor strong {
  font-weight: bold;
}
.ql-editor {
  letter-spacing: 0;
  font-style: normal;
  color: rgba(0, 0, 0, 0.84);
  font-size: 16px;
  line-height: 1.8;
}
.ql-editor p {
  letter-spacing: 0;
  font-weight: 300;
  font-style: normal;
  margin-block-start: 0px !important;
  margin-block-end: 0px !important;
  color: rgba(0, 0, 0, 0.84);
  font-size: 16px;
  line-height: 1.8;
}
@import "quill/dist/quill.snow.css";
</style>

You can also view a codesandbox demo here

If a lot of content is pasted, the page may scroll up unexpectedly, creating a strange user experience.

Update: The scroll-to-top issue in webkit-based browsers like Chrome can be resolved by upgrading Quill to version 2.0.0-dev.4

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The altered variable refuses to show up

Currently, I am working on a project to create a Skate Dice program that will select random numbers and display the results simultaneously. Unfortunately, I have encountered an issue where the randomly generated number is not being shown; instead, it dis ...

Functionality Described Undefined

This is the JavaScript code that I am using: document.getElementById("config2").addEventListener("click", function(){ config3(); console.log("In Function config.onclick()..."); }); function config3() { document. ...

What steps are needed to create a transport directly from the Console?

In my current setup, this is the code I have: const logger = new winston.Logger(); logger.add(winston.transports.Console, { level: environment === 'development' ? 'silly' : 'info', colorize: true, prettyPrint: true }); ...

Tips for incorporating Vue.js tag attributes in IDEA

I am using IDEA 2016.2.5 and I'm trying to incorporate Vue.js into my project. However, Vue has some tag attributes that IDEA is not recognizing and keeps highlighting as errors. I have installed the Vue Plugin and tried setting the HTML custom unkno ...

What steps should I take to ensure a Vue 2/Vuetify form does not submit if the mandatory fields are left blank?

I developed a contact form using Vue 2/Vuetify 2 for a project I am working on. The form successfully submits to Strapi, the CMS that I am utilizing. However, despite having set rules and validation, it still submits with empty fields. The best progress I ...

Alter the reply prior to being dispatched to the customer

Node 16.14.2, Express 4.18.1 There have been several instances where individuals have altered res.send in order to execute actions before the response is sent to the client. app.use(function (req, res, next) { originalSend = res.send; res.send = f ...

Methods for transforming a TypeScript class instance containing getter/setter properties into a JSON format for storage within a MySQL database

I am currently working on a TypeScript class that includes a getter and setter method: export class KitSection { uid: string; order: number; set layout(layout: KitLayout) { this._layout = new KitLayout(layout); } get layout( ...

Unable to create a proper JWT signature using Google KMS

My current setup involves utilizing Google KMS (https://cloud.google.com/kms/) with an asymmetric signing key for the purpose of signing JSON Web tokens (jwt) within a node.js application. The process typically involves creating a header and payload, foll ...

Switching classes in real time with JavaScript

I'm struggling to understand how to toggle a class based on the anchor text that is clicked. <div> <a id="Menu1" href="#">Menu</a> <div id="subMenu1" class="subLevel"> <p>stuff</p> </div> <div> <a i ...

The reason why JavaScript doesn't treat "1-1" as 0 in an operation like it does with "123" to 123 during calculations

When dealing with JavaScript, the difference between "123" and "1-2" can be confusing. While "123" is recognized as a string type with a numerical value, "1-2" is also a string type but it does not allow for multiplication. Why doesn't JavaScript hand ...

Connecting one page to another on the same page using Next.js

Hey everyone, I could really use some help with linking pages on Next.js. I understand how to create links, but here's what I'm trying to achieve: On my homepage, I have navigation links for courses, team, and contact in the navbar. When I click ...

Issue with click event for submit button in ASP.Net following a change in dropdown list index using JavaScript

Currently, I have an asp.net application where a confirmation popup alert is displayed when the selected index changes to a specific value ("Cancelled") in a dropdown list. <asp:DropDownList ID="ddlStatus" runat="server" CssClass="selectstyle" DataText ...

The images on the carousel fail to load unless I adjust the window size

After investing countless hours into finding a solution, I am still unable to resolve this issue. The problem lies within my use of a Carousel and setting the images through a javascript file. Strangely enough, upon loading the page, only the first image ...

Verifying if form submission was done through AJAX using PHP

Hey there, I need some help with checking whether or not this ajax method has been submitted. I want to display the result based on a certain condition. Below is the code for the Ajax POST request: $.ajax({ url: "addorderInfo.php", // This ...

What is the most effective way to create a straightforward user interface in Node Js for the purpose of automation?

Currently, I am employing Selenium webdriver alongside Javascript and Node JS for automating test cases. My initial test case looks like this : var webdriver = require('selenium-webdriver'); var driver = new webdriver.Builder(). withCapabili ...

Generating random time in JavaScript: A step-by-step guide

Looking to generate a random time in the format "HH:MM AM" within my selenium IDE using JavaScript. Attempted code: javascript{Math.floor(24*Math.random() + 00) +":" + "00 PM";} Unfortunately, this code is not functioning as expected. Any assistance ...

Selenium unable to interact with Javascript pop-up box

I am currently working on automating a feature for our web application, specifically a form of @mentioning similar to Facebook. On the front end, when a user types @ into a text input, the API is called to retrieve the list of users and display them in a b ...

Warning: Unhandled promise rejection - Type Error: The property "id' cannot be read because it is undefined

I've been attempting to obtain a reference of a resort room, but I encountered this error: route model room roomPost controller postman data response roomGet ...

Emphasize text within the input field

Is there a way to create an input textarea that can detect words from an array in this.state and highlight those words as the user types text? Here is what I'm aiming for: The list of words: https://i.sstatic.net/eOx7G.png The input textarea examp ...

Update a div with PHP content every 10 seconds using jQuery

Trying to automatically update the information stored in a specific div every 10 seconds using jQuery. Here is my HTML code: <!DOCTYPE html> <head> <title>Untitled Document</title> <script src="http://code.jquery.com/jquery-la ...