Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Améliorer la saisie avec un éditeur WYSIWYG #796

Open
wants to merge 57 commits into
base: main
Choose a base branch
from

Conversation

yaaax
Copy link
Collaborator

@yaaax yaaax commented Aug 9, 2024

  • Should handle existing markdown content
  • The editor is configured with extensions:
    • all what's in StarterKit
    • code block lowlight
    • highlight
    • link
    • task
    • typography (with french double quotes)
  • Some styles have been added to fit DSFR styling

Still work in progress, but a nice start!

To do:

  • image uploading and placement inside editor
  • menu buttons
  • accessibility tests and improvements

@yaaax yaaax linked an issue Aug 9, 2024 that may be closed by this pull request
40 tasks
@hissalht hissalht temporarily deployed to ara-687-ameliorer-la-sa-ejgfhq August 9, 2024 07:38 Inactive
@hissalht hissalht had a problem deploying to ara-687-ameliorer-la-sa-ejgfhq August 9, 2024 09:15 Failure
@hissalht hissalht temporarily deployed to ara-687-ameliorer-la-sa-ejgfhq August 9, 2024 09:20 Inactive
@yaaax yaaax changed the title Add Tiptap and a first integration in NotesModal Améliorer la saisoe des erreurs Aug 9, 2024
@yaaax yaaax changed the title Améliorer la saisoe des erreurs Améliorer la saisie avec un éditeur WYSIWYG Aug 9, 2024
@yaaax yaaax force-pushed the 687-améliorer-la-saisie-erreurs-et-recommandations branch from d5003ef to 2ba70c2 Compare August 16, 2024 17:48
@hissalht hissalht temporarily deployed to ara-687-ameliorer-la-sa-ejgfhq August 16, 2024 17:48 Inactive
@yaaax yaaax force-pushed the 687-améliorer-la-saisie-erreurs-et-recommandations branch from 2ba70c2 to 31ce9e5 Compare August 16, 2024 18:00
@hissalht hissalht temporarily deployed to ara-687-ameliorer-la-sa-ejgfhq August 16, 2024 18:00 Inactive
@hissalht hissalht temporarily deployed to ara-687-ameliorer-la-sa-ejgfhq August 17, 2024 18:24 Inactive
@hissalht hissalht temporarily deployed to ara-687-ameliorer-la-sa-ejgfhq August 17, 2024 20:35 Inactive
@yaaax yaaax force-pushed the 687-améliorer-la-saisie-erreurs-et-recommandations branch from 6672e96 to b9a24e0 Compare August 17, 2024 20:44
@hissalht hissalht temporarily deployed to ara-687-ameliorer-la-sa-ejgfhq August 17, 2024 20:44 Inactive
@yaaax yaaax force-pushed the 687-améliorer-la-saisie-erreurs-et-recommandations branch from b9a24e0 to 1250bda Compare August 19, 2024 09:59
@hissalht hissalht temporarily deployed to ara-687-ameliorer-la-sa-ejgfhq August 19, 2024 09:59 Inactive
@hissalht hissalht temporarily deployed to ara-687-ameliorer-la-sa-aargwr September 4, 2024 08:41 Inactive
@hissalht hissalht temporarily deployed to ara-687-ameliorer-la-sa-aargwr September 4, 2024 09:15 Inactive
@yaaax yaaax self-assigned this Sep 5, 2024
@hissalht hissalht temporarily deployed to ara-687-ameliorer-la-sa-aargwr September 13, 2024 14:00 Inactive
@yaaax yaaax force-pushed the 687-améliorer-la-saisie-erreurs-et-recommandations branch from 3251d48 to 9f3a245 Compare September 13, 2024 16:41
@hissalht hissalht temporarily deployed to ara-687-ameliorer-la-sa-aargwr September 13, 2024 16:42 Inactive
@hissalht hissalht temporarily deployed to ara-687-ameliorer-la-sa-itzbxb October 2, 2024 09:45 Inactive
@yaaax yaaax force-pushed the 687-améliorer-la-saisie-erreurs-et-recommandations branch from 75c5aeb to 7981839 Compare October 24, 2024 16:02
@hissalht hissalht temporarily deployed to ara-687-ameliorer-la-sa-abtxfg October 29, 2024 11:08 Inactive
* Should handle existing markdown content
* The editor is configured with extensions:
  * all what's in StarterKit
  * code block lowlight
  * highlight
  * link
  * task
  * typography (with french double quotes)
* Some styles have been added to fit DSFR styling

Still work in progress, but a nice start!

To do:
* image uploading and placement inside editor
* menu buttons
* accessibility tests and improvements
(and possibly importing JSON content?)
@hissalht hissalht temporarily deployed to ara-687-ameliorer-la-sa-d03ef2 January 29, 2025 14:34 Inactive
yaaax added 4 commits January 29, 2025 16:33
Pruning uploads should not be possible from client web app. This is now only available on backend side.
Code has been commented out in case we need to test it quickly for the web app.
@hissalht hissalht had a problem deploying to ara-687-ameliorer-la-sa-d03ef2 January 29, 2025 18:07 Failure
@yaaax yaaax force-pushed the 687-améliorer-la-saisie-erreurs-et-recommandations branch from 63560a0 to 465801e Compare January 29, 2025 18:13
@hissalht hissalht had a problem deploying to ara-687-ameliorer-la-sa-d03ef2 January 29, 2025 18:14 Failure
If not editable:
* avoid adding useless functionnalities
* do not display buttons
@yaaax yaaax force-pushed the 687-améliorer-la-saisie-erreurs-et-recommandations branch from 465801e to fb6476b Compare January 29, 2025 18:19
@hissalht hissalht temporarily deployed to ara-687-ameliorer-la-sa-d03ef2 January 29, 2025 18:19 Inactive
* require access token to prune images

* add workflow to trigger pruning
@hissalht hissalht temporarily deployed to ara-687-ameliorer-la-sa-d03ef2 February 7, 2025 09:42 Inactive
@hissalht hissalht temporarily deployed to ara-687-ameliorer-la-sa-d03ef2 February 19, 2025 10:16 Inactive
@@ -65,6 +65,252 @@ from DSFR links with `target="_blank"` */
color: var(--background-action-high-error) !important;
}

/* Tiptap */
Copy link
Collaborator

@bellangerq bellangerq Feb 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je suggère de déplacer tout le style lié à TipTap dans un fichier dédié, ou le mettre dans Tiptap.vue ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oui, je dirais plutôt un tiptap.css ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Peut-être à garder pour une autre PR histoire de pas avoir trop de choses qui sortent du scope.

display: FileDisplay;
}

export enum FileDisplay {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

À mettre dans le fichier enums.ts plutôt du coup ?

<button
:disabled="disabled"
class="fr-btn--sm fr-btn--tertiary"
:class="[
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pour éviter à avoir de faire un ternaire, tu peux utiliser cette syntaxe pour appliquer une classe quand une condition est true :

<button
  :class="{
    'fr-btn--icon-left': labelVisible,
    `fr-icon-${icon}`: icon,
    'fr-btn--is-toggle': isToggle,
  }"
  ...
>
</button>

v-if="error.notCompliantComment"
:content="error.notCompliantComment"
:editable="false"
Copy link
Collaborator

@bellangerq bellangerq Feb 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On peut simplifier en n'indiquant pas du tout la prop (revient à ce qu'elle soit false)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nettoyer les commentaires.

Copy link
Collaborator

@bellangerq bellangerq Feb 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commentaires à supprimer ?

vertical-align: middle;
}

/* Testing some different UI for Tiptap editor: */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Supprimer les commentaires

Comment on lines +12 to +43
constructor() {
const debugQuery = process.env.DEBUG === "prisma:query";
let logObject = {};
if (debugQuery) {
// Note: ideally we would use `emit: "event"` instead of `emit: "stdout"`
// to avoid double logging, but Prisma's query logging is connection-scoped
// rather than query-scoped, so queries using an existing connection
// would not appear in logs
// TODO: improve when upgrading Prisma
logObject = {
log: [
{
emit: "stdout",
level: "query"
}
]
};
}
super(logObject);
}

async onModuleInit() {
await this.$connect();
this.$on("query", (query: Prisma.QueryEvent) => {
let q = query.query;
JSON.parse(query.params).forEach((e, i) => {
q = q.replace(`$${i + 1}`, `'${e}'`);
});
console.log("=======================================");
console.log("--- Prisma Query (with $n replaced) ---");
console.log(q);
console.log("Duration: " + query.duration + "ms\n");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a besoin de tout ça ? Ou c'était juste pour débuguer ?

Comment on lines +12 to +43

type PrunableFile = {
fileType: FileType;
id: number;
key: string;
thumbnailKey: string;
};

@Injectable()
export class SystemService {
constructor(
private readonly prisma: PrismaService,
private readonly fileStorageService: FileStorageService
) {}

/**
* Deletes expired AuditFile and StoredFile entries from the database + the associated files from the S3 bucket.
* For each Audit, checks if the file URLs are still present in:
* - notes (AuditFile entries)
* - all criterionResult comments (StoredFile entries)
* If the URL is found, the AuditFile (or StoredFile) is considered expired only if it has been created more than 1 month ago.
* In that case, the entry is deleted from the database and the associated files (1 or 2 if a thumbnail exists) are deleted from the S3 bucket.
*
* Also, checks for obsolete files on the S3 bucket that are not associated anymore to any entry in the database,
* and deletes them if needed (checks all notes and all criteria in the database).
*
* Good to know: A key looks like "audits/lOuFFlopCxZ_mLKzAqpzu/BN2Jhq-iOiTIG96-f3lQU/image.png"
* It contains the audit id, a specific key for the file and the file name
* (or "external" if the image comes from an external URL – i.e. dragged and dropped
* from another website).
*/
async pruneUploads() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honnêtement, cette fonction fait un peu peur. Je pense qu'on peut envisager de merger ce mécanisme de pruning à part

Comment on lines +20 to +23
// async function pruneUploads() {
// await ky.post(`/api/system/prune-uploads`);
// }

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// async function pruneUploads() {
// await ky.post(`/api/system/prune-uploads`);
// }

window.addEventListener("online", onOnline);
window.addEventListener("offline", onOffline);

return {
isOnline
// pruneUploads
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// pruneUploads

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Améliorer la saisie erreurs et recommandations
3 participants