Commit f5a58a3d authored by Marcel Amirault's avatar Marcel Amirault Committed by Nathan Friend

Make lists use hyphens in markdown toolbar

parent 60fcd514
...@@ -158,7 +158,7 @@ export default { ...@@ -158,7 +158,7 @@ export default {
<div class="d-inline-block ml-md-2 ml-0"> <div class="d-inline-block ml-md-2 ml-0">
<toolbar-button <toolbar-button
:prepend="true" :prepend="true"
tag="* " tag="- "
:button-title="__('Add a bullet list')" :button-title="__('Add a bullet list')"
icon="list-bulleted" icon="list-bulleted"
/> />
...@@ -170,7 +170,7 @@ export default { ...@@ -170,7 +170,7 @@ export default {
/> />
<toolbar-button <toolbar-button
:prepend="true" :prepend="true"
tag="* [ ] " tag="- [ ] "
:button-title="__('Add a task list')" :button-title="__('Add a task list')"
icon="list-task" icon="list-task"
/> />
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
= markdown_toolbar_button({ icon: "quote", data: { "md-tag" => "> ", "md-prepend" => true }, title: _("Insert a quote") }) = markdown_toolbar_button({ icon: "quote", data: { "md-tag" => "> ", "md-prepend" => true }, title: _("Insert a quote") })
= markdown_toolbar_button({ icon: "code", data: { "md-tag" => "`", "md-block" => "```" }, title: _("Insert code") }) = markdown_toolbar_button({ icon: "code", data: { "md-tag" => "`", "md-block" => "```" }, title: _("Insert code") })
= markdown_toolbar_button({ icon: "link", data: { "md-tag" => "[{text}](url)", "md-select" => "url" }, title: _("Add a link") }) = markdown_toolbar_button({ icon: "link", data: { "md-tag" => "[{text}](url)", "md-select" => "url" }, title: _("Add a link") })
= markdown_toolbar_button({ icon: "list-bulleted", data: { "md-tag" => "* ", "md-prepend" => true }, title: _("Add a bullet list") }) = markdown_toolbar_button({ icon: "list-bulleted", data: { "md-tag" => "- ", "md-prepend" => true }, title: _("Add a bullet list") })
= markdown_toolbar_button({ icon: "list-numbered", data: { "md-tag" => "1. ", "md-prepend" => true }, title: _("Add a numbered list") }) = markdown_toolbar_button({ icon: "list-numbered", data: { "md-tag" => "1. ", "md-prepend" => true }, title: _("Add a numbered list") })
= markdown_toolbar_button({ icon: "list-task", data: { "md-tag" => "* [ ] ", "md-prepend" => true }, title: _("Add a task list") }) = markdown_toolbar_button({ icon: "list-task", data: { "md-tag" => "- [ ] ", "md-prepend" => true }, title: _("Add a task list") })
= markdown_toolbar_button({ icon: "table", data: { "md-tag" => "| header | header |\n| ------ | ------ |\n| cell | cell |\n| cell | cell |", "md-prepend" => true }, title: _("Add a table") }) = markdown_toolbar_button({ icon: "table", data: { "md-tag" => "| header | header |\n| ------ | ------ |\n| cell | cell |\n| cell | cell |", "md-prepend" => true }, title: _("Add a table") })
- if show_fullscreen_button - if show_fullscreen_button
%button.toolbar-btn.toolbar-fullscreen-btn.js-zen-enter.has-tooltip{ type: "button", tabindex: -1, "aria-label": "Go full screen", title: _("Go full screen"), data: { container: "body" } } %button.toolbar-btn.toolbar-fullscreen-btn.js-zen-enter.has-tooltip{ type: "button", tabindex: -1, "aria-label": "Go full screen", title: _("Go full screen"), data: { container: "body" } }
......
---
title: Set markdown toolbar to use hyphens for lists
merge_request: 31426
author:
type: changed
...@@ -25,13 +25,13 @@ describe('init markdown', () => { ...@@ -25,13 +25,13 @@ describe('init markdown', () => {
insertMarkdownText({ insertMarkdownText({
textArea, textArea,
text: textArea.value, text: textArea.value,
tag: '* ', tag: '- ',
blockTag: null, blockTag: null,
selected: '', selected: '',
wrap: false, wrap: false,
}); });
expect(textArea.value).toEqual(`${initialValue}* `); expect(textArea.value).toEqual(`${initialValue}- `);
}); });
it('inserts the tag on a new line if the current one is not empty', () => { it('inserts the tag on a new line if the current one is not empty', () => {
...@@ -43,13 +43,13 @@ describe('init markdown', () => { ...@@ -43,13 +43,13 @@ describe('init markdown', () => {
insertMarkdownText({ insertMarkdownText({
textArea, textArea,
text: textArea.value, text: textArea.value,
tag: '* ', tag: '- ',
blockTag: null, blockTag: null,
selected: '', selected: '',
wrap: false, wrap: false,
}); });
expect(textArea.value).toEqual(`${initialValue}\n* `); expect(textArea.value).toEqual(`${initialValue}\n- `);
}); });
it('inserts the tag on the same line if the current line only contains spaces', () => { it('inserts the tag on the same line if the current line only contains spaces', () => {
...@@ -61,13 +61,13 @@ describe('init markdown', () => { ...@@ -61,13 +61,13 @@ describe('init markdown', () => {
insertMarkdownText({ insertMarkdownText({
textArea, textArea,
text: textArea.value, text: textArea.value,
tag: '* ', tag: '- ',
blockTag: null, blockTag: null,
selected: '', selected: '',
wrap: false, wrap: false,
}); });
expect(textArea.value).toEqual(`${initialValue}* `); expect(textArea.value).toEqual(`${initialValue}- `);
}); });
it('inserts the tag on the same line if the current line only contains tabs', () => { it('inserts the tag on the same line if the current line only contains tabs', () => {
...@@ -79,13 +79,13 @@ describe('init markdown', () => { ...@@ -79,13 +79,13 @@ describe('init markdown', () => {
insertMarkdownText({ insertMarkdownText({
textArea, textArea,
text: textArea.value, text: textArea.value,
tag: '* ', tag: '- ',
blockTag: null, blockTag: null,
selected: '', selected: '',
wrap: false, wrap: false,
}); });
expect(textArea.value).toEqual(`${initialValue}* `); expect(textArea.value).toEqual(`${initialValue}- `);
}); });
it('places the cursor inside the tags', () => { it('places the cursor inside the tags', () => {
......
...@@ -185,7 +185,7 @@ describe('Markdown field component', () => { ...@@ -185,7 +185,7 @@ describe('Markdown field component', () => {
markdownButton.trigger('click'); markdownButton.trigger('click');
return wrapper.vm.$nextTick(() => { return wrapper.vm.$nextTick(() => {
expect(textarea.value).toContain('* testing'); expect(textarea.value).toContain('- testing');
}); });
}); });
...@@ -197,7 +197,7 @@ describe('Markdown field component', () => { ...@@ -197,7 +197,7 @@ describe('Markdown field component', () => {
markdownButton.trigger('click'); markdownButton.trigger('click');
return wrapper.vm.$nextTick(() => { return wrapper.vm.$nextTick(() => {
expect(textarea.value).toContain('* testing\n* 123'); expect(textarea.value).toContain('- testing\n- 123');
}); });
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment