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

Add an empty <p> tag after the table #20

Open
StijnMaenhaut opened this issue Nov 10, 2015 · 1 comment
Open

Add an empty <p> tag after the table #20

StijnMaenhaut opened this issue Nov 10, 2015 · 1 comment

Comments

@StijnMaenhaut
Copy link

If the selected text, being converted in to a table, is on the final line of the editor textarea, one cannot type below the table anymore.

Inserting a blank <p></p> tag after the table upon inserting the table would (imho) fix this issue.

@ghost
Copy link

ghost commented Jun 8, 2018

@StijnMaenhaut

I had this exact same problem and was surprised it wasn't fixed in all this time. Your solution proposed above does correct this. I thought it would be helpful to let everyone here know this.

@daviferreira @j0k3r @nmielnik @orthes This edit really should be added to the official script.

Here is how I implemented this:

`
var html = this._html(rows, cols);

    this._editor.pasteHTML(
        '<table class="medium-editor-table" id="medium-editor-table"' +
        ' width="100%">' +
        '<tbody id="medium-editor-table-tbody">' +
        html +
        '</tbody>' +
        // BUG FIX - ENTER TEXT BELOW TABLE
        //
        // Place a paragraph and break below all table instances
        // This is necessary to enter text below the table when it is the last item on the page
        '</table><p class="medium-editor-table-paragraph-below"><br></p>', {
            cleanAttrs: [],
            cleanTags: []
        }
    );

`

I should note that when using this solution that the above css class will appear on all paragraph elements that follow the table. This is not a problem of course; I thought it made sense to label the class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants