新增依赖 highlightjs 代码文件预览高亮支持
This commit is contained in:
@ -17,6 +17,7 @@ public interface FilePreview {
|
||||
String TIFF_FILE_PREVIEW_PAGE = "tiff";
|
||||
String OFFICE_PICTURE_FILE_PREVIEW_PAGE = "officePicture";
|
||||
String TXT_FILE_PREVIEW_PAGE = "txt";
|
||||
String CODE_FILE_PREVIEW_PAGE = "code";
|
||||
String EXEL_FILE_PREVIEW_PAGE = "html";
|
||||
String XML_FILE_PREVIEW_PAGE = "xml";
|
||||
String MARKDOWN_FILE_PREVIEW_PAGE = "markdown";
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
package cn.keking.service.impl;
|
||||
|
||||
import cn.keking.model.FileAttribute;
|
||||
import cn.keking.service.FilePreview;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.ui.Model;
|
||||
|
||||
/**
|
||||
* @author kl (http://kailing.pub)
|
||||
* @since 2021/2/18
|
||||
*/
|
||||
@Component
|
||||
public class CodeFilePreviewImpl implements FilePreview {
|
||||
|
||||
private final SimTextFilePreviewImpl filePreviewHandle;
|
||||
|
||||
public CodeFilePreviewImpl(SimTextFilePreviewImpl filePreviewHandle) {
|
||||
this.filePreviewHandle = filePreviewHandle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute) {
|
||||
filePreviewHandle.filePreviewHandle(url, model, fileAttribute);
|
||||
return CODE_FILE_PREVIEW_PAGE;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user