-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat(core): core module added #75
Conversation
⏭️ No files to mutate for |
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
---|---|---|---|
🟢 | Statements | 100% | 0/0 |
🟢 | Branches | 100% | 0/0 |
🟢 | Functions | 100% | 0/0 |
🟢 | Lines | 100% | 0/0 |
Test suite run success
1 tests passing in 1 suite.
Report generated by 🧪jest coverage report action from e75d567
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
---|---|---|---|
🟢 | Statements | 100% | 745/745 |
🟢 | Branches | 99.5% (-0% 🔻) |
198/199 |
🟢 | Functions | 98.9% (-0.55% 🔻) |
179/181 |
🟢 | Lines | 100% | 719/719 |
Show files with reduced coverage 🔻
St.❔ |
File | Statements | Branches | Functions | Lines |
---|---|---|---|---|---|
🟢 | ... / index.ts |
100% | 100% | 96.15% (-3.85% 🔻) |
100% |
Test suite run success
390 tests passing in 24 suites.
Report generated by 🧪jest coverage report action from e75d567
⏭️ No files to mutate for |
/** | ||
* Block tool adapter will be passed to the tool to connect data with the DOM | ||
*/ | ||
blockToolAdapter: BlockToolAdapter; |
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.
Maybe just adapter
as this is a block tool by declaration
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.
done
packages/core/src/index.ts
Outdated
*/ | ||
private validateConfig(config: CoreConfig): void { | ||
if (config.holder === undefined) { | ||
const holder = document.getElementById('editorjs'); |
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.
Magic string
packages/core/src/index.ts
Outdated
const index = event.detail.index; | ||
|
||
if (index.blockIndex === undefined) { | ||
throw new Error('Block index should be defined'); |
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.
If blockIndex is not there that means something is wrong with the model. This error would give a user no information on how to fix that
packages/core/src/index.ts
Outdated
throw new Error('Block index should be defined'); | ||
} | ||
|
||
const caretAdapter = new CaretAdapter(this.#config.holder, this.#model); |
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.
CaretAdapter should be a single instance for the whole document, not for a block
/** | ||
* Works with tools | ||
*/ | ||
export default class ToolsManager { |
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.
Is this something we intend to keep? We could use ToolsFactory/ToolsCollection from the 2nd version
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.
we can use any implementation later
.map(([key, value]) => { | ||
return [ | ||
key, { | ||
value: value as TextNodeSerialized, |
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.
Should be checked if typeof value is a string
Core package added
Now we should pass blocks to the model via
initializeDocument()
method instead of constructor. This is needed to allow to subscribe on model update first