Skip to content

Commit

Permalink
Merge pull request #49 from camarm-dev/dev
Browse files Browse the repository at this point in the history
Fonctionnalité correction #40 et autres fix
  • Loading branch information
camarm-dev authored Dec 17, 2023
2 parents 910f1a9 + 80b1875 commit a9cfafa
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "remede",
"private": true,
"version": "1.0.0-rc",
"version": "1.0.0-rc.2",
"type": "module",
"license": "Cecill V2.1",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions app/src/functions/types/reverso.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ interface ReversoCorrection {
longDescription: string
mistakeText: string
suggestions: ReversoCorrectionSuggestion[]
replacementText: string
startIndex: number
endIndex: number
}
Expand Down
22 changes: 17 additions & 5 deletions app/src/views/CorrectionPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,19 @@
<ion-text :id="`correction-${corrections.indexOf(segment.correction)}`" :class="`error ${segment.correction.type}`">{{ segment.correction.mistakeText }}</ion-text>
<ion-popover :trigger="`correction-${corrections.indexOf(segment.correction)}`" trigger-action="click">
<ion-content class="ion-padding">
<ion-label>
<ion-label v-if="segment.correction.shortDescription">
<h2>{{ segment.correction.shortDescription }}</h2>
<p v-html="segment.correction.longDescription.replaceAll('#!', `<a href=/dictionnaire/${segment.correction.mistakeText}>`).replaceAll('#$', '</a>')"></p>
</ion-label>
<br>
<ion-label>
<ion-text color="medium">Remplacer par</ion-text>
<br>
<ion-text @click="explainSegments[explainSegments.indexOf(segment)] = { correction: false, text: suggested.text }" color="primary" :key="suggested" v-for="suggested in segment.correction.suggestions">{{ suggested.text }}<br></ion-text>
<ion-text @click="setSegmentAsText(segment, suggested.text)" color="primary" :key="suggested" v-for="suggested in segment.correction.suggestions">{{ suggested.text }}<br></ion-text>
<ion-text v-if="!segment.correction.suggestions" color="primary" @click="setSegmentAsText(segment, segment.correction.replacementText)">{{ segment.correction.replacementText }}<br></ion-text>
</ion-label>
<ion-label>
<ion-text @click="setSegmentAsText(segment, segment.correction.mistakeText)" color="primary">Ne pas remplacer "{{ segment.correction.mistakeText }}"</ion-text>
</ion-label>
</ion-content>
</ion-popover>
Expand Down Expand Up @@ -146,7 +150,7 @@ export default {
'Content-Type': 'application/*+json'
}
}).then(resp => resp.json()).then(response => {
this.corrections = response.corrections
this.corrections = response.corrections.concat(response.autoReplacements)
this.corrected = response.text
const originalText = this.content
let lastIndex = 0
Expand All @@ -155,8 +159,8 @@ export default {
const startIndex = correction.startIndex
const endIndex = correction.endIndex
segmentedText.push({
correction: false,
text: originalText.slice(lastIndex, lastIndex == 0 ? startIndex: startIndex - 1)
correction: false as any as ReversoCorrection,
text: originalText.slice(lastIndex == 0 ? lastIndex: lastIndex + 1, startIndex)
})
segmentedText.push({
correction: correction,
Expand All @@ -165,6 +169,11 @@ export default {
lastIndex = endIndex
}
segmentedText.push({
correction: false as any as ReversoCorrection,
text: originalText.slice(lastIndex + 1, originalText.length)
})
this.explainSegments = segmentedText
this.locked = true
})
Expand All @@ -178,6 +187,9 @@ export default {
return this.explainSegments.map(obj => {
return obj.correction ? obj.correction.mistakeText: obj.text
}).join('')
},
setSegmentAsText(segment: ExplainSegment, text: string) {
this.explainSegments[this.explainSegments.indexOf(segment)] = { correction: false, text: text }
}
}
}
Expand Down
Binary file modified builds/remede.apk
Binary file not shown.
11 changes: 0 additions & 11 deletions docs/sheets-credits.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,13 @@ This page credits the Remède contributors who wrote french cheatsheets.

## Credits

[//]: # (Add your own credits here !)


[//]: # (Starts "example" credits)

### Example

- Author(s): [camarm](https://github.com/camarm-dev)
- Source: [Remède](https://github.com/camarm-dev/remede)

- File historic and contributions: [On Github](https://github.com/camarm-dev/remede/commits/main/data/fiches/Exemple.md)

[//]: # (End "example" credits)

[//]: # (Starts "classes-grammaticales" credits)

### Classes Grammaticales

- Author(s): [camarm](https://github.com/camarm-dev)
Expand All @@ -28,5 +19,3 @@ This page credits the Remède contributors who wrote french cheatsheets.
- With help of: [Wikipedia](https://fr.wikipedia.org/wiki/Nom)

- File historic and contributions: [On Github](https://github.com/camarm-dev/remede/commits/main/data/fiches/Classes-grammaticales.md)

[//]: # (End "classes-grammaticales" credits)

0 comments on commit a9cfafa

Please sign in to comment.