'undefined is not a function' in custom textEditor

I’m using this example:

I think I minimally pulled the “customText” part into my code correctly.
As soon as I click on the text block , however, I keep getting ‘TypeError: undefined is not a function’ in Chrome.

It happens right after calling "doActivate()" on customText.
My html div does appear on screen in the right place
Stack trace:
lh.doActivate (go-debug.js:12156) Ze.doMouseUp (go-debug.js:12415) u.doMouseUp (go-debug.js:13966) a.Pp (go-debug.js:13709)

I did an unminify.com pass on go-debug.js to see if it would help figure out what go is trying to do:

If I look in Chrome, “c” seems to be my HTML Div element I put on the page.
And it is true, it does NOT have “select()” method.

                c.style.position = "absolute";
                c.style.zIndex = 100;
                c.className = "start";
                c.textEditingTool = this;
                c.qK = k;
                if (d && void 0 !== c.onActivate) c.onActivate();
                this.nh = c;
                c.focus();
                <font color="#ff0000"><b>c.select() <-- dies here. Why is it calling select()?! </b></font>
            }
        }
    }

Any ideas?

It’s assuming that the element is an HTMLInputElement, calling this method: https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement.select

Apparently for 1.5 we have already improved the code to be:
if (typeof input.focus === ‘function’) input.focus();
if (typeof input.select === ‘function’) input.select();

If you have specified the text editor to be something other than an HTMLInputElement, I suppose you could implement focus() and select() methods on your element.

Sorry for the confusion.

Thanks

I wondered about that, but how is the sample working then?

oh-- unless it has the latest code?
I’ll grab the latest also.

I’m using the same html chunk as the example, just to see if I could get anything working.

That has <<span =“pl-ent” style=“line-height: 16.7999992370605px; -sizing: border-; color: rgb99, 163, 92; font-family: Consolas, ‘Liberation Mono’, Menlo, Courier, monospace; white-space: pre; : rgb255, 255, 255;”>div <span =“pl-e” style=“line-height: 16.7999992370605px; -sizing: border-; color: rgb121, 93, 163; font-family: Consolas, ‘Liberation Mono’, Menlo, Courier, monospace; white-space: pre; : rgb255, 255, 255;”>id=<span =“pl-s1” style=“line-height: 16.7999992370605px; -sizing: border-; color: rgb223, 80, 0; font-family: Consolas, ‘Liberation Mono’, Menlo, Courier, monospace; white-space: pre; : rgb255, 255, 255;”><span =“pl-pds” style="-sizing: border-;">"customTextEditor…

I put in the fake select() method, seems to fix it.

And I have back-ported the fixes into the 1.4.* stream, so in the future someone using a non-HTMLInputElement just won’t get their text selected. Unless they define the select method themselves, as you now have.