src/js/extensions/chart/chart.js
function _setWwCodeBlockManagerForChart(editor) {
  const componentManager = editor.wwEditor.componentManager;
  componentManager.removeManager('codeblock');
  componentManager.addManager(class extends WwCodeBlockManager {
    /**
     * Convert table nodes into code block as TSV
     * @memberof WwCodeBlockManager
     * @param {Array.<Node>} nodes Node array
     * @returns {HTMLElement} Code block element
     */
    convertNodesToText(nodes) {
      if (nodes.length !== 1 || nodes[0].tagName !== 'TABLE') {
        return super.convertNodesToText(nodes);
      }

      const node = nodes.shift();
      let str = '';

      // convert table to 2-dim array
      const cells = [].slice.call(node.rows).map(
        row => [].slice.call(row.cells).map(
          cell => cell.innerText.trim()
        )
      );

      const tsvRows = _reduceToTSV(cells);
      str += tsvRows.reduce((acc, row) => acc + `${row}\n`, []);

      return str;
    }
  });
}
function _setWwCodeBlockManagerForChart(editor) {
  const componentManager = editor.wwEditor.componentManager;
  componentManager.removeManager('codeblock');
  componentManager.addManager(class extends WwCodeBlockManager {
    /**
     * Convert table nodes into code block as TSV
     * @memberof WwCodeBlockManager
     * @param {Array.<Node>} nodes Node array
     * @returns {HTMLElement} Code block element
     */
    convertNodesToText(nodes) {
      if (nodes.length !== 1 || nodes[0].tagName !== 'TABLE') {
        return super.convertNodesToText(nodes);
      }

      const node = nodes.shift();
      let str = '';

      // convert table to 2-dim array
      const cells = [].slice.call(node.rows).map(
        row => [].slice.call(row.cells).map(
          cell => cell.innerText.trim()
        )
      );

      const tsvRows = _reduceToTSV(cells);
      str += tsvRows.reduce((acc, row) => acc + `${row}\n`, []);

      return str;
    }
  });
}
function _setWwCodeBlockManagerForChart ( editor ) { const componentManager = editor . wwEditor . componentManager ; componentManager . removeManager ( 'codeblock' ) ; componentManager . addManager ( class extends WwCodeBlockManager { /**
     * Convert table nodes into code block as TSV
     * @memberof WwCodeBlockManager
     * @param {Array.<Node>} nodes Node array
     * @returns {HTMLElement} Code block element
     */ convertNodesToText ( nodes ) { if ( nodes . length !== 1 || nodes [ 0 ] . tagName !== 'TABLE' ) { return super . convertNodesToText ( nodes ) ; } const node = nodes . shift ( ) ; let str = '' ; // convert table to 2-dim array const cells = [ ] . slice . call ( node . rows ) . map ( row => [ ] . slice . call ( row . cells ) . map ( cell => cell . innerText . trim ( ) ) ) ; const tsvRows = _reduceToTSV ( cells ) ; str += tsvRows . reduce ( ( acc , row ) => acc + ` ${ row } \n ` , [ ] ) ; return str ; } } ) ; }
override WwCodeBlockManager to enclose pasting data strings from wysiwyg in quotes
@param {Editor} editor - editor
@ignore
override WwCodeBlockManager to enclose pasting data strings from wysiwyg in quotes