table-with-handsontable-button.js 626 B

12345678910111213141516
  1. export default class TableWithHandsontableButtonConfigurer {
  2. configure(md) {
  3. md.renderer.rules.table_open = (tokens, idx) => {
  4. const beginLine = tokens[idx].map[0] + 1;
  5. const endLine = tokens[idx].map[1];
  6. // eslint-disable-next-line max-len
  7. return `<div class="editable-with-handsontable"><button class="handsontable-modal-trigger" onClick="globalEmitter.emit('launchHandsontableModal', ${beginLine}, ${endLine})"><i class="icon-note"></i></button><table class="table table-bordered">`;
  8. };
  9. md.renderer.rules.table_close = (tokens, idx) => {
  10. return '</table></div>';
  11. };
  12. }
  13. }