Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The best text editor! Good job! But there is a small problem. enableLineBreaks does not remove lines #2685

Open
ottmark444 opened this issue Apr 14, 2024 · 0 comments
Labels

Comments

@ottmark444
Copy link

When enableLineBreaks is true in a text block, it adds a new line when you press enter, and this is correct behavior. But when I try to delete these lines using backspace, they are not deleted, and the cursor simply moves up (without deleting the line)

image


// Quote block code 

export class Quote {
    constructor({data, api, config, readOnly}) {
        this.data = data
        this.api = api 
        this.config = config
        this.readOnly = readOnly
    }


    static get enableLineBreaks() {
        return true;
    }

    static get isReadOnlySupported() {
        return true;
    }

    static get toolbox() {
        return {
            title: 'Quote',
            icon: '', 
        };
    }


    render() {
        this.wrapper = document.createElement('div')

        this.quote = document.createElement('div')
        
        if (!this.readOnly) {
            this.quote.contentEditable = true
        }

        this.quote.classList.add('quote')
        
        this.quote.placeholder = '...'   

        this.quote.innerHTML = (this.data && this.data.quoteText) ? this.data.quoteText : ''


        this.wrapper.appendChild(this.quote)


        return this.wrapper 
    }

    static get sanitize() {
        return {
            quoteText: true,
        };
    }


    validate(data) {
        if (!data.quoteText) {
            return false
        }

        return true
    }


    save(blockContent) {
        const quote = blockContent.querySelector('.quote')
        
        return {
            quoteText: quote.innerHTML,
        }
    }

}


export const quote = Quote 

I will be very grateful for your help

@ottmark444 ottmark444 added the bug label Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant