All docs
V24.2
24.2
24.1
The page you are viewing does not exist in version 24.1.
23.2
The page you are viewing does not exist in version 23.2.
23.1
The page you are viewing does not exist in version 23.1.
22.2
The page you are viewing does not exist in version 22.2.
22.1
The page you are viewing does not exist in version 22.1.
21.2
The page you are viewing does not exist in version 21.2.
21.1
The page you are viewing does not exist in version 21.1.
20.2
The page you are viewing does not exist in version 20.2.
20.1
The page you are viewing does not exist in version 20.1.
19.2
The page you are viewing does not exist in version 19.2.
19.1
The page you are viewing does not exist in version 19.1.
18.2
The page you are viewing does not exist in version 18.2.
18.1
The page you are viewing does not exist in version 18.1.
17.2
The page you are viewing does not exist in version 17.2.

JavaScript/jQuery HtmlEditor - converter

Allows you to convert an HtmlEditor value between different markups.

Type:

Converter

| undefined
Default Value: undefined

jQuery
index.js
const converter = {
    toHtml: (value) => {
        const result = */ Convert the value and return a string */
        return result;
    },

    fromHtml: (value) => {
        const result = /* Convert the value and return a string */
        return result;
    }
    }

$('#editor').dxHtmlEditor({
    converter,
});
Angular
app.component.ts
app.component.html
export class AppComponent {
    toHtml(value) {
        const result = */ Convert the value and return a string */
        return result;
    }

    fromHtml(value) {
        const result = /* Convert the value and return a string */
        return result;
    }
}
<dx-html-editor>
    <dxo-converter
        (toHtml)="toHtml"
        (fromHtml)="fromHtml"
    >
    </dxo-converter>
</dx-html-editor>
Vue
App.vue
<template>
    <DxHtmlEditor ...>
        <DxConverter
            @to-html="toHtml"
            @from-html="fromHtml"
        />
    </DxHtmlEditor>
</template>

<script setup>
import DxHtmlEditor, { DxConverter } from 'devextreme-vue/html-editor';

const toHtml: (value) => {
    const result = */ Convert the value and return a string */
    return result;
}

const fromHtml: (value) => {
    const result = /* Convert the value and return a string */
    return result;
}
</script>
React
App.js
import React from 'react';
import HtmlEditor, { Converter } from 'devextreme-react/html-editor';

const toHtml: (value) => {
    const result = */ Convert the value and return a string */
    return result;
}

const fromHtml: (value) => {
    const result = /* Convert the value and return a string */
    return result;
}

function App() {
    return (
        <HtmlEditor ...>
            <Converter
                fromHtml={fromHtml}
                toHtml={toHtml}
            />
        </HtmlEditor>
    );
}

export default App;

View Demo

fromHtml

A function that converts an HtmlEditor value from HTML to another markup language.

Type:

Function

Function parameters:
value:

String

The HtmlEditor value.

Return Value:

String

The converted value.

toHtml

A function that converts an HtmlEditor value from a markup language to HTML.

Type:

Function

Function parameters:
value:

String

The HtmlEditor value.

Return Value:

String

The converted value.