Medium.js icon indicating copy to clipboard operation
Medium.js copied to clipboard

Cannot read property 'innerText' of undefined

Open SimonLlewellyn opened this issue 10 years ago • 19 comments

medium.js:1725 Uncaught TypeError: Cannot read property 'innerText' of undefined

Heres my init:

var ed = $("#createBox");
new Medium({
    element: ed[0],
    modifier: 'auto',
    placeholder: "What's happening?",
    autofocus: true

)}

SimonLlewellyn avatar Jan 15 '15 02:01 SimonLlewellyn

Can you throw this into jsfiddle.net? Also, what browser, and version of Medium.js are you using?

On Wed, Jan 14, 2015 at 9:01 PM, Simon [email protected] wrote:

medium.js:1725 Uncaught TypeError: Cannot read property 'innerText' of undefined

Heres my init:

var ed = $("#createBox"); new Medium({ element: ed[0], modifier: 'auto', placeholder: "What's happening?", autofocus: true

)}

— Reply to this email directly or view it on GitHub https://github.com/jakiestfu/Medium.js/issues/130.

Robert Plummer

robertleeplummerjr avatar Jan 15 '15 02:01 robertleeplummerjr

Chrome, version in medium.js says: * Version: master

SimonLlewellyn avatar Jan 15 '15 02:01 SimonLlewellyn

http://jsfiddle.net/a76kmk9x/

SimonLlewellyn avatar Jan 15 '15 02:01 SimonLlewellyn

Interesting. I am unable to reproduce locally. Can you give me instructional step by step to reproduce?

On Wed, Jan 14, 2015 at 9:25 PM, Simon [email protected] wrote:

http://jsfiddle.net/a76kmk9x/

— Reply to this email directly or view it on GitHub https://github.com/jakiestfu/Medium.js/issues/130#issuecomment-70030542.

Robert Plummer

robertleeplummerjr avatar Jan 15 '15 02:01 robertleeplummerjr

Yea the fiddle seems to work fine too :( Typical - I have put exactly what I have in my code, into fiddle.

SimonLlewellyn avatar Jan 15 '15 02:01 SimonLlewellyn

I'm intrigued. Care for a remote session?

On Wed, Jan 14, 2015 at 9:35 PM, Simon [email protected] wrote:

Yea the fiddle seems to work fine too :( Typical - I have put exactly what I have in my code, into fiddle.

— Reply to this email directly or view it on GitHub https://github.com/jakiestfu/Medium.js/issues/130#issuecomment-70031256.

Robert Plummer

robertleeplummerjr avatar Jan 15 '15 02:01 robertleeplummerjr

Sure how?

SimonLlewellyn avatar Jan 15 '15 02:01 SimonLlewellyn

Teamviewer? If you'd like to switch to business/private email: robertleeplummerjr at gmail or rplummer at visop-dev.com

On Wed, Jan 14, 2015 at 9:37 PM, Simon [email protected] wrote:

Sure how?

— Reply to this email directly or view it on GitHub https://github.com/jakiestfu/Medium.js/issues/130#issuecomment-70031385.

Robert Plummer

robertleeplummerjr avatar Jan 15 '15 02:01 robertleeplummerjr

Skyped u an invite.

SimonLlewellyn avatar Jan 15 '15 02:01 SimonLlewellyn

Linux didn't like it, switched to virtualbox, and it was over before it had begun.

On Wed, Jan 14, 2015 at 9:39 PM, Simon [email protected] wrote:

TM: m24-679-003

— Reply to this email directly or view it on GitHub https://github.com/jakiestfu/Medium.js/issues/130#issuecomment-70031529.

Robert Plummer

robertleeplummerjr avatar Jan 15 '15 02:01 robertleeplummerjr

RobertLeePlummerJr, no notifications as of yet.

On Wed, Jan 14, 2015 at 9:44 PM, Simon [email protected] wrote:

Skyped u an invite.

— Reply to this email directly or view it on GitHub https://github.com/jakiestfu/Medium.js/issues/130#issuecomment-70031928.

Robert Plummer

robertleeplummerjr avatar Jan 15 '15 02:01 robertleeplummerjr

DIdnt like teamviewer or skype?

SimonLlewellyn avatar Jan 15 '15 02:01 SimonLlewellyn

I'm awaiting on skype.

On Wed, Jan 14, 2015 at 9:50 PM, Simon [email protected] wrote:

DIdnt like teamviewer or skype?

— Reply to this email directly or view it on GitHub https://github.com/jakiestfu/Medium.js/issues/130#issuecomment-70032319.

Robert Plummer

robertleeplummerjr avatar Jan 15 '15 02:01 robertleeplummerjr

Ok - add me "SmartySimon" - NZ

SimonLlewellyn avatar Jan 15 '15 02:01 SimonLlewellyn

https://www.youtube.com/watch?v=hmqyc1VVw4M

On Wed, Jan 14, 2015 at 9:50 PM, Robert Plummer < [email protected]> wrote:

I'm awaiting on skype.

On Wed, Jan 14, 2015 at 9:50 PM, Simon [email protected] wrote:

DIdnt like teamviewer or skype?

— Reply to this email directly or view it on GitHub https://github.com/jakiestfu/Medium.js/issues/130#issuecomment-70032319 .

Robert Plummer

Robert Plummer

robertleeplummerjr avatar Jan 15 '15 02:01 robertleeplummerjr

Hi, I think I've the same issue. with the following init code everything is fine:

new Medium({
        element: document.getElementById('editor'),
        mode: Medium.partialMode,
        placeholder: 'Your comment'
});

but if I try to use the maxLength option with the following init code:

new Medium({
        element: document.getElementById('editor'),
        mode: Medium.partialMode,
        placeholder: 'Your comment',
        maxLength:2000
});

I got the same error message:

Uncaught TypeError: Cannot read property 'innerText' of undefined medium.js:1725
Medium.Utilities.utils.text medium.js:1725
intercept.down medium.js:195

I installed Medium.js using bower install medium.js and it seems to install an old version.

thibauds avatar Feb 25 '15 18:02 thibauds

Same issue different code

   $(function() {
        $('*[data-update="patch"]').each(function(index, value) {
            var $value = $(value);
            $value.on('dblclick', function(){

                new Medium({
                    element: value,
                    mode: M.inlineMode,
                    maxLength: 25,
                    placeholder: 'edit'
                });
                return false;
            });
        });
    });

Basicaly i got a table i want the editable behavior when double clicking a cell i got the Uncaught TypeError: Cannot read property 'innerText' of undefined as soon as i change the value of the cell

meshenka avatar Mar 03 '16 17:03 meshenka

Same here. Removing maxLength from the config, fixed the errors and also an issue where could still enter newlines while in inlineMode by pressing enter twice, with weird cursor-jump in between (which reads a bit like #189).

Using Chrome 51 on Windows 7. My config:

// initialising editor. see http://jakiestfu.github.io/Medium.js/docs/
this.medium = new Medium({
  element: this.textField().querySelector('.medium-mount'),
  modifier: 'auto',
  placeholder: this.placeholder,
  autoHR: false, //if true, inserts <hr> after two empty lines
  mode: Medium.inlineMode, // no newlines, no styling
  //maxLength: this.maxChars, 
  tags: {   },
  attributes: {
    remove: ['style', 'class'] 
  },
});
this.medium.placeholder.style = ""; //remove the inline-styles placed by medium.js

pheara avatar Jun 17 '16 14:06 pheara

Yep removing maxLength fixes it. I tried using data-medium-maxLength, but that seems to get set to data-medium-maxlength when rendered from an underscore template (which I'm assuming causes Medium.js to not pick up on it).

vhmth avatar Nov 14 '16 08:11 vhmth