table
table copied to clipboard
SHIFT + ENTER to make new line?
Inside a table cell, I press shift + enter to create a new line. It displays fine. However in JSON, the new line is not saved, therefore not printed.
Any ideas on keeping the style in JSON?
I'm running into the same problem.
Looks like the issue is caused by cell.textContent.trim());
at:
https://github.com/editor-js/table/blob/59071355377fd853d424cfd18366929221009c5e/src/table.js#L932
@KevinBeckers May I ask why your merge request was blocked? And did you solve the issue by removing trim()
?
+edit) Oh, your pr isn't reviewed yet ;)
After more research, the problem seems to vary by browser. Different browsers have different behavior in a 'contentEditable DIV'. Safari for example, which places a new div. Chrome adds a new line and Firefox ads a
Just adding that I am having the same problem. It would be great if this could be supported somehow! Even with these browsers handling everything differently
I have the same issue. Would be great if we could find a solution. @KevinBeckers Did you by any chance find something that worked?
@intaek-h @KevinBeckers @evanshabsove @Thimows
The reason is that br
is not an allowed inline tag, which will then be removed when the Editor calls it a sanitization function.
Just extend this plugin, then add a sanitization configuration, like this:
import Table from '@editorjs/table'
export default class TablePlugin extends Table {
static get sanitize(){
return {
br: {},
// ... other configs
}
}
}
Thanks @manh-gntvn the suggested approach works I am using following code to support bold, italic and links alongside newlines in table cells
import Table from '@editorjs/table'
export default class TablePlugin extends Table {
static get sanitize() {
return {
b: true,
a: {
href: true,
},
i: true,
br: {},
};
}
}