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

Unresizable columns #37

Open
Heraes-git opened this issue Apr 9, 2019 · 0 comments
Open

Unresizable columns #37

Heraes-git opened this issue Apr 9, 2019 · 0 comments

Comments

@Heraes-git
Copy link

Heraes-git commented Apr 9, 2019

Here's a recurrent bug I encounter in the editor, that I solve by a manual editing of the markdown :

  • When pasting a content (ex : a table coming from LibreOffice), columns of the table become not resizable.
  • I discover two mechanisms that can explain that :
  1. First, there may have (sometimes) some "width" attribute created (or pasted ?) directly in the <td>, wich conflict with the "style" attribute that TinyMCE is supposed to manage in order to let the user to resize the columns in the editor (TinyMCE defines dynamic width for <td>, in percent, and the "width" attribute contradict the percentage). This result in rigid columns in the editor, wether we try to move them. Strangely, I don't manage to reproduce the bug with the same table I copied from the same file. It seems that the bug depends on non-predictible actions, like : do we create a blank table before pasting, what's the number of rows of the blank table (is it the exact same number), etc... But for sure, I had to delete some "width" attribute in order to fix the bug.

  2. Even by removing all the "width" HTML attributes, the bug persist if we don't add this to the "style" attribute : table-layout: fixed;. It's a CSS property that change the algorithm used by browsers for dynamically calculating the rows/columns of a table. When added to a CSS sheet, it works for the generated page but not for the editor ; thus, it is absolutely necessary to manually add it to the HTML <table> tag in the markdown.

  3. Also, I noticed that sometime, for the plugin config to be correctly applied (all the filters supposed to rewrite the code), I need to save at least two or three times the page to have a correctly rewritten HTML.

Now, for fixing this, I looked at the plugin YAML and TinyMCE content filters in order to find a solution.
Here's what I actually have (and wich is not enough) to "filter" the HTML elements :

  -
    name: extended_valid_elements
    value: 'td[style|rowspan|colspan],b/strong,i/em'

As you can see, I rewritten the <td> and limited it in order to wipe any "width" or "height" HTML attribute in it. But it's not enough, and sometimes, the "width" attribute reapears. It may be due to the mechanism n°3 I talked about.

I will test some other restrictions, like :

  -
    name: invalid_elements
    value: 'td[width]'

But I'm not sure that this filter accept these kind of options.

Goals for fixing the bug

  1. Find the correct set of filters in the plugin's config in order to remove any "width" attribute in <td> and <th>.
  2. Automatically add table-layout: fixed; in the style="" attribute of the table, in the TinyMCE editor. This has to be done by the plugin directly (so it implies a fix/patch).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant