Fixed and closed #492 : visual editor works also on Chrome.
This commit is contained in:
parent
725d30d082
commit
fb90ca2400
3 changed files with 13 additions and 3 deletions
|
@ -16,5 +16,5 @@ using System.Reflection;
|
||||||
//
|
//
|
||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
[assembly: AssemblyVersion("3.0.2.522")]
|
[assembly: AssemblyVersion("3.0.2.523")]
|
||||||
[assembly: AssemblyFileVersion("3.0.2.522")]
|
[assembly: AssemblyFileVersion("3.0.2.523")]
|
||||||
|
|
|
@ -13,6 +13,7 @@ namespace ScrewTurn.Wiki {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class ReverseFormatter {
|
public static class ReverseFormatter {
|
||||||
|
|
||||||
|
private static readonly Regex WebkitDivRegex = new Regex(@"(<div>)((.|\n|\r)*?)(</div>)", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||||
private static readonly Regex BoldRegex = new Regex(@"(<b>)((.|\n|\r)*?)(</b>)", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
private static readonly Regex BoldRegex = new Regex(@"(<b>)((.|\n|\r)*?)(</b>)", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||||
private static readonly Regex ItalicRegex = new Regex(@"(<i>)((.|\n|\r)*?)(</i>)", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
private static readonly Regex ItalicRegex = new Regex(@"(<i>)((.|\n|\r)*?)(</i>)", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||||
private static readonly Regex UnderlineRegex = new Regex(@"(<u>)((.|\n|\r)*?)(</u>)", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
private static readonly Regex UnderlineRegex = new Regex(@"(<u>)((.|\n|\r)*?)(</u>)", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||||
|
@ -141,6 +142,15 @@ namespace ScrewTurn.Wiki {
|
||||||
match = PreRegex.Match(buffer.ToString(), match.Index + 1);
|
match = PreRegex.Match(buffer.ToString(), match.Index + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WebkitDivRegex
|
||||||
|
// Remove all div added by webkit and replace them with \r\n.
|
||||||
|
match = WebkitDivRegex.Match(buffer.ToString());
|
||||||
|
while(match.Success) {
|
||||||
|
buffer.Remove(match.Index, match.Length);
|
||||||
|
buffer.Insert(match.Index, "\r\n" + match.Groups[2].Value);
|
||||||
|
match = WebkitDivRegex.Match(buffer.ToString(), match.Index + 1);
|
||||||
|
}
|
||||||
|
|
||||||
// Bold
|
// Bold
|
||||||
match = BoldRegex.Match(buffer.ToString());
|
match = BoldRegex.Match(buffer.ToString());
|
||||||
while(match.Success) {
|
while(match.Success) {
|
||||||
|
|
|
@ -32,11 +32,11 @@
|
||||||
iframe.document.designMode='On';
|
iframe.document.designMode='On';
|
||||||
} else {
|
} else {
|
||||||
iframe = document.getElementById('iframe').contentWindow;
|
iframe = document.getElementById('iframe').contentWindow;
|
||||||
iframe.focus();
|
|
||||||
iframe.document.designMode='On';
|
iframe.document.designMode='On';
|
||||||
iframe.document.execCommand('styleWithCSS',false,false);
|
iframe.document.execCommand('styleWithCSS',false,false);
|
||||||
iframe.document.execCommand('backcolor', false, 'white');
|
iframe.document.execCommand('backcolor', false, 'white');
|
||||||
try { // This seems to throw an exception in Firefox
|
try { // This seems to throw an exception in Firefox
|
||||||
|
iframe.focus();
|
||||||
iframe.document.execCommand('inserthtml', false, document.getElementById(VisualControl).value);
|
iframe.document.execCommand('inserthtml', false, document.getElementById(VisualControl).value);
|
||||||
} catch(ex) { }
|
} catch(ex) { }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue