Explorar o código

delete the old MarkdownTable class in MarkdownTableUtil

utsushiiro %!s(int64=7) %!d(string=hai) anos
pai
achega
2a471e72d9

+ 2 - 19
src/client/js/components/PageEditor/MarkdownTableUtil.js

@@ -1,6 +1,7 @@
-import markdownTable from 'markdown-table';
 import stringWidth from 'string-width';
 
+import MarkdownTable from '../../models/MarkdownTable';
+
 /**
  * Utility for markdown table
  */
@@ -185,24 +186,6 @@ class MarkdownTableUtil {
   }
 }
 
-/**
- * markdown table class for markdown-table module
- *   ref. https://github.com/wooorm/markdown-table
- */
-class MarkdownTable {
-
-  constructor(table, options) {
-    this.table = table || [];
-    this.options = options || {};
-
-    this.toString = this.toString.bind(this);
-  }
-
-  toString() {
-    return markdownTable(this.table, this.options);
-  }
-}
-
 // singleton pattern
 const instance = new MarkdownTableUtil();
 Object.freeze(instance);

+ 3 - 3
src/client/js/models/MarkdownTable.js

@@ -13,15 +13,15 @@ const linePartOfTableRE = /^\|[^\r\n]*|[^\r\n]*\|$|([^|\r\n]+\|[^|\r\n]*)+/; //
  */
 export default class MarkdownTable {
 
-  constructor(data, options) {
-    this.data = data || [];
+  constructor(table, options) {
+    this.table = table || [];
     this.options = options || {};
 
     this.toString = this.toString.bind(this);
   }
 
   toString() {
-    return markdownTable(this.data, this.options);
+    return markdownTable(this.table, this.options);
   }
 
   static fromTableTag(str) {