Fixed Insert button for uploads inserting with the wrong markup format if the setting was changed after upload.

This commit is contained in:
flash 2023-05-04 17:20:56 +00:00
parent 8038f61470
commit 5d602bd56f

View file

@ -149,26 +149,26 @@ Misuzu.Forum.Editor.init = function() {
}; };
uploadTask.onComplete = function(fileInfo) { uploadTask.onComplete = function(fileInfo) {
const parserMode = parseInt(postingParser.value);
let insertText = location.protocol + fileInfo.url;
if(parserMode == 1) { // bbcode
if(fileInfo.isImage())
insertText = '[img]' + fileInfo.url + '[/img]';
else if(fileInfo.isAudio())
insertText = '[audio]' + fileInfo.url + '[/audio]';
else if(fileInfo.isVideo())
insertText = '[video]' + fileInfo.url + '[/video]';
} else if(parserMode == 2) { // markdown
if(fileInfo.isMedia())
insertText = '![](' + fileInfo.url + ')';
}
uploadElem.classList.add('eeprom-widget-file-done'); uploadElem.classList.add('eeprom-widget-file-done');
uploadElemName.href = fileInfo.url; uploadElemName.href = fileInfo.url;
uploadElemProgressText.textContent = ''; uploadElemProgressText.textContent = '';
const insertTheLinkIntoTheBoxEx2 = function() { const insertTheLinkIntoTheBoxEx2 = function() {
const parserMode = parseInt(postingParser.value);
let insertText = location.protocol + fileInfo.url;
if(parserMode == 1) { // bbcode
if(fileInfo.isImage())
insertText = '[img]' + fileInfo.url + '[/img]';
else if(fileInfo.isAudio())
insertText = '[audio]' + fileInfo.url + '[/audio]';
else if(fileInfo.isVideo())
insertText = '[video]' + fileInfo.url + '[/video]';
} else if(parserMode == 2) { // markdown
if(fileInfo.isMedia())
insertText = '![](' + fileInfo.url + ')';
}
$insertTags(postingText, insertText, ''); $insertTags(postingText, insertText, '');
postingText.value = postingText.value.trim(); postingText.value = postingText.value.trim();
}; };