Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
dom.placeCaretAtHorizontalEdge(element, true);
// $ExpectType void
dom.placeCaretAtHorizontalEdge(undefined, false);
// $ExpectType void
dom.placeCaretAtVerticalEdge(element, true);
// $ExpectType void
dom.placeCaretAtVerticalEdge(undefined, false);
// $ExpectType void
dom.remove(node);
// $ExpectType void
dom.replace(node, node);
// $ExpectType HTMLParagraphElement
dom.replaceTag(node, 'p');
// $ExpectType HTMLSpanElement
dom.replaceTag(node, 'span');
// $ExpectType void
dom.unwrap(node);
// $ExpectType void
dom.wrap(node, node);
export default function( node, doc ) {
if ( node.nodeType !== COMMENT_NODE ) {
return;
}
if ( node.nodeValue === 'nextpage' ) {
replace( node, createNextpage( doc ) );
return;
}
if ( node.nodeValue.indexOf( 'more' ) === 0 ) {
// Grab any custom text in the comment.
const customText = node.nodeValue.slice( 4 ).trim();
/*
* When a `` comment is found, we need to look for any
* `` sibling, but it may not be a direct sibling
* (whitespace typically lies in between)
*/
let sibling = node;
let noTeaser = false;
while ( ( sibling = sibling.nextSibling ) ) {
if (
* (whitespace typically lies in between)
*/
let sibling = node;
let noTeaser = false;
while ( ( sibling = sibling.nextSibling ) ) {
if (
sibling.nodeType === COMMENT_NODE &&
sibling.nodeValue === 'noteaser'
) {
noTeaser = true;
remove( sibling );
break;
}
}
replace( node, createMore( customText, noTeaser, doc ) );
}
}