14 lines
345 B
JavaScript
14 lines
345 B
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
import { getStringSize } from "./domUtils.js";
|
|
export function getWordsByLines({
|
|
style,
|
|
needsComputation,
|
|
text
|
|
}) {
|
|
return text.split('\n').map(subText => _extends({
|
|
text: subText
|
|
}, needsComputation ? getStringSize(subText, style) : {
|
|
width: 0,
|
|
height: 0
|
|
}));
|
|
} |