<!DOCTYPE html>
<html>

<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta charset="utf-8" />
    <title>为内容里面的英文、数字自动加上空格</title>

    <script src="https://cdn.jsdelivr.net/npm/pangu@4.0.7/dist/browser/pangu.min.js"></script>
</head>

<body>
    <textarea placeholder="粘贴内容,为内容里面的英文、数字自动加上空格" autofocus ></textarea>
    <textarea placeholder="输出"></textarea>
</body>

</html>
var txts = document.querySelectorAll('textarea');
txts[0].oninput = function () {
    txts[1].value = pangu.spacing(this.value)
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    padding: 15px;
}
textarea {
    width: 100%;
    height: 45vh;
    outline: none;
    padding: 15px;
    font-size: 1.5rem;
    border-radius: 6px;
    border: 1px solid #ddd;
}