feat(Case Converter): allow multiline

Fix #1826
This commit is contained in:
ShareVB committed 2026-07-05 10:10:46 +02:00
1 parent 652ac8234d
commit be6a951e43
1 file changed
+23 -22
+23 -22
View File
@@ -41,82 +41,82 @@ const cleaningRegexValidation = useValidation({
const input = useQueryParam({ tool: 'case-conv', name: 'text', defaultValue: 'lorem ipsum dolor sit amet' });
const inputCleaned = computed(() => {
if (!cleaningRegexValidation.isValid) {
return input.value;
return input.value.split('\n');
}
return input.value.replace(new RegExp(cleaningRegex.value, 'g'), '');
return input.value.replace(new RegExp(cleaningRegex.value, 'g'), '').split('\n');
});
const formats = computed(() => [
{
label: t('tools.case-converter.texts.label-lowercase'),
value: inputCleaned.value.toLocaleLowerCase(),
value: inputCleaned.value.map(s => s.toLocaleLowerCase()),
},
{
label: t('tools.case-converter.texts.label-uppercase'),
value: inputCleaned.value.toLocaleUpperCase(),
value: inputCleaned.value.map(s => s.toLocaleUpperCase()),
},
{
label: t('tools.case-converter.texts.label-camelcase'),
value: camelCase(inputCleaned.value),
value: inputCleaned.value.map(s => camelCase(s)),
},
{
label: t('tools.case-converter.texts.label-titlecase'),
value: titleCase(inputCleaned.value),
value: inputCleaned.value.map(s => titleCase(s)),
},
{
label: t('tools.case-converter.texts.label-capitalcase'),
value: capitalCase(inputCleaned.value),
value: inputCleaned.value.map(s => capitalCase(s)),
},
{
label: t('tools.case-converter.texts.label-constantcase'),
value: constantCase(inputCleaned.value),
value: inputCleaned.value.map(s => constantCase(s)),
},
{
label: t('tools.case-converter.texts.label-dotcase'),
value: dotCase(inputCleaned.value),
value: inputCleaned.value.map(s => dotCase(s)),
},
{
label: t('tools.case-converter.texts.label-kebab-paramcase'),
value: kebabCase(inputCleaned.value),
value: inputCleaned.value.map(s => kebabCase(s)),
},
{
label: t('tools.case-converter.texts.label-nocase'),
value: noCase(inputCleaned.value),
value: inputCleaned.value.map(s => noCase(s)),
},
{
label: t('tools.case-converter.texts.label-train-headercase'),
value: trainCase(inputCleaned.value),
value: inputCleaned.value.map(s => trainCase(s)),
},
{
label: t('tools.case-converter.texts.label-pascalcase'),
value: pascalCase(inputCleaned.value),
value: inputCleaned.value.map(s => pascalCase(s)),
},
{
label: t('tools.case-converter.texts.label-pathcase'),
value: pathCase(inputCleaned.value),
value: inputCleaned.value.map(s => pathCase(s)),
},
{
label: t('tools.case-converter.texts.label-sentencecase'),
value: sentenceCase(inputCleaned.value),
value: inputCleaned.value.map(s => sentenceCase(s)),
},
{
label: t('tools.case-converter.texts.label-snakecase'),
value: snakeCase(inputCleaned.value),
value: inputCleaned.value.map(s => snakeCase(s)),
},
{
label: t('tools.case-converter.texts.label-mockingcase'),
value: inputCleaned.value
value: inputCleaned.value.map(s => s
.split('')
.map((char, index) => (index % 2 === 0 ? char.toUpperCase() : char.toLowerCase()))
.join(''),
.join('')),
},
{
label: t('tools.case-converter.texts.label-spongecase'),
value: spongeCase(inputCleaned.value),
value: inputCleaned.value.map(s => spongeCase(s)),
},
{
label: t('tools.case-converter.texts.label-swapcase'),
value: swapCase(inputCleaned.value),
value: inputCleaned.value.map(s => swapCase(s)),
},
]);
@@ -135,6 +135,7 @@ const inputLabelAlignmentConfig = {
:placeholder="t('tools.case-converter.texts.placeholder-your-string')"
raw-text
v-bind="inputLabelAlignmentConfig"
multiline
mb-1
/>
@@ -152,10 +153,10 @@ const inputLabelAlignmentConfig = {
<InputCopyable
v-for="format in formats"
:key="format.label"
:value="format.value"
:value="format.value?.join('\n')"
:label="format.label"
v-bind="inputLabelAlignmentConfig"
mb-1
multiline mb-1
/>
</c-card>
</template>