Подчёркивание
Добавьте подчёркивание к выделенному тексту.
Попробуйте
Выделите «Yurich» и нажмите Подчёркивание. Вы получите <u>Yurich</u>. Нажмите ещё раз, чтобы снять подчёркивание.
Интерактивный пример
Результат примера
Добавьте в редактор
Включите Underline и привяжите кнопку к toggleUnderline.
import { EditorContent, EditorProvider, Underline, useEditor, useIsActive } from 'yurich';
export function UnderlineEditor() {
const editor = useEditor({
extensions: [Underline],
initialValue: "<p>Проведите линию под 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')}
>
Подчёркивание
</button>
<EditorContent ariaLabel="Редактор" />
</EditorProvider>
);
}
Особенности поведения
Сочетание — Mod+U. Для текста, открывающего URL, используйте Link.