vkurko / calendar

Full-sized drag & drop JavaScript event calendar with resource & timeline views
https://vkurko.github.io/calendar/
MIT License
1.23k stars 108 forks source link

setContact action improvement #125

Closed stackasaur closed 1 year ago

stackasaur commented 1 year ago

All of the 'html' options use the setContact action defined in common. The action can handle either a string, or an object declaring html or domNodes, to render using innerHTML or appendChild respectively.

I believe passing in a DOM Node directly should be allowable. So rather than having to do

titleHTML: {
  domNodes:[el]
}

for a singular domNode, we should be able to just do

titleHTML:el

this would just require setContent to have another check

// isNode function to handle browser discrepancies 
function isNode(o){
  return (
    typeof Node === "object" ? o instanceof Node : 
    o && typeof o === "object" && typeof o.nodeType === "number" && typeof o.nodeName==="string"
  );
}
...
else if (isNode(content)){
  node.appendChild(content);
}
...

This is absolutely not needed, but I think it'd be a nice QOL improvement.

vkurko commented 1 year ago

titleHTML: { domNodes:[el] }

This format is not supported for titleHTML. The only supported format is string.

You may be confusing this with the eventContent option. But in this case, the current format of input value seems quite convenient and sufficient to me.