table-with-handsontable-button.js 678 B

1234567891011121314151617181920
  1. export default class TableWithHandsontableButtonConfigurer {
  2. constructor(crowi) {
  3. this.crowi = crowi;
  4. }
  5. configure(md) {
  6. md.renderer.rules.table_open = (tokens, idx) => {
  7. const beginLine = tokens[idx].map[0] + 1;
  8. const endLine = tokens[idx].map[1];
  9. // eslint-disable-next-line max-len
  10. 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">`;
  11. };
  12. md.renderer.rules.table_close = (tokens, idx) => {
  13. return '</table></div>';
  14. };
  15. }
  16. }