@@ -41,6 +41,7 @@ export class Shape {
4141
4242 relRootTag : string ;
4343 relAttribute : string ;
44+ relType : string ;
4445 relParent : ( element : XmlElement ) => XmlElement ;
4546
4647 targetElement : XmlElement ;
@@ -93,13 +94,15 @@ export class Shape {
9394 async setTargetElement ( ) : Promise < void > {
9495 if ( ! this . sourceElement ) {
9596 // If we don't have a source element, we might be trying to remove a hyperlink
96- console . log ( `Warning: No source element for shape ${ this . name } . Creating empty element for operations.` ) ;
97+ console . log (
98+ `Warning: No source element for shape ${ this . name } . Creating empty element for operations.` ,
99+ ) ;
97100 if ( this . shape && this . shape . mode === 'remove' && this . targetArchive ) {
98101 // For remove operations, we don't need a source element
99102 // Just continue without setting targetElement
100103 return ;
101104 }
102-
105+
103106 // For non-remove operations or if other conditions aren't met, throw the error
104107 console . log ( this . shape ) ;
105108 throw `No source element for shape ${ this . name } ` ;
@@ -133,25 +136,28 @@ export class Shape {
133136 async processHyperlinks ( targetSlideXml : XmlDocument ) : Promise < void > {
134137 // Find all text runs in the element
135138 const runs = this . targetElement . getElementsByTagName ( 'a:r' ) ;
136-
139+
137140 for ( let i = 0 ; i < runs . length ; i ++ ) {
138141 const run = runs [ i ] ;
139142 const rPr = run . getElementsByTagName ( 'a:rPr' ) [ 0 ] ;
140-
143+
141144 if ( rPr ) {
142145 // Find hyperlink elements
143146 const hlinkClicks = rPr . getElementsByTagName ( 'a:hlinkClick' ) ;
144-
147+
145148 for ( let j = 0 ; j < hlinkClicks . length ; j ++ ) {
146149 const hlinkClick = hlinkClicks [ j ] ;
147150 const sourceRid = hlinkClick . getAttribute ( 'r:id' ) ;
148-
151+
149152 if ( sourceRid ) {
150153 // Update the r:id attribute to use the created relationship ID
151154 hlinkClick . setAttribute ( 'r:id' , this . createdRid ) ;
152-
155+
153156 // Ensure the xmlns:r attribute is set
154- hlinkClick . setAttribute ( 'xmlns:r' , 'http://schemas.openxmlformats.org/officeDocument/2006/relationships' ) ;
157+ hlinkClick . setAttribute (
158+ 'xmlns:r' ,
159+ 'http://schemas.openxmlformats.org/officeDocument/2006/relationships' ,
160+ ) ;
155161 }
156162 }
157163 }
@@ -252,7 +258,8 @@ export class Shape {
252258
253259 async updateTargetElementRelId ( ) : Promise < void > {
254260 this . targetElement
255- . getElementsByTagName ( this . relRootTag ) [ 0 ]
261+ . getElementsByTagName ( this . relRootTag )
262+ . item ( 0 )
256263 . setAttribute ( this . relAttribute , this . createdRid ) ;
257264 }
258265
0 commit comments