Skip to content

Cannot able to get the selected text along with its formatted html #221

@suganyapalani22

Description

@suganyapalani22

When selecting the text, i need to add the outer div with some format, I have used this code, but throws some exceptions,

const range = currentElement.summernote('createRange');
var newrange=range.nativeRange()
const newParent = document.createElement('span');
newParent.setAttribute('contenteditable', false);
newParent.setAttribute('class', 'freeze-word');
var newtext=newrange.surroundContents(newParent);

The exception,
Failed to execute 'surroundContents' on 'Range': The Range has partially selected a non-Text node.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions