Skip to content

CKEditor is stripping out attributes and styles #1619

@liquidmelon

Description

@liquidmelon

this issue is easy to replicate by adding the data attribute to a span in the source editor of a component, for example:
<span class="tidbit-trigger tidbit-color" data-bitnum="0">your text here</span>

if you edit anything in the component a second time, the data attribute will get stripped

based on the CKEditor documentation, CKEditor filters incoming HTML content by transforming and deleting disallowed elements, attributes, classes and styles.

taking what is already in the code and adding two things, i have a solution. change this line: https://github.com/adaptlearning/adapt_authoring/blob/master/frontend/src/core/scaffold/scaffoldOverrides.js#L125

to this:
extraAllowedContent: 'span(*)[*]{*}',

please note that this might only fix the span tag (see this post). there's another post in the forum that appears to be doing this to ordered list tags.

the editor documentation shows that specific things can be allowed or disallowed. there is also a way to allow everything... so maybe changing line 125 to this might also fix the ol tags? i haven't tested this theory, just putting it out there:
allowedContent = true

Metadata

Metadata

Labels

S: mergedCompleted, reviewed, and merged issuesT: enhancementAdding additional functionality

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions