Documentação

Sublinhado

Trace uma linha sob o texto selecionado.

Experimente

Selecione “Yurich” e clique em Sublinhado. O resultado inclui <u>Yurich</u>. Clique novamente para remover.

Exemplo interativo
Resultado do exemplo

Adicione ao seu editor

Ative Underline e chame toggleUnderline a partir do botão.

import { EditorContent, EditorProvider, Underline, useEditor, useIsActive } from 'yurich';

export function UnderlineEditor() {
  const editor = useEditor({
    extensions: [Underline],
    initialValue: "<p>Trace uma linha sob o Yurich.</p>",
  });
  const active = useIsActive(editor, 'toggleUnderline');

  return (
    <EditorProvider editor={editor}>
      <button
        type="button"
        aria-pressed={active}
        onMouseDown={event => event.preventDefault()}
        onClick={() => editor.execute('toggleUnderline')}
      >
        Sublinhado
      </button>
      <EditorContent ariaLabel="Editor" />
    </EditorProvider>
  );
}

Como o recurso se comporta

Use Mod+U. Para um texto que abre um endereço, ative Link.

Recursos