Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[BUG] addNotes function adding notes as an array of objects, parsed as [object Object] in notes field #941

Closed
1 of 4 tasks
karlolsonuc opened this issue Apr 21, 2021 · 2 comments
Assignees
Milestone

Comments

@karlolsonuc
Copy link

karlolsonuc commented Apr 21, 2021

Category

  • Enhancement
  • Bug
  • Question
  • Documentation gap/issue

Version

Please specify what version of the library you are using: 3.5.0

Please specify what version(s) of PowerPoint you are targeting: Powerpoint Online, Google Slides (they show identical behavior)

Expected / Desired Behavior

addNotes should result in text notes in the Notes field of the Powerpoint file.

Observed Behavior

addNotes function with any string results in [object Object] in the note field in any reader I've tried it in.

Steps to Reproduce

  1. use addNotes function to add any string to a pptxgen presentation.
  2. trigger save presentation
  3. open in either Powerpoint Online or Google Slides (possibly in Powerpoint itself?)
  4. note [object Object] in the field

Here is a slightly modified version of the demo fiddle which replicates this behavior: https://jsfiddle.net/zj5m21ba/0/

Here is another version of the demo fiddle that bypasses addNotes but successfully generates notes: https://jsfiddle.net/zj5m21ba/1/

@karlolsonuc karlolsonuc changed the title [ISSUE] addNotes function adding notes as an array of objects, parsed as [object Object [ISSUE] addNotes function adding notes as an array of objects, parsed as [object Object] in notes field Apr 21, 2021
@karlolsonuc karlolsonuc changed the title [ISSUE] addNotes function adding notes as an array of objects, parsed as [object Object] in notes field [BUG] addNotes function adding notes as an array of objects, parsed as [object Object] in notes field Apr 21, 2021
@ReimaFrgos
Copy link
Contributor

I noticed the same issue yesterday after updating. It looks like the function was updated as part of the addTextDefinition update that took place for 3.5.0.

Updated function:

function addNotesDefinition(target, notes) {
    target._slideObjects.push({
        _type: SLIDE_OBJECT_TYPES.notes,
        text: [{ text: notes }],
    });
}

All the downstream code still seems to be expecting a string though, so reverting back to the following restores the previous behaviour:

function addNotesDefinition(target, notes) {
    target._slideObjects.push({
        _type: SLIDE_OBJECT_TYPES.notes,
        text: notes,
    });
}

@gitbrent gitbrent self-assigned this Apr 22, 2021
@gitbrent gitbrent added this to the 3.6.0 milestone Apr 22, 2021
gitbrent added a commit that referenced this issue Apr 23, 2021
gitbrent added a commit that referenced this issue Apr 23, 2021
@gitbrent
Copy link
Owner

Thanks @karlolsonuc and @ReimaFrgos

Whoops. I neglected to check Notes functionality before v.3.5.0 was released.

Fixed now:
Screen Shot 2021-04-22 at 22 21 48

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants