From e9f7908f5eb88c43c5e1689190a3d6b0c840a650 Mon Sep 17 00:00:00 2001 From: George Tsiolis Date: Sat, 6 Oct 2018 14:30:35 +0000 Subject: [PATCH] Add button to insert table in markdown editor --- .../vue_shared/components/markdown/header.vue | 16 ++++++++++++++++ app/views/projects/_md_preview.html.haml | 2 ++ .../add-button-to-insert-table-in-markdown.yml | 5 +++++ locale/gitlab.pot | 6 ++++++ .../components/markdown/header_spec.js | 13 +++++++++++-- 5 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 changelogs/unreleased/add-button-to-insert-table-in-markdown.yml diff --git a/app/assets/javascripts/vue_shared/components/markdown/header.vue b/app/assets/javascripts/vue_shared/components/markdown/header.vue index afc4196c729..ccd53158820 100644 --- a/app/assets/javascripts/vue_shared/components/markdown/header.vue +++ b/app/assets/javascripts/vue_shared/components/markdown/header.vue @@ -18,6 +18,16 @@ required: true, }, }, + computed: { + mdTable() { + return [ + '| header | header |', + '| ------ | ------ |', + '| cell | cell |', + '| cell | cell |', + ].join('\n'); + }, + }, mounted() { $(document).on('markdown-preview:show.vue', this.previewMarkdownTab); $(document).on('markdown-preview:hide.vue', this.writeMarkdownTab); @@ -129,6 +139,12 @@ button-title="Add a task list" icon="task-done" /> +