Conversation
…plement get data method that returns serialized model object
|
⏭️ No files to mutate for |
|
⏭️ No files to mutate for |
|
⏭️ No files to mutate for |
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
|---|---|---|---|
| 🟢 | Statements | 96.43% | 27/28 |
| 🟢 | Branches | 86.96% | 20/23 |
| 🟢 | Functions | 100% | 5/5 |
| 🟢 | Lines | 96.43% | 27/28 |
Test suite run success
11 tests passing in 2 suites.
Report generated by 🧪jest coverage report action from 179b754
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
|---|---|---|---|
| 🟢 | Statements | 99.89% | 893/894 |
| 🟢 | Branches | 99.62% | 262/263 |
| 🟢 | Functions | 98.17% | 214/218 |
| 🟢 | Lines | 99.88% | 858/859 |
Test suite run success
467 tests passing in 25 suites.
Report generated by 🧪jest coverage report action from 179b754
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
|---|---|---|---|
| 🟢 | Statements | 100% | 107/107 |
| 🟢 | Branches | 97.44% | 38/39 |
| 🟢 | Functions | 100% | 26/26 |
| 🟢 | Lines | 100% | 99/99 |
Show new covered files 🐣
St.❔ |
File | Statements | Branches | Functions | Lines |
|---|---|---|---|---|---|
| 🟢 | ... / DocumentAPI.ts |
100% | 100% | 100% | 100% |
Test suite run success
67 tests passing in 6 suites.
Report generated by 🧪jest coverage report action from 179b754
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
|---|---|---|---|
| 🟡 | Statements | 70.97% | 22/31 |
| 🔴 | Branches | 20% | 1/5 |
| 🟡 | Functions | 75% | 6/8 |
| 🟡 | Lines | 68.97% | 20/29 |
Test suite run success
4 tests passing in 1 suite.
Report generated by 🧪jest coverage report action from 179b754
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
|---|---|---|---|
| 🟢 | Statements | 91.99% | 356/387 |
| 🟢 | Branches | 84.06% | 116/138 |
| 🟢 | Functions | 98.15% | 53/54 |
| 🟢 | Lines | 91.88% | 351/382 |
Test suite run success
117 tests passing in 7 suites.
Report generated by 🧪jest coverage report action from 179b754
There was a problem hiding this comment.
Pull request overview
Introduces a new DocumentAPI to expose serialized editor document data via the main EditorAPI surface, including DI integration in core and a unit test.
Changes:
- Added
DocumentAPItype to the SDK and exported it from the SDK API index. - Implemented
DocumentAPIservice in core and injected it into core’sEditorAPI. - Added a unit test validating
DocumentAPI.datareturns the model’s serialized document.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/sdk/src/api/index.ts | Re-exports the new DocumentAPI type. |
| packages/sdk/src/api/EditorAPI.ts | Extends EditorAPI interface with a document property. |
| packages/sdk/src/api/DocumentAPI.ts | Defines the DocumentAPI interface with a data getter. |
| packages/core/src/api/index.ts | Injects DocumentAPI into core EditorAPI (runtime import path issue noted). |
| packages/core/src/api/DocumentAPI/index.ts | Adds barrel export for core DocumentAPI implementation. |
| packages/core/src/api/DocumentAPI/DocumentAPI.ts | Implements DocumentAPI as a typedi service backed by EditorJSModel.serialized. |
| packages/core/src/api/DocumentAPI/DocumentAPI.spec.ts | Adds unit test for DocumentAPI.data getter. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| */ | ||
| @Service() | ||
| export class DocumentAPI implements DocumentApiInterface { | ||
| #model: EditorJSModel; |
There was a problem hiding this comment.
jsdoc missing, you could use @link to definition of the model maybe
This pull request introduces a new
DocumentAPIto the codebase, providing a standardized way to access the serialized document data from the editor. The implementation includes both the interface and the concrete class, integrates the API into the editor's dependency injection system, and adds corresponding tests and exports.New Document API Implementation and Integration:
DocumentAPIclass inpackages/core/src/api/DocumentAPI/DocumentAPI.ts, which provides a getter for the serialized document data and is registered as a service for dependency injection.DocumentAPIinterface inpackages/sdk/src/api/DocumentAPI.tsto standardize access to the serialized document object.EditorAPIinterface and implementation to include the newdocumentproperty, making theDocumentAPIaccessible as part of the main API surface. [1] [2] [3] [4]Testing:
DocumentAPIinDocumentAPI.spec.tsto verify that the API correctly returns the serialized model data.