![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
element-tiptap
Advanced tools
A WYSIWYG editor based on tiptap and element-ui for Vue2
English | 简体中文
👉https://leecason.github.io/element-tiptap
en
, zh
, pl
). welcome to contribute more languagesinit
, transaction
, focus
, blur
, paste
, drop
, update
yarn add element-tiptap
Or
npm install --save element-tiptap
import Vue from 'vue';
import { ElementTiptapPlugin } from 'element-tiptap';
Vue.use(ElementTiptapPlugin);
// Now you register `'el-tiptap'` component globally.
Or
<template>
<div>
<el-tiptap ...><el-tiptap>
</div>
</template>
<script>
import { ElementTiptap } from 'element-tiptap';
export default {
components: {
'el-tiptap': ElementTiptap,
},
};
</script>
You can declare when you install the plugin.
Vue.use(ElementTiptapPlugin, {
lang: 'zh',
});
Available languages: en
(default), zh
, pl
.
Welcome contribution.
<template>
<div>
<el-tiptap
v-model="content"
:extensions="extensions"
/>
</div>
</template>
<script>
import {
// necessary extensions
Doc,
Text,
Paragraph,
Heading,
Bold,
Underline,
Italic,
Strike,
ListItem,
BulletList,
OrderedList,
} from 'element-tiptap';
export default {
data () {
// editor extensions
// they will be added to menubar and bubble menu by the order you declare.
extensions: [
new Doc(),
new Text(),
new Paragraph(),
new Heading({ level: 5 }),
new Bold({ bubble: true }), // render command-button in bubble menu.
new Underline(),
new Italic(),
new Strike(),
new ListItem(),
new BulletList(),
new OrderedList(),
],
// editor's content
content: `
<h1>Heading</h1>
<p>This Editor is awesome!</p>
`,
},
},
</script>
You can use the necessary extensions. The corresponding command-buttons will be added by declaring the order of the extension.
All available extensions:
Doc
Text
Paragraph
Heading
Bold
Italic
Strike
Underline
Link
Image
Iframe
CodeBlock
Blockquote
ListItem
BulletList
OrderedList
TodoItem
TodoList
TextAlign
Indent
LineHeight
HorizontalRule
HardBreak
TrailingNode
History
Table
TableHeader
TableCell
TableRow
FormatClear
TextColor
TextHighlight
Preview
Print
Fullscreen
You can customize the extension menu button view
// create your extension file
import { Bold } from 'element-tiptap';
export default class CustomBold extends Bold {
menuBtnView (editorContext) {
// editorContext contains a collection of properties that are useful to you
// see https://github.com/scrumpy/tiptap#editormenubar
// ElementTiptap plus editor instance to editorContext.
return {
component: CustomButton, // your component
componentProps: {
...
},
},
}
}
<template>
<el-tiptap :extensions="extensions" />
</template>
<script>
import CustomBold from '...'; // import your extension
export default {
...
data () {
return {
extensions: [
...
new CustomBold(),
],
};
},
};
</script>
When editor is empty, placeholder will display.
<el-tiptap
placeholder="Write something …"
/>
Editor's content
<el-tiptap
:content="content"
@onUpdate="onEditorUpdate"
/>
or Use 'v-model'
<el-tiptap
v-model="content"
/>
Output can be defined to 'html'
(default) or 'json'
.
<el-tiptap
output="json"
/>
<template>
<el-tiptap
@init="onInit"
/>
</template>
<script>
export default {
...
methods: {
// argument (object)
// {
// editor: Editor, // tiptap editor instance
// }
methods: {
onInit ({ editor }) {
},
},
},
},
</script>
The same as init
You can customize the menubar.
<el-tiptap
v-model="content"
:extensions="extensions"
>
<template #menubar="{ commands, isActive }">
<!--You can render custom menu buttons.-->
<custom-button
:class="{ 'is-active': isActive.bold() }"
@click="commands.bold"
>
Bold
</custom-button>
</template>
</el-tiptap>
Customize the bubble menu like menubar.
<el-tiptap
v-model="content"
:extensions="extensions"
>
<template #menububble="{ commands, isActive }">
<custom-button
:class="{ 'is-active': isActive.bold() }"
@click="commands.bold"
>
Bold
</custom-button>
</template>
</el-tiptap>
Footer of the editor, after the editor content.
I can do more feature for you, or solve your problem faster if had your support.💪
FAQs
🌸A modern WYSIWYG rich-text editor using tiptap and Element UI for Vue.js
The npm package element-tiptap receives a total of 1,148 weekly downloads. As such, element-tiptap popularity was classified as popular.
We found that element-tiptap demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.