From f37ac6f2b79a7aa4ef06b09d911091bfcf650f05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Wed, 14 Aug 2024 15:23:52 +0200 Subject: [PATCH] Fix ckeditor wrapper --- app/helpers/application_helper.rb | 13 +++++++------ .../core/setup/globals/global-listeners/settings.ts | 2 +- .../src/global_styles/content/editor/_ckeditor.sass | 4 +--- .../text_formatting/formats/markdown/helper.rb | 2 +- spec/lib/tabular_form_builder_spec.rb | 4 ++-- spec/support/components/wysiwyg/wysiwyg_editor.rb | 2 +- spec/support/pages/admin/system_settings/general.rb | 2 +- 7 files changed, 14 insertions(+), 15 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 341888e7390d..2c3e21e4d6e9 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -202,7 +202,7 @@ def time_tag(time) else datetime = time.acts_like?(:time) ? time.xmlschema : time.iso8601 content_tag(:time, text, datetime:, - title: format_time(time), class: "timestamp") + title: format_time(time), class: "timestamp") end end @@ -260,11 +260,12 @@ def simple_format_without_paragraph(text) end def lang_options_for_select(blank = true) - auto = if blank && (valid_languages - all_languages) == (all_languages - valid_languages) - [["(auto)", ""]] - else - [] - end + auto = + if blank && (valid_languages - all_languages) == (all_languages - valid_languages) + [["(auto)", ""]] + else + [] + end mapped_languages = valid_languages.map { |lang| translate_language(lang) } diff --git a/frontend/src/app/core/setup/globals/global-listeners/settings.ts b/frontend/src/app/core/setup/globals/global-listeners/settings.ts index 9392ea046b98..181d4f3a3216 100644 --- a/frontend/src/app/core/setup/globals/global-listeners/settings.ts +++ b/frontend/src/app/core/setup/globals/global-listeners/settings.ts @@ -33,7 +33,7 @@ export function listenToSettingChanges() { const settingName = id.replace('lang-for-', ''); const newLang = self.val(); const textArea = jQuery(`#settings-${settingName}`); - const editor = textArea.siblings('ckeditor-augmented-textarea').data('editor'); + const editor = textArea.siblings('opce-ckeditor-augmented-textarea').data('editor'); return { id, settingName, newLang, textArea, editor, diff --git a/frontend/src/global_styles/content/editor/_ckeditor.sass b/frontend/src/global_styles/content/editor/_ckeditor.sass index 71cde283a871..4994efe97520 100644 --- a/frontend/src/global_styles/content/editor/_ckeditor.sass +++ b/frontend/src/global_styles/content/editor/_ckeditor.sass @@ -10,7 +10,7 @@ @include op-uc-table-header-styles // Wrapper for full text element -ckeditor-augmented-textarea .op-ckeditor--wrapper +opce-ckeditor-augmented-textarea .op-ckeditor--wrapper margin-bottom: 2rem // Ensure same border and min-height for preview @@ -128,5 +128,3 @@ ckeditor-augmented-textarea .op-ckeditor--wrapper .ck-icon_inherit-color path fill: var(--body-font-color) !important - - diff --git a/lib/open_project/text_formatting/formats/markdown/helper.rb b/lib/open_project/text_formatting/formats/markdown/helper.rb index efceaa5134a3..90cee1c84ad4 100644 --- a/lib/open_project/text_formatting/formats/markdown/helper.rb +++ b/lib/open_project/text_formatting/formats/markdown/helper.rb @@ -49,7 +49,7 @@ def wikitoolbar_for(field_id, **context) # Pass an optional resource to the CKEditor instance resource = context.fetch(:resource, {}) - helpers.angular_component_tag "ckeditor-augmented-textarea", + helpers.angular_component_tag "opce-ckeditor-augmented-textarea", inputs: { textareaSelector: "##{field_id}", editorType: context[:editor_type] || "full", diff --git a/spec/lib/tabular_form_builder_spec.rb b/spec/lib/tabular_form_builder_spec.rb index 4f2eb6931f2e..f976d24705b7 100644 --- a/spec/lib/tabular_form_builder_spec.rb +++ b/spec/lib/tabular_form_builder_spec.rb @@ -210,7 +210,7 @@ context "an id is missing" do it "outputs the wysiwyg wrapper" do expect(output).to have_css "textarea" - expect(output).to have_css "ckeditor-augmented-textarea" + expect(output).to have_css "opce-ckeditor-augmented-textarea" end end @@ -219,7 +219,7 @@ it "outputs the wysiwyg wrapper" do expect(output).to have_css "textarea" - expect(output).to have_css "ckeditor-augmented-textarea" + expect(output).to have_css "opce-ckeditor-augmented-textarea" end end end diff --git a/spec/support/components/wysiwyg/wysiwyg_editor.rb b/spec/support/components/wysiwyg/wysiwyg_editor.rb index 1000027e86fd..7b20b51da4b9 100644 --- a/spec/support/components/wysiwyg/wysiwyg_editor.rb +++ b/spec/support/components/wysiwyg/wysiwyg_editor.rb @@ -6,7 +6,7 @@ class WysiwygEditor attr_reader :context_selector, :attachments, :attachments_list - def initialize(context = "#content", attachment_list_selector = "ckeditor-augmented-textarea") + def initialize(context = "#content", attachment_list_selector = "opce-ckeditor-augmented-textarea") @context_selector = context @attachments = ::Components::Attachments.new @attachments_list = ::Components::AttachmentsList.new("#{context} #{attachment_list_selector}") diff --git a/spec/support/pages/admin/system_settings/general.rb b/spec/support/pages/admin/system_settings/general.rb index 9e647e062e0d..011f047ae9c6 100644 --- a/spec/support/pages/admin/system_settings/general.rb +++ b/spec/support/pages/admin/system_settings/general.rb @@ -39,7 +39,7 @@ def welcome_text_editor end def welcome_text_selector - 'ckeditor-augmented-textarea[data-textarea-selector="\"#settings_welcome_text\""]' + 'opce-ckeditor-augmented-textarea[data-textarea-selector="\"#settings_welcome_text\""]' end end end