mirror of
https://gh.wpcy.net/https://github.com/elementor/one-click-accessibility.git
synced 2026-04-23 17:03:34 +08:00
* [APP-934] add submit logic * [APP-934] add submit logic * [APP-934] add submit logic * [APP-934] add submit logic * Added replace remediation action * Add submit logic * Add submit alt text logic, generate AI alt text * Add AI generate request, add convert from SVG to png base64, added manual fix block * Add AI generate request, add convert from SVG to png base64, added manual fix block * Add texts, add remediation submit, fix logic to store remediation * Add texts, add remediation submit, fix logic to store remediation * Add texts, add remediation submit, fix logic to store remediation * Add texts, add remediation submit, fix logic to store remediation * Add texts, add remediation submit, fix logic to store remediation * Add texts, add remediation submit, fix logic to store remediation --------- Co-authored-by: Raz Ohad <admin@bainternet.info>
20 lines
774 B
JavaScript
20 lines
774 B
JavaScript
export const splitDescriptions = (inputString) => {
|
|
return inputString
|
|
.replace('Here are 5 alt text descriptions for the image:', '')
|
|
.replace('Here are 5 concise alt text descriptions for the image:', '')
|
|
.split('\n') // Split by newlines
|
|
.map((item) => item.trim()) // Trim leading/trailing spaces
|
|
.filter((item) => item.length > 0) // Filter out empty lines
|
|
.map((item) => {
|
|
// Check if the first dot is not the last item
|
|
if (item.indexOf('.') !== item.length - 1) {
|
|
item = item.replace(/^[^\.]*\.\s*/, ''); // Remove everything before and including the first dot
|
|
}
|
|
|
|
if (item.length >= 2 && item.startsWith('"') && item.endsWith('"')) {
|
|
item = item.slice(1, -1);
|
|
}
|
|
|
|
return item; // Leave the item unchanged if dot is last
|
|
});
|
|
};
|