Browse Source

CHART-18102 JXBrowser资源请求增加文件类型

feature/big-screen
Qinghui.Liu 4 years ago
parent
commit
27de15b8be
  1. 14
      designer-base/src/main/java/com/fr/design/ui/Assistant.java
  2. 4
      designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html

14
designer-base/src/main/java/com/fr/design/ui/Assistant.java

@ -6,14 +6,12 @@ import com.teamdev.jxbrowser.chromium.BrowserContext;
import com.teamdev.jxbrowser.chromium.ProtocolService; import com.teamdev.jxbrowser.chromium.ProtocolService;
import com.teamdev.jxbrowser.chromium.URLResponse; import com.teamdev.jxbrowser.chromium.URLResponse;
import javax.activation.MimetypesFileTypeMap;
import java.io.DataInputStream; import java.io.DataInputStream;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths;
/** /**
* @author richie * @author richie
@ -50,6 +48,18 @@ public class Assistant {
if (path.endsWith(".svg")) { if (path.endsWith(".svg")) {
return "image/svg+xml"; return "image/svg+xml";
} }
if (path.endsWith(".png")) {
return "image/png";
}
if (path.endsWith(".woff")) {
return "font/woff";
}
if (path.endsWith(".ttf")) {
return "truetype";
}
if (path.endsWith(".eot")) {
return "embedded-opentype";
}
Path file = new File(path).toPath(); Path file = new File(path).toPath();
try { try {
return Files.probeContentType(file); return Files.probeContentType(file);

4
designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html

@ -3,8 +3,8 @@
<head> <head>
<meta charset="utf-8"/> <meta charset="utf-8"/>
<title></title> <title></title>
<link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css"/> <link rel="stylesheet" type="text/css" href="emb:/com/fr/web/ui/fineui.min.css"/>
<link rel="stylesheet" type="text/css" href="./rich_editor.css"/> <link rel="stylesheet" type="text/css" href="emb:/com/fr/web/ui/materials.min.css"/>
</head> </head>
<body> <body>
<script src="script/enums.js"></script> <script src="script/enums.js"></script>

Loading…
Cancel
Save