BikeHub Posted February 14, 2021 Posted February 14, 2021 Hi all, A few years late but we're finally converting our 3.4 board to 4.x. I've just run through a test upgrade and it was mostly successful, however we have over 5000 articles in a Pages database which used Custom BB Codes for formatting and layout of some content. After the upgrade it seems like all the custom code has been successfully converted to HTML, however the CSS classes have been stripped out. Has anyone been able to upgrade while preserving CSS associated with BB codes?For example: 3.4 Custom BBcode [spec_list_row='{option}']{content}[/spec_list_row] Was output as follows 3.4: <li><span class="row_title">{option}</span><span class="row_data">{content}</span></li> After upgrading to 4.x the converted HTML structure is correct, but the classes have been stripped which means the ability to re-apply formatting / layout via CSS is lost. <li><span>{option}</span><span>{content}</span></li> Any help or advice would be much appreciated. Matt
opentype Posted February 14, 2021 Posted February 14, 2021 Custom CSS classes need to be whitelisted in the ACP. It’s an editor option. I am not sure the background task for the bb code will honour that option though. I am actually surprised to see your custom bb codes touched at all. Can’t remember that being the case when I upgraded a long time ago.
BikeHub Posted February 14, 2021 Author Posted February 14, 2021 Thank you, I know this will be a distant memory for most! That makes sense then - the HTML structure was migrated perfectly, just without the classes. Will see if it's possible to update the allowed classes setting manually before/during the upgrade process. Failing that I'm guessing deleting the custom BB code definitions in 3.4 and a good old find & replace after upgrading will be the way.
Solution bfarber Posted February 15, 2021 Solution Posted February 15, 2021 Custom bbcode should be converted upon upgrade to 4.x. You do need to whitelist custom CSS classes as mentioned, however, if you are using them.
BikeHub Posted February 16, 2021 Author Posted February 16, 2021 18 hours ago, bfarber said: Custom bbcode should be converted upon upgrade to 4.x. You do need to whitelist custom CSS classes as mentioned, however, if you are using them. Thanks for the feedback. It was converted perfectly in terms of the HTML structure, just stripped of the CSS. From what I could tell the conversion and stripping of CSS happened during the upgrade (i.e. before the background rebuild tasks ran). So does that mean we'd need to inject the whitelisted CSS classes ahead of the upgrade? e.g. by editing the default value in the settings.json file? Or would updating the whitelisted custom classes in the 4.x admin CP ahead of the rebuild tasks running do the trick?
bfarber Posted February 16, 2021 Posted February 16, 2021 5 hours ago, BikeHub said: Thanks for the feedback. It was converted perfectly in terms of the HTML structure, just stripped of the CSS. From what I could tell the conversion and stripping of CSS happened during the upgrade (i.e. before the background rebuild tasks ran). So does that mean we'd need to inject the whitelisted CSS classes ahead of the upgrade? e.g. by editing the default value in the settings.json file? Or would updating the whitelisted custom classes in the 4.x admin CP ahead of the rebuild tasks running do the trick? We do not rebuild any post content through the upgrade process. All rebuilding occurs by background tasks.
Recommended Posts