项目作者: donotebase

项目描述 :
A modern WYSIWYG rich-text editor built on top of tiptap and Quasar for Vue.js.
高级语言: JavaScript
项目地址: git://github.com/donotebase/quasar-tiptap.git
创建时间: 2020-04-15T09:47:13Z
项目社区:https://github.com/donotebase/quasar-tiptap

开源协议:MIT License

下载


quasar-tiptap

A modern WYSIWYG rich-text editor built on top of tiptap and Quasar Framework for Vue.js.


Codacy Badge
Build Status

semantic-release
Join the chat at discord

Examples & Demos

Features

  • Extensions: tiptap official extensions, and dozens of great extensions
  • Markdown
  • Diagram and LaTex Math formula
  • I18n support (en-us, zh-hans, pl, pt-br)
  • Fully extensible for editor extensions, menubar

I18n

Installation

Dependencies

quasar-tiptap is built on top of Quasar Framework and tiptap, therefore it should be used in Quasar App and depends on several packages.

  1. # required
  2. yarn add tiptap
  3. yarn add tiptap-extensions
  4. # optional (required if diagram and latex formula enabled)
  5. yarn add vue-codemirror
  6. yarn add mermaid
  7. yarn add katex

quasar-tiptap

  1. yarn add quasar-tiptap

quasar.conf.js

Use mdi-v5 icon set and v-close-popup directive.

  1. extras: [
  2. 'mdi-v5'
  3. ],
  4. framework: [
  5. directives: [
  6. 'ClosePopup'
  7. ]
  8. ]

Usage

Register quasar-tiptap globally by installing plugin, or import QuasarTiptap component as needed.

Install plugin

  1. import Vue from 'vue'
  2. import { QuasarTiptapPlugin, RecommendedExtensions } from 'quasar-tiptap'
  3. Vue.use(QuasarTiptapPlugin, {
  4. language: 'zh-hans',
  5. spellcheck: true
  6. })

Import component

  1. <template>
  2. <div>
  3. <quasar-tiptap v-bind="options" @update="onUpdate" ></quasar-tiptap>
  4. </div>
  5. </template>
  6. <script>
  7. import { QuasarTiptap, RecommendedExtensions } from 'quasar-tiptap'
  8. import 'quasar-tiptap/lib/index.css'
  9. export default {
  10. data () {
  11. return {
  12. options: {
  13. content: 'content',
  14. editable: true,
  15. extensions: [
  16. ...RecommendedExtensions,
  17. // other extenstions
  18. // name string, or custom extension
  19. ],
  20. toolbar: [
  21. 'add-more',
  22. 'separator',
  23. 'bold',
  24. 'italic',
  25. 'underline',
  26. // other toolbar buttons
  27. // name string
  28. ]
  29. },
  30. json: '',
  31. html: ''
  32. }
  33. },
  34. components: {
  35. QuasarTiptap,
  36. },
  37. methods: {
  38. onUpdate ({ getJSON, getHTML }) {
  39. this.json = getJSON()
  40. this.html = getHTML()
  41. console.log('html', this.html)
  42. }
  43. },
  44. mounted () {
  45. // set language dynamically
  46. this.$o.lang.set('en-us')
  47. }
  48. }
  49. </script>

Editor Properties

Property Type Default Description
content `Object\ String` null The editor content
editable Boolean true When set to false the editor is read-only.
extensions Array [] A list of extensions used, by the editor. This can be String, Nodes, Marks or Plugins.
toolbar Array [] A list of toolbar button used, by the editor. This can be String, Vue components
tableToolbar Array [] A list of toolbar button used, by the table. This can be String, Vue components

Extensions

Available Extensions

Extensions provided by tiptap official and quasar-tip:

  1. export const TipTapExtensions = [
  2. 'Bold',
  3. 'Italic',
  4. 'Strike',
  5. 'Underline',
  6. 'Code',
  7. 'CodeBlock',
  8. 'CodeBlockHighlight',
  9. 'BulletList',
  10. 'OrderedList',
  11. 'ListItem',
  12. 'TodoList',
  13. 'HorizontalRule',
  14. 'Table',
  15. 'Link',
  16. 'Image',
  17. ]
  18. export const QuasarTipTapExtensions = [
  19. 'OTitle',
  20. 'ODoc',
  21. 'OParagraph',
  22. 'OBlockquote',
  23. 'OTodoItem',
  24. 'OHeading',
  25. 'OAlignment',
  26. 'OLineHeight',
  27. 'OForeColor',
  28. 'OBackColor',
  29. 'OFontFamily',
  30. 'OIframe',
  31. 'ODiagram',
  32. 'OKatexBlock',
  33. 'OKatexInline',
  34. 'OFormatClear',
  35. ]
  36. export const RecommendedExtensions = [
  37. ...TipTapExtensions,
  38. ...QuasarTipTapExtensions
  39. ]

extensions and toolbar in options

extension toolbar Remarks
‘Bold’ ‘bold’
‘Italic’ ‘italic’
‘Strike’ ‘strike’
‘Underline’ ‘underline’
‘Code’ ‘code’
‘CodeBlock’ ‘code_blok’
‘CodeBlockHighlight’
‘BulletList’ ‘bullet_list’
‘OrderedList’ ‘ordered_list’
‘ListItem’
‘TodoList’ ‘todo_list’
‘HorizontalRule’ ‘horizontal’
‘Table’ ‘table’
‘Link’
‘Image’ ‘photo’
‘OTitle’
‘ODoc’
‘OParagraph’
‘OBlockquote’ ‘blockquote’
‘OTodoItem’
‘OHeading’ ‘heading’
‘OIndent’ ‘indent’, ‘outdent’
‘OAlignment’ ‘align-dropdown’, ‘align-group’
‘OLineHeight’ ‘line-height’
‘OForeColor’ ‘fore-color’
‘OBackColor’ ‘back-color’
‘OFontFamily’ ‘font-family’
‘OIframe’ ‘add-more’
‘ODiagram’ ‘add-more’
‘OKatexBlock’ ‘add-more’
‘OKatexInline’ ‘add-more’
‘OFormatClear’ ‘format_clear’

" class="reference-link">🏗 Contributing PR or ISSUE

  1. 🍴Fork it
  2. 🔀Create your branch: git checkout -b your-branch
  3. 🎨Make your changes
  4. 📝Commit your changes with Semantic Commit Messages (recommended)
  5. 🚀Push to the branch: git push origin your-branch
  6. 🎉Submit a PR to dev branch

Roadmap

A todo list will be shown in QuasarTiptap Project kanban.

Thanks

License

The MIT License (MIT). Please see License File for more information.