55 class =" fixed top-0 left-0 bg-background rounded-xl text-foreground border"
66 :style =" { zIndex: CONTENT_ZINDEX.content, width: CONTAINER_WIDTH + 'px' }"
77 >
8- <div
9- class =" text-center py-1 bg-muted/25 cursor-move text-muted-foreground px-4 flex items-center transition-colors w-full rounded-t-lg border-b"
10- @pointerdown.self =" startDragging"
11- >
12- <GripHorizontalIcon class =" h-5 w-5 text-muted-foreground opacity-50" />
13- <div class =" flex-grow" ></div >
14- <button
15- class =" hover p-1 rounded-sm hover:bg-muted/50 hover:text-foreground transition"
16- @click =" closeWindow"
17- >
18- <XIcon class =" h-5 w-5" />
19- </button >
20- </div >
8+ <DetailHeader
9+ :container-el =" containerRef"
10+ :last-position =" lastPosition"
11+ :selected-el =" selectedEl"
12+ @close-window =" closeWindow"
13+ @update-window-pos =" updateWindowPosition"
14+ />
2115 <div class =" px-4 pt-4" >
2216 <UiElementSelector :selector =" elProperties.selector" />
2317 <div class =" flex items-center mt-0.5 gap-1 text-sm" >
4741 </button >
4842 </div >
4943 <div style =" max-height : calc (100vh - 200px )" class =" overflow-auto p-4" >
50- <KeepAlive >
44+ <KeepAlive include = " detail-style,DetailStyle " >
5145 <DetailStyle
5246 v-if =" state.activeTab === 'style' && elStyleData"
5347 :el-selector =" elSelector"
6054 v-else-if =" state.activeTab === 'attributes' && selectedEl"
6155 :element =" selectedEl"
6256 />
57+ <DetailElementHTML
58+ v-else-if =" state.activeTab === 'html' && selectedEl"
59+ :element =" selectedEl"
60+ />
6361 </KeepAlive >
6462 </div >
6563 </div >
@@ -82,20 +80,17 @@ import {
8280 BrushIcon ,
8381 CaseSensitiveIcon ,
8482 PencilRuler ,
85- XIcon ,
86- GripHorizontalIcon ,
83+ Code2Icon ,
8784} from ' lucide-vue-next' ;
88- import {
89- CONTENT_ZINDEX ,
90- EL_ATTR_NAME ,
91- SESSION_STORAGE_KEY ,
92- } from ' @src/utils/constant' ;
85+ import { CONTENT_ZINDEX , SESSION_STORAGE_KEY } from ' @src/utils/constant' ;
9386import getElProperties , {
9487 ElementProperties ,
9588} from ' @root/src/utils/getElProperties' ;
9689import DetailStyle from ' ./detail/DetailStyle.vue' ;
90+ import DetailElementHTML from ' ./detail/DetailElementHTML.vue' ;
9791import UiElementSelector from ' @root/src/pages/components/ui/UiElementSelector.vue' ;
9892import { finder } from ' @medv/finder' ;
93+ import DetailHeader from ' ./detail/DetailHeader.vue' ;
9994import DetailAttributes from ' ./detail/DetailAttributes.vue' ;
10095import { debounce , parseJSON } from ' @root/src/utils/helper' ;
10196import { StyleDataItem , useAppProvider } from ' ../app-plugin' ;
@@ -117,6 +112,7 @@ const cssRulesUtils = new CSSRulesUtils();
117112const tabItems = [
118113 { name: ' Style' , id: ' style' , icon: BrushIcon },
119114 { name: ' Attributes' , id: ' attributes' , icon: PencilRuler },
115+ { name: ' HTML' , id: ' html' , icon: Code2Icon },
120116];
121117
122118const appProvider = useAppProvider ();
@@ -177,45 +173,6 @@ function updateWindowPosition(x: number, y: number) {
177173 lastPosition = { x , y };
178174 containerRef .value .style .transform = ` translate(${x }px, ${y }px) ` ;
179175}
180- function startDragging(pointerDownEvent : PointerEvent ) {
181- if (! containerRef .value ) return ;
182-
183- const containerRect = containerRef .value .getBoundingClientRect ();
184-
185- const offsetY = pointerDownEvent .clientY - containerRect .top ;
186- const offsetX = pointerDownEvent .clientX - containerRect .left ;
187-
188- document .body .setAttribute (EL_ATTR_NAME .dragging , ' ' );
189-
190- function pointerMoveHandler({ clientX , clientY }: PointerEvent ) {
191- let x = clientX - offsetX ;
192- let y = clientY - offsetY ;
193-
194- if (x < 0 ) x = 0 ;
195- else if (x + containerRect .width > window .innerWidth )
196- x = window .innerWidth - containerRect .width ;
197-
198- if (y < 0 ) y = 0 ;
199- else if (y + containerRect .height > window .innerHeight )
200- y = window .innerHeight - containerRect .height ;
201-
202- updateWindowPosition (x , y );
203- }
204-
205- document .addEventListener (' pointermove' , pointerMoveHandler );
206- document .addEventListener (
207- ' pointerup' ,
208- () => {
209- sessionStorage .setItem (
210- SESSION_STORAGE_KEY .elPropsPosition ,
211- JSON .stringify (lastPosition ),
212- );
213- document .body .removeAttribute (EL_ATTR_NAME .dragging );
214- document .removeEventListener (' pointermove' , pointerMoveHandler );
215- },
216- { once: true },
217- );
218- }
219176function onSelectElement({
220177 el ,
221178 properties ,
0 commit comments