v8.89.6

Erasing shapes with the eraser

By default only the sharpie tool and lines/arrows can be erased with the eraser.

To enable erasing other shapes we can override default shape properties. We can use the createMarkupEditorShapeStyles function and override or extend the default styles and settings for a shape.

In the example below we enable erasing the 'rectangle' shape.

<!DOCTYPE html>

<head>
    <link rel="stylesheet" href="./pintura.css" />
</head>

<style>
    .pintura-editor {
        height: 600px;
    }
</style>

<div id="editor"></div>

<script type="module">
    import {
        appendDefaultEditor,
        createMarkupEditorToolStyle,
        createMarkupEditorToolStyles,
    } from './pintura.js';

    const editor = appendDefaultEditor('#editor', {
        src: 'image.jpeg',
        util: 'annotate',
        markupEditorToolStyles: createMarkupEditorToolStyles({
            text: {
                disableErase: false,
            },
        }),
    });
</script>