Description
First, I think the call to extractContent()
in the Editable.getContent()
function
Line 270 in 58f9a24
should actually be
return content.extractContent(element, false)
to ensure that the argument keepUiElements
is a boolean as defined in the function’s documentation:
Line 80 in 58f9a24
Technically, undefined
is a falsey value, but it’s just not clean 🤓
Request
I’d like to modify/clean up the content of the host element before it’s serialized to HTML by passing in a callback function. Without it, getContent()
returns a serialized HTML which I need to parse into a DOM element, clean it up, and serialize it again… which isn’t great.
So, for example:
const content = editable.getContent(elem, function(e) {
// Modify and clean up `e` where `e` is the cloned and scrubbed `elem`.
});
If you’re interested in adding a callback function parameter to getContent()
then I can open a PR. (It’s not a big change, but quite useful!)
Activity