Browse Source

Merge pull request #946 in BA/design from ~KERRY/design:9.0 to 9.0

* commit '317aabb6261d54d7f8d811110c1fdf4fa742d44b':
  REPORT-2354 将平台的插件管理和设计器的插件管理统一起来
master
superman 7 years ago
parent
commit
dd318a13af
  1. 2
      designer_base/src/com/fr/design/extra/PluginOperateUtils.java
  2. 27
      designer_base/src/com/fr/design/extra/exe/callback/JSCallback.java

2
designer_base/src/com/fr/design/extra/PluginOperateUtils.java

@ -92,7 +92,7 @@ public class PluginOperateUtils {
List<PluginView> plugins = PluginsReaderFromStore.readPluginsForUpdate();
JSONArray jsonArray = new JSONArray();
for (PluginView plugin : plugins) {
org.json.JSONObject jsonObject = new org.json.JSONObject();
JSONObject jsonObject = new JSONObject();
jsonObject.put("pluginid", plugin.getID());
jsonArray.put(jsonObject);
}

27
designer_base/src/com/fr/design/extra/exe/callback/JSCallback.java

@ -8,6 +8,9 @@ import javafx.concurrent.Task;
import javafx.scene.web.WebEngine;
import netscape.javascript.JSObject;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created by ibm on 2017/5/27.
*/
@ -57,7 +60,7 @@ public class JSCallback<T> extends Task<T> {
* 这边建议去除所有的html标签
* 字符\在java中实际存储的是\\,替换字符串\\n, 需要用\\\\n
* "\t""\n" 都要转义成" " 不然会解析出错
* "\\"需要转换成"\"
* "\\"需要转换成"\\\"
* 过滤掉html标签及内容
*
* @param old 原始字符串
@ -65,9 +68,8 @@ public class JSCallback<T> extends Task<T> {
*/
private String trimText(String old) {
if (StringUtils.isNotBlank(old)) {
String a = filterHtmlTag(old, "a");
String b = filterHtmlTag(a, "font");
return b.replaceAll("\\\\n", "").replaceAll("\\\\t", "").replaceAll("\"", "\\\\\"").replaceAll("\'", "\\\\\'").replaceAll("\\\\\\\\", "\\\\");
String b = filterHtmlTag(old);
return b.replaceAll("\\\\n", "").replaceAll("\\\\t", "").replaceAll("\"", "\\\\\"").replaceAll("\'", "\\\\\'").replaceAll("\\\\\\\\", "\\\\\\\\\\\\");
}
return StringUtils.EMPTY;
}
@ -75,21 +77,16 @@ public class JSCallback<T> extends Task<T> {
/**
* 进行html标签过滤
* @param origin 原始字符串
* @param tag html标签
* @return 处理之后的字符串
*/
private String filterHtmlTag(String origin, String tag) {
String matter1 = "<" + tag;
String matter2 = tag + ">";
int a = origin.indexOf(matter1);
int b = origin.indexOf(matter2);
while (a != -1 && b != -1) {
origin = origin.substring(0, a) + origin.substring(b + matter2.length(), origin.length());
a = origin.indexOf(matter1);
b = origin.indexOf(matter2);
}
private String filterHtmlTag(String origin) {
String regEx_html = "<[^>]+>";
Pattern p_html = Pattern.compile(regEx_html, Pattern.CASE_INSENSITIVE);
Matcher m_html = p_html.matcher(origin);
origin = m_html.replaceAll("");
return origin;
}
}

Loading…
Cancel
Save