Problem porting WordPress Editor to a non-WP application - javascript

I like the look and feel of the WordPress editor (version 2.7), and I would like to use it in another web application that is written in ASP.NET. I've used TinyMCE before, and I've even extended it in the past. However, I can't seem to get the Wordpress configuration to work!
I've downloaded the entire WordPress package and taken the TinyMCE code (from the "js" folder) and put it in my web site. It ends up giving me an error on the following line of tiny_mce.js
return f.apply(s||this,Array.prototype.slice.call(arguments,2))
'undefined' is null or not an object.
Now, I've carefully made sure that the steps of execution are identical with the WordPress demonstration site that I've based this from.
I'm not a Javascript newbie (at all), but I can't seem to figure out why this is not working. Has anybody tried to do this before? What am I missing?
A demo of what I am talking about is here (username="admin", password="demo"). View the source, I have the three parts of Javascript that are (seemingly) required to power the editor.

Something of a stab in the dark, but I'm suspecting that there's a dependency on WP's prototype.js and you didn't bring that over with TinyMCE.

If you are able to determine which bit is undefined that might give you a clue. I tried looking at the demo with firebug, but tinymce.js was all one line, so I gave up trying to find that code.
Try putting in either some console.log() if you have firebug, or alert()s before that line, and try to see what f,s,this,arguments etc are when yu get the error, then do the same thing with a vanilla WP install and see the difference?

I suggest including the tiny_mce_src.js istead of the minified version, this way you can use firebug to debug and receive helpfull information.

Related

Combine vis-network and vis-timeline on same page

I'm trying to use the network and timeline package on the same page (like I did when using the old 4.21 version, and it works there), but I can't get it to work. It's throwing an error (dataset or array expected), when I provide the vis-datasets to the network. If I remove the load of the js for the timeline in the header, it works - but then I don't have a timeline.
So it looks like loading the package for the timeline is interfering with the vis-datasets definitions.
Any idea what's wrong here?
Just found out that I need to use the DIST from vis-charts to have this working.
Just to clarify this is a known bug we're actively working to solve. It will work as you'd expect eventually. See https://github.com/visjs/vis-network/pull/85 for more information. In the mean time as you found out yourself use vis-charts.

Why isn't including this 'bigInt' script working? (p5.js web editor)

I'm following The Coding Train and learning about the p5.js library. In this particular exercise, I want to work with potentially massive integers, so I looked around and found peterolson/BigInteger.js.
I attempted to include this script in my project in the same way the p5.js library itself is included, and as suggested in BigInteger's readme:
<script src="http://peterolson.github.com/BigInteger.js/BigInteger.min.js"></script>
However, after doing so, I still get bigInt is not defined errors when I try to reference it from my script.js.
Could anyone help me understand what I'm missing? You can see my project in the p5.js web editor here!
Questions like these are best answered by looking at your developer tools. Check out the JavaScript console and the network log to see the error you're getting.
Basically, you can't reference files on GitHub the way you're trying to reference BigInteger.min.js. You either need to find a CDNS that hosts the file for you, or you need to upload it to your sketch and reference it via a relative url.

First step with AngularJs plug-in. Browser can't load the controller's function

Recently I've discovered AngularJS as mentioned in the title. After some lectures I'm trying to use this plug-in in order to obtain some dragNdrop feature for my web-page. I've downloaded the code from the git's master but nothing seems to work as planned. All the pages are filled with the AngularJS's syntax.
code result
I've tested the example on 3 different browsers but the result is always the same. The question is: what is the missing step for a correct browser-interpretation of the code? What do I need to include in the stock files given by the owner?
i'm not sure, but i think that the problem is that you're trying (according to attached screenshot) to load nested.html that is sort of "view page" (according to gihub repo), because of that there are no links to angular libs there. That's why try to include angular.js to your page or load index.html instead of nested/nested.html.
I hope my answer will help you to solve your problem.

When debugging JavaScript using the Chrome developer tools, what information can I use to diagnose a site crash?

What information can I take from the following debug pause? I don't see any information that I can use to identify the problem :s
UPDATE:
console is empty
The code you show is minified, that's why it's only one line and not readable nor directly debbugable.
But you have a small button { } at the bottom left of the screen you show (the fifth from the left), it lets you beautify the code. Click on it.
You can put breakpoints in this beautified code in a much precise way.
When you are debugging your own website, you should load the uncompressed version of jQuery and any other libraries you need to debug. If you're loading jQuery from the Google or jQuery CDNs, simply change jquery.min.js to jquery.js.
If you're serving jQuery from your own server, always check in both the compressed and uncompressed versions into your source tree. This applies to other libraries too. You don't want to have nothing but the compressed code available.
By using the original uncompressed source, you will have the formatted code with all its comments and the original variable names.
When you don't have access to the original code or just need to take a quick look at something, dystroy's tip about using the built-in DevTools beautifier is an excellent one. It cleans up the formatting nicely, you just don't get the comments or original variable names.

how to install and use a javascript based plugin on rails?

I am making a rails app and having a ridiculously hard time trying to get the Redbox plugin to work. I'm pretty sure I installed everything correctly and am using it properly. When I use one of the helper methods, it seems to generate javascript properly. For example when I type:
<%= link_to_redbox 'hello', 'test' %>
it generates:
hello
which seems correct if i want to show a non visible ( display:none; ) div called test.
I'm so confused on this one. I'm pretty sure it is not finding the js or something but don't see why this would be. The redbox.js link is generated as:
<script src="/javascripts/redbox.js?1239506092" type="text/javascript"></script>
Check that the javascript file actually exists - it should be at public/javascripts/redbox.js (at least, that appears to be where it expects it to be).
the css has to be inline!
Try the version of GitHub. The current sourceforge version is pretty creaky.
http://github.com/craigambrose/redbox/tree/master
I'm using this one.
Stuff has started moving here. There is a few other forks that you might investigate. From some somments on the blog in April, it sounded like Craig may start it maintaining again, but oddly, the blog hasn't been update to point to GitHub.
There is another one
Also, read the comments for patches and other stuff:
blog.craigambrose.com/articles/2006/09/22/redbox-release-2
The blog comments are an impromptu support forum. I applied a form within a form patch I found here.
There is another blog somewhere that has a large discussion in the comments.
The other thing- play around with Firebug to analysis the html and find the issue.

Categories

Resources