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:
@@ -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 EditorType CodeBase { get; set; }
|
||||||
public string ClientSaveMethod { get; set; }
|
public string ClientSaveMethod { get; set; }
|
||||||
|
|
||||||
@@ -56,7 +64,7 @@ namespace umbraco.uicontrols {
|
|||||||
base.OnInit(e);
|
base.OnInit(e);
|
||||||
EnsureChildControls();
|
EnsureChildControls();
|
||||||
|
|
||||||
if (!UmbracoSettings.ScriptDisableEditor)
|
if (CodeMirrorEnabled)
|
||||||
{
|
{
|
||||||
ClientDependencyLoader.Instance.RegisterDependency("CodeMirror/js/codemirror.js", "UmbracoClient", ClientDependencyType.Javascript);
|
ClientDependencyLoader.Instance.RegisterDependency("CodeMirror/js/codemirror.js", "UmbracoClient", ClientDependencyType.Javascript);
|
||||||
ClientDependencyLoader.Instance.RegisterDependency("CodeArea/styles.css", "UmbracoClient", ClientDependencyType.Css);
|
ClientDependencyLoader.Instance.RegisterDependency("CodeArea/styles.css", "UmbracoClient", ClientDependencyType.Css);
|
||||||
@@ -69,12 +77,11 @@ namespace umbraco.uicontrols {
|
|||||||
CodeTextBox = new TextBox();
|
CodeTextBox = new TextBox();
|
||||||
CodeTextBox.ID = "CodeTextBox";
|
CodeTextBox.ID = "CodeTextBox";
|
||||||
|
|
||||||
if (UmbracoSettings.ScriptDisableEditor)
|
if (!CodeMirrorEnabled)
|
||||||
{
|
{
|
||||||
CodeTextBox.Attributes.Add("class", "codepress");
|
CodeTextBox.Attributes.Add("class", "codepress");
|
||||||
CodeTextBox.Attributes.Add("wrap", "off");
|
CodeTextBox.Attributes.Add("wrap", "off");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
|
||||||
CodeTextBox.TextMode = TextBoxMode.MultiLine;
|
CodeTextBox.TextMode = TextBoxMode.MultiLine;
|
||||||
|
|
||||||
@@ -91,7 +98,7 @@ namespace umbraco.uicontrols {
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (UmbracoSettings.ScriptDisableEditor)
|
if (!CodeMirrorEnabled)
|
||||||
return CodeTextBox.ClientID;
|
return CodeTextBox.ClientID;
|
||||||
else
|
else
|
||||||
return base.ClientID;
|
return base.ClientID;
|
||||||
@@ -103,7 +110,7 @@ namespace umbraco.uicontrols {
|
|||||||
EnsureChildControls();
|
EnsureChildControls();
|
||||||
|
|
||||||
var jsEventCode = "";
|
var jsEventCode = "";
|
||||||
if (UmbracoSettings.ScriptDisableEditor)
|
if (!CodeMirrorEnabled)
|
||||||
{
|
{
|
||||||
CodeTextBox.RenderControl(writer);
|
CodeTextBox.RenderControl(writer);
|
||||||
jsEventCode = RenderBasicEditor();
|
jsEventCode = RenderBasicEditor();
|
||||||
@@ -125,7 +132,7 @@ namespace umbraco.uicontrols {
|
|||||||
|
|
||||||
if (this.AutoResize)
|
if (this.AutoResize)
|
||||||
{
|
{
|
||||||
if (!UmbracoSettings.ScriptDisableEditor)
|
if (CodeMirrorEnabled)
|
||||||
{
|
{
|
||||||
//reduce the width if using code mirror because of the line numbers
|
//reduce the width if using code mirror because of the line numbers
|
||||||
OffSetX += 20;
|
OffSetX += 20;
|
||||||
@@ -134,7 +141,7 @@ namespace umbraco.uicontrols {
|
|||||||
jsEventCode += @"
|
jsEventCode += @"
|
||||||
|
|
||||||
//create the editor
|
//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 + @"');
|
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(window).resize(function(){ resizeTextArea(m_textEditor, " + OffSetX.ToString() + "," + OffSetY.ToString() + @"); });
|
||||||
jQuery(document).ready(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);
|
jsEventCode = string.Format(@"<script type=""text/javascript"">{0}</script>", jsEventCode);
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
<!-- what files can be opened/created in the script editor -->
|
<!-- what files can be opened/created in the script editor -->
|
||||||
<scriptFileTypes>js,xml</scriptFileTypes>
|
<scriptFileTypes>js,xml</scriptFileTypes>
|
||||||
<!-- disable the codepress 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>
|
<scriptDisableEditor>false</scriptDisableEditor>
|
||||||
</scripteditor>
|
</scripteditor>
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,8 @@
|
|||||||
<scriptFolderPath>/scripts</scriptFolderPath>
|
<scriptFolderPath>/scripts</scriptFolderPath>
|
||||||
<!-- what files can be opened/created in the script editor -->
|
<!-- what files can be opened/created in the script editor -->
|
||||||
<scriptFileTypes>js,xml</scriptFileTypes>
|
<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>
|
<scriptDisableEditor>false</scriptDisableEditor>
|
||||||
</scripteditor>
|
</scripteditor>
|
||||||
|
|
||||||
@@ -23,9 +24,8 @@
|
|||||||
<!-- the id of the page that should be shown if the page is not found -->
|
<!-- the id of the page that should be shown if the page is not found -->
|
||||||
<!-- <errorPage culture="default">1</errorPage>-->
|
<!-- <errorPage culture="default">1</errorPage>-->
|
||||||
<!-- <errorPage culture="en-US">200</errorPage>-->
|
<!-- <errorPage culture="en-US">200</errorPage>-->
|
||||||
<error404>1050</error404>
|
<error404>1</error404>
|
||||||
</errors>
|
</errors>
|
||||||
|
|
||||||
<notifications>
|
<notifications>
|
||||||
<!-- the email that should be used as from mail when umbraco sends a notification -->
|
<!-- the email that should be used as from mail when umbraco sends a notification -->
|
||||||
<email>robot@umbraco.dk</email>
|
<email>robot@umbraco.dk</email>
|
||||||
|
|||||||
@@ -370,6 +370,7 @@
|
|||||||
<key alias="pythonErrorText">The python script has not been saved, because it contained error(s)</key>
|
<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="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="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>
|
||||||
<area alias="speechBubbles">
|
<area alias="speechBubbles">
|
||||||
<key alias="xsltSavedHeader">Xslt saved</key>
|
<key alias="xsltSavedHeader">Xslt saved</key>
|
||||||
|
|||||||
Reference in New Issue
Block a user