Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(crepe): button type in toolbar #1530

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/crepe/src/feature/toolbar/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export const toolbarComponent: Component<ToolbarProps> = ({

return html`<host>
<button
type="button"
class=${clsx('toolbar-item', ctx && isActive(strongSchema.type(ctx)) && 'active')}
onmousedown=${onClick((ctx) => {
const commands = ctx.get(commandsCtx)
Expand All @@ -61,6 +62,7 @@ export const toolbarComponent: Component<ToolbarProps> = ({
${config?.boldIcon?.() ?? boldIcon}
</button>
<button
type="button"
class=${clsx('toolbar-item', ctx && isActive(emphasisSchema.type(ctx)) && 'active')}
onmousedown=${onClick((ctx) => {
const commands = ctx.get(commandsCtx)
Expand All @@ -70,6 +72,7 @@ export const toolbarComponent: Component<ToolbarProps> = ({
${config?.italicIcon?.() ?? italicIcon}
</button>
<button
type="button"
class=${clsx('toolbar-item', ctx && isActive(strikethroughSchema.type(ctx)) && 'active')}
onmousedown=${onClick((ctx) => {
const commands = ctx.get(commandsCtx)
Expand All @@ -80,6 +83,7 @@ export const toolbarComponent: Component<ToolbarProps> = ({
</button>
<div class="divider"></div>
<button
type="button"
class=${clsx('toolbar-item', ctx && isActive(inlineCodeSchema.type(ctx)) && 'active')}
onmousedown=${onClick((ctx) => {
const commands = ctx.get(commandsCtx)
Expand All @@ -89,6 +93,7 @@ export const toolbarComponent: Component<ToolbarProps> = ({
${config?.codeIcon?.() ?? codeIcon}
</button>
<button
type="button"
class=${clsx('toolbar-item', ctx && isActive(linkSchema.type(ctx)) && 'active')}
onmousedown=${onClick((ctx) => {
const view = ctx.get(editorViewCtx)
Expand Down