Skip to content

Commit 65650a3

Browse files
authored
Remove waitForElements
1 parent 5028bf3 commit 65650a3

File tree

1 file changed

+0
-22
lines changed

1 file changed

+0
-22
lines changed

features/align-to-center/script.js

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@ export default async function ({ feature, console }) {
2323
return textWidth;
2424
}
2525

26-
function clearCenterAlignment(textarea) {
27-
const lines = textarea.value.split("\n");
28-
const uncenteredLines = lines.map((line) => {
29-
return line.replace(/^\s+/, "");
30-
});
31-
textarea.value = uncenteredLines.join("\n");
32-
}
33-
3426
function centerAlignText() {
3527
const form = document.querySelector(".project-description-form");
3628
if (form) {
@@ -39,8 +31,6 @@ export default async function ({ feature, console }) {
3931
activeElement.tagName === "TEXTAREA" &&
4032
form.contains(activeElement)
4133
) {
42-
clearCenterAlignment(activeElement);
43-
4434
const spaceWidth = getSpaceWidth();
4535
const lines = activeElement.value.split("\n");
4636
const centeredLines = lines.map((line) => {
@@ -59,16 +49,4 @@ export default async function ({ feature, console }) {
5949
centerAlignText();
6050
}
6151
});
62-
63-
await ScratchTools.waitForElements(
64-
".project-description-form textarea",
65-
(textareas) => {
66-
textareas.forEach((textarea) => {
67-
textarea.addEventListener("input", function () {
68-
centerAlignText();
69-
});
70-
});
71-
}
72-
);
7352
}
74-

0 commit comments

Comments
 (0)