-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: UFM component filters #2246
Conversation
- Re-structures "ufm-components" folder - Adds `ufmFilter` extension type - Adds `UmbUfmElementBase` to support reusing filters
- Fallback - Lowercase - Strip HTML - Title Case - Truncate - Uppercase - Word Limit
re: @sonarcloud's code duplication issue, this is in a manifest file, of which the duplication of JSON structure is intentional. |
I have added |
This moves the `UmbExtensionsApiInitializer` code from the `ufm-render` and `ufm-element-base` components to the context, for optimization.
… length, otherwise the function might return "..." leading other filters to be confused
|
Important
The details in this pull request may be outdated.
Please refer to the official documentation for the latest UFM syntax.
Description
To support a "filter" feature to Umbraco-Flavored Markdown (UFM), this pull request adds an
ufmFilter
extension type and a base class (UmbUfmElementBase
) for the UFM components in order to support reuse the filter logic.Also in this pull request...
{~value}
, to support document, media and member pickers (both single and arrays), rendering the entity's name as the label{= value | fallback:No items }
{= value | lowercase }
{= value | strip-html }
{ markup, blocks }
{= value | title-case }
{= value | truncate:10:false }
length: number
andtail: string
(defaulting to "…", and omitted if"false"
){= value | uppercase }
{= value | word-limit:10 }
limit: number
argumentNote, UFM filters can be piped together, e.g.
{= value | strip-html | word-limit:30 }
. The filters will also work for the localization and content picker UFM components, e.g.{#general_choose | uppercase}
;{~value | title-case | fallback: No items }
.Types of changes
How to test?
For general testing of dynamic labels can be done within Collection Views, Block List/Grid and Document property descriptions.
For specific testing of the filters, e.g. in a Collection View, try adding the piped filter syntax to
{=value}
labels; also try piping filters, e.g.{= value | lowercase | uppercase | title-case | truncate:4:true}
.