-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: move Strikethrough into More Formatting drop down
- Loading branch information
Showing
5 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...es/svelte-lexical/src/lib/components/toolbar/MoreStylesDropDown/MoreStylesDropDown.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<script lang="ts"> | ||
import {getIsEditable} from '$lib/core/composerContext.js'; | ||
import DropDown from '$lib/components/generic/dropdown/DropDown.svelte'; | ||
const isEditable = getIsEditable(); | ||
</script> | ||
|
||
<DropDown | ||
disabled={!$isEditable} | ||
buttonClassName="toolbar-item spaced" | ||
buttonLabel="" | ||
buttonAriaLabel="Formatting options for additional text styles" | ||
buttonIconClassName="icon dropdown-more"> | ||
<slot /> | ||
</DropDown> |
23 changes: 23 additions & 0 deletions
23
...te-lexical/src/lib/components/toolbar/MoreStylesDropDown/StrikethroughDropDownItem.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<script lang="ts"> | ||
import DropDownItem from '$lib/components/generic/dropdown/DropDownItem.svelte'; | ||
import {getActiveEditor} from '$lib/core/composerContext.js'; | ||
import {FORMAT_TEXT_COMMAND} from 'lexical'; | ||
import {getContext} from 'svelte'; | ||
import type {Writable} from 'svelte/store'; | ||
const activeEditor = getActiveEditor(); | ||
const isStrikethrough: Writable<boolean> = getContext('isStrikethrough'); | ||
</script> | ||
|
||
<DropDownItem | ||
on:click={() => { | ||
$activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, 'strikethrough'); | ||
}} | ||
class={'item ' + ($isStrikethrough ? 'active dropdown-item-active' : '')} | ||
title="Strikethrough" | ||
ariaLabel="Format text with a strikethrough"> | ||
<i class="icon strikethrough" /> | ||
<span class="text">Strikethrough</span> | ||
</DropDownItem> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters