Tag: HTML

Getting Sitecore Dictionary in JavaScript

It’s very easy to get translations in back-end code — either Razor views or .cs files — by simply calling to

Sitecore.Globalization.Translate.Text()

But what about JavaScript widgets? There we have several options:

  • Item Web API results in overhead and is hard to use without additional implementation.
  • StringDictionary embeds values right in HTML and needs to be configured accordingly.
  • Injecting translated text into .js components via HTML tags has the same drawbacks as StringDictionary.

All these options are cumbersome and inconvenient.

Continue reading “Getting Sitecore Dictionary in JavaScript”

How to strip tags in the Rich Text Editor – Not breaking Sitecore

This is the third post in the series about Rich Text Editor (RTE) in Sitecore. The first post which was about the basics of setting up the RTE could be found here.

Copy-paste wrecks your day

So, you have configured your editor and specified access for HTML edit buttons to appropriate people only. If you think that this is the end – unfortunately I have to disappoint you. As an editors are a little bit lazy and don’t want to type a lot – they prefer to copy & paste. And in this case our RTE can lose its head.

Let’s imagine that editors prefer to prepare some content in Microsoft Word (from my experience it’s so often). In this case when they paste something formatted from MS Word into RTE the result will be a little bit ugly.

word-formatted-html
Word formatted HTML (it rhymes with ‘Hell’ for a reason)

Luckily the Rich Text Editor is a powerful tool and comes with mechanics to strip tags when pasting.

Continue reading “How to strip tags in the Rich Text Editor – Not breaking Sitecore”