function onLineBreak(measureText) {
  return (state) => {
    const item = state.node;
    if (shouldLineBreak(item)) {
      const wordBreakFn = resolveLineBreakAlgorithm(item);
      if (!wordBreakFn) {
        return;
      }

      const tm = measureText(item);
      if (tm.width > item.maxWidth || includesLineBreak(item.text)) {
        const diff = fontSizeToLineHeight(item) - tm.height;
        const halfLead = diff / 2;
        const result = wordBreakFn(item, wrappedMeasureText(item, measureText));

        state.node = generateLineNodes(result, item, halfLead, tm.height); // Convert node to container
      }
    }
  };
}
/**
 * Apply wordBreak rules to text nodes.
 * @ignore
 * @param {function} measureText
 * @returns {function} Event function to convert a text node into multiple nodes
 */
Apply wordBreak rules to text nodes.
@ignore
@param {function} measureText
@returns {function} Event function to convert a text node into multiple nodes
Apply wordBreak rules to text nodes . @ignore @param { function } measureText @returns { function } Event function to convert a text node into multiple nodes
function onLineBreak(measureText) {
  return (state) => {
    const item = state.node;
    if (shouldLineBreak(item)) {
      const wordBreakFn = resolveLineBreakAlgorithm(item);
      if (!wordBreakFn) {
        return;
      }
      const tm = measureText(item);
      if (tm.width > item.maxWidth || includesLineBreak(item.text)) {
        const diff = fontSizeToLineHeight(item) - tm.height;
        const halfLead = diff / 2;
        const result = wordBreakFn(item, wrappedMeasureText(item, measureText));
        state.node = generateLineNodes(result, item, halfLead, tm.height); 
      }
    }
  };
}
function onLineBreak ( measureText ) { return ( state ) => { const item = state . node ; if ( shouldLineBreak ( item ) ) { const wordBreakFn = resolveLineBreakAlgorithm ( item ) ; if ( ! wordBreakFn ) { return ; } const tm = measureText ( item ) ; if ( tm . width > item . maxWidth || includesLineBreak ( item . text ) ) { const diff = fontSizeToLineHeight ( item ) - tm . height ; const halfLead = diff / 2 ; const result = wordBreakFn ( item , wrappedMeasureText ( item , measureText ) ) ; state . node = generateLineNodes ( result , item , halfLead , tm . height ) ; } } } ; }
Apply wordBreak rules to text nodes.
Apply wordBreak rules to text nodes .
// Convert node to container