Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typeError: Cannot read property 'config' of undefined #469

Closed
rafalradomski opened this issue Sep 2, 2015 · 3 comments
Closed

typeError: Cannot read property 'config' of undefined #469

rafalradomski opened this issue Sep 2, 2015 · 3 comments

Comments

@rafalradomski
Copy link

HI when I using function

this.quill.formatText(0, placeholder.length, this.style);

I have error like this:

TypeError: Cannot read property 'config' of undefined
    at http://local.com:9000/lib/quill/dist/quill.js:10230:40

Is looking for some config:

if (!(value && value !== format.config["default"])) {
          formats[name] = null;
}

Whole function looks like:

Quill.prototype.formatText = function(start, end, name, value, source) {
    var delta, formats, ref;
    ref = this._buildParams(start, end, name, value, source), start = ref[0], end = ref[1], formats = ref[2], source = ref[3];
    formats = _.reduce(formats, (function(_this) {
      return function(formats, value, name) {
        var format;
        format = _this.editor.doc.formats[name];
        if (!(value && value !== format.config["default"])) {
          formats[name] = null;
        }
        return formats;
      };
    })(this), formats);
    delta = new Delta().retain(start).retain(end - start, formats);
    return this.editor.applyDelta(delta, source);
  };

How I can provide this config or skip it?

@willrowe
Copy link
Contributor

willrowe commented Sep 2, 2015

It looks like either the passed format isn't valid or you didn't pass a value for the format.

@jhchen
Copy link
Member

jhchen commented Sep 2, 2015

@willrowe is correct this is likely the issue

@brettimus
Copy link

Hey I found the source of this problem, and it was that the passed format isn't valid like @willrowe said.

Are formats getting completely overhauled soon? Otherwise, would it be worthwhile to have a more helpful error message when an invalid format is applied?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants