/ You can use Maskito with contentEditable too!
Just wrap the element with maskitoAdaptContentEditable utility and use Maskito in the same way as HTMLInputElement / HTMLTextAreaElement .
maskitoAdaptContentEditable if you use @maskito/angular , @maskito/react or @maskito/vue with the default element predicate (it will be wrapped automatically). Learn more in the "Core Concepts" section.
import {Maskito, maskitoAdaptContentEditable, MaskitoOptions} from '@maskito/core';
const maskitoOptions: MaskitoOptions = {
mask: /^\d+$/,
};
const element = document.querySelector<HTMLElement>('[contenteditable]')!;
const maskedInput = new Maskito(
maskitoAdaptContentEditable(element), // <-- This is the only difference
maskitoOptions,
);
Time mask white-space: pre for multi-line mode Hello, world! How are you today? Read description of this example!