@@ -137,7 +137,12 @@ export default class HasShapes {
137137 targetType : ShapeTargetType ;
138138 params : AutomizerParams ;
139139
140- constructor ( params ) {
140+ cleanupPlaceholders : boolean = false ;
141+
142+ constructor ( params : {
143+ presentation : IPresentationProps ;
144+ template : PresTemplate ;
145+ } ) {
141146 this . sourceTemplate = params . template ;
142147
143148 this . modifications = [ ] ;
@@ -147,6 +152,8 @@ export default class HasShapes {
147152
148153 this . status = params . presentation . status ;
149154 this . content = params . presentation . content ;
155+
156+ this . cleanupPlaceholders = params . presentation . params . cleanupPlaceholders ;
150157 }
151158
152159 /**
@@ -939,7 +946,7 @@ export default class HasShapes {
939946 targetPath ,
940947 ) ;
941948
942- if ( sourcePlaceholderTypes ) {
949+ if ( this . cleanupPlaceholders && sourcePlaceholderTypes ) {
943950 this . removeDuplicatePlaceholders ( xml , sourcePlaceholderTypes ) ;
944951 this . normalizePlaceholderShapes ( xml , sourcePlaceholderTypes ) ;
945952 }
@@ -983,9 +990,14 @@ export default class HasShapes {
983990 ( sourcePlaceholder ) => sourcePlaceholder . type === usedType ,
984991 ) ;
985992 removePlaceholders . forEach ( ( removePlaceholder ) => {
986- const removePlaceholderShape = removePlaceholder . xml . parentNode
987- . parentNode . parentNode as XmlElement ;
988- XmlHelper . remove ( removePlaceholderShape ) ;
993+ const parentShapeTag = 'p:sp' ;
994+ const parentShape = XmlHelper . getClosestParent (
995+ parentShapeTag ,
996+ removePlaceholder . xml ,
997+ ) ;
998+ if ( parentShape ) {
999+ XmlHelper . remove ( parentShape ) ;
1000+ }
9891001 } ) ;
9901002 }
9911003 }
0 commit comments