- Issue created by @bruno.bicudo
- Status changed to Postponed: needs info
almost 2 years ago 5:28pm 12 January 2024 - ๐ฆ๐บAustralia larowlan ๐ฆ๐บ๐.au GMT+10
Can you reproduce this in a fresh install?
- ๐ง๐ทBrazil bruno.bicudo Braganรงa Paulista - Sรฃo Paulo
@larowlan I recorded this evidence โ from simplytest.me with a "Drupal Core" 10.2.1 sandbox.
If you need it, I can also take an evidence from a local fresh environment.
Thanks! :)
- Status changed to Active
almost 2 years ago 8:14pm 12 January 2024 - Status changed to Postponed: needs info
over 1 year ago 1:13pm 13 February 2024 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
So you're saying this used to work correctly in 10.0 and 10.1? ๐ค
- ๐ฌ๐งUnited Kingdom vitaliych
This is happens and to the drupal 10.1.6
- Status changed to Active
11 months ago 2:05pm 27 November 2024 - ๐ซ๐ฎFinland Alexander Tallqvist
We're experiencing exactly the same issue with a site running Drupal 10.3.9. All the "text-align-*" classes get properly set except for the "text-align-left" one.
- ๐น๐ณTunisia oumaimaneffati
For anyone experiencing the issue where text-align-left is never output (because CKEditor 5 considers "left" the default and does not store it in the model), here is a workaround.
You can implement this as a custom CKEditor 5 plugin. It overrides the alignment command to ensure that "left" is explicitly written to the model, allowing the downcast to output the correct class.
const classMap = { left: 'text-align-left', center: 'text-align-center', right: 'text-align-right', justify: 'text-align-justify', }; editor.once('ready', () => { const command = editor.commands.get('alignment'); if (command) { this.listenTo(command, 'execute', (evt, data) => { const value = Array.isArray(data) ? data[0]?.value : data?.value; const selection = editor.model.document.selection; if (value === 'left') { editor.model.change(writer => { for (const block of selection.getSelectedBlocks()) { writer.setAttribute('alignment', 'left', block); } }); evt.stop(); } }); } }); editor.conversion.for('downcast').attributeToAttribute({ model: 'alignment', view: (modelValue) => { const cls = classMap[modelValue]; return cls ? { key: 'class', value: cls } : null; }, converterPriority: 'high', });