Skip to content

docx/pptx editors still open the main part by name #1339

Description

@Mearman

The readers now resolve the main part from the root officeDocument relationship (#1314), but the edit path still opens it by name. packages/documents.js/src/edit/docx/editor.ts has its own DOCUMENT_PART_PATH = "word/document.xml" and throws package has no root element at word/document.xml; packages/documents.js/src/edit/pptx/editor.ts does the same with PRESENTATION_PART_PATH from edit/pptx/scaffold.ts.

So openDocx/openPptx on the exact file #1314 was about (body at word/document2.xml, which Word opens fine) throws, even though readDocxContent on the same package now reads it.

The docx side looks like resolving once in openDocx and threading the resolved path through the editor's media config and addRelationship call sites. The pptx side is more tangled: PRESENTATION_PART_PATH is a scaffold export that the writer genuinely needs as a literal when it builds a new package, so the read-an-existing-package path needs separating from the build-a-new-one path rather than just swapping the constant.

ooxml.js's findMainPartPath is the resolver, already exported.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions