Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

make ckeditor primer adjustments reusable following input from @oliverguenther

Jonas Jabari867aebceeea7
diff --git a/app/components/work_packages/activities_tab/journals/item_component/edit.html.erb b/app/components/work_packages/activities_tab/journals/item_component/edit.html.erb
index 95cfac1bec8..7fee7fcb273 100644
--- a/app/components/work_packages/activities_tab/journals/item_component/edit.html.erb
+++ b/app/components/work_packages/activities_tab/journals/item_component/edit.html.erb
@@ -9,7 +9,7 @@
url: work_package_activity_path(work_package_id: work_package.id, id: journal.id, filter:),
) do |f|
flex_layout do |form_container|
- form_container.with_row(id: "ck-editor-adjustment-container") do
+ form_container.with_row(classes: "work-packages-activities-tab-journals-item-component-edit--ck-editor-adjustments") do
render(WorkPackages::ActivitiesTab::Journals::NotesForm.new(f))
end
form_container.with_row(flex_layout: true, mt: 3, justify_content: :flex_end) do |submit_container|
diff --git a/app/components/work_packages/activities_tab/journals/item_component/edit.sass b/app/components/work_packages/activities_tab/journals/item_component/edit.sass
index db9b6228a98..2abc1c30d20 100644
--- a/app/components/work_packages/activities_tab/journals/item_component/edit.sass
+++ b/app/components/work_packages/activities_tab/journals/item_component/edit.sass
@@ -1,21 +1,5 @@
.work-packages-activities-tab-journals-item-component-edit
- // prototypical primer style adoptions, using ID in order to get higher priority, needs refactoring
- #ck-editor-adjustment-container
- .ck-toolbar
- border-radius: var(--borderRadius-medium) var(--borderRadius-medium) 0px 0px
- .document-editor__editable-container
- background: var(--bgColor-default)
- border-radius: 0px 0px var(--borderRadius-medium) var(--borderRadius-medium)
- .ck-content
- background: var(--bgColor-default)
- overflow-y: auto
- border-radius: var(--borderRadius-medium)
- margin: 5px
- .CodeMirror
- border-radius: 0px 0px var(--borderRadius-medium) var(--borderRadius-medium)
- .ck-editor__preview
- border-radius: 0px 0px var(--borderRadius-medium) var(--borderRadius-medium)
+ &--ck-editor-adjustments
// overwrites margin bottom defined in _ckeditor.sass:13
opce-ckeditor-augmented-textarea .op-ckeditor--wrapper
- margin-bottom: 0px
-
+ margin-bottom: 0px
\ No newline at end of file
diff --git a/app/components/work_packages/activities_tab/journals/new_component.html.erb b/app/components/work_packages/activities_tab/journals/new_component.html.erb
index 2b72154b522..5ec55df8e03 100644
--- a/app/components/work_packages/activities_tab/journals/new_component.html.erb
+++ b/app/components/work_packages/activities_tab/journals/new_component.html.erb
@@ -50,7 +50,6 @@
) do |f|
flex_layout(justify_content: :space_between, align_items: :flex_end) do |form_container|
form_container.with_column(
- id: "ck-editor-adjustment-container",
classes: "work-packages-activities-tab-journals-new-component--ck-editor-column",
mr: 2
) do
diff --git a/app/components/work_packages/activities_tab/journals/new_component.sass b/app/components/work_packages/activities_tab/journals/new_component.sass
index 48f40e9d995..fe203c32348 100644
--- a/app/components/work_packages/activities_tab/journals/new_component.sass
+++ b/app/components/work_packages/activities_tab/journals/new_component.sass
@@ -8,26 +8,11 @@
display: block
&--ck-editor-column
width: calc(100% - 40px)
- // prototypical primer style adoptions, using ID in order to get higher priority, needs refactoring
- #ck-editor-adjustment-container
- .ck-toolbar
- border-radius: var(--borderRadius-medium) var(--borderRadius-medium) 0px 0px
- .document-editor__editable-container
- background: var(--bgColor-default)
- border-radius: 0px 0px var(--borderRadius-medium) var(--borderRadius-medium)
+ // specific ck editor adjustments
.ck-content
- background: var(--bgColor-default)
- max-height: 30vh
- overflow-y: auto
- border-radius: var(--borderRadius-medium)
- margin: 5px
- .ck-editor__source
max-height: 30vh
- .CodeMirror
- border-radius: 0px 0px var(--borderRadius-medium) var(--borderRadius-medium)
.ck-editor__preview
max-height: 30vh
- border-radius: 0px 0px var(--borderRadius-medium) var(--borderRadius-medium)
// overwrites margin bottom defined in _ckeditor.sass:13
opce-ckeditor-augmented-textarea .op-ckeditor--wrapper
margin-bottom: 0px
diff --git a/app/forms/work_packages/activities_tab/journals/notes_form.rb b/app/forms/work_packages/activities_tab/journals/notes_form.rb
index 9dbd30cf14e..d1639045691 100644
--- a/app/forms/work_packages/activities_tab/journals/notes_form.rb
+++ b/app/forms/work_packages/activities_tab/journals/notes_form.rb
@@ -31,6 +31,7 @@ module WorkPackages::ActivitiesTab::Journals
form do |notes_form|
notes_form.rich_text_area(
+ classes: "ck-editor-primer-adjusted",
name: :notes,
label: nil,
rich_text_options: {
diff --git a/frontend/src/global_styles/primer/_overrides.sass b/frontend/src/global_styles/primer/_overrides.sass
index e74b5c0e269..3619814449e 100644
--- a/frontend/src/global_styles/primer/_overrides.sass
+++ b/frontend/src/global_styles/primer/_overrides.sass
@@ -93,3 +93,20 @@ sub-header,
&:hover
background: var(--header-item-bg-hover-color)
color: var(--header-item-font-hover-color)
+
+// Prototypical CKEditor adjustments to better match Primer styles
+.ck-editor-primer-adjusted
+ .ck-toolbar
+ border-radius: var(--borderRadius-medium) var(--borderRadius-medium) 0px 0px!important
+ .document-editor__editable-container
+ background: var(--bgColor-default)
+ border-radius: 0px 0px var(--borderRadius-medium) var(--borderRadius-medium)
+ .ck-content
+ background: var(--bgColor-default)
+ overflow-y: auto
+ border-radius: var(--borderRadius-medium)!important
+ margin: 5px
+ .CodeMirror
+ border-radius: 0px 0px var(--borderRadius-medium) var(--borderRadius-medium)
+ .ck-editor__preview
+ border-radius: 0px 0px var(--borderRadius-medium) var(--borderRadius-medium)
\ No newline at end of file
diff --git a/lib/primer/open_project/forms/dsl/rich_text_area_input.rb b/lib/primer/open_project/forms/dsl/rich_text_area_input.rb
index 5cf58d9abd2..4ae4facfa02 100644
--- a/lib/primer/open_project/forms/dsl/rich_text_area_input.rb
+++ b/lib/primer/open_project/forms/dsl/rich_text_area_input.rb
@@ -5,12 +5,13 @@ module Primer
module Forms
module Dsl
class RichTextAreaInput < Primer::Forms::Dsl::Input
- attr_reader :name, :label
+ attr_reader :name, :label, :classes
def initialize(name:, label:, rich_text_options:, **system_arguments)
@name = name
@label = label
@rich_text_options = rich_text_options
+ @classes = system_arguments[:classes]
super(**system_arguments)
end
diff --git a/lib/primer/open_project/forms/rich_text_area.html.erb b/lib/primer/open_project/forms/rich_text_area.html.erb
index 671274e3f04..fc34cef585c 100644
--- a/lib/primer/open_project/forms/rich_text_area.html.erb
+++ b/lib/primer/open_project/forms/rich_text_area.html.erb
@@ -2,13 +2,14 @@
<%= content_tag(:div, hidden: true) do %>
<%= builder.text_area(@input.name, **@input.input_arguments) %>
<% end %>
- <%= angular_component_tag 'opce-ckeditor-augmented-textarea',
+ <%= angular_component_tag "opce-ckeditor-augmented-textarea",
inputs: @rich_text_options.reverse_merge(
{
textareaSelector: "##{builder.field_id(@input.name)}",
macros: false,
turboMode: true
}
- )
+ ),
+ class: @input.classes
%>
<% end %>