From 5aac2ecdc45e4065c618e225538049c925af1388 Mon Sep 17 00:00:00 2001 From: Christophe Robillard Date: Mon, 11 Mar 2024 16:20:00 +0100 Subject: [PATCH] rename editor css class Co-authored-by: Colin Darie --- .../stylesheets/attestation_template_2_edit.scss | 13 +------------ app/assets/stylesheets/tiptap_editor.scss | 14 ++++++++++++++ .../attestation_template_v2s/edit.html.haml | 2 +- .../instructeurs/export_templates/_form.html.haml | 6 +++--- 4 files changed, 19 insertions(+), 16 deletions(-) create mode 100644 app/assets/stylesheets/tiptap_editor.scss diff --git a/app/assets/stylesheets/attestation_template_2_edit.scss b/app/assets/stylesheets/attestation_template_2_edit.scss index b726e9a8d..74a0a5684 100644 --- a/app/assets/stylesheets/attestation_template_2_edit.scss +++ b/app/assets/stylesheets/attestation_template_2_edit.scss @@ -20,7 +20,7 @@ min-height: 400px; } - .editor { + .tiptap-editor { // Visual zones .header .flex-1, h1 { @@ -63,17 +63,6 @@ li p { margin-bottom: 0; } - - // Tags - .fr-menu__list { - max-height: 500px; - } - - .fr-tag:not(.fr-menu .fr-tag) { - // style span rendered by tiptap like a button/link tag - color: var(--text-action-high-blue-france); - background-color: var(--background-action-low-blue-france); - } } // scss-lint:disable SelectorFormat diff --git a/app/assets/stylesheets/tiptap_editor.scss b/app/assets/stylesheets/tiptap_editor.scss new file mode 100644 index 000000000..9682989e5 --- /dev/null +++ b/app/assets/stylesheets/tiptap_editor.scss @@ -0,0 +1,14 @@ +@import "constants"; + +.tiptap-editor { + // Tags + .fr-menu__list { + max-height: 500px; + } + + .fr-tag:not(.fr-menu .fr-tag) { + // style span rendered by tiptap like a button/link tag + color: var(--text-action-high-blue-france); + background-color: var(--background-action-low-blue-france); + } +} diff --git a/app/views/administrateurs/attestation_template_v2s/edit.html.haml b/app/views/administrateurs/attestation_template_v2s/edit.html.haml index 308dca5e4..090247519 100644 --- a/app/views/administrateurs/attestation_template_v2s/edit.html.haml +++ b/app/views/administrateurs/attestation_template_v2s/edit.html.haml @@ -77,7 +77,7 @@ %button.fr-btn.fr-btn--secondary.fr-btn--sm{ type: 'button', title: label, class: icon == :hidden ? "hidden" : "fr-icon-#{icon}", data: { action: 'click->tiptap#menuButton', tiptap_target: 'button', tiptap_action: action } } = label - #editor.editor{ data: { tiptap_target: 'editor' }, aria: { describedby: dom_id(f.object, "json-body-messages")} } + #editor.tiptap-editor{ data: { tiptap_target: 'editor' }, aria: { describedby: dom_id(f.object, "json-body-messages")} } = f.hidden_field :tiptap_body, data: { tiptap_target: 'input' } .fr-error-text{ id: dom_id(f.object, "json-body-messages"), class: class_names("hidden" => !f.object.errors.include?(:json_body)) } diff --git a/app/views/instructeurs/export_templates/_form.html.haml b/app/views/instructeurs/export_templates/_form.html.haml index 2acdb655f..30dde872f 100644 --- a/app/views/instructeurs/export_templates/_form.html.haml +++ b/app/views/instructeurs/export_templates/_form.html.haml @@ -20,13 +20,13 @@ .fr-input-group{ data: { controller: 'tiptap' } } = f.label :tiptap_default_dossier_directory, class: "fr-label" - .editor.mt-2{ data: { tiptap_target: 'editor' } } + .tiptap-editor.fr-mt-1w{ data: { tiptap_target: 'editor' } } = f.hidden_field :tiptap_default_dossier_directory, data: { tiptap_target: 'input', controller: 'turbo-input', turbo_input_url_value: preview_instructeur_export_templates_path } .fr-mt-2w= render TagsButtonListComponent.new(tags: { nil => @export_template.specific_tags }) .fr-input-group{ data: { controller: 'tiptap' } } = f.label :tiptap_pdf_name, class: "fr-label" - .editor.mt-2{ data: { tiptap_target: 'editor' } } + .tiptap-editor.fr-mt-1w{ data: { tiptap_target: 'editor' } } = f.hidden_field :tiptap_pdf_name, data: { tiptap_target: 'input', controller: 'turbo-input', turbo_input_url_value: preview_instructeur_export_templates_path } .fr-mt-2w= render TagsButtonListComponent.new(tags: { nil => @export_template.specific_tags }) @@ -36,7 +36,7 @@ - @all_pj.each do |pj| .fr-input-group{ data: { controller: 'tiptap' } } = label_tag pj.libelle, nil, name: field_name(:export_template, "tiptap_pj_#{pj.stable_id}"), class: "fr-label" - .editor.mt-2{ data: { tiptap_target: 'editor' } } + .tiptap-editor.fr-mt-1w{ data: { tiptap_target: 'editor' } } = hidden_field_tag field_name(:export_template, "tiptap_pj_#{pj.stable_id}"), "#{@export_template.content_for_pj(pj)}" , data: { tiptap_target: 'input', controller: 'turbo-input', turbo_input_url_value: preview_instructeur_export_templates_path } .fr-mt-2w= render TagsButtonListComponent.new(tags: { nil => @export_template.specific_tags })