@@ -30,6 +30,14 @@ class AutoShareManager {
3030
3131 // Listen for workspace changes
3232 this . attachListeners ( ) ;
33+
34+ // Trigger initial sync if there's content
35+ setTimeout ( ( ) => {
36+ const data = this . collectWorkspaceData ( ) ;
37+ if ( Object . keys ( data ) . length > 0 ) {
38+ this . markDirty ( ) ;
39+ }
40+ } , 500 ) ;
3341 }
3442
3543 attachListeners ( ) {
@@ -72,6 +80,16 @@ class AutoShareManager {
7280 // Collect current workspace data
7381 const payload = this . collectWorkspaceData ( ) ;
7482
83+ // If no files, don't sync
84+ if ( Object . keys ( payload ) . length === 0 ) {
85+ this . dirty = false ;
86+ this . setState ( 'synced' ) ;
87+ if ( this . linkInput ) {
88+ this . linkInput . value = 'Add files to generate install link' ;
89+ }
90+ return ;
91+ }
92+
7593 // Check if payload has changed
7694 const payloadHash = this . hashPayload ( payload ) ;
7795 if ( payloadHash === this . lastPayloadHash ) {
@@ -166,13 +184,17 @@ class AutoShareManager {
166184 case 'synced' :
167185 if ( this . panel ) this . panel . style . display = 'flex' ;
168186 if ( this . linkInput ) {
169- this . linkInput . value = this . currentShareUrl || 'No share link yet ' ;
187+ this . linkInput . value = this . currentShareUrl || 'Add files to generate install link ' ;
170188 this . linkInput . classList . remove ( 'opacity-50' ) ;
171189 this . linkInput . disabled = false ;
172190 }
173191 if ( this . copyButton ) {
174- this . copyButton . disabled = false ;
175- this . copyButton . classList . remove ( 'opacity-50' ) ;
192+ this . copyButton . disabled = ! this . currentShareUrl ;
193+ if ( this . currentShareUrl ) {
194+ this . copyButton . classList . remove ( 'opacity-50' ) ;
195+ } else {
196+ this . copyButton . classList . add ( 'opacity-50' ) ;
197+ }
176198 }
177199 break ;
178200
0 commit comments