tinymce icon indicating copy to clipboard operation
tinymce copied to clipboard

plugin.min.js:4 Uncaught TypeError: Cannot read property 'length' of undefined

Open Yusuf023 opened this issue 3 years ago • 10 comments

What is the current behavior? Upon pasting a piece of text from Microsoft Outlook, which has unordered list, and editing it, I get an error on my console

Please provide the steps to reproduce and if possible a minimal demo of the problem via [codesandbox.io] I replicated my exact implementation here but somehow I'm unable to replicate the error https://codepen.io/yusuf023/pen/PopWBpN?editors=1111

What is the expected behavior? Copying from a Non HTML source might make the text lose its formatting on the open source version but no error on console.

Which versions of TinyMCE, and which browser / OS are affected by this issue? Did this work in previous versions of TinyMCE or tinymce-react? @tinymce/tinymce-react Version 3.12.6

Can't say if it worked in previous version as I'm just now starting to work with Tiny MCE The error came up with Tiny MCE cloud as well has self hosted library.

Full Error:

https://user-images.githubusercontent.com/32506959/119090662-843dcc00-ba29-11eb-961d-f79a4179c1c2.mp4

plugin.js:176 Uncaught TypeError: Cannot read property 'length' of undefined at each (plugin.js:176) at foldl (plugin.js:215) at clone (plugin.js:781) at plugin.js:1271 at Object.map (plugin.js:127) at createEntry (plugin.js:1265) at plugin.js:1347 at Object.fold (plugin.js:73) at parseItem (plugin.js:1341) at plugin.js:1365 at map (plugin.js:171) at bind (plugin.js:245) at parseList (plugin.js:1362) at plugin.js:1374 at map (plugin.js:171) at parseLists (plugin.js:1371) at listIndentation (plugin.js:1411) at selectionIndentation (plugin.js:1429) at flattenListSelection (plugin.js:1445) at plugin.js:1939 at ignore (tinymce.js:17510) at Object.ignore (tinymce.js:17583) at ignore$1 (tinymce.js:17832) at Object.ignore (tinymce.js:21540) at transact (tinymce.js:17504) at Object.transact (tinymce.js:17580) at transact$1 (tinymce.js:17829) at Object.transact (tinymce.js:21537) at backspaceDeleteFromListToListCaret (plugin.js:1938) at backspaceDeleteCaret (plugin.js:1975) at backspaceDelete (plugin.js:1991) at Editor. (plugin.js:1996) at EventDispatcher.fire (tinymce.js:27836) at Editor.fire (tinymce.js:27941) at fireEvent (tinymce.js:27988) at Object.delegate (tinymce.js:28034) at EventUtils.executeHandlers (tinymce.js:5163) at HTMLBodyElement.defaultNativeHandler (tinymce.js:4966)

Yusuf023 avatar May 21 '21 06:05 Yusuf023

Ref: INT-2557

exalate-issue-sync[bot] avatar May 21 '21 06:05 exalate-issue-sync[bot]

The stack trace originates from the lists plugin so I'm going to transfer this to the TinyMCE repo as there is nothing we can do to fix this in the tinymce-react repo.

tiny-james avatar May 24 '21 01:05 tiny-james

Hi Team, Is there any update on this. Even I am seeing similar logs on my console.

Akshay9790 avatar Jun 11 '21 16:06 Akshay9790

Same here

RSickenberg avatar Sep 14 '21 15:09 RSickenberg

Happens as well.

liesahead avatar Oct 01 '21 10:10 liesahead

@tiny-james same error here, but different stack trace:

Uncaught TypeError: Cannot read properties of undefined (reading 'length')
    at tinymce.min.js:4
    at Object.fold (tinymce.min.js:4)
    at kg (tinymce.min.js:4)
    at Object.setContent (tinymce.min.js:4)
    at Yh (tinymce.min.js:4)
    at _x.resetContent (tinymce.min.js:4)
    at _x.<anonymous> (tinymce.min.js:4)
    at rx.fire (tinymce.min.js:4)
    at _x.fire (tinymce.min.js:4)
    at Object.ai.Event.domLoaded.t.getElement.xt.contentEditable.t.formEventDelegate (tinymce.min.js:4)
    at ui.executeHandlers (tinymce.min.js:4)
    at HTMLFormElement.o (tinymce.min.js:4)
    at reset (index.esm.js?34a0:1559)
    at eval (send-email-form.tsx?17a6:65)
    at invokePassiveEffectCreate (react-dom.development.js?61bb:23487)
    at HTMLUnknownElement.callCallback (react-dom.development.js?61bb:3945)
    at Object.invokeGuardedCallbackDev (react-dom.development.js?61bb:3994)
    at invokeGuardedCallback (react-dom.development.js?61bb:4056)
    at flushPassiveEffectsImpl (react-dom.development.js?61bb:23574)
    at unstable_runWithPriority (scheduler.development.js?3069:468)
    at runWithPriority$1 (react-dom.development.js?61bb:11276)
    at flushPassiveEffects (react-dom.development.js?61bb:23447)
    at performSyncWorkOnRoot (react-dom.development.js?61bb:22269)
    at eval (react-dom.development.js?61bb:11327)
    at unstable_runWithPriority (scheduler.development.js?3069:468)
    at runWithPriority$1 (react-dom.development.js?61bb:11276)
    at flushSyncCallbackQueueImpl (react-dom.development.js?61bb:11322)
    at flushSyncCallbackQueue (react-dom.development.js?61bb:11309)
    at scheduleUpdateOnFiber (react-dom.development.js?61bb:21893)
    at dispatchAction (react-dom.development.js?61bb:16139)
    at _callee$ (data-store.ts?0e09:95)
    at tryCatch (runtime.js?96cf:63)
    at Generator.invoke [as _invoke] (runtime.js?96cf:294)
    at Generator.eval [as next] (runtime.js?96cf:119)
    at asyncGeneratorStep (asyncToGenerator.js?2240:3)
    at _next (asyncToGenerator.js?2240:25)

I have the editor component on a page, then when a query parameter changes, data is fetched and the component re-renders with new data, and this error shows up in the console. In my case, the main page component is not unmounted. This error is not seen on the first fresh load of the page.

jedireza avatar Oct 28 '21 22:10 jedireza

Happens as well:

TinyMCE: v5.10.1

/list/plugin.js:165 Uncaught TypeError: Cannot read properties of undefined (reading 'length')
    at each$1 (/list/plugin.js:165)
    at foldl (/list/plugin.js:204)
    at clone$1 (/list/plugin.js:803)
    at plugin.js:1298
    at Object.map (/list/plugin.js:124)
    at createEntry (/list/plugin.js:1292)
    at /list/plugin.js:1374
    at Object.fold (/list/plugin.js:74)
    at parseItem (/list/plugin.js:1368)
    at /list/plugin.js:1393

Happens when I need to indent list.

SergkeiM avatar Nov 08 '21 09:11 SergkeiM

Yep we're seeing this error as well. It throws when we use command + A for select all.

ydax avatar Nov 23 '21 17:11 ydax

I experience a similar issue caused by setContentString as described here: https://github.com/tinymce/tinymce-react/issues/318.

natterstefan avatar Feb 15 '22 06:02 natterstefan

It's a bug, any idea ??? And, don't close it, it's not fixed.

Error in uncompresssed tinymce version:

plugin.js:1107 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'select')
    at Editor.<anonymous> (plugin.js:1107:20)
    at EventDispatcher.dispatch (tinymce.js:27705:31)
    at Editor.dispatch (tinymce.js:27820:57)
    at fireSetContent (tinymce.js:8836:53)
    at postProcessSetContent (tinymce.js:16473:9)
    at tinymce.js:18052:9
    at Object.map (tinymce.js:6098:37)
    at setContent (tinymce.js:18050:58)
    at Editor.setContent (tinymce.js:28624:16)
    at $$self.$$.update (Editor.svelte? [sm]:65:19)

kuchaguangjie avatar Aug 09 '22 17:08 kuchaguangjie

Hey! we have the same issue on copying a table from MS Word to the editor: image

IraErshova avatar Jan 11 '23 15:01 IraErshova