Skip to content

Commit 1cb2303

Browse files
committed
progress on linking improvements and review comments
1 parent 27cbb15 commit 1cb2303

File tree

4 files changed

+21
-8
lines changed

4 files changed

+21
-8
lines changed

src/components/ui/coaching-sessions/coaching-notes/extensions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const Extensions = (
4545
Text,
4646
Underline,
4747
Link.configure({
48-
openOnClick: true,
48+
openOnClick: false,
4949
autolink: true,
5050
defaultProtocol: "https",
5151
protocols: ["http", "https"],

src/components/ui/coaching-sessions/coaching-notes/link-dialog.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export const LinkDialog = ({
5151
.focus()
5252
.extendMarkRange("link")
5353
.setLink({ href: linkUrl })
54+
.updateAttributes("link", { title: linkUrl })
5455
.run();
5556
setLinkUrl("");
5657
onOpenChange(false);

src/components/ui/coaching-sessions/coaching-notes/toolbar.tsx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type React from "react";
1+
import React, { useEffect } from "react";
22
import { useCurrentEditor } from "@tiptap/react";
33
import {
44
Bold,
@@ -25,6 +25,18 @@ export const Toolbar = () => {
2525
if (!editor) {
2626
return null;
2727
}
28+
// Add keyboard shortcut handler
29+
useEffect(() => {
30+
const handleKeyDown = (e: KeyboardEvent) => {
31+
if ((e.metaKey || e.ctrlKey) && e.key === "k") {
32+
e.preventDefault();
33+
setIsLinkDialogOpen(true);
34+
}
35+
};
36+
37+
document.addEventListener("keydown", handleKeyDown);
38+
return () => document.removeEventListener("keydown", handleKeyDown);
39+
}, []);
2840

2941
return (
3042
<>
@@ -105,7 +117,11 @@ export const Toolbar = () => {
105117
onClick={() => setIsLinkDialogOpen(true)}
106118
isActive={editor.isActive("link")}
107119
icon={<Link className="h-4 w-4" />}
108-
title="Link"
120+
title={
121+
editor.isActive("link")
122+
? "Update link (Ctrl + k)"
123+
: "Insert link (Ctrl + k)"
124+
}
109125
/>
110126
</div>
111127

src/styles/styles.scss

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,7 @@
144144
margin: 2rem 0;
145145
}
146146

147-
a {
148-
color: #0000EE;
149-
text-decoration: underline;
150-
}
151-
/* Link styles */
147+
/* Editor Link styles */
152148
a {
153149
text-decoration: underline;
154150
color: #0000EE;

0 commit comments

Comments
 (0)