Skip to content

Commit

Permalink
add striked text
Browse files Browse the repository at this point in the history
  • Loading branch information
astudentinearth committed Nov 25, 2024
1 parent 68718a8 commit ccbe962
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 46 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 0.2.0-alpha.3

## 🌟 Features

- Added striked text

# 0.2.0-alpha.2

## 🌟 Features
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "darkwrite",
"version": "0.2.0-alpha.2",
"version": "0.2.0-alpha.3",
"description": "",
"scripts": {
"test:all": "yarn workspaces foreach -A run test",
Expand Down
2 changes: 1 addition & 1 deletion packages/app-desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"description": "The eye candy note-taking app for all desktops.",
"productName": "Darkwrite",
"private": true,
"version": "0.2.0-alpha.2",
"version": "0.2.0-alpha.3",
"type": "module",
"license": "AGPL-3.0-or-later",
"main": "dist-electron/main.js",
Expand Down
95 changes: 52 additions & 43 deletions packages/app-desktop/src/features/editor/bubble-menu/formatting.tsx
Original file line number Diff line number Diff line change
@@ -1,48 +1,57 @@
import { useEditor } from "novel";
import { Bold, Code, Italic, Underline } from "lucide-react";
import { Bold, Code, Italic, Strikethrough, Underline } from "lucide-react";
import { BubbleButton } from "./bubble-button";

export function FormattingButtons() {
const { editor } = useEditor();
if (!editor) return null;
return (
<div className="flex h-10">
<BubbleButton
isActive={(e) => e.editor?.isActive("bold") ?? false}
name="bold"
icon={Bold}
editor={{ editor }}
command={(editor) => {
editor.chain().focus().toggleBold().run();
}}
/>
<BubbleButton
isActive={(e) => e.editor?.isActive("italic") ?? false}
name="italic"
icon={Italic}
editor={{ editor }}
command={(editor) => {
editor.chain().focus().toggleItalic().run();
}}
/>
<BubbleButton
isActive={(e) => e.editor?.isActive("underline") ?? false}
name="underline"
icon={Underline}
editor={{ editor }}
command={(editor) => {
editor.chain().focus().toggleUnderline().run();
}}
/>
<BubbleButton
isActive={(e) => e.editor?.isActive("code") ?? false}
name="code"
icon={Code}
editor={{ editor }}
command={(editor) => {
editor.chain().focus().toggleCode().run();
}}
/>
</div>
);
const { editor } = useEditor();
if (!editor) return null;
return (
<div className="flex h-10">
<BubbleButton
isActive={(e) => e.editor?.isActive("bold") ?? false}
name="bold"
icon={Bold}
editor={{ editor }}
command={(editor) => {
editor.chain().focus().toggleBold().run();
}}
/>
<BubbleButton
isActive={(e) => e.editor?.isActive("italic") ?? false}
name="italic"
icon={Italic}
editor={{ editor }}
command={(editor) => {
editor.chain().focus().toggleItalic().run();
}}
/>
<BubbleButton
isActive={(e) => e.editor?.isActive("underline") ?? false}
name="underline"
icon={Underline}
editor={{ editor }}
command={(editor) => {
editor.chain().focus().toggleUnderline().run();
}}
/>
<BubbleButton
isActive={(e) => e.editor?.isActive("strike") ?? false}
name="strike"
icon={Strikethrough}
editor={{ editor }}
command={(editor) => {
editor.chain().focus().toggleStrike().run();
}}
/>
<BubbleButton
isActive={(e) => e.editor?.isActive("code") ?? false}
name="code"
icon={Code}
editor={{ editor }}
command={(editor) => {
editor.chain().focus().toggleCode().run();
}}
/>
</div>
);
}
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@darkwrite/common",
"version": "0.2.0-alpha.2",
"version": "0.2.0-alpha.3",
"types": "./dist/index.d.ts",
"main": "./dist/index.js",
"scripts": {
Expand Down

0 comments on commit ccbe962

Please sign in to comment.