Quellcode durchsuchen

修改富文本编辑器中的统一格式功能

limeng vor 1 Monat
Ursprung
Commit
41f91c020c
2 geänderte Dateien mit 10 neuen und 8 gelöschten Zeilen
  1. 7 6
      WebRoot/manage/news/newsAdd.jsp
  2. 3 2
      WebRoot/manage/news/newsEdit.jsp

+ 7 - 6
WebRoot/manage/news/newsAdd.jsp

@@ -305,12 +305,13 @@
         function mytrim(text){
             text = text.replace(/(^[\s( ) ]*)|(\s*$)/gi,"");
             var img_Str = text.match(/^(<IMG|EMBED\gi)([\s\S]*?)>/);
-            if(img_Str!=null){
-                text = text.replace(img_Str[0],"<p  align=center>"+img_Str[0]+"</p>"+"<p style='margin-bottom:13px'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
-                return (text!="")? text + "</p>": "";
-            }else{
-                return (text!="")? "<p style='margin-bottom:13px;;color:#323036'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + text + "</p>" : ""
-            }
+			if(img_Str!=null){
+				text = text.replace(img_Str[0],"<p  align=center>"+img_Str[0]+"</p>"+"<p style='margin-bottom:13px;text-indent: 2em;text-align: justify;'>");
+				return (text!="")? text + "</p>": "";
+			}else{
+				// 首行缩进2
+				return (text!="")? "<p style='margin-bottom:13px;color:#323036;text-indent: 2em;text-align: justify;'>" + text + "</p>" : ""
+			}
         }
 
 

+ 3 - 2
WebRoot/manage/news/newsEdit.jsp

@@ -116,10 +116,11 @@
             text = text.replace(/(^[\s(&nbsp;) ]*)|(\s*$)/gi,"");
             var img_Str = text.match(/^(<IMG|EMBED\gi)([\s\S]*?)>/);
             if(img_Str!=null){
-                text = text.replace(img_Str[0],"<p  align=center>"+img_Str[0]+"</p>"+"<p style='margin-bottom:13px'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
+                text = text.replace(img_Str[0],"<p  align=center>"+img_Str[0]+"</p>"+"<p style='margin-bottom:13px;text-indent: 2em;text-align: justify;'>");
                 return (text!="")? text + "</p>": "";
             }else{
-                return (text!="")? "<p style='margin-bottom:13px;color:#323036'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + text + "</p>" : ""
+				// 首行缩进2
+                return (text!="")? "<p style='margin-bottom:13px;color:#323036;text-indent: 2em;text-align: justify;'>" + text + "</p>" : ""
             }
         }