Fixes issue with wrapping the UmbEditor init in doc ready causing template editing not to work.

This commit is contained in:
Shannon Deminick
2012-10-12 09:15:33 +05:00
parent 65d5bc9155
commit 689fe2a44f
2 changed files with 9 additions and 6 deletions

View File

@@ -30,7 +30,7 @@
},
doSubmit: function () {
var codeVal = UmbEditor.GetCode();
var codeVal = UmbClientMgr.contentFrame().UmbEditor.GetCode();
var self = this;
umbraco.presentation.webservices.codeEditorSave.SaveTemplate(
@@ -59,7 +59,7 @@
changeMasterPageFile: function ( ) {
//var editor = document.getElementById(this._opts.sourceEditorId);
var templateDropDown = this._opts.masterPageDropDown.get(0);
var templateCode = UmbEditor.GetCode();
var templateCode = UmbClientMgr.contentFrame().UmbEditor.GetCode();
var newValue = templateDropDown.options[templateDropDown.selectedIndex].id;
var layoutDefRegex = new RegExp("(@{[\\s\\S]*?Layout\\s*?=\\s*?)(\"[^\"]*?\"|null)(;[\\s\\S]*?})", "gi");
@@ -80,7 +80,7 @@
}
}
UmbEditor.SetCode(templateCode);
UmbClientMgr.contentFrame().UmbEditor.SetCode(templateCode);
return false;
}

View File

@@ -170,10 +170,13 @@ namespace umbraco.uicontrols
OffSetX += 20;
}
jsEventCode += @"
$(function () {
jsEventCode += @"
//TODO: for now this is a global var, need to refactor all this so that is using proper js standards
//with correct objects, and proper accessors to these objects.
var UmbEditor;
$(document).ready(function () {
//create the editor
var UmbEditor = new Umbraco.Controls.CodeEditor.UmbracoEditor(" + (!CodeMirrorEnabled).ToString().ToLower() + @", '" + this.ClientID + @"');
UmbEditor = new Umbraco.Controls.CodeEditor.UmbracoEditor(" + (!CodeMirrorEnabled).ToString().ToLower() + @", '" + this.ClientID + @"');
var m_textEditor = jQuery('#" + this.ClientID + @"');
//with codemirror adding divs for line numbers, we need to target a different element