Skip to content

[4.0] feat(presentation): insert pages into an existing presentation (from core and plugins) - #277

Merged
TiagoJacobs merged 4 commits into
bigbluebutton:v0.1.xfrom
imdt-claudiop:feature/insert-pages-server-command
Aug 6, 2026
Merged

[4.0] feat(presentation): insert pages into an existing presentation (from core and plugins)#277
TiagoJacobs merged 4 commits into
bigbluebutton:v0.1.xfrom
imdt-claudiop:feature/insert-pages-server-command

Conversation

@imdt-claudiop

@imdt-claudiop imdt-claudiop commented Jul 7, 2026

Copy link
Copy Markdown

feat(server-commands): add presentation.insertPages command

What this adds (and why)

This adds a new server-command to the plugin SDK: serverCommands.presentation.insertPages(position, content). It allows a plugin to insert pages taken from a source file into an existing in-meeting presentation at a given 1-based position. Pages already in the target are shifted right; omitting content (or passing null) inserts a blank slide.

This is the SDK half of a feature whose backend + html5 glue lands in the paired BBB monorepo PR (bigbluebutton/bigbluebutton#25380). The SDK envelope is shipped separately because it is a distinct repository and follows its own release cadence; the BBB PR references this branch by codeload until a versioned release of the SDK is published.

API

/**
 * Inserts pages into the current presentation at a given position (if presenter,
 * ignores otherwise).
 *
 * @param position 1-based position where the pages are inserted. Out-of-range
 *  values are clamped by the server (1 prepends, totalPages + 1 appends).
 * @param content The file to convert into pages. Pass `null` (or omit) to insert a
 *  single blank page.
 * @param mimeType Optional mime type of the content (e.g. `application/pdf`).
 * @param filename Optional original filename.
 */
serverCommands.presentation.insertPages(
  position: number,
  content?: UploadPresentationContent | null,
  mimeType?: string,
  filename?: string,
): void;

content is the same UploadPresentationContent union used by the sibling upload command, so the source can be provided as { file }, { blob }, { base64 } or { dataUrl }.

The signature is positional (unlike upload(args)), matching the contract originally specified. Internally it is wrapped in an InsertPagesCommandArguments payload and dispatched via the same window.dispatchEvent(new CustomEvent(...)) pattern as the sibling upload command.

Changes

  • src/server-commands/presentation/enum.ts: adds INSERT_PAGES = 'PRESENTATION_INSERT_PAGES_COMMAND'.
  • src/server-commands/presentation/types.ts: adds InsertPagesCommandArguments (with position, content: UploadPresentationContent | null, mimeType?, filename?); adds insertPages(position: number, content?: UploadPresentationContent | null, mimeType?: string, filename?: string): void to ServerCommandsPresentationObject.
  • src/server-commands/presentation/commands.ts: implements insertPages(position: number, content?: UploadPresentationContent | null, mimeType?: string, filename?: string): void; an omitted or null content is dispatched as null and produces a blank-slide request server-side.
  • src/server-commands/index.ts: re-exports the new types.

Validation

Validated end-to-end in a running from-source BBB 4.0 server (paired with the backend PR above): a minimal test plugin calls serverCommands.presentation.insertPages(2, { file: pdf }) against a base 3-page presentation; the inserted pages appear at positions 2-3, the originals shift to 4-5 (verified by DOM, GraphQL pres_page ordering, and recording events.xml integrity). See the paired BBB PR for the MP4 + screenshots.

Out of scope

The external XML API (insertDocument) is intentionally not extended; this command is exposed only via the in-meeting plugin path.

@welcome

welcome Bot commented Jul 7, 2026

Copy link
Copy Markdown

Thank you for this contribution! Could you please confirm if you already sent in the signed Contributor License Agreement? See https://docs.bigbluebutton.org/support/faq.html#why-do-i-need-to-sign-a-contributor-license-agreement-to-contribute-source-code Thanks in advance!

@imdt-claudiop
imdt-claudiop marked this pull request as draft July 7, 2026 03:34
@imdt-claudiop imdt-claudiop changed the title feat(server-commands): add presentation.insertPages command feat(presentation): insert pages into an existing presentation Jul 7, 2026
@imdt-claudiop imdt-claudiop changed the title feat(presentation): insert pages into an existing presentation feat(presentation): insert pages into an existing presentation (from core and plugins) Jul 7, 2026
@imdt-claudiop imdt-claudiop changed the title feat(presentation): insert pages into an existing presentation (from core and plugins) [4.0] feat(presentation): insert pages into an existing presentation (from core and plugins) Jul 7, 2026
Add a plugin server-command that inserts pages into the current
presentation at a 1-based position. A null content inserts a single
blank page; out-of-range positions are clamped server-side.

- enum: PRESENTATION_INSERT_PAGES_COMMAND
- types: InsertPagesCommandArguments, insertPages on ServerCommandsPresentationObject
- commands: insertPages(position, content?, mimeType?, filename?) dispatcher
Move the defaulted `content` parameter to the end of the `insertPages`
signature so optional params (`mimeType`, `filename`) come first, and
break the params across lines to satisfy function-paren-newline. Update
the JSDoc and the ServerCommandsPresentationObject type to match.
The previous ordering pushed content behind mimeType and filename to avoid
the default-param-last lint rule, which forced insertPages(2, undefined,
undefined, { file }) for the primary use case. The rule only flags
default-value parameters, so declaring content as an optional parameter with
no default keeps the positional (position, content) contract and still lints
clean. The dispatched detail now normalizes an omitted content to null, which
core reads as a blank page.
@imdt-claudiop
imdt-claudiop force-pushed the feature/insert-pages-server-command branch from 0a05200 to 4e112d3 Compare August 6, 2026 17:07
Add the insertPages entry to the server commands namespace list, with an
example usage that inserts the pages of a PDF file at a given position.

Also deduplicate the presentation block: it was listed twice, verbatim, as
a leftover of the v0.0.x into v0.1.x merges, and both copies were indented
as children of the caption namespace instead of being a sibling of it.

@GuiLeme GuiLeme left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@TiagoJacobs
TiagoJacobs merged commit 5c12444 into bigbluebutton:v0.1.x Aug 6, 2026
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants