File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import scssStyles from './index.module.scss';
77
88const logseqCopilotPopupId = 'logseq-copilot-popup' ;
99export const zIndex = '2147483647' ;
10+ const highlights = CSS . highlights ;
1011
1112const QuickCapture = ( ) => {
1213 const [ position , setPostion ] = useState ( {
@@ -15,10 +16,19 @@ const QuickCapture = () => {
1516 } ) ;
1617 const [ show , setShow ] = useState ( false ) ;
1718
19+ const setHighlight = ( range : Range ) => {
20+ if ( ! highlights . has ( "copilot-highlight" ) ) {
21+ highlights . set ( 'copilot-highlight' , new Highlight ( ) )
22+ }
23+ const highlight = highlights . get ( 'copilot-highlight' ) ;
24+ highlight . add ( range ) ;
25+ }
26+
1827 const capture = ( ) => {
1928 const selection = getSelection ( ) ;
2029 if ( selection !== null ) {
2130 const range = selection . getRangeAt ( 0 ) ;
31+ setHighlight ( range ) ;
2232 const clonedSelection = range . cloneContents ( ) ;
2333 const turndownService = buildTurndownService ( ) ;
2434 selection . empty ( ) ;
You can’t perform that action at this time.
0 commit comments