Skip to content

Underline

This is the Underline extension. It allows you to underline text.

Usage

Default usage of the underline extension and its control button.

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

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

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

Commands

js
// Toggle underline
editor?.chain().focus().toggleUnderline().run()

// Set underline
editor?.commands.setUnderline()

// Unset underline
editor?.commands.unsetUnderline()

Imports

ts
import {
  RequiredExtensions,
  Editor,
  HLTextEditor,
  RTEControlUnderline,
  Underline,
} 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
ariaLabelstringUnderlineThe aria label

Slots

SlotDescriptionDefault
iconThe icon to displayUnderline01Icon