codex-team / codex-team/editor.js

[Bug] Cannot assign to read only property 'parseInt' of object '[object Object]'

Open
#1,856 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
31.9k
Forks
2.2k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

Unable to load Editor.js in Salesforce LWC

I am trying to use [Editor.js][1] within an Salesforce `LWC`

Editor.JS [source][2] file.

I've added the 3rd party library as a `Static Resource`

And the LWC JS file is:

import { LightningElement } from "lwc";
import editorJS from "@salesforce/resourceUrl/EditorJS";
import { loadScript } from "lightning/platformResourceLoader";

export default class ExampleLWC extends LightningElement {
isRendered = false;

renderedCallback() {
if (this.isRendered) {
return;
}

this.isRendered = true;

loadScript(this, editorJS)
.then(() => {
this.initialize();
})
.catch((error) => {
console.log("Error Loading EditorJS");
console.log(error); // <--- always undefined
});
}

initialize() {
console.log("Loaded EditorJS");
}
}

But it fails, and the `error` variable is `undefined`

When I enabled `Debug Mode` for the user, I got more messages in the console, including:

Failed to load script at /resource/1641397119000/EditorJS: Cannot assign to read only property 'parseInt' of object '[object Object]'

**Questions**

1. Why is it not working?
2. How can I fix it?

[1]: https://editorjs.io/getting-started
[2]: https://github.com/codex-team/editor.js/releases/download/v2.23.0-rc.1/editor.js

Cross-posted from:

https://salesforce.stackexchange.com/questions/366431/unable-to-load-editor-js-into-lwc

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.