summaryrefslogtreecommitdiff
path: root/app/views/shared/blob/_markdown_buttons.html.haml
blob: 4db1d20e81b761eaa7a99fb5104ffdcfc27c2d08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
- modifier_key = client_js_flags[:isMac] ? '⌘' : s_('KeyboardKey|Ctrl+')

.md-header-toolbar.active
  = markdown_toolbar_button({ icon: "bold",
                              data: { "md-tag" => "**", "md-shortcuts": '["mod+b"]' },
                              title: sprintf(s_("MarkdownEditor|Add bold text (%{modifier_key}B)") % { modifier_key: modifier_key }) })

  = markdown_toolbar_button({ icon: "italic",
                              data: { "md-tag" => "_", "md-shortcuts": '["mod+i"]' },
                              title: sprintf(s_("MarkdownEditor|Add italic text (%{modifier_key}I)") % { modifier_key: modifier_key }) })

  = markdown_toolbar_button({ icon: "strikethrough",
                              data: { "md-tag" => "~~", "md-shortcuts": '["mod+shift+x"]' },
                              title: sprintf(s_("MarkdownEditor|Add strikethrough text (%{modifier_key}⇧X)") % { modifier_key: modifier_key }) })

  = 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: "link",
                              data: { "md-tag" => "[{text}](url)", "md-select" => "url", "md-shortcuts": '["mod+k"]' },
                              title: sprintf(s_("MarkdownEditor|Add a link (%{modifier_key}K)") % { modifier_key: modifier_key }) })

  = 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-task", data: { "md-tag" => "- [ ] ", "md-prepend" => true }, title: _("Add a checklist") })
  = markdown_toolbar_button({ icon: "details-block",
                              data: { "md-tag" => "<details><summary>Click to expand</summary>\n{text}\n</details>", "md-prepend" => true, "md-select" => "Click to expand" },
                              title: _("Add a collapsible section") })
  = 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: "paperclip",
                              data: { "testid" => "button-attach-file" },
                              css_class: 'js-attach-file-button markdown-selector',
                              title: _("Attach a file or image") })
  - if show_fullscreen_button
    %button.gl-button.btn.btn-default-tertiary.btn-icon.js-zen-enter.has-tooltip{ type: "button", tabindex: -1, "aria-label": "Go full screen", title: _("Go full screen"), data: { container: "body" } }
      = sprite_icon("maximize")