diff --git a/_server/editor_ui.js b/_server/editor_ui.js index 47e26bdb..2bb6e774 100644 --- a/_server/editor_ui.js +++ b/_server/editor_ui.js @@ -781,21 +781,62 @@ editor_ui_wrapper = function (editor) { // 显示每一项内容 var html = "

"; - html += "
"; + html += ""+ + "
"; data.forEach(function (one) { - html += `= 0? 'checked' : ''} /> ${one}
`; + html += `= 0? 'checked' : ''} /> ${one}`; + // 预览图片 + if (one.endsWith('.png') || one.endsWith('.jpg') || one.endsWith('.jpeg') || one.endsWith('.gif')) { + html += ""; + html += '
'; + } + // 试听音频 + if (one.endsWith('.mp3') || one.endsWith('.wmv') || one.endsWith('.ogg') || one.endsWith('.wav')) { + html += ""; + html += '
'; + } + html += '
'; }); html += "

"; uievent.elements.materialList.innerHTML = html; }); } - uievent._selectAll = function (checked) { + uievent._selectAllMaterial = function (checked) { Array.from(document.getElementsByClassName('materialCheckbox')).forEach(function (one) { one.checked = checked; }) } + uievent._previewMaterialImage = function (button) { + var br = button.nextElementSibling; + var img = br.nextElementSibling; + if (br.style.display == 'none') { + button.innerText = '折叠'; + br.style.display = 'block'; + img.style.display = 'block'; + img.src = img.getAttribute('key'); + } else { + button.innerText = '预览'; + br.style.display = 'none'; + img.style.display = 'none'; + } + } + + uievent._previewMaterialAudio = function (button) { + var br = button.nextElementSibling; + var audio = br.nextElementSibling; + if (br.style.display == 'none') { + button.innerText = '折叠'; + br.style.display = 'block'; + audio.style.display = 'block'; + } else { + button.innerText = '试听'; + br.style.display = 'none'; + audio.style.display = 'none'; + } + } + editor.constructor.prototype.uievent=uievent; } \ No newline at end of file