Fixes 27750 and 27787: Disable CodeMirror in IE due to the automatic hyperlinking "feature" in content editable areas which effectively removes quotes around whatever it believe is a link.

[TFS Changeset #70466]
This commit is contained in:
kenny
2010-06-21 11:44:35 +00:00
parent c2c3dc0f06
commit b9d3529f86
4 changed files with 25 additions and 10 deletions

View File

@@ -46,6 +46,14 @@ namespace umbraco.uicontrols {
}
}
public bool CodeMirrorEnabled
{
get
{
return !UmbracoSettings.ScriptDisableEditor && HttpContext.Current.Request.Browser.Browser != "IE";
}
}
public EditorType CodeBase { get; set; }
public string ClientSaveMethod { get; set; }
@@ -56,7 +64,7 @@ namespace umbraco.uicontrols {
base.OnInit(e);
EnsureChildControls();
if (!UmbracoSettings.ScriptDisableEditor)
if (CodeMirrorEnabled)
{
ClientDependencyLoader.Instance.RegisterDependency("CodeMirror/js/codemirror.js", "UmbracoClient", ClientDependencyType.Javascript);
ClientDependencyLoader.Instance.RegisterDependency("CodeArea/styles.css", "UmbracoClient", ClientDependencyType.Css);
@@ -69,12 +77,11 @@ namespace umbraco.uicontrols {
CodeTextBox = new TextBox();
CodeTextBox.ID = "CodeTextBox";
if (UmbracoSettings.ScriptDisableEditor)
if (!CodeMirrorEnabled)
{
CodeTextBox.Attributes.Add("class", "codepress");
CodeTextBox.Attributes.Add("wrap", "off");
}
else
CodeTextBox.TextMode = TextBoxMode.MultiLine;
@@ -91,7 +98,7 @@ namespace umbraco.uicontrols {
{
get
{
if (UmbracoSettings.ScriptDisableEditor)
if (!CodeMirrorEnabled)
return CodeTextBox.ClientID;
else
return base.ClientID;
@@ -103,7 +110,7 @@ namespace umbraco.uicontrols {
EnsureChildControls();
var jsEventCode = "";
if (UmbracoSettings.ScriptDisableEditor)
if (!CodeMirrorEnabled)
{
CodeTextBox.RenderControl(writer);
jsEventCode = RenderBasicEditor();
@@ -125,7 +132,7 @@ namespace umbraco.uicontrols {
if (this.AutoResize)
{
if (!UmbracoSettings.ScriptDisableEditor)
if (CodeMirrorEnabled)
{
//reduce the width if using code mirror because of the line numbers
OffSetX += 20;
@@ -134,7 +141,7 @@ namespace umbraco.uicontrols {
jsEventCode += @"
//create the editor
var UmbEditor = new Umbraco.Controls.CodeEditor.UmbracoEditor(" + UmbracoSettings.ScriptDisableEditor.ToString().ToLower() + @", '" + this.ClientID + @"');
var UmbEditor = new Umbraco.Controls.CodeEditor.UmbracoEditor(" + (!CodeMirrorEnabled).ToString().ToLower() + @", '" + this.ClientID + @"');
var m_textEditor = jQuery('#" + this.ClientID + @"');
@@ -143,6 +150,12 @@ namespace umbraco.uicontrols {
jQuery(window).resize(function(){ resizeTextArea(m_textEditor, " + OffSetX.ToString() + "," + OffSetY.ToString() + @"); });
jQuery(document).ready(function(){ resizeTextArea(m_textEditor, " + OffSetX.ToString() + "," + OffSetY.ToString() + @"); });
";
if (!UmbracoSettings.ScriptDisableEditor && HttpContext.Current.Request.Browser.Browser == "IE")
{
jsEventCode += "jQuery('<p style=\"color:#999\">" + ui.Text("codemirroriewarning") +"</p>').insertAfter('#" + this.ClientID + "');";
}
}
jsEventCode = string.Format(@"<script type=""text/javascript"">{0}</script>", jsEventCode);

View File

@@ -13,6 +13,7 @@
<!-- what files can be opened/created in the script editor -->
<scriptFileTypes>js,xml</scriptFileTypes>
<!-- disable the codepress editor and use a simple textarea instead -->
<!-- note! codepress editor always disabled in IE due to automatic hyperlinking "feature" in contenteditable areas -->
<scriptDisableEditor>false</scriptDisableEditor>
</scripteditor>

View File

@@ -12,7 +12,8 @@
<scriptFolderPath>/scripts</scriptFolderPath>
<!-- what files can be opened/created in the script editor -->
<scriptFileTypes>js,xml</scriptFileTypes>
<!-- disable the code editor and use a simple textarea instead -->
<!-- disable the codepress editor and use a simple textarea instead -->
<!-- note! codepress editor always disabled in IE due to automatic hyperlinking "feature" in contenteditable areas -->
<scriptDisableEditor>false</scriptDisableEditor>
</scripteditor>
@@ -23,9 +24,8 @@
<!-- the id of the page that should be shown if the page is not found -->
<!-- <errorPage culture="default">1</errorPage>-->
<!-- <errorPage culture="en-US">200</errorPage>-->
<error404>1050</error404>
<error404>1</error404>
</errors>
<notifications>
<!-- the email that should be used as from mail when umbraco sends a notification -->
<email>robot@umbraco.dk</email>

View File

@@ -370,6 +370,7 @@
<key alias="pythonErrorText">The python script has not been saved, because it contained error(s)</key>
<key alias="contentTypeAliasAndNameNotNull">Please fill both alias and name on the new propertytype!</key>
<key alias="filePermissionsError">There is a problem with read/write access to a specific file or folder</key>
<key alias="codemirroriewarning">NOTE! Even though CodeMirror is enabled by configuration, it is disabled in IE due to automatic hyperlinking.</key>
</area>
<area alias="speechBubbles">
<key alias="xsltSavedHeader">Xslt saved</key>