Creating a New Story
Stories are created through the WordPress admin dashboard. The editor initializes with:packages/story-editor/src/storyEditor.js:80-83
Canvas Workspace
The canvas is your primary workspace for designing story pages. It maintains a fixed aspect ratio defined byFULLBLEED_RATIO from @googleforcreators/units.
Canvas Layers
The canvas uses multiple layers for different purposes:- Display Layer
- Edit Layer
- Frames Layer
Purpose: Non-interactive preview with animationsThe display layer shows how your story will appear to viewers, including:Reference:
- Animated elements using
<StoryAnimation.WAAPIWrapper /> - Full visual rendering
- Element stacking order
packages/story-editor/src/components/canvas/displayElement.jsAdding Pages
Using the Page Navigation
Pages can be added through:- Page Menu - Located in the canvas footer
- Extra Pages Area - Click the ”+” button to add new pages
- Keyboard Shortcuts - Use shortcuts to quickly add pages
packages/story-editor/src/components/canvas/extraPages.js
Page Management
The story state manages all pages:packages/story-editor/src/app/story/
Adding Elements to Pages
Insert Element Hook
TheuseInsertElement hook handles adding elements to the canvas:
packages/story-editor/src/components/canvas/useInsertElement.ts
Element Types
Supported element types:- Text - Rich text with formatting
- Image - Static images
- Video - Video elements with playback controls
- Shape - Geometric shapes and masks
- Sticker - Decorative elements
packages/elements/
Working with the Canvas
Element Selection
Select elements by clicking them on the canvas. The selection system is managed by:packages/story-editor/src/components/canvas/selection.js
Multi-Selection
Select multiple elements:
Reference:
packages/story-editor/src/components/canvas/multiSelectionMoveable/
Element Manipulation
The editor uses the Moveable library for element transformation:- Drag - Click and drag to move elements
- Resize - Drag corner or edge handles
- Rotate - Use rotation handle
- Precise positioning - Use Size & Position panel for exact values
packages/story-editor/src/components/canvas/frameElement.js
Canvas Upload Support
Drag and Drop
Drop media files directly onto the canvas:packages/story-editor/src/components/canvas/canvasElementDropzone.js
Upload with Preview
TheuseUploadWithPreview hook handles file uploads with immediate visual feedback:
packages/story-editor/src/components/canvas/useUploadWithPreview.js
Page Actions
Right-Click Menu
Access page and element actions via right-click:- Duplicate page
- Delete page
- Copy elements
- Paste elements
- Arrange elements (bring to front, send to back)
packages/story-editor/src/components/canvas/rightClickMenu.js
Page Side Menu
Additional page controls in the side menu:packages/story-editor/src/components/canvas/pageSideMenu.js
Canvas Viewport
The canvas automatically adjusts to fit your screen:Pinch to Zoom
On touch devices, use pinch gestures to zoom:packages/story-editor/src/components/canvas/usePinchToZoom.js
The canvas maintains a fixed aspect ratio based on the Web Stories standard dimensions (9:16 portrait format).
Auto-Save
Changes are automatically saved through two mechanisms:- Server Auto-Save
- Local Auto-Save
Saves to WordPress database at regular intervals:Reference:
packages/story-editor/src/components/autoSaveHandler/History and Undo
The editor maintains an undo/redo history:- Undo:
Cmd/Ctrl + Z - Redo:
Cmd/Ctrl + Shift + Z
packages/story-editor/src/app/history/
Next Steps
Using Templates
Start with pre-built story templates
Page Templates
Apply individual page designs
Media Library
Add images and videos to your story
Animations
Add animations to elements