quilljs / quill

Quill is a modern WYSIWYG editor built for compatibility and extensibility.

Home Page:https://quilljs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

excess new lines

windmillcode0 opened this issue Β· comments

Please describe the a concise description and fill out the details below. It will help others efficiently understand your request and get to an answer instead of repeated back and forth. Providing a minimal, complete and verifiable example will further increase your chances that someone can help.

  • Steps to reproduce
    1paste this value into quill emoji editor
    πŸ˜½β˜πŸ‘ƒπŸ‘°πŸ‘ΈπŸ‘šπŸ‘›πŸ‘πŸ‘β˜
    πŸ˜½β˜πŸ‘ƒπŸ‘°πŸ‘ΈπŸ‘šπŸ‘›πŸ‘πŸ‘β˜

πŸ˜½β˜πŸ‘ƒπŸ‘°πŸ‘ΈπŸ‘šπŸ‘›πŸ‘πŸ‘β˜

2, create a quill element and listen for text change

    this.quill = new Quill("yourElement", {
      theme: 'snow',
      modules:{
        toolbar:true,

      },
    });
    this.quill.on('text-change',this.listenForTextChange)
 listenForTextChange = (delta, oldDelta, source)=>{
    let text = this.quill.root.innerText
console.log(text)
//solution
    //text = text.replace(/\n\n/g, '\n');
}

Expected behavior:
Excess new lines should not be added

Actual behavior:
https://www.youtube.com/watch?v=MemPRSWztfY

Platforms:

Include browser, operating system and respective versions
Google Chrome 124.0.6367.91 (Official Build) (64-bit) (cohort: M124 Rollout)
Review 51df0e5e17a8b0a4f281c1665dbd1b8a0c6b46af-refs/branch-heads/6367@{#984}
Windows 11 Version 23H2 (Build 22631.3447) operating system
JavaScript V8 12.4.254.14
User-agent Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
Command line "C:\Program Files\Google\Chrome\Application\chrome.exe" --profile-directory="Profile 2" --restart --flag-switches-begin --flag-switches-end
Executable path C:\Program Files\Google\Chrome\Application\chrome.exe
Profile Path C:...\User Data\Profile 2
Version:

Run Quill.version to find out
2.0.0