formats.mdx 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. ---
  2. title: Formats
  3. ---
  4. Quill supports a number of formats, both in UI controls and API calls.
  5. By default, all formats are enabled and allowed in a Quill editor. They can be configured with the [formats](/docs/configuration/#formats) option. This is separate from adding a control in the [Toolbar](/docs/modules/toolbar/). For example, you can configure Quill to allow bolded content to be pasted into an editor that has no bold button in the toolbar.
  6. <Sandpack
  7. preferPreview
  8. files={{
  9. 'index.html': `
  10. <link href="/styles.css" rel="stylesheet" />
  11. <link href="{{site.cdn}}/quill.snow.css" rel="stylesheet" />
  12. <script src="{{site.highlightjs}}/highlight.min.js"></script>
  13. <script src="{{site.cdn}}/quill.js"></script>
  14. <link
  15. rel="stylesheet"
  16. href="{{site.highlightjs}}/styles/atom-one-dark.min.css"
  17. />
  18. <script src="{{site.katex}}/katex.min.js"></script>
  19. <link rel="stylesheet" href="{{site.katex}}/katex.min.css" />
  20. <div id="toolbar-container">
  21. <span class="ql-formats">
  22. <select class="ql-font"></select>
  23. <select class="ql-size"></select>
  24. </span>
  25. <span class="ql-formats">
  26. <button class="ql-bold"></button>
  27. <button class="ql-italic"></button>
  28. <button class="ql-underline"></button>
  29. <button class="ql-strike"></button>
  30. </span>
  31. <span class="ql-formats">
  32. <select class="ql-color"></select>
  33. <select class="ql-background"></select>
  34. </span>
  35. <span class="ql-formats">
  36. <button class="ql-script" value="sub"></button>
  37. <button class="ql-script" value="super"></button>
  38. </span>
  39. <span class="ql-formats">
  40. <button class="ql-header" value="1"></button>
  41. <button class="ql-header" value="2"></button>
  42. <button class="ql-blockquote"></button>
  43. <button class="ql-code-block"></button>
  44. </span>
  45. <span class="ql-formats">
  46. <button class="ql-list" value="ordered"></button>
  47. <button class="ql-list" value="bullet"></button>
  48. <button class="ql-indent" value="-1"></button>
  49. <button class="ql-indent" value="+1"></button>
  50. </span>
  51. <span class="ql-formats">
  52. <button class="ql-direction" value="rtl"></button>
  53. <select class="ql-align"></select>
  54. </span>
  55. <span class="ql-formats">
  56. <button class="ql-link"></button>
  57. <button class="ql-image"></button>
  58. <button class="ql-video"></button>
  59. <button class="ql-formula"></button>
  60. </span>
  61. <span class="ql-formats">
  62. <button class="ql-clean"></button>
  63. </span>
  64. </div>
  65. <div id="editor">
  66. </div>
  67. <!-- Initialize Quill editor -->
  68. <script>
  69. const quill = new Quill('#editor', {
  70. modules: {
  71. syntax: true,
  72. toolbar: '#toolbar-container',
  73. },
  74. placeholder: 'Compose an epic...',
  75. theme: 'snow',
  76. });
  77. </script>
  78. `,
  79. }}
  80. />
  81. <a className="standalone-link" href="/standalone/full/">
  82. Standalone
  83. </a>
  84. #### Inline
  85. - Background Color - `background`
  86. - Bold - `bold`
  87. - Color - `color`
  88. - Font - `font`
  89. - Inline Code - `code`
  90. - Italic - `italic`
  91. - Link - `link`
  92. - Size - `size`
  93. - Strikethrough - `strike`
  94. - Superscript/Subscript - `script`
  95. - Underline - `underline`
  96. #### Block
  97. - Blockquote - `blockquote`
  98. - Header - `header`
  99. - Indent - `indent`
  100. - List - `list`
  101. - Text Alignment - `align`
  102. - Text Direction - `direction`
  103. - Code Block - `code-block`
  104. #### Embeds
  105. - Formula - `formula` (requires [KaTeX](https://katex.org/))
  106. - Image - `image`
  107. - Video - `video`