Ryu Sato пре 5 година
родитељ
комит
051aa11147

+ 1 - 1
resource/locales/en_US/translation.json

@@ -308,7 +308,7 @@
   },
   "page_edit": {
     "Show active line": "Show active line",
-    "formatting_a_markdown_table": "Formatting a Markdown Table",
+    "formatting_a_markdown_table": "Auto format table",
     "overwrite_scopes": "{{operation}} and Overwrite scopes of all descendants",
     "notice": {
       "conflict": "Couldn't save the changes you made because someone else was editing this page. Please re-edit the affected section after reloading the page."

+ 1 - 1
resource/locales/ja_JP/translation.json

@@ -310,7 +310,7 @@
   },
   "page_edit": {
     "Show active line": "アクティブ行をハイライト",
-    "formatting_a_markdown_table": "Markdownの表を整形する",
+    "formatting_a_markdown_table": "表の自動整形",
     "overwrite_scopes": "{{operation}}と同時に全ての配下ページのスコープを上書き",
     "notice": {
       "conflict": "すでに他の人がこのページを編集していたため保存できませんでした。ページを再読み込み後、自分の編集箇所のみ再度編集してください。"

+ 1 - 1
resource/locales/zh_CN/translation.json

@@ -286,7 +286,7 @@
 	},
 	"page_edit": {
 		"Show active line": "显示活动行",
-		"formatting_a_markdown_table": "格式化一个Markdown表",
+		"formatting_a_markdown_table": "自动格式化表",
 		"overwrite_scopes": "{{operation}和覆盖所有子体的作用域",
 		"notice": {
 			"conflict": "无法保存您所做的更改,因为其他人正在编辑此页。请在重新加载页面后重新编辑受影响的部分。"

+ 1 - 5
src/client/js/components/PageEditor/CodeMirrorEditor.jsx

@@ -824,10 +824,6 @@ export default class CodeMirrorEditor extends AbstractEditor {
 
     const placeholder = this.state.isGfmMode ? 'Input with Markdown..' : 'Input with Plane Text..';
 
-    const markdownTableOption = {
-      pad: this.props.editorOptions.formattingMarkdownTable === true,
-    };
-
     return (
       <React.Fragment>
 
@@ -903,7 +899,7 @@ export default class CodeMirrorEditor extends AbstractEditor {
         <HandsontableModal
           ref={this.handsontableModal}
           onSave={(table) => { return mtu.replaceFocusedMarkdownTableWithEditor(this.getCodeMirror(), table) }}
-          markdownTableAdditionalOption={markdownTableOption}
+          ignoreAutoFormatting={this.props.editorOptions.formattingMarkdownTable}
         />
         <DrawioModal
           ref={this.drawioModal}

+ 9 - 6
src/client/js/components/PageEditor/HandsontableModal.jsx

@@ -156,13 +156,9 @@ export default class HandsontableModal extends React.PureComponent {
   }
 
   save() {
-    const markdownTableOption = Object.assign(
-      { align: [].concat(this.state.markdownTable.options.align) },
-      this.props.markdownTableAdditionalOption,
-    );
     const markdownTable = new MarkdownTable(
       this.hotTable.hotInstance.getData(),
-      markdownTableOption,
+      this.markdownTableOption,
     ).normalizeCells();
 
     if (this.props.onSave != null) {
@@ -402,6 +398,13 @@ export default class HandsontableModal extends React.PureComponent {
     }
   }
 
+  get markdownTableOption() {
+    return {
+      align: [].concat(this.state.markdownTable.options.align),
+      pad: this.props.ignoreAutoFormatting !== true,
+    };
+  }
+
   renderCloseButton() {
     return (
       <button type="button" className="close" onClick={this.cancel} aria-label="Close">
@@ -508,5 +511,5 @@ export default class HandsontableModal extends React.PureComponent {
 
 HandsontableModal.propTypes = {
   onSave: PropTypes.func,
-  markdownTableAdditionalOption: PropTypes.object,
+  ignoreAutoFormatting: PropTypes.boolean,
 };