diff --git a/AssemblyVersion.cs b/AssemblyVersion.cs index 1116d1f..77a3de1 100644 --- a/AssemblyVersion.cs +++ b/AssemblyVersion.cs @@ -16,5 +16,5 @@ using System.Reflection; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("3.0.2.522")] -[assembly: AssemblyFileVersion("3.0.2.522")] +[assembly: AssemblyVersion("3.0.2.523")] +[assembly: AssemblyFileVersion("3.0.2.523")] diff --git a/Core/ReverseFormatter.cs b/Core/ReverseFormatter.cs index d592139..9c1d5ab 100644 --- a/Core/ReverseFormatter.cs +++ b/Core/ReverseFormatter.cs @@ -13,6 +13,7 @@ namespace ScrewTurn.Wiki { /// public static class ReverseFormatter { + private static readonly Regex WebkitDivRegex = new Regex(@"(
)((.|\n|\r)*?)(
)", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant); private static readonly Regex BoldRegex = new Regex(@"()((.|\n|\r)*?)()", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant); private static readonly Regex ItalicRegex = new Regex(@"()((.|\n|\r)*?)()", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant); private static readonly Regex UnderlineRegex = new Regex(@"()((.|\n|\r)*?)()", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant); @@ -141,6 +142,15 @@ namespace ScrewTurn.Wiki { 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 match = BoldRegex.Match(buffer.ToString()); while(match.Success) { diff --git a/WebApplication/Editor.ascx b/WebApplication/Editor.ascx index e873e81..2817f21 100644 --- a/WebApplication/Editor.ascx +++ b/WebApplication/Editor.ascx @@ -32,11 +32,11 @@ iframe.document.designMode='On'; } else { iframe = document.getElementById('iframe').contentWindow; - iframe.focus(); iframe.document.designMode='On'; iframe.document.execCommand('styleWithCSS',false,false); iframe.document.execCommand('backcolor', false, 'white'); try { // This seems to throw an exception in Firefox + iframe.focus(); iframe.document.execCommand('inserthtml', false, document.getElementById(VisualControl).value); } catch(ex) { } }