TransWikia.com

Preview for ECL in RichText

Tridion Asked on November 27, 2021

How we can see preview for an ECL image added in RichText field from Media Manager?

Now in rich text I have image inserted as

<img src="ecl:68-mm-234-dist-file" title="[email protected]"... 

2 Answers

DXA best practice is does not recommend embedded multimedia in rich text fields, but if you must...

As stated by Alvin, you can't easily get a preview image.

So if you want to add some style to identify the embedded image, rather than the anonymous grey box, there are a couple of changes you need to make.

1.The DXA Rich Text XSLT Paragraph Filter removes all styles,

< ! - - remove all style attributes except those for a table and its cells and to allow underline - - >

this removes the width and height from the embedded image resulting in nothing showing in the design and preview tabs.

So you should replace this with your own XSLT filter which will allow image styles.

2.The FormatAreaStyles.css selector in %tridion_home%webWebUIEditorsBaseConfigurationFormatAreaStyles.css for the embedded image is

body[contenteditable='true'] img[tcmuri^="ecl"]

Example css:

body[contenteditable='true'] img[tcmuri^="ecl"]{
    display:block;
    -moz-box-sizing:border-box;
    box-sizing:border-box;
    /*padding-left: 2000px; */
    background: url("/BynderPlaceHolder.png") no-repeat; 
    border: 1pt solid black;
    color: black;
    font: 20px Impact;
    text-align: left;
    word-wrap: break-word;
    content: url("/EraseTridionBackground.png");
    width: 200px;
    height: 200px;
}

body[contenteditable='true'] img[tcmuri^="ecl"]::after 
{
    content: " (" attr(style) ")";
}

Answered by Chris Mills on November 27, 2021

See Thumbnails

+1 to @Velmurugan comment to Load Images. ECL items will show a (thumbnail) preview and an icon to note they're ECL items.

However, the rich text format area will not (can not easily) present additional HTML elements to actually render working video in RTF. For background see Yuriy's explanation to: External Content Libraries - GetTemplateFragment.

Preview Videos

Otherwise to preview External Content Library items in their rendered form or with their "player," you can use:

  • Your published Staging environment, optionally with Experience Manager
  • Content Manager Explorer Preview for the Component and/or Page (depending on your templating format and output)

Optional Extra Styling

I think the ECL icon is enough to let your users know something is an external item, but you can probably add extra styles for rich text format areas by adjusting the Content Manager Styles Configuration. See Rob Stevenson-Leggett's post or my post for some examples.

This would be something like the following added to FormatAreaStyles.css:

img[src^="ecl"] { 
    /* add anything else you'd like to otherwise highlight ECL items in RTF */
}

If you're interested, consider joining SDL Web Ideas to vote and comment on a similar enchancement request about showing External Content previews to CMS users. I'd recommend focusing on your use cases rather than the specific solution.

Answered by Alvin Reyes on November 27, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP