table icon indicating copy to clipboard operation
table copied to clipboard

Allowing more tags inside table cell

Open nikita-vanyasin opened this issue 4 years ago • 1 comments

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 avatar Nov 15 '21 16:11 nikita-vanyasin

@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,
    }
  }
}

hardrese7 avatar Jun 02 '22 12:06 hardrese7