Browse Source

REPORT-2354 将平台的插件管理和设计器的插件管理统一起来

master
kerry 8 years ago
parent
commit
317aabb626
  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(); List<PluginView> plugins = PluginsReaderFromStore.readPluginsForUpdate();
JSONArray jsonArray = new JSONArray(); JSONArray jsonArray = new JSONArray();
for (PluginView plugin : plugins) { for (PluginView plugin : plugins) {
org.json.JSONObject jsonObject = new org.json.JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("pluginid", plugin.getID()); jsonObject.put("pluginid", plugin.getID());
jsonArray.put(jsonObject); 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 javafx.scene.web.WebEngine;
import netscape.javascript.JSObject; import netscape.javascript.JSObject;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
* Created by ibm on 2017/5/27. * Created by ibm on 2017/5/27.
*/ */
@ -57,7 +60,7 @@ public class JSCallback<T> extends Task<T> {
* 这边建议去除所有的html标签 * 这边建议去除所有的html标签
* 字符\在java中实际存储的是\\,替换字符串\\n, 需要用\\\\n * 字符\在java中实际存储的是\\,替换字符串\\n, 需要用\\\\n
* "\t""\n" 都要转义成" " 不然会解析出错 * "\t""\n" 都要转义成" " 不然会解析出错
* "\\"需要转换成"\" * "\\"需要转换成"\\\"
* 过滤掉html标签及内容 * 过滤掉html标签及内容
* *
* @param old 原始字符串 * @param old 原始字符串
@ -65,9 +68,8 @@ public class JSCallback<T> extends Task<T> {
*/ */
private String trimText(String old) { private String trimText(String old) {
if (StringUtils.isNotBlank(old)) { if (StringUtils.isNotBlank(old)) {
String a = filterHtmlTag(old, "a"); String b = filterHtmlTag(old);
String b = filterHtmlTag(a, "font"); return b.replaceAll("\\\\n", "").replaceAll("\\\\t", "").replaceAll("\"", "\\\\\"").replaceAll("\'", "\\\\\'").replaceAll("\\\\\\\\", "\\\\\\\\\\\\");
return b.replaceAll("\\\\n", "").replaceAll("\\\\t", "").replaceAll("\"", "\\\\\"").replaceAll("\'", "\\\\\'").replaceAll("\\\\\\\\", "\\\\");
} }
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }
@ -75,21 +77,16 @@ public class JSCallback<T> extends Task<T> {
/** /**
* 进行html标签过滤 * 进行html标签过滤
* @param origin 原始字符串 * @param origin 原始字符串
* @param tag html标签
* @return 处理之后的字符串 * @return 处理之后的字符串
*/ */
private String filterHtmlTag(String origin, String tag) { private String filterHtmlTag(String origin) {
String matter1 = "<" + tag; String regEx_html = "<[^>]+>";
String matter2 = tag + ">"; Pattern p_html = Pattern.compile(regEx_html, Pattern.CASE_INSENSITIVE);
int a = origin.indexOf(matter1); Matcher m_html = p_html.matcher(origin);
int b = origin.indexOf(matter2); origin = m_html.replaceAll("");
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);
}
return origin; return origin;
} }
} }

Loading…
Cancel
Save