File tree Expand file tree Collapse file tree
custom/code-block/suggestion Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,19 +20,33 @@ import type { SuggestedChangeConfig } from '../../../../editor/utils/loadCodeSug
2020
2121export function defineCodeBlockSuggestionCommand ( ) {
2222 return defineCommands ( {
23- insertCodeBlockSuggestion : ( attrs : {
23+ insertCodeBlockSuggestion : ( options : {
2424 suggestChange : SuggestedChangeConfig
2525 } ) => {
26- const lang = detectLanguageFromFilename ( attrs . suggestChange . filePath ! )
27- return insertNode ( {
28- type : 'codeBlock' ,
29- attrs : {
30- code : attrs . suggestChange . sourceContentFromDiffLines || '' ,
31- lang : lang || '' ,
32- isSuggestion : true ,
33- suggestedChangeConfig : attrs . suggestChange ,
34- } ,
35- } )
26+ const lang = detectLanguageFromFilename ( options . suggestChange . filePath ! )
27+ return ( state , dispatch , view ) => {
28+ const node = state . schema . nodes . codeBlock . create (
29+ {
30+ code : options . suggestChange . sourceContentFromDiffLines || '' ,
31+ lang : lang || '' ,
32+ isSuggestion : true ,
33+ suggestChangeConfig : options . suggestChange ,
34+ } ,
35+ state . schema . text (
36+ options . suggestChange . sourceContentFromDiffLines || '' ,
37+ ) ,
38+ )
39+
40+ return insertNode ( {
41+ node,
42+ attrs : {
43+ code : options . suggestChange . sourceContentFromDiffLines || '' ,
44+ lang : lang || '' ,
45+ isSuggestion : true ,
46+ suggestedChangeConfig : options . suggestChange ,
47+ } ,
48+ } ) ( state , dispatch , view )
49+ }
3650 } ,
3751 } )
3852}
Original file line number Diff line number Diff line change @@ -388,7 +388,7 @@ export function Toolbar() {
388388 </ TooltipTrigger >
389389 < TooltipContent > Issues & Feedback </ TooltipContent >
390390 </ Tooltip >
391- < Popover placement = { 'bottom-end' } >
391+ < Popover placement = { 'bottom-end' } modal = { true } >
392392 < PopoverTrigger class = { styles . ToolbarAction } >
393393 < LucideCog size = { 16 } />
394394 </ PopoverTrigger >
Original file line number Diff line number Diff line change 1111 -webkit-font-variant-ligatures : none;
1212 font-variant-ligatures : none;
1313 font-feature-settings : 'liga' 0 ;
14+ caret-color : initial !important ;
1415 }
1516
1617 .ProseMirror pre {
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2025 Riccardo Perra
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+
17+ import { delegateEvents } from 'solid-js/web'
18+
19+ export function delegateEditorEvents ( root : HTMLElement ) {
20+ const delegatedEvents = [
21+ 'beforeinput' ,
22+ 'click' ,
23+ // 'dblclick',
24+ // 'contextmenu',
25+ 'focusin' ,
26+ 'focusout' ,
27+ 'input' ,
28+ 'keydown' ,
29+ 'keyup' ,
30+ // 'mousedown',
31+ // 'mousemove',
32+ // 'mouseout',
33+ // 'mouseover',
34+ // 'mouseup',
35+ // 'pointerdown',
36+ // 'pointermove',
37+ // 'pointerout',
38+ // 'pointerover',
39+ // 'pointerup',
40+ // 'touchend',
41+ // 'touchmove',
42+ // 'touchstart',
43+ ]
44+ delegateEvents ( delegatedEvents , root as unknown as Document )
45+ delegatedEvents . forEach ( ( event ) => {
46+ root . addEventListener ( event , ( event ) => {
47+ event . stopPropagation ( )
48+ event . stopImmediatePropagation ( )
49+ } )
50+ } )
51+ }
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import { ConfettiExplosion } from 'solid-confetti-explosion'
2222import { Editor , EditorRootContext } from './editor/editor'
2323import { OcticonCaution } from './core/custom/githubAlert/icons'
2424import { ConfigStore } from './config.store'
25+ import { delegateEditorEvents } from './editor/utils/eventDelegation'
2526import type { EditorType } from './editor/editor'
2627import type { Accessor } from 'solid-js'
2728import type { GitHubUploaderHandler } from './core/custom/image/github-file-uploader'
@@ -138,6 +139,8 @@ export function EditorErrorBoundary(props: EditorErrorBoundaryProps) {
138139}
139140
140141export function mountEditor ( root : HTMLElement , props : RenderEditorProps ) {
142+ delegateEditorEvents ( root )
143+
141144 return render ( ( ) => {
142145 return (
143146 < StateProvider >
You can’t perform that action at this time.
0 commit comments