SCEditor
SCEditor copied to clipboard
hardcoded decision in dom.isInline
There is a hardcoded decision in dom.isInline
function for <code>
element.
Is there another way? Can't it use handler's configuration somehow?
If it should be done on dom level, so why only code is there? Shouldn't comments behave the same?
export function isInline(elm, includeCodeAsBlock) {
var tagName,
nodeType = (elm || {}).nodeType || TEXT_NODE;
if (nodeType !== ELEMENT_NODE) {
return nodeType === TEXT_NODE;
}
tagName = elm.tagName.toLowerCase();
if (tagName === 'code') {
return !includeCodeAsBlock;
}
return blockLevelList.indexOf('|' + tagName + '|') < 0;
}
IIRC, there's a comment from @samclarke some time ago exactly about that. I forgot when it is
Found related TODO in SCEditor.js:
// TODO: make configurable
// don't apply any commands to code elements
if (dom.closest(rangeHelper.parentNode(), 'code')) {
return;
}
I believe you can create a PR solving that. I can then review and merge it if all checks out.