Phase 3: - Declare PowerPointApi 1.5 and replace template manifest values - Remove the dead command pipeline and the tracked Babel/polyfill setup - Extract constants, status/settings contexts, PowerPoint services, and an error boundary - Build with ES2020 and strict TypeScript; hash production assets and drop prod source maps - Add Vitest tests, CI, LICENSE, Node 20 pinning, and prune unused dependencies - Correct the README, user guide, developer guide, and audit notes Phase 4: - Add a persisted 16:9/4:3 slide size setting used by all layout tools - Add dark mode with Office/system theme detection - Make sections collapsible and move to accessible Fluent controls - Announce status through aria-live and add semantic status icons - Add a progress counter with cooperative cancellation and a Stop button - Update the tracked dependency tree for the pruned packages
This commit is contained in:
1 parent
e57258afe9
commit
89989c04e9
6211 files changed
+7028
-274819
No files matched your search
+229
-206
@@ -1,175 +1,249 @@
|
||||
# Edison PowerPoint Add-in Developer Documentation
|
||||
|
||||
This document provides detailed technical information for developers working on the Edison PowerPoint Add-in.
|
||||
This document provides technical information for developers working on the Edison PowerPoint Add-in.
|
||||
|
||||
## Architecture Overview
|
||||
|
||||
Edison is a PowerPoint add-in built with:
|
||||
- **TypeScript** for type-safe code
|
||||
- **React** for UI components
|
||||
- **Office.js API** for PowerPoint integration
|
||||
- **Fluent UI** for Microsoft-style interface components
|
||||
Edison is a PowerPoint task pane add-in built with:
|
||||
|
||||
The application follows a component-based architecture where each tool is encapsulated in its own React component.
|
||||
- **TypeScript** for type-safe code
|
||||
- **React 18** for UI components
|
||||
- **Office.js** (PowerPointApi 1.5) for PowerPoint integration
|
||||
- **Fluent UI v9** for Microsoft-style components
|
||||
- **Webpack 5** with `ts-loader`
|
||||
- **Vitest** for unit tests
|
||||
|
||||
The application separates UI, shared state, and PowerPoint operations:
|
||||
|
||||
- Components render tools and collect user input.
|
||||
- `context/` holds shared status/progress state and per-presentation settings.
|
||||
- `services/` contains batched PowerPoint operations and pure helpers.
|
||||
- `constants.ts` is the single source for slide size presets and shape name constants.
|
||||
|
||||
## UML Diagrams
|
||||
|
||||
To better understand the architecture and structure of the Edison PowerPoint Add-in, refer to the following UML diagrams:
|
||||
|
||||
- [UML Diagrams Index](powerpoint-toolbox-uml-index.md) - Overview and index of all UML diagrams
|
||||
- [Component Relationships](powerpoint-toolbox-uml.md) - Shows the relationships between React components
|
||||
- [Project Structure](powerpoint-toolbox-structure-uml.md) - Illustrates the file and directory organization
|
||||
- [Data Flow](powerpoint-toolbox-dataflow-uml.md) - Demonstrates the flow of data and interactions
|
||||
|
||||
These diagrams provide visual representations of the application's architecture, component relationships, and data flow patterns, which can help new developers understand the codebase more quickly.
|
||||
The diagrams under `docs/` predate the context/service refactoring and should be treated as historical overviews. The source tree below is authoritative.
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
/
|
||||
├── assets/ # Images and icons
|
||||
├── dist/ # Build output (generated)
|
||||
├── src/
|
||||
│ ├── commands/ # Command handlers
|
||||
│ │ ├── commands.html # HTML for command UI
|
||||
│ │ └── commands.ts # Command implementations
|
||||
│ └── taskpane/ # Main add-in UI
|
||||
│ ├── components/ # React components
|
||||
│ │ ├── ActionButton.tsx # Reusable button with error handling
|
||||
│ └── taskpane/
|
||||
│ ├── components/
|
||||
│ │ ├── App.tsx # Layout, status, settings UI
|
||||
│ │ ├── ActionButton.tsx # Processing/error-aware button
|
||||
│ │ ├── ConfirmButton.tsx # Confirmation dialog button
|
||||
│ │ ├── ErrorBoundary.tsx # Render error fallback
|
||||
│ │ ├── Section.tsx # Collapsible section
|
||||
│ │ ├── AlignmentButtons.tsx
|
||||
│ │ ├── App.tsx # Main application component
|
||||
│ │ ├── ConfidentialButtons.tsx
|
||||
│ │ ├── DraftButtons.tsx
|
||||
│ │ ├── GridGuidelineManager.tsx
|
||||
│ │ ├── Header.tsx
|
||||
│ │ ├── InsertTitles.tsx
|
||||
│ │ ├── MatchProperties.tsx
|
||||
│ │ ├── MatchSizes.tsx
|
||||
│ │ ├── ProgressBarButtons.tsx
|
||||
│ │ ├── RoundImage.tsx
|
||||
│ │ ├── Section.tsx # Reusable section component
|
||||
│ │ ├── SmartTextFormatter.tsx
|
||||
│ │ ├── SwapPositions.tsx
|
||||
│ │ └── commonStyles.tsx
|
||||
│ ├── types/ # TypeScript type definitions
|
||||
│ │ └── office-types.ts # Office API type utilities
|
||||
│ ├── index.tsx # Entry point
|
||||
│ └── taskpane.html # Main HTML container
|
||||
├── babel.config.json # Babel configuration
|
||||
├── manifest.xml # Add-in manifest
|
||||
├── package.json # Dependencies and scripts
|
||||
├── tsconfig.json # TypeScript configuration
|
||||
└── webpack.config.js # Webpack configuration
|
||||
│ ├── context/
|
||||
│ │ ├── SettingsContext.tsx # Slide size preset (persisted)
|
||||
│ │ └── StatusContext.tsx # Status, processing, progress
|
||||
│ ├── services/
|
||||
│ │ ├── cancellation.ts # Cooperative cancellation flag
|
||||
│ │ ├── markers.ts # Confidential/draft markers
|
||||
│ │ ├── progressBar.ts # Progress bar add/remove
|
||||
│ │ └── titles.ts # Title collection + ranking
|
||||
│ ├── types/
|
||||
│ │ ├── office-types.ts # Office.js helpers
|
||||
│ │ └── globals.d.ts # __APP_VERSION__ declaration
|
||||
│ ├── constants.ts
|
||||
│ ├── Root.tsx # Theme, settings, error boundary
|
||||
│ ├── index.tsx # Entry point
|
||||
│ └── taskpane.html
|
||||
├── docs/
|
||||
├── manifest.xml
|
||||
├── package.json
|
||||
├── tsconfig.json
|
||||
├── vitest.config.mts
|
||||
└── webpack.config.js
|
||||
```
|
||||
|
||||
## Development Environment Setup
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Node.js (LTS version recommended)
|
||||
- npm
|
||||
- Microsoft PowerPoint (desktop version)
|
||||
- Node.js 20 LTS (see `.nvmrc`)
|
||||
- npm
|
||||
- Microsoft PowerPoint (desktop or web)
|
||||
|
||||
### Setup Steps
|
||||
|
||||
1. Clone the repository:
|
||||
```bash
|
||||
git clone https://github.com/your-org/edison-powerpoint-addin.git
|
||||
cd edison-powerpoint-addin
|
||||
git clone https://gitea.h3132.de/Edison/powerpoint-toolbox.git
|
||||
cd powerpoint-toolbox
|
||||
```
|
||||
|
||||
2. Install dependencies:
|
||||
```bash
|
||||
npm install
|
||||
npm ci
|
||||
```
|
||||
|
||||
3. Build the project:
|
||||
3. Build:
|
||||
```bash
|
||||
npm run build:dev
|
||||
```
|
||||
|
||||
4. Start the development server:
|
||||
```bash
|
||||
npm run dev-server
|
||||
```
|
||||
|
||||
5. Start the add-in in PowerPoint:
|
||||
4. Start the development server and sideload:
|
||||
```bash
|
||||
npm run start
|
||||
```
|
||||
|
||||
### Local Development Certificates
|
||||
|
||||
Office Add-ins require HTTPS even for local development. The `office-addin-dev-certs` package is used to create and install self-signed certificates for development.
|
||||
Office add-ins require HTTPS locally. `office-addin-dev-certs` creates and installs a self-signed certificate. If you see certificate errors, run:
|
||||
|
||||
If you encounter certificate issues, run:
|
||||
```bash
|
||||
npx office-addin-dev-certs install
|
||||
```
|
||||
|
||||
## Component Development Guidelines
|
||||
## Shared State
|
||||
|
||||
### Reusable Components
|
||||
### Status and progress
|
||||
|
||||
#### ActionButton
|
||||
A reusable button component that handles error states, loading states, and consistent styling:
|
||||
`StatusContext` provides status messages, processing state, progress, and the setters used by `ActionButton` and tool components:
|
||||
|
||||
```typescript
|
||||
import { useStatusContext } from "../context/StatusContext";
|
||||
|
||||
const {
|
||||
setStatusMessage,
|
||||
setStatusType,
|
||||
isProcessing,
|
||||
setIsProcessing,
|
||||
progress,
|
||||
setProgress
|
||||
} = useStatusContext();
|
||||
```
|
||||
|
||||
Wrap long operations in `PowerPoint.run` and report progress at natural boundaries:
|
||||
|
||||
```typescript
|
||||
setProgress({ current: index + 1, total: slides.length });
|
||||
```
|
||||
|
||||
### Settings
|
||||
|
||||
`SettingsContext` exposes the per-presentation slide size:
|
||||
|
||||
```typescript
|
||||
import { useSettings } from "../context/SettingsContext";
|
||||
|
||||
const { slideSize, slideSizePreset, setSlideSizePreset } = useSettings();
|
||||
// slideSize.width / slideSize.height
|
||||
```
|
||||
|
||||
The selection is stored in `Office.context.document.settings` and survives task pane reloads for that presentation.
|
||||
|
||||
### Cancellation
|
||||
|
||||
Use the cancellation service for operations that can run long:
|
||||
|
||||
```typescript
|
||||
import {
|
||||
resetCancellation,
|
||||
isCancellationRequested
|
||||
} from "../services/cancellation";
|
||||
|
||||
resetCancellation();
|
||||
for (const slide of slides) {
|
||||
if (isCancellationRequested()) break;
|
||||
// queue work
|
||||
}
|
||||
```
|
||||
|
||||
`ActionButton` and the tool components reset the flag when an operation starts. `App.tsx` shows a Stop button while processing.
|
||||
|
||||
## Reusable Components
|
||||
|
||||
### ActionButton
|
||||
|
||||
Handles processing state, error reporting, and optional confirmation:
|
||||
|
||||
```tsx
|
||||
import ActionButton from "./ActionButton";
|
||||
|
||||
// In your component:
|
||||
<ActionButton
|
||||
title="Match Sizes"
|
||||
icon={<ArrowFitInRegular />}
|
||||
onClick={myAsyncFunction}
|
||||
title="Insert Titles"
|
||||
icon={<TextBulletListRegular />}
|
||||
onClick={doWork}
|
||||
confirmTitle="Replace text box contents?"
|
||||
confirmMessage="This replaces the text in the selected text box."
|
||||
confirmLabel="Insert"
|
||||
/>
|
||||
```
|
||||
|
||||
#### Section
|
||||
A consistent container for organizing the UI:
|
||||
### ConfirmButton
|
||||
|
||||
For raw Fluent buttons that need a confirmation dialog:
|
||||
|
||||
```tsx
|
||||
import Section from "./Section";
|
||||
<ConfirmButton
|
||||
title="Remove"
|
||||
icon={<DismissRegular />}
|
||||
onConfirm={remove}
|
||||
confirmTitle="Remove the grid?"
|
||||
confirmMessage="This removes the grid from the current slide."
|
||||
>
|
||||
Remove
|
||||
</ConfirmButton>
|
||||
```
|
||||
|
||||
// In your component:
|
||||
<Section title="My Feature Group">
|
||||
### Section
|
||||
|
||||
Collapsible grouping with consistent styling:
|
||||
|
||||
```tsx
|
||||
<Section title="My Feature">
|
||||
<MyFeatureComponent />
|
||||
</Section>
|
||||
```
|
||||
|
||||
### Creating a New Tool
|
||||
## Creating a New Tool
|
||||
|
||||
1. Create a new component file in `src/taskpane/components/`
|
||||
2. Import the necessary Office.js APIs and React hooks
|
||||
3. Use the StatusContext for user feedback
|
||||
4. Follow the pattern of existing components:
|
||||
- Use the `PowerPoint.run()` method for PowerPoint operations
|
||||
- Provide clear success/error messaging
|
||||
- Handle selection states appropriately
|
||||
1. Create a component in `src/taskpane/components/`.
|
||||
2. Use `useStatusContext()` and, if needed, `useSettings()`.
|
||||
3. Put reusable or batch-heavy PowerPoint logic in `src/taskpane/services/`.
|
||||
4. Add confirmation for destructive actions.
|
||||
5. Add the component to `App.tsx` inside a `Section`.
|
||||
6. Add unit tests for pure logic.
|
||||
7. Update the user and developer docs.
|
||||
|
||||
Example:
|
||||
|
||||
Example component structure:
|
||||
```tsx
|
||||
import * as React from "react";
|
||||
import { useState } from "react";
|
||||
import { Button } from "@fluentui/react-components";
|
||||
import { useStatusContext } from "./App";
|
||||
import { useStatusContext } from "../context/StatusContext";
|
||||
import { getErrorMessage } from "../types/office-types";
|
||||
import { resetCancellation } from "../services/cancellation";
|
||||
|
||||
const MyNewTool: React.FC = () => {
|
||||
const { setStatusMessage, setStatusType, isProcessing, setIsProcessing } = useStatusContext();
|
||||
|
||||
const performAction = async () => {
|
||||
resetCancellation();
|
||||
setIsProcessing(true);
|
||||
try {
|
||||
await PowerPoint.run(async (context) => {
|
||||
// Implement your PowerPoint operations here
|
||||
// Queue batched operations here
|
||||
await context.sync();
|
||||
});
|
||||
setStatusMessage("Operation completed successfully!");
|
||||
setStatusType("success");
|
||||
} catch (error) {
|
||||
setStatusMessage(`Error: ${error.message}`);
|
||||
} catch (error: unknown) {
|
||||
setStatusMessage(`Error: ${getErrorMessage(error)}`);
|
||||
setStatusType("error");
|
||||
console.error("Operation error:", error);
|
||||
} finally {
|
||||
setIsProcessing(false);
|
||||
}
|
||||
@@ -185,170 +259,119 @@ const MyNewTool: React.FC = () => {
|
||||
export default MyNewTool;
|
||||
```
|
||||
|
||||
### Common PowerPoint.js Operations
|
||||
## Common PowerPoint Operations
|
||||
|
||||
#### Type-Safe Utilities
|
||||
The application provides type-safe utility functions in `src/taskpane/types/office-types.ts`:
|
||||
### Type-safe utilities (`types/office-types.ts`)
|
||||
|
||||
```typescript
|
||||
// Get error message safely from any error type
|
||||
const errorMsg = getErrorMessage(error);
|
||||
|
||||
// Check if a shape is an image
|
||||
if (isPictureShape(shape)) {
|
||||
// It's a picture shape
|
||||
}
|
||||
|
||||
// Get the first selected slide
|
||||
const slide = getFirstSelectedSlide(context);
|
||||
|
||||
// Select shapes by ID
|
||||
selectShapesById(slide, [shape1.id, shape2.id]);
|
||||
getErrorMessage(error); // Safe message extraction
|
||||
isPictureShape(shape); // shape.type === image
|
||||
isTextCapableShape(shape); // Requires shape.type to be loaded
|
||||
isNotNullish(value); // Rejects null and undefined
|
||||
deleteShapesByPrefix(shapes, prefix); // Requires names to be loaded
|
||||
getFirstSelectedSlide(context);
|
||||
selectShapesById(slide, ids);
|
||||
```
|
||||
|
||||
#### Selecting Shapes
|
||||
### Selecting shapes
|
||||
|
||||
```typescript
|
||||
const shapes = context.presentation.getSelectedShapes();
|
||||
shapes.load("items");
|
||||
await context.sync();
|
||||
```
|
||||
|
||||
#### Working with Slide Masters
|
||||
### Creating a positioned text box
|
||||
|
||||
```typescript
|
||||
const slideMasters = context.presentation.slideMasters;
|
||||
slideMasters.load("items");
|
||||
await context.sync();
|
||||
const textBox = slide.shapes.addTextBox("Label", {
|
||||
left: 0,
|
||||
top: 500,
|
||||
width: 960,
|
||||
height: 24
|
||||
});
|
||||
textBox.name = "MyMarker";
|
||||
```
|
||||
|
||||
#### Creating Shapes
|
||||
### Removing marks
|
||||
|
||||
Load shape names, then queue deletes:
|
||||
|
||||
```typescript
|
||||
const shape = slide.shapes.addGeometricShape("Rectangle");
|
||||
shape.left = 100;
|
||||
shape.top = 100;
|
||||
shape.height = 50;
|
||||
shape.width = 50;
|
||||
for (const shape of shapes.items) {
|
||||
shape.load("name");
|
||||
}
|
||||
await context.sync();
|
||||
deleteShapesByPrefix(shapes.items, "edison_grid_");
|
||||
await context.sync();
|
||||
```
|
||||
|
||||
## Status System
|
||||
|
||||
The application includes a status system that provides feedback to users:
|
||||
|
||||
- **Success**: Operation completed successfully
|
||||
- **Warning**: Operation completed with concerns
|
||||
- **Error**: Operation failed
|
||||
- **Processing**: Shows a spinner while operations are in progress
|
||||
|
||||
Use the status context in your components:
|
||||
```typescript
|
||||
const {
|
||||
statusMessage,
|
||||
setStatusMessage,
|
||||
statusType,
|
||||
setStatusType,
|
||||
isProcessing,
|
||||
setIsProcessing
|
||||
} = useStatusContext();
|
||||
```
|
||||
|
||||
## Build and Deployment
|
||||
|
||||
### Development Build
|
||||
### Commands
|
||||
|
||||
```bash
|
||||
npm run build:dev
|
||||
npm run build # production build
|
||||
npm run build:dev # development build
|
||||
npm run lint # ESLint + Prettier
|
||||
npm run typecheck # tsc --noEmit
|
||||
npm test # Vitest
|
||||
npm run validate # manifest validation
|
||||
```
|
||||
|
||||
### Production Build
|
||||
### Production URL
|
||||
|
||||
`webpack.config.js` replaces `https://localhost:3000/` in the manifest with the production URL. Override it with:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
ADDIN_PROD_URL=https://example.com/powerpoint/ npm run build
|
||||
```
|
||||
|
||||
### Manifest Validation
|
||||
```bash
|
||||
npm run validate
|
||||
```
|
||||
### Version
|
||||
|
||||
This validates the manifest.xml file against the Office Add-in schema.
|
||||
`package.json` is the source of truth:
|
||||
|
||||
- `__APP_VERSION__` is injected by webpack and shown in the task pane footer.
|
||||
- `manifest.xml` uses the four-part version (`1.2.0.0`); keep it in sync with `package.json`.
|
||||
|
||||
### Manifest requirements
|
||||
|
||||
The manifest declares `PowerPointApi` 1.5. Update the `<Requirements>` element if the add-in starts relying on a newer API set.
|
||||
|
||||
## Testing
|
||||
|
||||
Currently, the project doesn't have automated tests. This is an area for future improvement.
|
||||
Unit tests use Vitest and live next to the code (`*.test.ts`):
|
||||
|
||||
Recommended testing approach:
|
||||
1. Manual testing in PowerPoint
|
||||
2. Implementation of unit tests for individual utilities
|
||||
3. Integration tests for PowerPoint API interactions
|
||||
|
||||
## Performance Considerations
|
||||
|
||||
### Optimizing context.sync() calls
|
||||
|
||||
A key performance optimization is to batch context.sync() calls:
|
||||
|
||||
```typescript
|
||||
// BAD: Calling context.sync() in a loop
|
||||
for (let i = 0; i < shapes.items.length; i++) {
|
||||
shapes.items[i].load("name");
|
||||
await context.sync(); // Slow! One network roundtrip per shape
|
||||
if (shapes.items[i].name === "Target") {
|
||||
// Do something
|
||||
}
|
||||
}
|
||||
|
||||
// GOOD: Batching context.sync() calls
|
||||
// Load all properties at once
|
||||
for (let i = 0; i < shapes.items.length; i++) {
|
||||
shapes.items[i].load("name");
|
||||
}
|
||||
await context.sync(); // Single network roundtrip for all shapes
|
||||
|
||||
// Process the data locally
|
||||
for (let i = 0; i < shapes.items.length; i++) {
|
||||
if (shapes.items[i].name === "Target") {
|
||||
// Do something
|
||||
}
|
||||
}
|
||||
```bash
|
||||
npm test
|
||||
```
|
||||
|
||||
Additional performance tips:
|
||||
- Use memoization for expensive calculations
|
||||
- Ensure proper cleanup of event listeners
|
||||
- Use the ActionButton component for consistent loading states
|
||||
- Consider using Web Workers for heavy computations
|
||||
Test pure functions and helpers directly. Office.js interactions should be kept behind small service functions so they can be mocked or tested through extracted logic (for example `pickTitleText` and `deleteShapesByPrefix`).
|
||||
|
||||
## Common Issues and Solutions
|
||||
Continuous integration runs lint, typecheck, tests, build, and manifest validation on every push and pull request.
|
||||
|
||||
### Add-in not loading in PowerPoint
|
||||
- Verify the development server is running
|
||||
- Check for certificate errors in the browser console
|
||||
- Validate the manifest.xml file
|
||||
## Performance Guidelines
|
||||
|
||||
### PowerPoint API errors
|
||||
- Ensure correct API version is being used
|
||||
- Check the sequence of operations (some operations require specific order)
|
||||
- Verify selections exist before operating on them
|
||||
- **Batch `context.sync()` calls.** Load all needed properties, then sync once.
|
||||
- **Avoid per-shape or per-slide syncs.** The batch services load items/names in two batches.
|
||||
- **Prefer two shapes over N shapes.** The progress bar uses one pending and one completed rectangle per slide.
|
||||
- **Check cancellation between batches.** Office.js cannot abort a queued batch.
|
||||
- **Report progress at item boundaries** so the user sees activity during long loops.
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Error Handling**: Always use try/catch blocks with PowerPoint API calls and use proper types (see `office-types.ts`)
|
||||
2. **User Feedback**: Provide clear status messages for all operations using the StatusContext
|
||||
3. **Accessibility**: Ensure all UI elements have proper ARIA attributes and support keyboard navigation
|
||||
4. **Theme Support**: Use Fluent UI theme tokens for consistent theming
|
||||
5. **Code Organization**: Keep component files focused on a single responsibility
|
||||
6. **Performance**: Batch context.sync() calls and avoid calling them inside loops
|
||||
7. **Reusability**: Use custom hooks for common operations and shared components like ActionButton and Section
|
||||
8. **Type Safety**: Avoid using "any" type and leverage TypeScript's static typing
|
||||
|
||||
## Contributing
|
||||
|
||||
1. Fork the repository
|
||||
2. Create a feature branch
|
||||
3. Make your changes
|
||||
4. Submit a pull request with a clear description of the changes
|
||||
1. Use `getErrorMessage` and type `catch` values as `unknown`.
|
||||
2. Keep `strict` TypeScript passing.
|
||||
3. Use `useSettings()` rather than hardcoded slide dimensions.
|
||||
4. Add confirmations for destructive operations.
|
||||
5. Make repeated add operations idempotent.
|
||||
6. Use Fluent `Field`/`Input`/`Dropdown` controls so labels and keyboard navigation work.
|
||||
7. Announce results through the status region (`role="status"`).
|
||||
8. Update docs when behavior changes.
|
||||
|
||||
## Resources
|
||||
|
||||
- [Office Add-ins Documentation](https://docs.microsoft.com/en-us/office/dev/add-ins/)
|
||||
- [Office.js API Reference](https://docs.microsoft.com/en-us/javascript/api/overview/office)
|
||||
- [Fluent UI Documentation](https://developer.microsoft.com/en-us/fluentui)
|
||||
- [React Documentation](https://reactjs.org/docs/getting-started.html)
|
||||
- [Office Add-ins documentation](https://learn.microsoft.com/office/dev/add-ins/)
|
||||
- [Office.js API reference](https://learn.microsoft.com/javascript/api/overview/office)
|
||||
- [Fluent UI React v9](https://react.fluentui.dev/)
|
||||
- [Vitest](https://vitest.dev/)
|
||||
+102
-94
@@ -8,171 +8,180 @@ This guide will help you use the Edison PowerPoint Add-in to create professional
|
||||
|
||||
### Installation
|
||||
|
||||
1. If Edison is not already installed, download it from the [Microsoft AppSource](https://appsource.microsoft.com) or follow the installation instructions provided by your organization.
|
||||
|
||||
1. If Edison is not already installed, download it from the [releases page](https://gitea.h3132.de/Edison/powerpoint-toolbox/releases) or follow the installation instructions provided by your organization.
|
||||
2. Open PowerPoint and navigate to the "Home" tab in the ribbon.
|
||||
|
||||
3. Click on the "Edison Pane" button to open the add-in taskpane.
|
||||
3. Click the "Edison Pane" button to open the add-in task pane.
|
||||
|
||||
### Interface Overview
|
||||
|
||||
The Edison taskpane is organized into several sections:
|
||||
The Edison task pane is organized into collapsible sections:
|
||||
|
||||
- **Content** - Tools for manipulating content and shapes
|
||||
- **Progress Bar** - Add/remove presentation progress indicators
|
||||
- **Confidential Marking** - Add/remove confidential labels
|
||||
- **Draft Watermark** - Add/remove draft watermarks
|
||||
- **Alignment** - Tools for aligning shapes and objects
|
||||
- **Layout** - Grids and guidelines for the current slide
|
||||
- **Settings** - Slide size and other per-presentation preferences
|
||||
|
||||
## Content Tools
|
||||
|
||||
### Match Properties
|
||||
|
||||
This tool copies visual properties from the first selected shape to all other selected shapes.
|
||||
Copies visual properties from the first shape in the selection to all other selected shapes.
|
||||
|
||||
**How to use:**
|
||||
1. Select multiple shapes (the shape you want to copy properties FROM should be selected FIRST)
|
||||
2. Click the "Match Properties" button
|
||||
3. All selected shapes will now have the same formatting properties as the first shape
|
||||
1. Select multiple shapes.
|
||||
2. Click the "Match Properties" button.
|
||||
3. All selected shapes receive the source shape's supported formatting.
|
||||
|
||||
**Properties matched include:**
|
||||
- Fill color and transparency
|
||||
- Line style, color, and weight
|
||||
- Text formatting (if applicable)
|
||||
- Shadow effects
|
||||
- Text formatting (name, size, bold, italic, underline, color) when the source has text
|
||||
|
||||
**Note:** The source is the first shape in PowerPoint's selection/z-order, which is not guaranteed to be the shape you clicked first.
|
||||
|
||||
### Match Sizes
|
||||
|
||||
This tool resizes all selected shapes to match the dimensions of the first selected shape.
|
||||
Resizes all selected shapes to match the width and height of the first shape in the selection.
|
||||
|
||||
**How to use:**
|
||||
1. Select multiple shapes (the shape with the desired size should be selected FIRST)
|
||||
2. Click the "Match Sizes" button
|
||||
3. All selected shapes will be resized to match the first shape's width and height
|
||||
1. Select multiple shapes.
|
||||
2. Click the "Match Sizes" button.
|
||||
3. All selected shapes are resized to match the source shape.
|
||||
|
||||
**Note:** The same selection-order caveat as Match Properties applies.
|
||||
|
||||
### Swap Positions
|
||||
|
||||
This tool exchanges the positions of two selected shapes while maintaining their size and formatting.
|
||||
Exchanges the positions of exactly two selected shapes while maintaining their size and formatting.
|
||||
|
||||
**How to use:**
|
||||
1. Select exactly two shapes
|
||||
2. Click the "Swap Positions" button
|
||||
3. The shapes will exchange positions
|
||||
|
||||
**Note:** This tool requires exactly two shapes to be selected.
|
||||
1. Select exactly two shapes.
|
||||
2. Click the "Swap Positions" button.
|
||||
3. The shapes exchange their top-left positions.
|
||||
|
||||
### Insert Titles
|
||||
|
||||
This tool adds slide titles to slides that are missing them.
|
||||
Collects the titles from every slide and inserts them into a selected text box, creating an agenda or table of contents.
|
||||
|
||||
**How to use:**
|
||||
1. Click the "Insert Titles" button
|
||||
2. The add-in will scan your presentation and add title placeholders to any slides that don't have titles
|
||||
1. Select the text box that should receive the agenda.
|
||||
2. Choose a title detection method:
|
||||
- **Auto-detect titles** (shape name, then position and formatting heuristics)
|
||||
- **Title shapes by name**
|
||||
- **Position-based detection**
|
||||
- **First text on slide**
|
||||
3. Choose whether to include slide numbers.
|
||||
4. Click "Insert Titles" and confirm.
|
||||
|
||||
**Note:** This affects all slides in the presentation, not just the current slide.
|
||||
**Note:** The operation replaces all text in the selected text box. Selecting a picture or other shape that cannot hold text produces a warning instead.
|
||||
|
||||
### Round Image
|
||||
|
||||
This tool creates circular images by applying a circular mask.
|
||||
Creates an elliptical mask over an image.
|
||||
|
||||
**How to use:**
|
||||
1. Select an image
|
||||
2. Click the "Round Image" button
|
||||
3. The image will be cropped to a circular shape
|
||||
1. Select an image.
|
||||
2. Click the "Round Image" button.
|
||||
3. An ellipse is created above the image and both shapes are selected.
|
||||
4. In PowerPoint choose **Shape Format → Merge Shapes → Intersect** to finish the crop.
|
||||
|
||||
## Slide Enhancement Tools
|
||||
|
||||
### Progress Bar
|
||||
|
||||
Adds or removes a visual progress indicator at the bottom of each slide showing the current position in the presentation.
|
||||
Adds or removes a visual progress indicator at the bottom of every slide showing the current position in the presentation.
|
||||
|
||||
**How to use:**
|
||||
1. Click "Add Progress Bar" to add a progress indicator to all slides
|
||||
2. Click "Remove Progress Bar" to remove all progress indicators
|
||||
1. Click "Add" to add a progress indicator to every slide.
|
||||
2. Click "Remove" (and confirm) to remove all progress indicators.
|
||||
|
||||
**Note:** The progress bar automatically updates as you navigate through the presentation.
|
||||
**Notes:**
|
||||
- Each slide contains two shapes (a pending bar and the completed portion).
|
||||
- Adding again replaces existing bars instead of duplicating them.
|
||||
- If you add or remove slides later, run **Add** again to rebuild the bars.
|
||||
|
||||
### Confidential Marking
|
||||
|
||||
Adds or removes a "Confidential" label to all slides in the presentation.
|
||||
Adds or removes a "– Confidential –" label on every slide.
|
||||
|
||||
**How to use:**
|
||||
1. Click "Add Confidential" to add the confidential label to all slides
|
||||
2. Click "Remove Confidential" to remove all confidential labels
|
||||
1. Click "Add" to add the label to every slide.
|
||||
2. Click "Remove" (and confirm) to remove all labels.
|
||||
|
||||
**Note:** The confidential marking appears in the bottom-right corner of each slide.
|
||||
**Note:** The label is a full-width text box centered at the bottom of each slide.
|
||||
|
||||
### Draft Watermark
|
||||
|
||||
Adds or removes a "DRAFT" watermark on slide masters to mark in-progress presentations.
|
||||
|
||||
**How to use:**
|
||||
1. Click "Add Draft" to add a DRAFT watermark to the slide masters
|
||||
2. Click "Remove Draft" to remove all DRAFT watermarks
|
||||
1. Click "Add" to add a watermark to every slide master.
|
||||
2. Click "Remove" (and confirm) to remove the watermarks.
|
||||
|
||||
**Note:** This adds the watermark to slide masters, affecting all slides in the presentation.
|
||||
**Note:** Because the watermark is added to slide masters, it affects all slides that use those masters.
|
||||
|
||||
## Alignment Tools
|
||||
|
||||
These tools align selected objects horizontally or vertically on the slide.
|
||||
These tools align selected objects to the slide edges or center.
|
||||
|
||||
### Horizontal Alignment
|
||||
|
||||
**How to use:**
|
||||
1. Select one or more shapes
|
||||
2. Click one of the horizontal alignment buttons:
|
||||
- **Left** - Aligns all shapes to the left edge
|
||||
- **Center** - Centers all shapes horizontally
|
||||
- **Right** - Aligns all shapes to the right edge
|
||||
- **Left** - Aligns all shapes to the left edge of the slide
|
||||
- **Center** - Centers all shapes horizontally on the slide
|
||||
- **Right** - Aligns all shapes to the right edge of the slide
|
||||
|
||||
### Vertical Alignment
|
||||
|
||||
**How to use:**
|
||||
1. Select one or more shapes
|
||||
2. Click one of the vertical alignment buttons:
|
||||
- **Top** - Aligns all shapes to the top edge
|
||||
- **Middle** - Centers all shapes vertically
|
||||
- **Bottom** - Aligns all shapes to the bottom edge
|
||||
- **Top** - Aligns all shapes to the top edge of the slide
|
||||
- **Middle** - Centers all shapes vertically on the slide
|
||||
- **Bottom** - Aligns all shapes to the bottom edge of the slide
|
||||
|
||||
**Note:** Alignment uses the slide size selected in **Settings**.
|
||||
|
||||
## Grid & Guidelines Tools
|
||||
|
||||
These tools help you align and position elements precisely on slides using grids and guidelines.
|
||||
These tools help you position elements precisely on the current slide.
|
||||
|
||||
### Custom Grid
|
||||
|
||||
Creates a customizable grid overlay on the current slide to help with precise positioning and alignment.
|
||||
Creates a grid on the current slide.
|
||||
|
||||
**How to use:**
|
||||
1. Navigate to the slide where you want to add a grid
|
||||
2. In the Grid & Guidelines section, configure the grid options:
|
||||
- **Spacing** - Set the distance between grid lines (in points)
|
||||
- **Opacity** - Adjust how visible the grid appears
|
||||
- **Color** - Choose from blue, red, yellow, or green
|
||||
3. Click "Create Grid" to add the grid to the current slide
|
||||
4. Click "Remove Grid" to clear the grid from the slide
|
||||
1. Navigate to the slide where you want the grid.
|
||||
2. Configure:
|
||||
- **Spacing** - Distance between grid lines in points (minimum 4 pt)
|
||||
- **Opacity** - Grid visibility from 0 to 100
|
||||
- **Color** - Blue, red, yellow, or green
|
||||
3. Click "Add" to create the grid, or "Remove" to delete it.
|
||||
|
||||
**Note:** The grid appears only on the current slide and is for visual reference only - it won't appear in presentation mode or exports.
|
||||
**Warning:** The grid consists of ordinary slide shapes. It **is included in slideshow, print, and export output**. Remove it before presenting.
|
||||
|
||||
### Guidelines
|
||||
|
||||
Add precise horizontal or vertical guidelines at specific positions on your slide.
|
||||
Adds horizontal or vertical guidelines at specific positions.
|
||||
|
||||
**How to use:**
|
||||
1. Navigate to the slide where you want to add guidelines
|
||||
2. In the Grid & Guidelines section:
|
||||
- **Position** - Set the position of the guideline (in points from top/left)
|
||||
- **Type** - Choose horizontal or vertical
|
||||
- **Color** - Select a color for the guideline
|
||||
3. Click "Add Guideline" to add the specified guideline
|
||||
4. Click "Remove All" to clear all guidelines from the slide
|
||||
1. Navigate to the slide where you want guidelines.
|
||||
2. Set the **Position** (points from the top or left), **Type**, and **Color**.
|
||||
3. Click "Add" to add a guideline.
|
||||
4. Click "Remove" to clear all guidelines on the slide.
|
||||
|
||||
**Tip:** Use different colors for different types of guidelines (e.g., blue for margins, red for key alignment points).
|
||||
**Tip:** Use different colors for different types of guidelines (for example blue for margins and red for key alignment points). Guidelines are also ordinary shapes and appear in output.
|
||||
|
||||
## Settings
|
||||
|
||||
### Slide Size
|
||||
|
||||
Choose **Widescreen (16:9)** or **Standard (4:3)**. The selection is stored with the presentation and used by alignment, grid, progress bar, title detection, and marking tools.
|
||||
|
||||
## Tips and Best Practices
|
||||
|
||||
### Selection Order Matters
|
||||
### Selection Order
|
||||
|
||||
For tools like Match Properties and Match Sizes, the **first** object you select is the source. Make sure to select the reference object first, then add other objects to your selection.
|
||||
For Match Properties and Match Sizes, the source is the first shape in PowerPoint's selection/z-order, which may not match the order in which you clicked. Check the result and use Ctrl+Z if needed.
|
||||
|
||||
### Keyboard Shortcuts for Selection
|
||||
|
||||
@@ -180,44 +189,43 @@ For tools like Match Properties and Match Sizes, the **first** object you select
|
||||
- **Shift+Click** to select a range of objects
|
||||
- **Ctrl+A** (Windows) or **Cmd+A** (Mac) to select all objects on a slide
|
||||
|
||||
### Working with Progress Bars
|
||||
### Long Operations
|
||||
|
||||
- Add the progress bar near the end of your presentation development
|
||||
- If you add or remove slides, you may need to remove and re-add the progress bar
|
||||
A progress counter appears for larger presentations. Click **Stop** to cancel cooperatively; already queued PowerPoint changes may still be applied.
|
||||
|
||||
### Draft Watermarks for Review Cycles
|
||||
### Destructive Actions
|
||||
|
||||
- Add the DRAFT watermark when sharing presentations for review
|
||||
- Remove the watermark before final distribution
|
||||
Removals and Insert Titles ask for confirmation. PowerPoint's own undo command can reverse the changes.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common Issues
|
||||
|
||||
**The add-in shows an error message:**
|
||||
- Ensure you've selected the appropriate objects for the tool you're using
|
||||
- For tools that require multiple selections, verify you have the correct number of objects selected
|
||||
- Ensure you selected the appropriate objects for the tool.
|
||||
- Verify the presentation uses a supported PowerPoint version (PowerPoint API 1.5).
|
||||
|
||||
**Changes aren't appearing:**
|
||||
- Wait for the "Success" message to appear before continuing
|
||||
- If using slide master features (like Draft Watermark), you may need to switch to normal view to see changes
|
||||
- Wait for the success or warning message before continuing.
|
||||
- For slide master features such as the Draft Watermark, switch to Normal view to see the result.
|
||||
|
||||
**The add-in is slow or unresponsive:**
|
||||
- For large presentations, some operations may take longer
|
||||
- Wait for the current operation to complete before starting another
|
||||
- Large presentations take longer; use **Stop** to cancel a batch operation.
|
||||
- Wait for the current operation to finish before starting another.
|
||||
|
||||
### Getting Help
|
||||
|
||||
If you encounter issues not covered in this guide, contact your IT department or the add-in administrator.
|
||||
Report issues at <https://gitea.h3132.de/Edison/powerpoint-toolbox/issues>.
|
||||
|
||||
## Version Information
|
||||
|
||||
This user guide is for Edison PowerPoint Add-in v1.1.0.
|
||||
This user guide is for Edison PowerPoint Add-in v1.2.0.
|
||||
|
||||
### What's New in v1.1.0
|
||||
### What's New in v1.2.0
|
||||
|
||||
* **Performance Improvements** - Faster operations especially when working with multiple shapes
|
||||
* **Enhanced Stability** - Improved error handling and recovery
|
||||
* **Better UI Experience** - More responsive interface with improved scrolling
|
||||
* **Accessibility Enhancements** - Better support for screen readers and keyboard navigation
|
||||
* **Code Quality** - Improved TypeScript typing for increased reliability
|
||||
- Batched operations and a progress counter with cooperative cancellation
|
||||
- Confirmation dialogs for destructive actions and Insert Titles
|
||||
- Slide size setting (16:9 / 4:3) stored with the presentation
|
||||
- Automatic light/dark theme following the Office/system theme
|
||||
- Collapsible sections, accessible Fluent controls, and screen-reader status announcements
|
||||
- Unit tests and continuous integration
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
This UML diagram represents the file and directory structure of the PowerPoint toolbox add-in.
|
||||
|
||||
> **Note:** This diagram predates v1.2.0. The `src/commands` folder, `babel.config.json`, and the
|
||||
> `core-js`/IE polyfill setup have been removed; see `docs/DEVELOPERS.md` for the current structure.
|
||||
|
||||
```mermaid
|
||||
classDiagram
|
||||
%% Project Structure
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
This document serves as an index for the UML diagrams created for the PowerPoint toolbox add-in repository.
|
||||
|
||||
> **Note:** These diagrams were created before the v1.2.0 context/service refactoring.
|
||||
> They remain useful as a high-level overview, but the current source tree (and
|
||||
> `docs/DEVELOPERS.md`) is authoritative.
|
||||
|
||||
## Available Diagrams
|
||||
|
||||
1. [Component Relationships](powerpoint-toolbox-uml.md) - Shows the relationships between React components and their interactions.
|
||||
@@ -25,9 +29,10 @@ The PowerPoint toolbox add-in is a Microsoft Office add-in built with React and
|
||||
### Architecture Highlights
|
||||
|
||||
- **Component-Based Structure**: The application is organized into reusable UI components
|
||||
- **Context API for State Management**: Uses React's Context API for sharing state across components
|
||||
- **Unidirectional Data Flow**: Data flows from user interaction through the application to PowerPoint and back
|
||||
- **Centralized Error Handling**: Error handling is managed through the Status Context
|
||||
- **Context API for State Management**: `StatusContext` (status/progress/cancellation) and `SettingsContext` (slide size)
|
||||
- **Service Layer**: Batched PowerPoint operations and pure helpers live in `src/taskpane/services/`
|
||||
- **Unidirectional Data Flow**: Data flows from user interaction through services to PowerPoint and back
|
||||
- **Centralized Error Handling**: Errors are reported through the Status Context and an error boundary
|
||||
|
||||
### Main Features
|
||||
|
||||
|
||||
Reference in new issue
Block a user