So I am using tinyMce in my app but I am getting a JavaScript error that I can’t really seem to figure out how to debug. The error is “TypeError: P is undefined” – I can see that from FireBug but I have no idea how to get more / better information?
I tried turning on “break on all errors” but that just shows me the minimized JS file and I can’t even see a variable named “P” in there so I am guessing I am barking up the wrong tree. The whole thing works fine except when I click save.
shrug I am just stuck at the moment. Here is my complete code. you can see I tried removing all the plugins thinking that might be it but no dice.
Obviously the problem I need to solve is why that is happening – the better solution would be how to figure out what is actually causing it so when something like this happens again I can figure it out myself.
Thanks – see the complete code below.
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript">
$(document).ready(function() {
$('textarea.tinymce').tinymce({
script_url: '/Scripts/TinyMCE/tiny_mce.js',
theme: "advanced",
plugins: "save",
theme_advanced_buttons1: "save",
// plugins: "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
// theme_advanced_buttons1: "save,cut,copy,paste,pastetext,pasteword,|,search,replace,|,bold,italic,underline,strikethrough,|,print,|,iespell",
theme_advanced_toolbar_location: "top",
theme_advanced_toolbar_align: "left",
theme_advanced_statusbar_location: "bottom",
save_enablewhendirty: true,
encoding: "xml",
theme_advanced_resizing: true,
mode: "textareas",
save_onsavecallback: "ajaxSave",
setup: function(ed) {
ed.onSaveContent.add(function(i, o) {
o.content = o.content.replace( /'/g , "&apos");
});
}
});
function ajaxSave() {
alert("ajaxSave called.");
}
});
</script>
<% Html.BeginForm("Index", "DisabilityReport", FormMethod.Post); %>
<%= Html.AntiForgeryToken() %>
<%= Html.ModelData() %>
<textarea name="documentContent" class="tinymce" cols="90" rows="60"></textarea>
<% Html.EndForm();%>
</asp:Content>
I’m not sure about Firebug, but if you’re working in Chrome, the Chrome dev tools can expand compressed JS, making it easier to track down these errors. See the brackets button below: