DevExtreme v26.1 is now available.

Explore our newest features/capabilities and share your thoughts with us.

Your search did not match any results.

Vue Html Editor - Toolbar Customization

This demo shows how to add a custom control to the toolbar. The Show markup button opens a popup that displays the HTML Editor's output markup.

Backend API
<template> <div class="widget-container"> <DxHtmlEditor v-model:value="value" > <DxToolbar> <DxItem name="undo"/> <DxItem name="redo"/> <DxItem name="separator"/> <DxItem name="header" :accepted-values="headerValues" :options="headerOptions" /> <DxItem name="separator"/> <DxItem name="bold"/> <DxItem name="italic"/> <DxItem name="strike"/> <DxItem name="underline"/> <DxItem name="separator"/> <DxItem name="alignLeft"/> <DxItem name="alignCenter"/> <DxItem name="alignRight"/> <DxItem name="alignJustify"/> <DxItem name="separator"/> <DxItem :options="toolbarButtonOptions" widget="dxButton" /> </DxToolbar> </DxHtmlEditor> <DxPopup :show-title="true" v-model:visible="popupVisible" title="Markup" :show-close-button="true" > {{ value }} </DxPopup> </div> </template> <script setup lang="ts"> import { ref } from 'vue'; import { DxHtmlEditor, DxToolbar, DxItem, } from 'devextreme-vue/html-editor'; import { DxPopup } from 'devextreme-vue/popup'; import { markup } from './data.ts'; const value = ref(markup); const popupVisible = ref(false); const headerValues = [false, 1, 2, 3, 4, 5]; const headerOptions = { inputAttr: { 'aria-label': 'Header' } }; const toolbarButtonOptions = { text: 'Show markup', stylingMode: 'text', onClick: () => { popupVisible.value = true; }, }; </script> <style> .dx-htmleditor-content img { vertical-align: middle; padding-right: 10px; } </style>
export const markup = ` <h2> <img src="../../../../images/widgets/HtmlEditor.svg" alt="HtmlEditor"> Formatted Text Editor (HTML Editor) </h2> <br> <p>DevExtreme JavaScript HTML Editor is a client-side WYSIWYG text editor that allows its users to format textual and visual content and store it as HTML.</p> <p>Supported features:</p> <ul> <li>Inline formats: <ul> <li><strong>Bold</strong>, <em>italic</em>, <s>strikethrough</s> text formatting</li> <li>Font, size, color changes (HTML only)</li> </ul> </li> <li>Block formats: <ul> <li>Headers</li> <li>Text alignment</li> <li>Lists (ordered and unordered)</li> <li>Code blocks</li> <li>Quotes</li> </ul> </li> <li>Custom formats</li> <li>Mail-merge placeholders (for example, %username%)</li> <li>Adaptive toolbar for working images, links, and color formats</li> <li>Image upload: drag-and-drop images onto the form, select files from the file system, or specify a URL.</li> <li>Copy-paste rich content (unsupported formats are removed)</li> <li>Tables support</li> </ul> `;
import { createApp } from 'vue'; import App from './App.vue'; createApp(App).mount('#app');
<!DOCTYPE html> <html lang="en"> <head> <title>DevExtreme Demo</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/26.1.5/css/dx.light.css" /> <link rel="stylesheet" type="text/css" href="./bundle.css" /> </head> <body class="dx-viewport"> <div class="demo-container"> <div id="app"> </div> </div> <script src="bundles/vendor/vue.vendor.js"></script> <script src="./bundle.js"></script> </body> </html>