Search code examples
javascriptcssvue-cli-3

How to make custom text and styling


I male website where user can make website profile. How can user from mywebsite can custom text and styling like make bold, coloring,etc ?


Solution

  • You need to use good wysiwyg editor like https://github.com/scrumpy/tiptap

    you can do the basic setup like this

    <template>
      <editor-content :editor="editor" />
    </template>
    
    <script>
    // Import the editor
    import { Editor, EditorContent } from 'tiptap'
    
    export default {
      components: {
        EditorContent,
      },
      data() {
        return {
          editor: null,
        }
      },
      mounted() {
        this.editor = new Editor({
          content: '<p>This is just a boring paragraph</p>',
        })
      },
      beforeDestroy() {
        this.editor.destroy()
      },
    }
    </script>