Spaces:
Running
Running
Update script.js
Browse files
script.js
CHANGED
@@ -141,9 +141,13 @@ function updateButtonStates() {
|
|
141 |
}
|
142 |
|
143 |
function replaceSpaces() {
|
144 |
-
|
145 |
-
|
146 |
-
|
|
|
|
|
|
|
|
|
147 |
handleTextChange();
|
148 |
}
|
149 |
|
|
|
141 |
}
|
142 |
|
143 |
function replaceSpaces() {
|
144 |
+
let text = inputText.value;
|
145 |
+
|
146 |
+
text = text.replace(/,(\S)/g, ', $1');
|
147 |
+
text = text.replace(/ {2,}/g, ' ');
|
148 |
+
text = text.replace(/([^,])\s+/g, '$1, ');
|
149 |
+
|
150 |
+
inputText.value = text;
|
151 |
handleTextChange();
|
152 |
}
|
153 |
|