paxuclus / list-style

Neos Package that adds the option to change the list-style of uls and ols.
0 stars 2 forks source link

Exception while copy&paste text into CKEditor field #13

Open erickloss opened 1 month ago

erickloss commented 1 month ago

Hello,

we see an Exception in the JS Console when copy/paste content from the clipboard to a CKEditor text field in the Neos Backend.

Uncaught CKEditorError: Cannot read properties of null (reading ‘getAttribute’)
    at ZZe (writer.js:1481:29)
    at Zh.setAttribute (writer.js:370:4)
    at dispatcher.on.priority (liststyleediting.js:100:25) <--- this should be the plugin code
    at ox.fire (emittermixin.js:209:30)
    at ox._convertItem (upcastdispatcher.js:239:9)
    at ox._convertChildren (upcastdispatcher.js:270:24)
    at ox.<anonymous> (upcasthelpers.js:356:54)
    at ox.fire (emittermixin.js:209:30)
    at ox._convertItem (upcastdispatcher.js:239:9)
    at ox._convertChildren (upcastdispatcher.js:270:24)

For some reason a NullPointer is thrown when calling getAttribute. That causes the paste command to stop working.

affected Code: https://github.com/paxuclus/list-style/blob/master/Resources/Private/src/liststyle/liststyleediting.js#L100

What do you think?

Thx + Cheers Eric

erickloss commented 1 month ago

hm, I think I misread the exception. Im unsure now where the error occurs exactly. I edited the description

paxuclus commented 1 month ago

Hi @erickloss,

I cannot seem to reproduce the problem. Which Neos UI Version are you using and how is your node property configured?

erickloss commented 1 month ago

Hi @paxuclus , I will provide more Info soon. I cannot reproduce it ether, but the following workaround hotfixed it for my customer in the production system:

try {
     conversionApi.writer.setAttribute( 'listStyle', listStyle, listItem );
} catch (error) {
    // ... log and swallow 
}

I will double-check the node configuration as well.

erickloss commented 1 month ago

The printed nodetype property configuration:

properties:
# ...

  text:
    type: string
    ui:
      inlineEditable: true
      inline:
        editorOptions: { autoparagraph: true, placeholder: '- Text eingeben -', hyphens: true, formatting: { strong: true, em: true, sub: true, sup: true, p: true, h1: true, h2: true, h3: true, h4: true, h5: true, h6: true, pre: true, underline: true, strikethrough: true, removeFormat: true, left: true, right: true, center: true, justify: true, table: true, ol: true, ul: true, a: true, 'Bl.CKExtensions:setMarkerCommand': true }, listStyle: { ul: { regular: true, square-blue: true, square-red: true, square-green: true, tick-blue: true, tick-red: true, tick-green: true, circle-blue: true, circle-red: true, circle-green: true, cross-blue: true, cross-red: true, cross-green: true }, ol: { decimal: true, lower-latin: true, upper-latin: true, lower-roman: true, upper-roman: true } } }
      inspector:
        editor: Neos.Neos/Inspector/Editors/RichTextEditor
        defaultValue: ''
    options:
      preset: text.free