Preserve QPowerPoint slide transitions in PPTX

This commit is contained in:
Курнат Андрей
2026-06-01 20:12:49 +03:00
parent d403ea7f10
commit ae82652068
5 changed files with 114 additions and 8 deletions
+27 -2
View File
@@ -1,7 +1,7 @@
import { useRef, useState } from "react";
import type { CSSProperties } from "react";
import { Copy, Download, EyeOff, FileText, FileUp, Image as ImageIcon, Palette, Plus, Save, Trash2 } from "lucide-react";
import type { Slide, SlideDeck, SlideImage } from "../../types";
import { Copy, Download, EyeOff, FileText, FileUp, Image as ImageIcon, Palette, Play, Plus, Save, Trash2 } from "lucide-react";
import type { Slide, SlideDeck, SlideImage, SlideTransition } from "../../types";
import { downloadBlobFile, downloadTextFile } from "../../utils/download";
import { exportPptxBlob, importPptxFile } from "../../io/powerPointOffice";
import { replaceFileExtension } from "../../io/fileHelpers";
@@ -40,6 +40,12 @@ const textColorSwatches = [
const slideFontFamilyOptions = ["Aptos", "Calibri", "Courier New", "Times New Roman"];
const titleFontSizeOptions = [24, 28, 30, 34, 40, 44, 48];
const subtitleFontSizeOptions = [14, 16, 18, 20, 22, 24, 28];
const slideTransitionOptions: Array<{ value: SlideTransition | ""; label: string }> = [
{ value: "", label: "Без перехода" },
{ value: "fade", label: "Растворение" },
{ value: "push", label: "Сдвиг" },
{ value: "wipe", label: "Шторка" }
];
const slideWidthInches = 13.333;
const slideHeightInches = 7.5;
@@ -448,6 +454,25 @@ export function QPowerPoint({ deck, onChange }: QPowerPointProps) {
))}
</select>
</label>
<label>
<span>
<Play size={16} />
Переход
</span>
<select
value={activeSlide.transition ?? ""}
onChange={(event) => {
const transition = event.target.value as SlideTransition | "";
updateSlide({ ...activeSlide, transition: transition || undefined });
}}
>
{slideTransitionOptions.map((option) => (
<option key={option.value || "none"} value={option.value}>
{option.label}
</option>
))}
</select>
</label>
<div className="slide-background-swatches" aria-label="Фон слайда">
{backgroundColorSwatches.map((swatch) => (
<button