Markdown formatting buttons for text inputs.
Перейти к файлу
Mu-An 慕安 eb44a7a777
Apply suggestions from code review
Co-authored-by: David Graham <dgraham@github.com>
2020-05-20 13:43:17 -04:00
.github/workflows Update test runs 2020-05-19 17:10:44 -04:00
examples Convert to typescript and simplify toolchain 2020-05-19 18:03:33 -04:00
src Apply suggestions from code review 2020-05-20 13:43:17 -04:00
test Convert to typescript and simplify toolchain 2020-05-19 18:03:33 -04:00
.eslintrc.json Convert to typescript and simplify toolchain 2020-05-19 18:03:33 -04:00
.gitignore Initial commit with the basics 2018-06-19 15:41:49 -07:00
LICENSE Initial commit with the basics 2018-06-19 15:41:49 -07:00
README.md docs: clarify focus management in readme 2020-04-02 10:40:04 +01:00
package-lock.json Convert to typescript and simplify toolchain 2020-05-19 18:03:33 -04:00
package.json Convert to typescript and simplify toolchain 2020-05-19 18:03:33 -04:00
tsconfig.json Apply suggestions from code review 2020-05-20 13:43:17 -04:00

README.md

<markdown-toolbar> element

Markdown formatting buttons for text inputs.

Installation

$ npm install --save @github/markdown-toolbar-element

Usage

import '@github/markdown-toolbar-element'
<markdown-toolbar for="textarea_id">
  <md-bold>bold</md-bold>
  <md-header>header</md-header>
  <md-italic>italic</md-italic>
  <md-quote>quote</md-quote>
  <md-code>code</md-code>
  <md-link>link</md-link>
  <md-image>image</md-image>
  <md-unordered-list>unordered-list</md-unordered-list>
  <md-ordered-list>ordered-list</md-ordered-list>
  <md-task-list>task-list</md-task-list>
  <md-mention>mention</md-mention>
  <md-ref>ref</md-ref>
  <button data-md-button>Custom button</button>
</markdown-toolbar>
<textarea id="textarea_id"></textarea>

<markdown-toolbar> comes with focus management as advised in WAI-ARIA Authoring Practices 1.1: Toolbar Design Pattern. The md-* buttons that ship with this package are automatically managed. Add a data-md-button attribute to any custom toolbar items to enroll them into focus management.

Browser support

Browsers without native custom element support require a polyfill.

  • Chrome
  • Firefox
  • Safari
  • Microsoft Edge

Development

npm install
npm test

License

Distributed under the MIT license. See LICENSE for details.