@cola1900/dsh-ppt 0.2.0 → 0.2.2

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/lib/client.js CHANGED
@@ -458,8 +458,12 @@ window.__ModuleLoader__.load({
458
458
  })))));
459
459
  }
460
460
  function OfficePptComposer(props) {
461
- const session = props.useSession(current => ({ blank: current.blank, agentPreset: current.agentPreset }));
462
- if (!session.blank || session.agentPreset !== "ppt") return null;
461
+ const blank = props.useSession(current => current.blank);
462
+ const agentPreset = props.useSessions(current => {
463
+ const summary = current.byId[props.sessionId];
464
+ return summary?.projectionValues?.agentPreset ?? summary?.agentPreset;
465
+ });
466
+ if (!blank || agentPreset !== "ppt") return null;
463
467
  return react_jsx_runtime.jsx(OfficePptChooser, {
464
468
  client: props.client, mode: props.mode, sessionId: props.sessionId, t: props.t
465
469
  }, props.sessionId);
@@ -652,7 +656,7 @@ window.__ModuleLoader__.load({
652
656
  name, id: "dsh-ppt", order: 20, locale: NS, inject: injectHero
653
657
  }, props => react_jsx_runtime.jsx(OfficePptComposer, {
654
658
  client: props.client, mode: props.mode, sessionId: props.sessionId,
655
- useSession: props.useSession, t: props.t
659
+ useSession: props.useSession, useSessions: props.useSessions, t: props.t
656
660
  }, props.sessionId)));
657
661
  }
658
662
  //#endregion
package/lib/index.js CHANGED
@@ -758,7 +758,8 @@ var PptService = class {
758
758
  state: {
759
759
  ...state,
760
760
  selectedTemplateId: template.id,
761
- templateMigration: undefined
761
+ templateMigration: undefined,
762
+ presentationMode: "ppt"
762
763
  },
763
764
  value: template,
764
765
  summary: `已选择模板 ${template.name}`,
@@ -3145,8 +3146,9 @@ function pptComposerContext(state) {
3145
3146
  /** Resolve the preset currently running this session, including blank-session switches. */
3146
3147
  function sessionAgentPreset(session) {
3147
3148
  if (session === void 0 || typeof session !== "object") return void 0;
3148
- for (let index = (session.events?.length ?? 0) - 1; index >= 0; index -= 1) {
3149
- const event = session.events[index];
3149
+ const events = typeof session.snapshotEvents === "function" ? session.snapshotEvents() : Array.isArray(session.events) ? session.events : [];
3150
+ for (let index = events.length - 1; index >= 0; index -= 1) {
3151
+ const event = events[index];
3150
3152
  if (event?.type === "agent-preset/selected" && typeof event.data?.agentPreset === "string") return event.data.agentPreset;
3151
3153
  }
3152
3154
  return typeof session.header?.agentPreset === "string" ? session.header.agentPreset : void 0;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cola1900/dsh-ppt",
3
3
  "description": "Standalone DSH plugin for PPT authoring, template selection, validation and editable PPTX export",
4
- "version": "0.2.0",
4
+ "version": "0.2.2",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/boe1900/dsh-ppt.git"