@@ -29,12 +29,22 @@ withDefaults(
29
29
30
30
// Component state for maximize functionality
31
31
const showMaximizeModal = ref (false );
32
+ const showMaximizeButton = ref (false );
32
33
33
34
// Handle maximize functionality
34
35
const toggleMaximizeModal = () => {
35
36
showMaximizeModal .value = ! showMaximizeModal .value ;
36
37
};
37
38
39
+ // Handle mouse enter/leave for showing maximize button
40
+ const onEditorMouseEnter = () => {
41
+ showMaximizeButton .value = true ;
42
+ };
43
+
44
+ const onEditorMouseLeave = () => {
45
+ showMaximizeButton .value = false ;
46
+ };
47
+
38
48
// Handle ESC key to close modal
39
49
const handleKeyDown = (event : KeyboardEvent ) => {
40
50
if (event .key === " Escape" && showMaximizeModal .value ) {
@@ -54,24 +64,41 @@ onBeforeUnmount(() => {
54
64
</script >
55
65
56
66
<template >
57
- <div class =" code-editor-wrapper" >
58
- <!-- Regular CodeEditor with maximize button in toolbarRight -->
59
- <CodeEditor class =" maximazable-code-editor--inline-instance" v-model =" modelValue" :language =" language" :read-only =" readOnly" :show-gutter =" showGutter" :show-copy-to-clipboard =" showCopyToClipboard" :aria-label =" ariaLabel" :extensions =" extensions" >
60
- <template #toolbarLeft >
61
- <slot name =" toolbarLeft" ></slot >
62
- </template >
63
- <template #toolbarRight >
64
- <slot name =" toolbarRight" ></slot >
65
- <img class =" maximize-icon-inline" :src =" DiffMaximizeIcon" alt =" Maximize" @click =" toggleMaximizeModal" title =" Maximize view" />
66
- </template >
67
- </CodeEditor >
67
+ <div class =" code-editor-wrapper" @mouseenter =" onEditorMouseEnter" @mouseleave =" onEditorMouseLeave" >
68
+ <!-- Regular CodeEditor -->
69
+ <div class =" editor-container" >
70
+ <!-- Maximize Button (shown on hover) -->
71
+ <button v-if =" showMaximizeButton" @click =" toggleMaximizeModal" class =" maximize-button" title =" Maximize view" >
72
+ <img :src =" DiffMaximizeIcon" alt =" Maximize" width =" 14" height =" 14" />
73
+ </button >
74
+
75
+ <CodeEditor
76
+ class =" maximazable-code-editor--inline-instance"
77
+ v-model =" modelValue"
78
+ :language =" language"
79
+ :read-only =" readOnly"
80
+ :show-gutter =" showGutter"
81
+ :show-copy-to-clipboard =" showCopyToClipboard"
82
+ :aria-label =" ariaLabel"
83
+ :extensions =" extensions"
84
+ >
85
+ <template #toolbarLeft >
86
+ <slot name =" toolbarLeft" ></slot >
87
+ </template >
88
+ <template #toolbarRight >
89
+ <slot name =" toolbarRight" ></slot >
90
+ </template >
91
+ </CodeEditor >
92
+ </div >
68
93
69
94
<!-- Maximize modal for CodeEditor -->
70
95
<div v-if =" showMaximizeModal" class =" maximize-modal" >
71
96
<div class =" maximize-modal-content" >
72
97
<div class =" maximize-modal-toolbar" >
73
98
<span class =" maximize-modal-title" >{{ modalTitle }}</span >
74
- <img class =" maximize-modal-close" :src =" DiffCloseIcon" alt =" Close" @click =" toggleMaximizeModal" title =" Close" />
99
+ <button @click =" toggleMaximizeModal" class =" maximize-modal-close" title =" Close" >
100
+ <img :src =" DiffCloseIcon" alt =" Close" width =" 16" height =" 16" />
101
+ </button >
75
102
</div >
76
103
<div class =" maximize-modal-body" >
77
104
<CodeEditor class =" maximazable-code-editor--pop-up-instance" v-model =" modelValue" :language =" language" :read-only =" readOnly" :show-copy-to-clipboard =" true" :show-gutter =" true" :aria-label =" ariaLabel" :extensions =" []" />
@@ -87,20 +114,43 @@ onBeforeUnmount(() => {
87
114
width : 100% ;
88
115
}
89
116
90
- /* Maximize icon styles */
91
- .maximize-icon-inline {
92
- width : 14px ;
93
- height : 14px ;
117
+ .maximize-button {
118
+ position : absolute ;
119
+ right : 6px ;
120
+ top : 6px ;
121
+ z-index : 10 ;
122
+ background-color : rgba (255 , 255 , 255 , 0.7 );
123
+ border : 1px solid #ddd ;
124
+ border-radius : 3px ;
125
+ padding : 4px ;
94
126
cursor : pointer ;
95
- opacity : 0.7 ;
127
+ opacity : 0.6 ;
96
128
transition : opacity 0.2s ease ;
97
- margin-left : 8px ;
98
129
}
99
130
100
- .maximize-icon-inline :hover {
131
+ .maximize-button :hover {
101
132
opacity : 1 ;
102
133
}
103
134
135
+ :deep(.wrapper.maximazable-code-editor--inline-instance ) {
136
+ border : none ;
137
+ border-radius : 0 ;
138
+ margin-top : 0 ;
139
+ }
140
+
141
+ :deep(.wrapper.maximazable-code-editor--inline-instance .toolbar ) {
142
+ border : none ;
143
+ border-radius : 0 ;
144
+ background-color : transparent ;
145
+ padding : 0 ;
146
+ margin-bottom : 0 ;
147
+ }
148
+
149
+ :deep(.wrapper.maximazable-code-editor--inline-instance .cm-editor ) {
150
+ /* Override any borders from the default theme */
151
+ border : none ;
152
+ }
153
+
104
154
/* Modal styles copied from DiffViewer */
105
155
.maximize-modal {
106
156
position : fixed ;
@@ -144,19 +194,22 @@ onBeforeUnmount(() => {
144
194
background : none ;
145
195
border : none ;
146
196
cursor : pointer ;
147
- width : 16px ;
148
- height : 16px ;
197
+ padding : 5px ;
198
+ display : flex ;
199
+ align-items : center ;
200
+ justify-content : center ;
149
201
}
150
202
151
203
.maximize-modal-body {
152
204
flex : 1 ;
153
205
overflow : auto ;
154
- padding : 15 px ;
206
+ padding : 0 ;
155
207
}
156
208
157
209
/* Ensure the CodeEditor wrapper fills the modal body */
158
210
.maximize-modal-body :deep(.wrapper ) {
159
- height : calc (100% - 20px );
211
+ height : 100% ;
212
+ border-radius : 0 ;
160
213
}
161
214
162
215
.maximize-modal-body :deep(.cm-editor ),
0 commit comments