Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 70ca480

Browse files
authored
Merge pull request #84 from JSKitty/master
fix: various About Me editing bugs
2 parents 66e9add + 5bb1d59 commit 70ca480

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/main.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,8 @@ function renderProfileTab(cProfile) {
12331233
domProfileStatusSecondary.innerHTML = domProfileStatus.innerHTML;
12341234

12351235
// Secondary Description
1236-
domProfileDescription.textContent = cProfile.about;
1236+
const strDescriptionPlaceholder = cProfile.mine ? (cProfile?.about || 'Set an About Me') : '';
1237+
domProfileDescription.textContent = strDescriptionPlaceholder;
12371238
twemojify(domProfileDescription);
12381239

12391240
// If this is OUR profile: make the elements clickable
@@ -2287,22 +2288,27 @@ function editProfileDescription() {
22872288

22882289
// Handle blur event to save and return to view mode
22892290
domProfileDescriptionEditor.onblur = () => {
2291+
// Hide textarea and show span
2292+
domProfileDescriptionEditor.style.display = 'none';
2293+
domProfileDescription.style.display = '';
2294+
2295+
// Remove the blur event listener
2296+
domProfileDescriptionEditor.onblur = null;
2297+
2298+
// If nothing was edited, don't change anything
2299+
if (!domProfileDescriptionEditor.value ||
2300+
domProfileDescriptionEditor.value === cProfile.about
2301+
) return;
2302+
22902303
// Update the profile's about property
22912304
cProfile.about = domProfileDescriptionEditor.value;
22922305

22932306
// Update the span content
22942307
domProfileDescription.textContent = cProfile.about;
22952308
twemojify(domProfileDescription);
22962309

2297-
// Hide textarea and show span
2298-
domProfileDescriptionEditor.style.display = 'none';
2299-
domProfileDescription.style.display = '';
2300-
23012310
// Upload new About Me to Nostr
23022311
setAboutMe(cProfile.about);
2303-
2304-
// Remove the blur event listener
2305-
domProfileDescriptionEditor.onblur = null;
23062312
};
23072313

23082314
// Resize it to match the content size (CSS cannot scale textareas based on content)

0 commit comments

Comments
 (0)