Skip to content

Commit

Permalink
hack support for macros on statusExplanation and description
Browse files Browse the repository at this point in the history
  • Loading branch information
ulferts committed Mar 28, 2024
1 parent da2087a commit a6b2f3d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion app/forms/custom_fields/inputs/text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class CustomFields::Inputs::Text < CustomFields::Inputs::Base::Input

def rich_text_options
{
resource: nil
resource: nil,
macros: "none"
}
end
end
1 change: 1 addition & 0 deletions app/views/custom_fields/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ See COPYRIGHT and LICENSE files for more details.
cols: 100,
rows: 20,
class: 'wiki-edit',
macros: "none",
with_text_formatting: true %>
<% end %>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ export class FormattableControlComponent implements ControlValueAccessor, OnInit
public get ckEditorContext():ICKEditorContext {
return {
type: this.templateOptions.editorType,
macros: 'none',
// This is a very project resource specific hack to allow macros on description and statusExplanation but
// disable it for custom fields. As the formly based approach is currently limited to projects, and that is to be removed,
// such a "pragmatic" approach should be ok.
macros: (this.templateOptions.property as string).startsWith('customField') ? 'none' : 'resource',
options: { rtl: this.templateOptions?.rtl },
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
status_field.select_option "On track"

status_description.set_markdown "Everything is fine at the start"
status_description.expect_supports_no_macros
status_description.expect_supports_macros

click_button "Save"

Expand Down
4 changes: 2 additions & 2 deletions spec/support/components/wysiwyg/wysiwyg_editor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ def expect_value(value)
expect(editor_element.text).to eq(value)
end

def expect_supports_no_macros
def expect_supports_macros
expect(container)
.to have_no_css(".ck-button", visible: :all, text: "Macros")
.to have_css(".ck-button", visible: :all, text: "Macros")
end

def within_enabled_preview
Expand Down

0 comments on commit a6b2f3d

Please sign in to comment.