Text Editor - Italic

Toggle italic formatting on the current selection with the italic command and pressed state.

#Usage

import { TextEditor } from '@primeui/vue-texteditor';
<TextEditor.Root v-model="value">
    <TextEditor.Toolbar>
        <ItalicButton />
    </TextEditor.Toolbar>
    <TextEditor.Content />
</TextEditor.Root>

Italic stresses a word or title. A toolbar button toggles the mark on the selection with commands.italic() and reflects pressed state with state.italic, both from useTextEditorContext().

#Command

commands.italic() toggles the mark on the selected text.

<!-- ItalicButton.vue -->
<script setup lang="ts">
import { useTextEditorContext } from '@primeui/vue-texteditor';

const { commands, state } = useTextEditorContext();
</script>

<template>
    <button @click="commands.italic()" :aria-pressed="state.italic">I</button>
</template>

#Example

Loading Demo...

#API

commands.italic() and state.italic come from useTextEditorContext(). See API for the full reference.