0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Added fixed order in data attributes for signup form embed script

refs https://ghost.slack.com/archives/C04TMVA1D7A/p1685711310532969
This commit is contained in:
Simon Backx 2023-06-02 16:13:42 +02:00
parent 8833ec03de
commit ff28e1c94f

View file

@ -109,7 +109,22 @@ export default class SignupFormEmbedModal extends Component {
}
let dataOptionsString = '';
for (const [key, value] of Object.entries(options)) {
const preferredOrder = [
'background-color',
'text-color',
'button-color',
'button-text-color',
'title',
'description',
'logo',
'site',
'locale'
];
const sortedKeys = Object.keys(options).sort((a, b) => {
return preferredOrder.indexOf(a) - preferredOrder.indexOf(b);
});
for (const key of sortedKeys) {
const value = options[key];
dataOptionsString += ` data-${key}="${escapeHtml(value)}"`;
}