Skip to content

Italic

This is the Italic extension. It allows you to make text italic.

Usage

Default usage of the italic extension and its control button.

Italic
vue
<template>
  <HLTextEditor :editor="editor">
    <template #header>
      <RTEControlItalic :editor="editor" />
    </template>
    <template #footer>
      <div>Footer</div>
    </template>
  </HLTextEditor>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import {
  RequiredExtensions,
  Editor,
  HLTextEditor,
  RTEControlItalic,
  Italic,
} from '@platform-ui/rte'

const content = ref()
const HTML = ref()

const editor = new Editor({
  content: 'Select text and click the italic button to make it italic',
  extensions: [Italic, RequiredExtensions.configure({})],
  onUpdate({ editor }) {
    content.value = editor.getText()
    HTML.value = editor.getHTML()
  },
})
</script>

Commands

js
editor?.chain().focus().toggleItalic().run()

Imports

ts
import {
  RequiredExtensions,
  Editor,
  HLTextEditor,
  RTEControlItalic,
  Italic,
} from '@platform-ui/rte'

Props

PropTypeDefaultDescription
editor *Editor-The editor instance
tooltipLabelstring-The tooltip label
tooltipPositionPlacement'top'The tooltip position
languageLanguage'en-US'The language
ariaLabelstringItalicThe aria label

Slots

SlotDescriptionDefault
iconThe icon to displayItalic01Icon