I am attempting to add in a third party plugin to TinyMCE that is built to connect language-tool and TinyMCE. The plugin will load and work properly only after the second time the page is loaded. The plugin is properly created here
tinymce.PluginManager.add('languagetool', function(editor, url) {
and added to the TinyMCE plugin list here
config.plugins = 'languagetool link lists paste';
When loading the page the first time, I receive the following error.
Uncaught TypeError: Cannot set property 'onload' of null
TinyMCE does not load the editor box at all. After switching to a different page and back, the error no longer appears but the TinyMCE editor (with some plugin functionality) is now visible and is able to be used.
Without seeing running code it will be difficult for anyone to give you a specific thought on why this is happening. Any time I see:
Cannot set property 'xxxxxxx' of null
...this typically means that some code assumes a variable has a value when its null. For example I could try to execute:
tinymce.activeEditor.getContent();
...but if there is no active editor then tinymce.activeEditor is null and you can't execute the getContent() on null. In your scenario some part of the code is trying to run the onload method but the object on which that is being called is null.
You need to figure out what line of code is causing that and then figure out why a variable is null when it is expected to be something else.
Related
I have customized a master page in SP 2013, adding a jquery library(vs:1.11.3) to the .html master page as well as some custom script for pulling in HTML content.
Custom Code reference in master page:
$(document).ready(function() {
$('#sideNavBox').empty().load('https://pageiampullingin.html');
$('#sideNavBox').css('display', 'block');
});
The page I'm pulling in has its own script links that act on the DOM elements for the page I'm pulling in. This code works, even though I'm getting an error:
"Unable to set property 'control' of undefined or null reference".
When I hit F12, occurs under ScriptResource.axd, {Sys.UI.Control ... a.control=this}. I've tried different methods for .load() but still getting this error. Again, HTML is pulled in and script works but can't figure out this error. When I block the .load function, the error goes away. Any help would be appreciated.
This line is causing that error: $('#sideNavBox').empty()
Not sure what you are trying to achieve. Remove the line and check. The error should be gone.
I know this is old but...
He's trying to replace the sharepoint left nav with custom content. I'd try this.
$('#sideNavBox').html("").load('https://pageiampullingin.html');
I'm trying to click on a webpage item via AppleScript but with no success.
I tried the following code in chrome and safari:
execute "document.getElementById('t-strikethrough').click();"
and
do JavaScript "document.getElementById('t-strikethrough').click();"
In Safari, the first line of code does nothing and the result section of Script Editor says missing value. With Chrome, I get the following error:
Can’t make "document.getElementById('t-strikethrough').click();" into
type specifier
This is included inside tell statements to locate app, window and document.
Without seeing all of your AppleScript code, it's difficult to see exactly what the problem is. You may want to try setting a variable for the URL like this:
set URL of document 1 to "http://www.whatever.com"
do JavaScript "document.getElementById('t-strikethrough').click();" in document 1
Check this post to see the full example . Click Button on Webpage with Applescript/JavaScript
I'm very new to javascript, so this is confusing me. All of the settings charm tutorials only show how to put the controls into the settings charm, but none of them say how to find the information gotten in them.
I tried to do one of these (like I do in the main program):
var muteToggle = document.GetElementById("Mute");
where "Mute" is the id in the separate html file.
muteToggle just ends up being null all of the time. I tried putting it after
WinJS.UI.ProcessAll().then(function completed() {...
but that didn't work either. Everything else is the same as in this page: http://msdn.microsoft.com/en-us/library/windows/apps/hh780611.aspx
Make sure you're doing it in the ready function of the js file that is referenced from your settings HTML. Try opening the JavaScript console or QuickWatch while broken at that line and also look at the DOM Explorer to see if you can find your toggle control. You should be able to access it though. Also, try element.getElementById instead of document.getElementById. Either should work actually, but as long as you're troubleshooting. Good luck.
Your problem is that you are trying to get a reference to the HTML element from the code running during the app activation. Although that piece of code may define the HTML to be loaded for a settings pane, it does Not actually load the HTML into the DOM. You just simply can't get the instance from that location.
What you need to do is have the settings flyout have its own js file that implements IPageControlMembers. In particular, you need to implement the ready method. This method is called once all the HTML and controls are loaded for the page, including your toggle. The link has an example of how to do this.
Also see:
WinJS.UI.Pages.define
Using single page navigation
We have a page which uses XMLHttpRequests and tries not to reload the page at all. After the user has logged in it should load a chart. Here is the main page: http://pastebin.com/h55Vzuvy
Here is what we are loading as the chart: http://pastebin.com/zDZr3bb6
I realize that the code where the function is called to load chart.php isn't displayed here but it is working properly and simply calls the xmlhttpGet function in the header of the main page.
The page that loads does evaluate Javascript, as I can put an alert and it pops up but the graph simply doesn't load. Any ideas why?
Also, the Chrome JS Debugger says this when I click to load the chart file. I have triple checked to make sure that the div name is being passed to the variables and the error only happens when loading the chart page.
Uncaught TypeError: Cannot set property 'innerHTML' of null
sethtml
callBackFunction
xmlHttpReq.onreadystatechange
Looks good at first glance, but this line:
document.getElementById(div).innerHTML=content;
Looks like it's where you're having the problem. Most likely 'div' (the id which should be 'auth_status' at this point) is not set right or the DOM was modified and busted up the auth_status div.
I'd recommend testing with:
console.log("id: " + div);
on the line right before that (so, line 66). If that shows "auth_status" as the ID like you'd expect, then I'd try typing this in the firebug/chrome js console:
document.getElementById(div)
to make sure it's still in the DOM. Good luck!
I have a Boilerplate 2.0-based page and want to add tooltips. Under the call to load jQuery, I add a call to load the jQuery-tools bundle, and then in js/script.js call:
jQuery(".has-tooltip").tooltip();
The result? No tooltips show up; Chrome's JavaScript console gives:
jQuery('.has-tooltip').tooltip();
script.js:30Uncaught TypeError: Object [object Object] has no method 'tooltip'
So far as I can tell, and from the order of things in index.html, the following happens:
I load jQuery.
I load jQuery Tools, without apparent error.
I call jQuery().tooltip(). This errors out, and doesn't display tooltips.
What can I do to ensure that the Tools extension is being registered to jQuery and I can call jQuery().tooltip(...)?
ATdhvaanckse,
--edit--
It's for a portfolio; the URL is:
http://JonathanHayward.com/portfolio
I've tried to pull things in to local loading (i.e. removed the CDN jQuery hit); this has not produced observable differences.
First, You load jQuery twice, also have two body and html closing tags and fix Modernizr issue which is not defined