src/scripts/modules/ContentEditable.js
/**
         * On dom focus do some stuff and then let the rest of the app know.
         *
         * @method handleFocus
         * @fires contenteditable:focus
         */
On dom focus do some stuff and then let the rest of the app know.
@method handleFocus
@fires contenteditable:focus
On dom focus do some stuff and then let the rest of the app know . @method handleFocus @fires contenteditable : focus
handleFocus () {
            const { mediator, dom } = this;
            this.clearCleanupTimeout();
            this.ensureDefaultBlock();
            this.updatePlaceholderState();
            dom.el[0].childNodes.forEach((childNode) => {
                if (childNode.nodeType === Node.TEXT_NODE && !childNode.textContent.trim().length) {
                    DOM.removeNode(childNode);
                }
            });
            mediator.emit('contenteditable:focus');
        }
handleFocus ( ) { const { mediator , dom } = this ; this . clearCleanupTimeout ( ) ; this . ensureDefaultBlock ( ) ; this . updatePlaceholderState ( ) ; dom . el [ 0 ] . childNodes . forEach ( ( childNode ) => { if ( childNode . nodeType === Node . TEXT_NODE && ! childNode . textContent . trim ( ) . length ) { DOM . removeNode ( childNode ) ; } } ) ; mediator . emit ( 'contenteditable:focus' ) ; }
On dom focus do some stuff and then let the rest of the app know.
On dom focus do some stuff and then let the rest of the app know .
// Trim out orphaned empty root level text nodes. Should maybe move this somewhere else.