-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
when I repeatedly click my button I first get the actual htmlParentNode but on second and subsequent click I get a div that is the htmlParentNode's parent:
extensions: {
'save': new MediumButton({
label: 'save',
action: function (html, mark, htmlParentNode) {
var c_id = jQuery(htmlParentNode).closest('div.editable').attr('id');
var contents = htmlParentNode.innerHTML; // innerText
alert(c_id + '\n'+ contents);
return html
}
}),
am i doing something wrong or is this a bug?
could it be as the parent is now of the menu button and not the editor div? ie this:
var sel = window.getSelection(); var parent = sel.anchorNode.parentElement;
I'm actually trying to get the id of the div that the editor instance is attached to as I have a page with many editors/ divs of editable class - is there an easy way to do that? (my goal is ajax with many editable divs).
thanks
----- edit - i'm pretty sure the parent of parent is being returned. here's a kludgy workaround
` extensions: {
'save': new MediumButton({
label: 'save',
action: function (html, mark, htmlParentNode) {
var maybe = jQuery(htmlParentNode).find('div.editable'); //.length !== 0)
if (maybe.length !== 0){
htmlParentNode = maybe;
}
var c_id = jQuery(htmlParentNode).attr('id');
var contents = htmlParentNode.innerHTML; // innerText
alert(c_id + '\n'+ html);
return html
}
}),`
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels