Plugin Function Error


I just started to learn how to write a plugin and run already into a problem. My main.js looks like this:

define(function(require, exports, module) {
	'use strict';

    var Extensions = require('ft/core/extensions').Extensions;

    Extensions.addInit(function (editor) {
            'Cmd-T' : function (editor) {


If I test this in the SDK I get an error:

[Error] TypeError: undefined is not a function (evaluating 'editor.textContent.toLowerCase()')
(anonymous function) (codemirror.js, line 2128)

Obviously I’m doing something fundamentally wrong, but what?


Try changing editor.textContent.toLowerCase() to editor.textContent().toLowerCase()textContent is a function not a property. Should maybe have named it getTextContent to make it more standard javascripty, but javascript conventions don’t seem 100% in that direction, so instead I followed objective-c convention in this case.


Thank you, this did the trick.

I had looked at the documentation, but obviously I’m suffering from selective bracket blindness. Thanks again.