table
table copied to clipboard
Allowing more tags inside table cell
I wasn't able to figure out how to allow line breaks inside the table cell so I forked the repo and implemented it myself by providing object for sanitize method:
https://github.com/nikita-vanyasin/table/blob/master/src/plugin.js#L53
Is any better way to do this without forking? Can do a pull request but it's a breaking change I guess.
Feel free to use my version from npm too: https://www.npmjs.com/package/@nikita-vanyasin/table
@nikita-vanyasin Thanks for sharing! Btw, you can achieve the same without forking by inheritance and overriding, my example:
import Table from '@editorjs/table'
export default class TableWithoutSanitize extends Table {
/**
* Allow line breaks inside table cells
*
* @returns {object}
*/
static get sanitize() {
return {
br: true,
b: true,
i: true,
strong: true,
h1: true,
h2: true,
h3: true,
h4: true,
h5: true,
h6: true,
sub: true,
sup: true,
span: true,
ul: true,
ol: true,
li: true,
pre: true,
hr: true,
a: true,
}
}
}