Skip to content

Commit cdbbc77

Browse files
authored
Merge branch 'main' into tadeu/sd-3347-feature-render-word-style-underlines
2 parents 9c7998c + 2294380 commit cdbbc77

114 files changed

Lines changed: 5561 additions & 182 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Notify Labs of OSS changes
2+
3+
on:
4+
push:
5+
branches:
6+
- nick/sync
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: superdoc-oss-sync-dispatch
13+
cancel-in-progress: false
14+
15+
jobs:
16+
dispatch:
17+
name: Dispatch to Labs
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 5
20+
steps:
21+
- name: Create Labs App token
22+
id: labs-token
23+
uses: actions/create-github-app-token@v2
24+
with:
25+
app-id: ${{ secrets.APP_ID }}
26+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
27+
owner: superdoc-dev
28+
repositories: labs
29+
30+
- name: Dispatch superdoc-oss-sync to Labs
31+
env:
32+
GH_TOKEN: ${{ steps.labs-token.outputs.token }}
33+
run: |
34+
gh api repos/superdoc-dev/labs/dispatches \
35+
-f event_type=superdoc-oss-sync \
36+
-F client_payload[sha]='${{ github.sha }}' \
37+
-F client_payload[ref]='${{ github.ref_name }}'

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ Special thanks to these community members who have contributed code to SuperDoc:
184184
<a href="https://github.com/msviderok"><img src="https://github.com/msviderok.png" width="50" height="50" alt="msviderok" title="Myroslav Sviderok" /></a>
185185
<a href="https://github.com/sergiogomes"><img src="https://github.com/sergiogomes.png" width="50" height="50" alt="sergiogomes" title="Sérgio Paulo Gomes" /></a>
186186
<a href="https://github.com/wookieb"><img src="https://github.com/wookieb.png" width="50" height="50" alt="wookieb" title="Łukasz Kużyński" /></a>
187+
<a href="https://github.com/xy200303"><img src="https://github.com/xy200303.png" width="50" height="50" alt="xy200303" title="小云" /></a>
187188

188189
Want to see your avatar here? Check the [Contributing Guide](CONTRIBUTING.md) to get started.
189190

demos/nextjs-ssr/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ yarn-error.log*
3939
# typescript
4040
*.tsbuildinfo
4141
next-env.d.ts
42+
public/fonts/

demos/nextjs-ssr/copy-fonts.mjs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copy SuperDoc's bundled metric-compatible font substitutes into public/fonts/ so they
2+
// are served at /fonts/ (the default asset base). Without this, the bundled .woff2 404
3+
// and SuperDoc paginates against a browser fallback. Runs as `predev`/`prebuild`.
4+
//
5+
// A real Next.js consumer would copy from `node_modules/@superdoc/font-system/assets/`
6+
// (or set `fonts.assetBaseUrl` to wherever they serve them); this example copies from the
7+
// workspace build for a self-contained demo.
8+
import { cpSync, existsSync } from 'node:fs';
9+
import { dirname, resolve } from 'node:path';
10+
import { fileURLToPath } from 'node:url';
11+
12+
const here = dirname(fileURLToPath(import.meta.url));
13+
const src = resolve(here, '../../packages/superdoc/dist/fonts');
14+
const dst = resolve(here, 'public/fonts');
15+
16+
if (existsSync(src)) {
17+
cpSync(src, dst, { recursive: true });
18+
console.log('[nextjs-ssr] copied bundled fonts -> public/fonts/');
19+
} else {
20+
console.warn(`[nextjs-ssr] bundled fonts not found at ${src}; run \`pnpm build:superdoc\` first`);
21+
}

demos/nextjs-ssr/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
"version": "0.1.0",
44
"private": true,
55
"scripts": {
6+
"predev": "node copy-fonts.mjs",
67
"dev": "next dev --turbopack",
8+
"prebuild": "node copy-fonts.mjs",
79
"build": "next build",
810
"start": "next start",
911
"lint": "next lint"

examples/getting-started/cdn/setup.mjs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// so `index.html` is self-contained and can be served with `npx serve .`.
33
// Run before `dev` or the Playwright smoke test.
44

5-
import { copyFileSync, existsSync } from 'node:fs';
5+
import { copyFileSync, cpSync, existsSync } from 'node:fs';
66
import { dirname, resolve } from 'node:path';
77
import { fileURLToPath } from 'node:url';
88

@@ -19,16 +19,26 @@ const assets = [
1919
[sampleSource, resolve(here, 'test_file.docx')],
2020
];
2121

22+
// The bundled metric-compatible substitutes ship as separate assets under dist/fonts/.
23+
// The CDN build auto-detects `./fonts/` relative to superdoc.min.js, so the example must
24+
// serve them beside the script (here/fonts/) or every .woff2 404s.
25+
const fontsSrc = resolve(dist, 'fonts');
26+
const fontsDst = resolve(here, 'fonts');
27+
2228
const missing = assets.filter(([src]) => !existsSync(src));
23-
if (missing.length) {
29+
if (missing.length || !existsSync(fontsSrc)) {
2430
console.error('[cdn-example/setup] Build the SuperDoc bundle first:');
2531
console.error(' pnpm --filter superdoc build');
2632
console.error('Missing files:');
2733
for (const [src] of missing) console.error(' ' + src);
34+
if (!existsSync(fontsSrc)) console.error(' ' + fontsSrc + ' (bundled font assets)');
2835
process.exit(1);
2936
}
3037

3138
for (const [src, dst] of assets) {
3239
copyFileSync(src, dst);
3340
console.log('[cdn-example/setup] copied', dst.replace(here + '/', ''));
3441
}
42+
43+
cpSync(fontsSrc, fontsDst, { recursive: true });
44+
console.log('[cdn-example/setup] copied fonts/ (bundled substitute pack)');

examples/getting-started/laravel/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ composer.lock
2222
/.nova
2323
/.vscode
2424
/.zed
25+
/public/fonts/
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copy SuperDoc's bundled metric-compatible font substitutes into public/fonts/ so Laravel
2+
// serves them at /fonts/ (the default asset base). Without this, the bundled .woff2 404 and
3+
// SuperDoc paginates against a browser fallback. Runs before `vite build` in `start`.
4+
//
5+
// A real Laravel app would copy from `node_modules/@superdoc/font-system/assets/` (or set
6+
// `fonts.assetBaseUrl`); this example copies from the workspace build for a self-contained demo.
7+
import { cpSync, existsSync } from 'node:fs';
8+
import { dirname, resolve } from 'node:path';
9+
import { fileURLToPath } from 'node:url';
10+
11+
const here = dirname(fileURLToPath(import.meta.url));
12+
const src = resolve(here, '../../../packages/superdoc/dist/fonts');
13+
const dst = resolve(here, 'public/fonts');
14+
15+
if (existsSync(src)) {
16+
cpSync(src, dst, { recursive: true });
17+
console.log('[laravel] copied bundled fonts -> public/fonts/');
18+
} else {
19+
console.warn(`[laravel] bundled fonts not found at ${src}; run \`pnpm build:superdoc\` first`);
20+
}

examples/getting-started/laravel/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"private": true,
44
"type": "module",
55
"scripts": {
6-
"build": "vite build",
7-
"dev": "concurrently \"php artisan serve --host=0.0.0.0 --port=8000\" \"vite\"",
8-
"start": "vite build && php artisan serve --host=127.0.0.1 --port=8000"
6+
"build": "node copy-fonts.mjs && vite build",
7+
"dev": "node copy-fonts.mjs && concurrently \"php artisan serve --host=0.0.0.0 --port=8000\" \"vite\"",
8+
"start": "node copy-fonts.mjs && vite build && php artisan serve --host=127.0.0.1 --port=8000"
99
},
1010
"dependencies": {
1111
"concurrently": "^9.0.0",

packages/layout-engine/contracts/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,6 +2008,8 @@ export type Page = {
20082008
* (in later phases) by body pagination itself.
20092009
*/
20102010
footnoteLedger?: FootnotePageLedger;
2011+
/** Numeric page number after section numbering restart/offset. Used for OOXML odd/even parity. */
2012+
displayNumber?: number;
20112013
numberText?: string;
20122014
size?: { w: number; h: number };
20132015
orientation?: 'portrait' | 'landscape';
@@ -2235,6 +2237,7 @@ export type HeaderFooterType = 'default' | 'first' | 'even' | 'odd';
22352237
export type HeaderFooterPage = {
22362238
number: number;
22372239
fragments: Fragment[];
2240+
displayNumber?: number;
22382241
numberText?: string;
22392242
/**
22402243
* Optional page-local block clones backing this page's resolved fragments.

0 commit comments

Comments
 (0)