新聞專區

最新行業新聞和動態

1
主題
0
評論
04-14 18:02
最後活動
排序方式:
時間範圍:
登錄後發帖
主題
統計
回覆
最後活動
传统中医药智慧守护现代肠胃健康——香港忠信制药以"溃肠宁丸"回应快节奏生活挑
123
2026-04-14 18:02
瀏覽: 113
點讚: 0
0
回覆
10-24 05:37
最後更新
 align-items: center; justify-content: center; `; removeBtn.onclick = function() { removeImageFromSelection(index); }; imgContainer.appendChild(img); imgContainer.appendChild(removeBtn); previewImages.appendChild(imgContainer); }; reader.readAsDataURL(file); }); previewContainer.style.display = 'block'; } // 从选择中移除图片 function removeImageFromSelection(index) { const fileInput = document.getElementById('topic-images'); const files = Array.from(fileInput.files); files.splice(index, 1); // 创建新的FileList const dataTransfer = new DataTransfer(); files.forEach(file => dataTransfer.items.add(file)); fileInput.files = dataTransfer.files; // 触发change事件更新预览 fileInput.dispatchEvent(new Event('change')); } // 初始化表情选择器 let titleEmojiPicker = null; let contentEmojiPicker = null; function initEmojiPickers() { const titleInput = document.getElementById('topic-title'); const contentTextarea = document.getElementById('topic-content'); if (titleInput && typeof attachEmojiPickerToInput !== 'undefined') { // 移除现有的表情选择器 if (titleEmojiPicker) { titleEmojiPicker.hide(); } // 为主题标题添加表情选择器 titleEmojiPicker = attachEmojiPickerToInput(titleInput, { position: 'bottom' }); } if (contentTextarea && typeof attachEmojiPickerToTextarea !== 'undefined') { // 移除现有的表情选择器 if (contentEmojiPicker) { contentEmojiPicker.hide(); } // 为主题内容添加表情选择器 contentEmojiPicker = attachEmojiPickerToTextarea(contentTextarea, { position: 'top' }); } } // 页面加载完成后初始化 document.addEventListener('DOMContentLoaded', function() { // 如果模态框已经打开(例如通过URL参数),初始化表情选择器 if (document.getElementById('newTopicModal').classList.contains('active')) { setTimeout(() => { initEmojiPickers(); }, 100); } // 添加图片预览样式 const style = document.createElement('style'); style.textContent = ` .images-preview { background: #f8f9fa; border: 1px solid #ddd; border-radius: 6px; padding: 10px; } .preview-title { font-size: 0.9rem; color: #666; margin-bottom: 8px; font-weight: 500; } .preview-images { display: flex; flex-wrap: wrap; gap: 8px; } .preview-image-item:hover { border-color: #0b5394; } `; document.head.appendChild(style); });