Skip to content

JavaScript error when clicking on a button in non editable area if the editor does not have the focus #325

@dpobel

Description

@dpobel

For instance use the following code:

<div id="editable" contenteditable="true">
    <p>Lorem ipsum dolor es</p>
    <p contenteditable="false"><button>Click on me</button> before anything else</p>
</div>

<script>
    var editor = AlloyEditor.editable('editable');
</script>

and click on the button to get the error. But if you click first on the editable text and then use the button, everything is fine.

In Chrome, you get:

Uncaught TypeError: Cannot read property 'startNode' of undefined
getCaretRegion @ alloy-editor-all-min.js:1271
getClientRectsRegion @ alloy-editor-all-min.js:1420
getSelectionRegion @ alloy-editor-all-min.js:1328
getSelectionData @ alloy-editor-all-min.js:1310
(anonymous function) @ alloy-editor-all-min.js:1977
(anonymous function) @ alloy-editor-all-min.js:994
setTimeout (async)callFn @ alloy-editor-all-min.js:993
j @ alloy-editor-all-min.js:12
CKEDITOR.event.CKEDITOR.event.fire @ alloy-editor-all-min.js:14
CKEDITOR.dom.domObject.a @ alloy-editor-all-min.js:49

In Firefox :

TypeError: bookmarks[0] is undefined

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions