Skip to content
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

Fix BlockManager.setCurrentBlockByChildNode() with multiple Editor.js instances #1511

Conversation

hata6502
Copy link
Contributor

* @type {number}
*/
this.currentBlockIndex = this._blocks.nodes.indexOf(parentFirstLevelBlock as HTMLElement);
if (!parentFirstLevelBlock?.closest(`.${this.Editor.UI.CSS.editorWrapper}`)?.isEqualNode(this.Editor.UI.nodes.wrapper)) {
Copy link
Contributor Author

@hata6502 hata6502 Jan 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Support multiple Editor.js instances, by checking the equality between this.Editor.UI.CSS.editorWrapper and this.Editor.UI.nodes.wrapper.

@hata6502 hata6502 marked this pull request as ready for review January 25, 2021 12:14
@robonetphy robonetphy closed this Jan 28, 2021
@robonetphy robonetphy reopened this Jan 28, 2021
@robonetphy
Copy link
Member

To Test PR we can use the following code:

<!DOCTYPE html>
<html>

<head>
    <title>Testing</title>
    <meta charset="UTF-8" />
</head>

<body>
    <div id="editorjs1" style="border:red solid 1px"></div>
    <div id="editorjs2" style="border:yellow solid 1px"></div>
    <script src="https://cdn.jsdelivr.net/npm/@editorjs/header@latest"></script><!-- Header -->
    <!-- <script src="https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest"></script> -->
    <script src="../dist/editor.js"></script>
    <script>
        var editor1 = new EditorJS({
            holder: 'editorjs1'
        });
        var editor2 = new EditorJS({
            holder: 'editorjs2'
        });
    </script>
</body>

</html>

@neSpecc
Copy link
Member

neSpecc commented Feb 17, 2021

Thanks, @hata6502

@neSpecc neSpecc merged commit c106819 into codex-team:next Feb 17, 2021
@hata6502 hata6502 deleted the bugfix/fix-set-current-block-by-child-node-for-multiple-editorjs branch February 17, 2021 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants