@@ -135,7 +135,7 @@ export default class HasShapes {
135135 unsupportedTags = [
136136 'p:custDataLst' ,
137137 // exclude bullet images
138- // 'a:buBlip',
138+ 'a:buBlip' ,
139139 // 'p:oleObj',
140140 // 'mc:AlternateContent',
141141 // 'a14:imgProps',
@@ -405,9 +405,8 @@ export default class HasShapes {
405405 * Try to convert a given slide's creationId to corresponding slide number.
406406 * Used if automizer is run with useCreationIds: true
407407 * @internal
408- * @param PresTemplate
409- * @slideNumber SourceSlideIdentifier
410- * @returns number
408+ * @param template
409+ * @param slideIdentifier
411410 */
412411 getSlideNumber (
413412 template : PresTemplate ,
@@ -436,19 +435,47 @@ export default class HasShapes {
436435 return slideIdentifier as number ;
437436 }
438437
438+ /**
439+ * Processes and updates the list of imported elements by ensuring their uniqueness based on a generated hash.
440+ * If duplicate elements are found, their callbacks are merged.
441+ *
442+ * @return {Promise<void> } Resolves when the process of identifying and updating unique imported elements is complete.
443+ */
444+ async getUniqueImportedElements ( ) : Promise < ImportElement [ ] > {
445+ for ( const element of this . importElements ) {
446+ const info = await this . getElementInfo ( element ) ;
447+ const selector = XmlSlideHelper . getSelector ( info . sourceElement )
448+ const eleHash = JSON . stringify ( selector )
449+ const alreadyImported = this . importElements . find (
450+ ( ele ) => ele . info ?. hash === eleHash ,
451+ ) ;
452+ if ( alreadyImported ) {
453+ alreadyImported . info . callback = GeneralHelper . arrayify (
454+ alreadyImported . info . callback ,
455+ ) ;
456+ const pushCallbacks = GeneralHelper . arrayify ( element . callback ) ;
457+ if ( pushCallbacks . length ) {
458+ alreadyImported . info . callback . push ( ...pushCallbacks ) ;
459+ }
460+ } else {
461+ info . hash = eleHash ;
462+ element . info = info ;
463+ }
464+ }
465+
466+ return this . importElements . filter ( ele => {
467+ return ele . info
468+ } )
469+ }
470+
439471 /**
440472 * Imported selected elements while merging multiple element modifications
441473 * @internal
442474 */
443475 async importedSelectedElements ( ) : Promise < void > {
444- await this . getUniqueImportedElements ( ) ;
445-
446- for ( const element of this . importElements ) {
447- if ( ! element . info ) {
448- // Element has already been modified, skipping...
449- continue ;
450- }
476+ const importElements = await this . getUniqueImportedElements ( ) ;
451477
478+ for ( const element of importElements ) {
452479 const info = element . info ;
453480 switch ( info ?. type ) {
454481 case ElementType . Chart :
@@ -502,35 +529,6 @@ export default class HasShapes {
502529 }
503530 }
504531
505- /**
506- * Processes and updates the list of imported elements by ensuring their uniqueness based on a generated hash.
507- * If duplicate elements are found, their callbacks are merged.
508- *
509- * @return {Promise<void> } Resolves when the process of identifying and updating unique imported elements is complete.
510- */
511- async getUniqueImportedElements ( ) : Promise < void > {
512- for ( const element of this . importElements ) {
513- const info = await this . getElementInfo ( element ) ;
514- const eleHash =
515-
516- XmlHelper . createHashFromXmlElement ( info . sourceElement , element ) ;
517-
518- const alreadyImported = this . importElements . find (
519- ( ele ) => ele . info ?. hash === eleHash ,
520- ) ;
521- if ( alreadyImported ) {
522- alreadyImported . callback = GeneralHelper . arrayify (
523- alreadyImported . callback ,
524- ) ;
525- const pushCallbacks = GeneralHelper . arrayify ( element . callback ) ;
526- alreadyImported . callback . push ( ...pushCallbacks ) ;
527- } else {
528- info . hash = eleHash ;
529- element . info = info ;
530- }
531- }
532- }
533-
534532 /**
535533 * Gets element info
536534 * @internal
0 commit comments