• Stars
    star
    806
  • Rank 56,569 (Top 2 %)
  • Language
    TypeScript
  • Created over 5 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Vuetify editor. Component simplifies integration tiptap editor with vuetify.

WYSIWYG editor for Vuetify. The editor is based on tiptap and uses vuetify's components. πŸ’ͺ

Version Downloads License CircleCI Build Status Language grade: JavaScript codebeat badge codebeat badge

If you have Vuetify 1.x (not 2.x), then you can find docs and demo here.

DEMO πŸ’£

Navigation

Features

  • used vuetify components
  • support for different types of icons (fa, md, mdi, mdiSvg)
  • internationalization (en, es, fr, pl, ru, uk, ptbr, tr, he, nl, ja, de, ko, zhHans, fa, sv, cs, it, el), with automatic detection of the current language through the Vuetify. You can make a PR for your language if it is not there, here is an example.
  • markdown support
  • easy to start using
  • props and events are available
  • TypeScript support
  • the project is ready to actively develop if there is support (stars)!
  • the ability to create and use your own extensions
  • choose where the extension buttons should be displayed: in the toolbar or in the bubble menu
  • support for custom image upload. You can use any method of upload through your Vue component.
  • Vuetify 2.x and 1.x support

Installation

yarn add tiptap-vuetify
# Or 
npm install --save tiptap-vuetify

Get started

Nuxt

If you have Nuxt.js, here is a simple demo how to integrate it (@nuxtjs/vuetify module is used). The code for this example is taken from this github repository, you can find more infΠΎ there.

NPM (ES modules)

  1. Installing the package and Vuetify 2 from scratch:
import Vue from 'vue'
import Vuetify from 'vuetify'
// import plugin
import { TiptapVuetifyPlugin } from 'tiptap-vuetify'
// don't forget to import CSS styles
import 'tiptap-vuetify/dist/main.css'
// Vuetify's CSS styles 
import 'vuetify/dist/vuetify.min.css'


// Vuetify Object (as described in the Vuetify 2 documentation)
const vuetify = new Vuetify()

// use Vuetify's plugin
Vue.use(Vuetify)
// use this package's plugin
Vue.use(TiptapVuetifyPlugin, {
  // the next line is important! You need to provide the Vuetify Object to this place.
  vuetify, // same as "vuetify: vuetify"
  // optional, default to 'md' (default vuetify icons before v2.0.0)
  iconsGroup: 'md'
})

More about vuetify icons you can read here.

  1. Use in your component. Here is a complete example:
<template>
  <div>
    <!-- Use the component in the right place of the template -->
    <tiptap-vuetify
      v-model="content"
      :extensions="extensions"
    />
  </div>
</template>

<script>
// import the component and the necessary extensions
import { TiptapVuetify, Heading, Bold, Italic, Strike, Underline, Code, Paragraph, BulletList, OrderedList, ListItem, Link, Blockquote, HardBreak, HorizontalRule, History } from 'tiptap-vuetify'

export default {
  // specify TiptapVuetify component in "components"
  components: { TiptapVuetify },
  data: () => ({
    // declare extensions you want to use
    extensions: [
      History,
      Blockquote,
      Link,
      Underline,
      Strike,
      Italic,
      ListItem,
      BulletList,
      OrderedList,
      [Heading, {
        options: {
          levels: [1, 2, 3]
        }
      }],
      Bold,
      Code,
      HorizontalRule,
      Paragraph,
      HardBreak
    ],
    // starting editor's content
    content: `
      <h1>Yay Headlines!</h1>
      <p>All these <strong>cool tags</strong> are working now.</p>
    `
  })
}
</script>

CDN

Attention: it seems that this method does not work due to the fact that this is not done in the tiptap package itself. Therefore, it most likely will not work. More details.

There is another use case with the script tag (CDN version of package):

<script src="https://unpkg.com/tiptap-vuetify"></script>

Or

<script src="https://cdn.jsdelivr.net/npm/tiptap-vuetify"></script>

The plugin should be installed automatically after connecting the script. The only thing is that the Vuetify object must be set in window.vuetify so that the plugin gets access to it. Write if you have questions.

Props

placeholder

Placeholder is displayed when there is no content in the editor.

How to use:

  <tiptap-vuetify
    placeholder="Write something …"
  />

extensions

You can use the necessary extensions. The corresponding buttons are added automatically (in the order in which you specify the extension).

How to import and use them can be seen in the example above.

Available extensions (native tiptap extensions from tiptap-extensions package):

  • Bold
  • Italic
  • Strike
  • Underline
  • Code
  • CodeBlock
  • Image
  • Paragraph
  • BulletList or OrderedList (use with the ListItem extension)
  • ListItem
  • Link
  • Blockquote
  • HardBreak
  • HorizontalRule
  • History
  • TodoList (use with the TodoItem extension)
  • TodoItem

I can easily add more.

toolbar-attributes

You can specify your attributes for the toolbar (<v-toolbar> vuetify component).

For example, change the color:

:toolbar-attributes="{ color: 'yellow' }"

card-props

Allows you to pass props for the editor's <v-card>.

<tiptap-vuetify
  :card-props="{ flat: true, color: '#26c6da' }"
/>

editor-properties

Tiptap Editor properties (passed to the constructor).

You can see the full list of properties here.

This is the most powerful way to customize the editor for yourself. Pay particular attention to editorProps.

Only these properties are not available: content, onUpdate, they are used in this package. If you want to add extensions to the extensions property, then use the native-extensions prop of this package.

native-extensions

You can transfer native extensions (not related to this package) to the extensions property.

How to use:

<tiptap-vuetify
  :native-extensions="nativeExtensions"
/>
// You can import from tiptap's built-in extensions
import {
  TrailingNode
} from 'tiptap-extensions'
// or your own extension
import Title from './Title'

// in script:
data () {
  return {
    nativeExtensions: [
      new Title(),
      new TrailingNode({
        node: 'paragraph',
        notAfter: ['paragraph'],
      })
    ]
  }
}

Here is example of how to create your extension from scratch.

custom image upload components

A custom image upload / selection component allows you to upload images to or select images from your application's backend system. The when properly configured, the component will be displayed as a tab in the Add Image window.

To implement this, first create a component where users can upload and/or select images. The component will not get any props from the image window. When a user selects an image, the component must emit a select-file event with an object containing src and alt properties. For example:

selectImage() {
  // When doing an asynchronous upload, you can set the src property to the value provided by the server (backend).
  this.$emit('select-file', { src: '/path/to/image.jpg', alt: 'Uploaded image' });
}

To add your component to the image extension, make the following changes: Import your component, e.g.

import FileSelector from '~/Components/FileSelector'

Update tiptap-vuetify :extensions value for Image as follows:

...
[Image, {
  options: {
    imageSources: [
      { component: FileSelector, name: 'File Selector' }
    ]
  }
}]
...

The value of name will be the tab name.

By default, your component will be added to tiptap-vuetify's own image sources (URL and data url Upload). If you want to exclude these image sources you can set imageSourcesOverride: true in the extension's options.

A basic example implementation can be found in the package's demo code in FileSelector.vue and Index.vue.

output-format

The format to output from the v-model. This defaults to html

For example, to get json instead:

<tiptap-vuetify
  output-format="json"
/>

disabled

Flag for disabling entire editor (disabled toolbar items and ready-only content area). Default false.

For example, disabled editor by component prop:

<tiptap-vuetify
  :disabled="editorDisabled"
/>

Events

init

first argument (object):

{
  // tiptap editor instance
  editor: Editor
}

How to use:

<tiptap-vuetify
  @init="onInit"
/>

keydown

Called when the editor receives a keydown event.

<tiptap-vuetify
  @keydown="onKeyDown"
/>
methods: {
  onkeydown (event, view) {
    console.log('event', event.key)
  }
}

Note: if you need to work with the Enter, then look here.

What is view?

Slots

toolbar

You can manually display the toolbar. How to use:

  1. Since Vue 2.6.0 (new syntax):
<tiptap-vuetify
  v-model="content"
  :extensions="extensions"
  :toolbar-attributes="{ color: 'yellow' }"
>
  <template #toolbar="{ buttons, commands, isActive }">
    <!--You can render the buttons as you wish (you can see in the source code how this is done).-->
    <pre>{{ buttons }}</pre>
  </template>
</tiptap-vuetify>
  1. Before 2.6.0:
<tiptap-vuetify>
  <div 
    slot="toolbar" 
    slot-scope="{ buttons, commands, isActive }"
  >
    <!--You can render the buttons as you wish (you can see in the source code how this is done).-->
    <pre>{{ buttons }}</pre>
  </div>
</tiptap-vuetify>

footer

Footer of the Editor.

toolbar-before

You can add content before the toolbar.

toolbar-after

You can add content after the toolbar.

Donate (creating code at your request out of turn)

#133

TODO

  • better images support: uploading (free hosting by default) Relevant issue. Ability to choose your uploading strategy. Resize image and change other params.
  • site with full-docs and examples
  • emoticons
  • tests
  • support for more extensions

More Repositories

1

vue-cool-select

Select with autocomplete, slots, bootstrap and material design themes.
JavaScript
244
star
2

laravel5.7-vue-cli3-boilerplate

Boilerplate / Starter kit. Laravel 5.7, Vue CLI 3 β€” Authentication with Email Verification. REST API.
PHP
54
star
3

blog-frontend

Frontend of blog created using: GraphQL (Apollo) + Vue + Nuxt.js + TypeScript + Vuetify...
Vue
44
star
4

tiptap-vuetify-nuxt

Integration tiptap-vuetify (editor) with Nuxt.
JavaScript
28
star
5

laravel-nuxt

Advanced authentication using Laravel 5.6 + Nuxt 1.4 (SSR, Socialite)
Vue
19
star
6

flutter_social_network

Social network built on flutter
Dart
11
star
7

flutter_state_managers_comparison

Flutter state managers comparison based on todos example
Dart
7
star
8

phaser3-snake-cordova

Phaser 3 + Cordova + TypeScript: The Snake Game.
TypeScript
7
star
9

tiptap-vuetify-demo

Demo for tiptap-vuetify package.
Vue
7
star
10

symfony-var-dumper-browser

Symfony's Var-Dump Server (server:dump) with live display of information in the Browser (without hot reloading) and with added functionality.
TypeScript
6
star
11

blog-backend

Blog created using: Laravel 5.7 + GraphQL
PHP
6
star
12

vue-electron-images-uploader

Electron β€” Upload files from explorer or screenshots to imgur.com
Vue
5
star
13

vue-plugin-axios

Powerful vue plugin for axios. There is support for Nuxt.js
JavaScript
5
star
14

freeCodeCamp-challenges-manager

Challenge-manager tool for freeCodeCamp. It allows you to create or edit existing Challenges through a convenient form (more convenient than editing a file on a Github).
Vue
5
star
15

skills

My skills
JavaScript
3
star
16

vue-cli-laravel-todo

Vue CLI 3 + Laravel 5.6 Example TODO project.
PHP
3
star
17

blog-laravel

Blog created using: Laravel 5.7 + GraphQL + Vue + Nuxt.js + Vuetify + TypeScript...
PHP
2
star
18

keyboard-speed-trainer

Train keyboard speed in a convenient UI. Random text from Wikipedia. Multilang. Many settings.
Vue
2
star
19

happy-birthday

Happy birthday static site on Vue 3
Vue
2
star
20

phaser3-typescript-boilerplate

Starter for Phaser 3 game with TypeScript (everything is set up).
TypeScript
2
star
21

tailwindcss-vue

The package makes it easy to use the Tailwind CSS with Vue.
TypeScript
2
star
22

all-world-flags

🏳️ Flags β€” ISO 3166-1 alpha-3 format (3 letters). SVG format. All world flags.
2
star
23

flutter_github_search

Flutter Github Search Example.
Dart
2
star
24

awesome-vue3

πŸŽ‰ A curated list of awesome things related to Vue.js 3 composition API.
1
star
25

vue3-awesome-composition

πŸŽ‰ A curated list of awesome things related to Vue.js 3 composition API.
1
star
26

phaser3-swipe-plugin

Mobile swipe plugin for Phaser 3.
TypeScript
1
star
27

blog-symfony

Symfony 4 GeekHub Blog
PHP
1
star
28

iliyaZelenko

I found a secret!
1
star
29

browser-extension-faceit-csgo

Search for a player by nickname (faceit.com), extended statistics on elo and other player statistics
Vue
1
star
30

typescript-node-simple-boilerplate

TypeScript, Node.js, simple but powerful Boilerplate.
TypeScript
1
star
31

symfony-cli-make

TypeScript
1
star
32

my_skills

Skills circular diagram using d3.js and Vite
JavaScript
1
star