Skip to content

Commit

Permalink
chore(lyrics): cleanup button
Browse files Browse the repository at this point in the history
  • Loading branch information
sifferhans committed Nov 21, 2024
1 parent 227a588 commit daaf6e1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion components/LyricsEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ onMounted(() => {
onBeforeUnmount(() => {
editor.value?.destroy();
});
function cleanUpFormatting() {
if (!editor.value) return;
modelValue.value = lyricsCleanupHtml(editor.value.getHTML());
editor.value.commands.setContent(modelValue.value);
}
</script>

<template>
Expand All @@ -80,7 +86,7 @@ onBeforeUnmount(() => {
<li>
<button
class="flex h-full items-center gap-3 border-r border-label-separator px-6 py-2 data-[active=true]:bg-background-2"
@click="editor.chain().focus().selectAll().clearNodes().run()"
@click="cleanUpFormatting"
>
<span>{{ $t("lyrics.remove-formatting") }}</span>
</button>
Expand Down

0 comments on commit daaf6e1

Please sign in to comment.