Make sure publicLink is populated even when nonexistent

This commit is contained in:
Robbie Antenesse 2019-05-28 23:12:51 -06:00 committed by Robbie Antenesse
parent 4bdeff3296
commit eadc13e04b
2 changed files with 3 additions and 1 deletions

View File

@ -56,13 +56,14 @@ export function renderLoginForm() {
export function renderMakePublic() {
const editSettingsTab = document.getElementById('editSettingsTab');
const { isPublic } = window.currentDictionary.settings;
const { externalID } = window.currentDictionary;
const editSettingsTabHTML = `<label>Make Public
<input type="checkbox" id="editIsPublic"${isPublic ? ' checked' : ''}><br>
<small>Checking this box will make this public via a link you can share with others.</small>
</label>
<p id="publicLinkDisplay" style="${!isPublic ? 'display:none;': ''}margin-left:20px;">
<strong>Public Link:</strong><br>
<input readonly id="publicLink" value="${window.location.href + window.currentDictionary.externalID.toString()}">
<input readonly id="publicLink" value="${window.location.href + (externalID ? externalID.toString() : '')}">
<a class="small button" id="publicLinkCopy">Copy</a>
</p>
`;

View File

@ -100,6 +100,7 @@ export function uploadWholeDictionary(asNew = false) {
dictionary,
}, remoteId => {
window.currentDictionary.externalID = remoteId;
dictionary.getElementById('publicLink').value = window.location.href + remoteId.toString();
saveDictionary(false);
addMessage('Dictionary Uploaded Successfully');
renderChangeDictionaryOptions();