pptx-viewer-core 1.1.37 → 1.1.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
Binary file
Binary file
package/dist/index.d.mts CHANGED
@@ -6380,6 +6380,14 @@ declare class PptxHandlerRuntime$11 extends PptxHandlerRuntime$12 {
6380
6380
  declare class PptxHandlerRuntime$10 extends PptxHandlerRuntime$11 {
6381
6381
  protected textStylesEqual(left: TextStyle | undefined, right: TextStyle | undefined): boolean;
6382
6382
  protected hasMixedTextStyles(textSegments: TextSegment[]): boolean;
6383
+ /**
6384
+ * Whether a segment carries run-level content that the flat `el.text` string
6385
+ * cannot represent: an OOXML field (`a:fld`), an inline equation, or a ruby
6386
+ * (phonetic) annotation. Such segments must survive a save: collapsing them
6387
+ * to the plain-text path silently downgrades a field to static text (e.g. a
6388
+ * slide-number field becomes a frozen number) or drops the equation/ruby.
6389
+ */
6390
+ protected isStructuralTextSegment(segment: TextSegment): boolean;
6383
6391
  protected areTextSegmentsUniform(textSegments: TextSegment[] | undefined): boolean;
6384
6392
  protected parseBooleanAttr(value: unknown): boolean;
6385
6393
  protected parseOptionalBooleanAttr(value: unknown): boolean | undefined;
package/dist/index.d.ts CHANGED
@@ -6380,6 +6380,14 @@ declare class PptxHandlerRuntime$11 extends PptxHandlerRuntime$12 {
6380
6380
  declare class PptxHandlerRuntime$10 extends PptxHandlerRuntime$11 {
6381
6381
  protected textStylesEqual(left: TextStyle | undefined, right: TextStyle | undefined): boolean;
6382
6382
  protected hasMixedTextStyles(textSegments: TextSegment[]): boolean;
6383
+ /**
6384
+ * Whether a segment carries run-level content that the flat `el.text` string
6385
+ * cannot represent: an OOXML field (`a:fld`), an inline equation, or a ruby
6386
+ * (phonetic) annotation. Such segments must survive a save: collapsing them
6387
+ * to the plain-text path silently downgrades a field to static text (e.g. a
6388
+ * slide-number field becomes a frozen number) or drops the equation/ruby.
6389
+ */
6390
+ protected isStructuralTextSegment(segment: TextSegment): boolean;
6383
6391
  protected areTextSegmentsUniform(textSegments: TextSegment[] | undefined): boolean;
6384
6392
  protected parseBooleanAttr(value: unknown): boolean;
6385
6393
  protected parseOptionalBooleanAttr(value: unknown): boolean | undefined;
package/dist/index.js CHANGED
@@ -30523,8 +30523,24 @@ var PptxHandlerRuntime17 = class extends PptxHandlerRuntime16 {
30523
30523
  (segment, index) => index > 0 && !this.textStylesEqual(segment.style, baseStyle)
30524
30524
  );
30525
30525
  }
30526
+ /**
30527
+ * Whether a segment carries run-level content that the flat `el.text` string
30528
+ * cannot represent: an OOXML field (`a:fld`), an inline equation, or a ruby
30529
+ * (phonetic) annotation. Such segments must survive a save: collapsing them
30530
+ * to the plain-text path silently downgrades a field to static text (e.g. a
30531
+ * slide-number field becomes a frozen number) or drops the equation/ruby.
30532
+ */
30533
+ isStructuralTextSegment(segment) {
30534
+ return Boolean(segment.fieldType || segment.equationXml || segment.rubyText);
30535
+ }
30526
30536
  areTextSegmentsUniform(textSegments) {
30527
- if (!textSegments || textSegments.length <= 1) {
30537
+ if (!textSegments || textSegments.length === 0) {
30538
+ return true;
30539
+ }
30540
+ if (textSegments.some((segment) => this.isStructuralTextSegment(segment))) {
30541
+ return false;
30542
+ }
30543
+ if (textSegments.length === 1) {
30528
30544
  return true;
30529
30545
  }
30530
30546
  return !this.hasMixedTextStyles(textSegments);
package/dist/index.mjs CHANGED
@@ -30518,8 +30518,24 @@ var PptxHandlerRuntime17 = class extends PptxHandlerRuntime16 {
30518
30518
  (segment, index) => index > 0 && !this.textStylesEqual(segment.style, baseStyle)
30519
30519
  );
30520
30520
  }
30521
+ /**
30522
+ * Whether a segment carries run-level content that the flat `el.text` string
30523
+ * cannot represent: an OOXML field (`a:fld`), an inline equation, or a ruby
30524
+ * (phonetic) annotation. Such segments must survive a save: collapsing them
30525
+ * to the plain-text path silently downgrades a field to static text (e.g. a
30526
+ * slide-number field becomes a frozen number) or drops the equation/ruby.
30527
+ */
30528
+ isStructuralTextSegment(segment) {
30529
+ return Boolean(segment.fieldType || segment.equationXml || segment.rubyText);
30530
+ }
30521
30531
  areTextSegmentsUniform(textSegments) {
30522
- if (!textSegments || textSegments.length <= 1) {
30532
+ if (!textSegments || textSegments.length === 0) {
30533
+ return true;
30534
+ }
30535
+ if (textSegments.some((segment) => this.isStructuralTextSegment(segment))) {
30536
+ return false;
30537
+ }
30538
+ if (textSegments.length === 1) {
30523
30539
  return true;
30524
30540
  }
30525
30541
  return !this.hasMixedTextStyles(textSegments);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pptx-viewer-core",
3
- "version": "1.1.37",
3
+ "version": "1.1.38",
4
4
  "description": "PowerPoint PPTX engine: parse, edit, serialize, and convert .pptx files. Framework-agnostic TypeScript SDK.",
5
5
  "keywords": [
6
6
  "converter",