-
Notifications
You must be signed in to change notification settings - Fork 43
feat: add page count to vanilla example #1657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ let editor = null; | |
| function initializeEditor(file = null) { | ||
| // Cleanup previous instance if it exists | ||
| if (editor) { | ||
| editor.destroy(); | ||
| editor = null; | ||
| } | ||
|
|
||
|
|
@@ -23,6 +24,24 @@ function initializeEditor(file = null) { | |
| }, | ||
| onEditorCreate: (event) => { | ||
| console.log('Editor is created', event); | ||
|
|
||
| // Get page count after editor is created | ||
| setTimeout(() => { | ||
| const documents = editor.superdocStore.documents; | ||
| const presentationEditor = documents[0]?.getPresentationEditor(); | ||
|
|
||
| if (presentationEditor) { | ||
|
Comment on lines
+29
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The Useful? React with 👍 / 👎.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please assess if this is relevant or not |
||
| const pages = presentationEditor.getPages(); | ||
| const pageCount = pages.length; | ||
| console.log(`Document has ${pageCount} page(s)`); | ||
|
|
||
| // Display page count in UI | ||
| const pageCountDisplay = document.getElementById('pageCount'); | ||
| if (pageCountDisplay) { | ||
| pageCountDisplay.textContent = `Pages: ${pageCount}`; | ||
| } | ||
| } | ||
| }, 100); // Small delay to ensure layout is complete | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| name = "superdoc-page-count" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why cloudflare pages? :) I thought we agreed on Github pages instead |
||
| compatibility_date = "2023-12-01" | ||
|
|
||
| [env.production] | ||
| account_id = "" | ||
| zone_id = "" | ||
|
|
||
| # Pages configuration | ||
| pages_build_output_dir = "dist" | ||
|
|
||
| # Build configuration | ||
| [build] | ||
| command = "npm run build" | ||
| cwd = "" | ||
|
|
||
| # Environment variables (if needed) | ||
| [vars] | ||
|
|
||
| # Custom domains (optional) | ||
| [env.production.routes] | ||
| # Add custom domains here if needed | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's update devDeps as well
npx npm-check-updates -u