Browse Source

[svn r18533] FS#2867: FCKEditor, the mimetex plugin: Correction in reading already created in the document formula. When a formula is selected, the opened dialog reads it from the URL, not from the alt-tag. Thus, a problem with disappearing backslashes in some edited places has been partially solved. In this places only the tooltip shows damaged LaTeX notation of the formula.

Ivan Tcholakov 16 years ago
parent
commit
afc607a743
1 changed files with 18 additions and 1 deletions
  1. 18 1
      main/inc/lib/fckeditor/editor/plugins/mimetex/mimetex.html

+ 18 - 1
main/inc/lib/fckeditor/editor/plugins/mimetex/mimetex.html

@@ -496,7 +496,24 @@ function LoadSelected()
 	else if ( eSelected.tagName == 'IMG' )
 	{
 		img_tag = true ;
-		document.pastemath.formula.value = eSelected.alt ;
+		// We will read the formula from the url, because the back slash is escaped with %5C,
+		// so the re is no risk the formula to be damaged by the php stripslashes(...) function.
+		//document.pastemath.formula.value = eSelected.alt ;
+		var formula = '' ;
+		var src = eSelected.src.toString() ;
+		var formula_start = src.indexOf( '?' ) ;
+		if ( formula_start != -1 )
+		{
+			formula = src.substr( formula_start + 1 ).replace(/%5C/gi,'\\').replace(/%20/g,' ') ;
+			formula = formula.Trim() ;
+			if ( formula.indexOf( '\\Large' ) == 0 )
+			{
+				formula = formula.substr( 6 ) ; 
+			}
+			formula = formula.Trim() ;
+		}
+		document.pastemath.formula.value = formula ;
+		//
 		formulaPreview() ;
 	}
 	else