File tree Expand file tree Collapse file tree 4 files changed +21
-8
lines changed
components/ui/coaching-sessions/coaching-notes Expand file tree Collapse file tree 4 files changed +21
-8
lines changed Original file line number Diff line number Diff 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" ] ,
Original file line number Diff line number Diff 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 ) ;
Original file line number Diff line number Diff line change 1- import type React from "react" ;
1+ import React , { useEffect } from "react" ;
22import { useCurrentEditor } from "@tiptap/react" ;
33import {
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
Original file line number Diff line number Diff line change 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 ;
You can’t perform that action at this time.
0 commit comments