electroluxcode/onlyoffice-web-comp
electroluxcode/onlyoffice-web-comp has 538 GitHub stars and 76 forks. GitHot measured 0 stars in 24 hours and 0 in 7 days. Last checked 2026-11-09 01:18 UTC. Last push 2026-07-30.
A component based on OnlyOffice (v9) for viewing, editing, and converting documents entirely on the user's device, no backend required.基于 OnlyOffice (v9) 的纯前端组件,封装文档查看、编辑、转换功能,全在用户设备本地运行,无需后端,即插即用
Measured star growth
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- Update delayed
- in 1 month
- Update delayed
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalOnlyOffice Web Comp
📖 English | 中文
🌐 Live Demo: https://onlyoffice-web-comp.vercel.app/
A browser-based document solution built on the OnlyOffice static SDK. View, edit, and convert Word, Excel, and PowerPoint entirely on the client—no Document Server required.
This repository has two parts:
| Part | Path | Description |
|---|---|---|
| Component library | src/components/onlyoffice-web-comp/ |
Reusable Web editor wrapper + Markdown docs |
| Demo site | src/app/ + src/features/ |
Next.js landing, docs, and live demos |
Project Positioning
This project is not an npm package with a one-line install flow yet. It is a browser-only OnlyOffice integration template: the reusable runtime lives in src/components/onlyoffice-web-comp/, and this repository also includes the static OnlyOffice SDK / x2t assets required by that runtime.
Use this project when you want to embed OnlyOffice editing into your own web app without running OnlyOffice Document Server. The demo site is intentionally part of the repository so you can copy a working integration instead of reconstructing the editor lifecycle from scattered snippets.
Integrating into Your Project
The practical integration path is:
- Copy
src/components/onlyoffice-web-comp/into your application source tree. - Copy the static assets from
public/packages/onlyoffice/into your app'spublic/packages/onlyoffice/directory. - Build your UI by following
src/features/demo/office-preview-page.tsx: create an editor container, keep anOnlyOfficeManagerinstance, callopenDocument,downloadExport,toggleReadOnly, and destroy the manager on unmount. To call the editor Automation API from the parent page, get a Developer Edition Connector withcreateConnector().
Static resource resolution is centralized in src/components/onlyoffice-web-comp/const/index.ts. Both local and CDN modes use the Developer Edition Docker-exported 9.4 SDK at /packages/onlyoffice/9.4.0-develop by default; onlyofficeVersion can override the CDN directory when needed.
Core Advantages
- Local processing: Documents stay in the browser
- Format support: Word, Excel, PowerPoint, CSV, DOCM, and more
- No backend: Host static SDK assets only
- Engineering APIs: Read-only/edit toggle, theme, language, multi-instance isolation
- Connector support: Call the editor Automation API from the parent page with the Developer Edition Connector; works in both local and cross-origin CDN modes
Quick Try
- Visit the live demo or run locally:
git clone <repository-url>
cd onlyoffice-web-comp
pnpm install
pnpm dev
# http://localhost:3001
- Open a route:
| Route | Description |
|---|---|
/ |
Product landing page |
/docs |
Component library documentation (rendered from Markdown) |
/docs/demos/single |
Single-instance editor demo |
/docs/demos/multi |
Multi-instance Tab demo |
- Upload a file → edit → export
Legacy route /examples redirects to the single-instance demo; /multi redirects to the multi-instance demo.
Component Library Docs
API details live in the component library docs, not duplicated here.
- Entry: Component README (English)
- Overview: docs/概述.md
| Doc | Topic |
|---|---|
| Quick Start | Init and container mount |
| Core API | OnlyOfficeManager, multi-instance |
| Events | EventBus |
| Examples | React integration patterns |
| Reference | Constants and types |
| Notes & Formats | Prerequisites and formats |
| Fonts | Custom font registration |
| Comments & Revisions | Comments and revisions |
| Single-instance Demo | Single editor demo + source |
| Multi-instance Demo | Full Tab demo source |
import { OnlyOfficeManager, FILE_TYPE, ONLYOFFICE_ID } from "@/components/onlyoffice-web-comp";
Project Structure
onlyoffice-web-comp/
├── src/
│ ├── app/ # Next.js routes
│ │ ├── page.tsx # Landing
│ │ ├── docs/ # Documentation site
│ │ │ ├── page.tsx # /docs (overview md)
│ │ │ ├── [slug]/page.tsx # /docs/*
│ │ │ └── demos/ # /docs/demos/single|multi
│ │ └── examples/ # → redirect to single demo
│ ├── features/
│ │ ├── docs/ # Docs shell, markdown renderer, site-map
│ │ ├── demo/ # Live demo components
│ │ ├── marketing/ # Landing page
│ │ └── shell/ # Site header / footer / layout
│ └── components/
│ └── onlyoffice-web-comp/ # SDK wrapper + docs/*.md source
├── public/ # OnlyOffice SDK static assets
└── ...
Docs pages read Markdown directly from src/components/onlyoffice-web-comp/docs/. Demo tabs embed live editors from src/features/demo/.
Tech Stack
- OnlyOffice SDK: Core editing
- x2t + WebAssembly: Format conversion
- Next.js 15 + React 19: Demo application
Deployment
pnpm install
pnpm build
Deploy to Vercel or any static host. Live demo: https://onlyoffice-web-comp.vercel.app/
Deploy SDK Assets to Cloudflare Pages CDN
OnlyOffice SDK assets can be hosted separately from the app. Deploy the contents of public/packages to Cloudflare Pages, then register the Pages URL before creating an editor.
# one-time project creation
npx wrangler pages project create onlyoffice-packages
# upload public/packages as the CDN root
npx wrangler pages deploy public/packages \
--project-name onlyoffice-packages \
--commit-dirty=true
After deployment, the asset URL should look like:
https://<project>.pages.dev/onlyoffice/9.4.0-develop/web-apps/apps/api/documents/api.js
Use that Pages origin as the runtime resource root:
import { OnlyOfficeManager } from "@/components/onlyoffice-web-comp";
OnlyOfficeManager.registerStaticResource({
cdnOrigin: "https://<project>.pages.dev",
});
cdnOrigin points to the uploaded public/packages root, so do not append /packages. Configure this resource origin in src/components/onlyoffice-web-comp/const/index.ts by editing the cdnOrigin logic in buildStaticResource. Cloudflare Pages Direct Upload supports Wrangler folder uploads; dashboard drag-and-drop is less suitable for this repository because the SDK contains many files.
Fonts
Custom fonts are registered via __custom_font_registry__, with ttf-to-catalog-font.mjs producing OnlyOffice catalog wire-format files. See Fonts in the component docs for the full guide.
Quick outline:
- Run
ttf-to-catalog-font.mjs --id <id> --verifyto producefonts/{id}catalog files - Register the id and aliases in
window["__custom_font_registry__"]insideAllFonts.js - Ensure aliases cover every font name used in your documents
Ensure all font files comply with applicable licenses.
Related Resources
Contributing
Issues and Pull Requests are welcome.
License
See LICENSE.
Explore related projects
freeCodeCamp/freeCodeCamp
freeCodeCamp.org's open-source codebase and curriculum. Learn math, programming, and computer science for free.
458,823 starsdonnemartin/system-design-primer
Learn how to design large-scale systems. Prep for the system design interview. Includes Anki flashcards.
377,441 starsreact/react
The library for web and native user interfaces.
252,445 starsvuejs/vue
This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core
212,624 stars