From 3b8cc98e1ee133694f4fe0a8ee3d7b01adf57b74 Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Tue, 28 May 2024 17:30:52 -0700 Subject: [PATCH 1/4] Use TextArea in MarkdownField By Default Fix #12318 --- .../Drivers/MarkdownFieldDisplayDriver.cs | 6 ++--- .../Views/MarkdownField-TextArea.Edit.cshtml | 22 ------------------- .../MarkdownField-TextArea.Option.cshtml | 4 ---- .../Views/MarkdownField.Edit.cshtml | 2 +- 4 files changed, 4 insertions(+), 30 deletions(-) delete mode 100644 src/OrchardCore.Modules/OrchardCore.Markdown/Views/MarkdownField-TextArea.Edit.cshtml delete mode 100644 src/OrchardCore.Modules/OrchardCore.Markdown/Views/MarkdownField-TextArea.Option.cshtml diff --git a/src/OrchardCore.Modules/OrchardCore.Markdown/Drivers/MarkdownFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Markdown/Drivers/MarkdownFieldDisplayDriver.cs index ec1c4060ea9..18de59d06ad 100644 --- a/src/OrchardCore.Modules/OrchardCore.Markdown/Drivers/MarkdownFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Markdown/Drivers/MarkdownFieldDisplayDriver.cs @@ -57,9 +57,9 @@ public override IDisplayResult Display(MarkdownField field, BuildFieldDisplayCon // The default Markdown option is to entity escape html // so filters must be run after the markdown has been processed. - model.Html = _markdownService.ToHtml(model.Markdown ?? ""); + model.Html = _markdownService.ToHtml(model.Markdown ?? string.Empty); - // The liquid rendering is for backwards compatability and can be removed in a future version. + // The liquid rendering is for backwards compatibility and can be removed in a future version. if (!settings.SanitizeHtml) { model.Markdown = await _liquidTemplateManager.RenderStringAsync(model.Html, _htmlEncoder, model, @@ -75,7 +75,7 @@ public override IDisplayResult Display(MarkdownField field, BuildFieldDisplayCon if (settings.SanitizeHtml) { - model.Html = _htmlSanitizerService.Sanitize(model.Html ?? ""); + model.Html = _htmlSanitizerService.Sanitize(model.Html ?? string.Empty); } }) .Location("Detail", "Content") diff --git a/src/OrchardCore.Modules/OrchardCore.Markdown/Views/MarkdownField-TextArea.Edit.cshtml b/src/OrchardCore.Modules/OrchardCore.Markdown/Views/MarkdownField-TextArea.Edit.cshtml deleted file mode 100644 index f30ad769431..00000000000 --- a/src/OrchardCore.Modules/OrchardCore.Markdown/Views/MarkdownField-TextArea.Edit.cshtml +++ /dev/null @@ -1,22 +0,0 @@ -@model OrchardCore.Markdown.ViewModels.EditMarkdownFieldViewModel -@using OrchardCore.ContentLocalization -@using OrchardCore.ContentManagement.Metadata.Models -@using OrchardCore.Markdown.Settings -@using OrchardCore.Mvc.Utilities -@using OrchardCore -@{ - var settings = Model.PartFieldDefinition.GetSettings(); - var culture = await Orchard.GetContentCultureAsync(Model.Field.ContentItem); -} - -
- @await DisplayAsync(await New.ShortcodeModal()) - -
- - @if (!string.IsNullOrEmpty(settings.Hint)) - { - @settings.Hint - } -
-
diff --git a/src/OrchardCore.Modules/OrchardCore.Markdown/Views/MarkdownField-TextArea.Option.cshtml b/src/OrchardCore.Modules/OrchardCore.Markdown/Views/MarkdownField-TextArea.Option.cshtml deleted file mode 100644 index 84c163d22df..00000000000 --- a/src/OrchardCore.Modules/OrchardCore.Markdown/Views/MarkdownField-TextArea.Option.cshtml +++ /dev/null @@ -1,4 +0,0 @@ -@{ - string currentEditor = Model.Editor; -} - diff --git a/src/OrchardCore.Modules/OrchardCore.Markdown/Views/MarkdownField.Edit.cshtml b/src/OrchardCore.Modules/OrchardCore.Markdown/Views/MarkdownField.Edit.cshtml index 9e174a57c7c..f30ad769431 100644 --- a/src/OrchardCore.Modules/OrchardCore.Markdown/Views/MarkdownField.Edit.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Markdown/Views/MarkdownField.Edit.cshtml @@ -13,7 +13,7 @@ @await DisplayAsync(await New.ShortcodeModal())
- + @if (!string.IsNullOrEmpty(settings.Hint)) { @settings.Hint From 660f5ab8c6e3c17f94e3948f323c2707e802ea2d Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Wed, 29 May 2024 20:49:38 -0700 Subject: [PATCH 2/4] adding release notes --- src/docs/releases/2.0.0.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/docs/releases/2.0.0.md b/src/docs/releases/2.0.0.md index 9deac8831e2..12bda8ff74b 100644 --- a/src/docs/releases/2.0.0.md +++ b/src/docs/releases/2.0.0.md @@ -515,3 +515,8 @@ public class ReverseProxySettingsDisplayDriver : SectionDisplayDriver Date: Wed, 29 May 2024 20:50:41 -0700 Subject: [PATCH 3/4] cleanup --- src/docs/releases/2.0.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/docs/releases/2.0.0.md b/src/docs/releases/2.0.0.md index 12bda8ff74b..4a249f3e604 100644 --- a/src/docs/releases/2.0.0.md +++ b/src/docs/releases/2.0.0.md @@ -516,7 +516,7 @@ public class ReverseProxySettingsDisplayDriver : SectionDisplayDriver Date: Thu, 30 May 2024 07:56:40 -0700 Subject: [PATCH 4/4] Update src/docs/releases/2.0.0.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Zoltán Lehóczky --- src/docs/releases/2.0.0.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/docs/releases/2.0.0.md b/src/docs/releases/2.0.0.md index 4a249f3e604..64dce12a17f 100644 --- a/src/docs/releases/2.0.0.md +++ b/src/docs/releases/2.0.0.md @@ -518,5 +518,6 @@ Prior to this release, if you had a module with multiple features, you had to us ### Content Fields -Before this release, the `MarkdownField` used a single-line input field and offered two different editors: TextArea and WYSIWYG. Now, by default, it uses a TextArea, and the MultiLine option has been removed since TextArea is now the standard editor. -W \ No newline at end of file +Before this release, the `MarkdownField` used a single-line input field by default (named the Standard editor) and offered two different editors: Multi-line with a simple `textarea` and WYSIWYG with a rich editor. Now, by default, it uses a `textarea` as the Standard editor, and the separate Multi-line option has been removed. + +You have nothing to do, fields configured with the Standard or Multi-line editors previously will both continue to work. Note though, that their editors will now be a `textarea`. \ No newline at end of file