When I create a Global Data Type for localizable content in user controls I run into the problem that C1 always surrounds plain text with
<p></p>
I don't want that if the content is just meant to be inside a link for example, but still has to contain html. Even if I use the code view of the Visual Editor, C1 will readd the tags e.h. if I translate the data.
Is there a way to stop C1 from automagically adding html to my string data when using the visual editor?
I suggest you leave the editor as it is and keep on storing your html as valid xhtml documents, and instead handle this when rendering. Not having custom features/design permeate the way you store data could also be a plus in the long run.
One way to achieve this is with XSLT as described in this article "How can I modify the HTML from the Visual Content editor?" - you can also do this with C#.
There has been a few reports of this undesired behavior, but unfortunately its by design. You could argue if ts Composite C1's fault or the underlying TinyMCE editor, but maybe you can tweak the configuration of it. Or wrap the functions that output the content with a xslt-template that will strip out the p's.
See these discussions for further explanations.
TinyMCE Config Change - Force P False
Visual editor adding p tag automatically
Related
edit html option on Stackoverflow
Does wagtail CMS support the ability to edit rich text html code as seen in the screenshot?
No, editing HTML source is not available from Wagtail's built-in Draftail rich text editor. This is because its internal representation of the edited text is not HTML, but its own data structure where entities like links and inline styles are tracked alongside the text, rather than part of the text itself. There isn't a direct correspondence between things that can be represented in this data structure, and things that can be written as HTML.
(Alternative rich text editors might be available as third-party packages that do offer HTML source editing, but I'm not aware of the status of whether they're actively maintained.)
This might seem like a needless restriction, but there are good technical reasons behind it:
It means that images and page links (and anything else that references other objects managed by Wagtail) can be stored as database IDs instead of URLs, so that if those objects change URL as a result of user edits, it won't result in a broken link.
When pasting content from a Word document, there will often be unwanted formatting embedded in it, such as setting the font to Times New Roman. Having a data format that distinguishes between the meaningful 'structural' aspects of the content (headings, links, bold / italic spans...) and the cosmetic ones (style attributes) ensures that these are stripped out.
Some things we want to represent in rich text, such as Youtube embeds, don't have known predictable HTML representations. It's useful for the data format to be able to store these as "a video embed for URL X" rather than "an <iframe> tag with some obscure collection of attributes" - if it was stored as the latter, you'd run into issues of how far a user can edit the HTML before it ceases to be recognisable as a Youtube embed.
I want to be able to write unit tests against Xaml to look for improper patterns. We have issues where the Xaml is still valid and otherwise compiles and "works" fine but can cause hidden issues or lacks consistency. In order to help combat this we want to write unit tests against the files.
A simple example: If you define a grid and the grid column is bound to a numeric field on the underlying object then the column title of the grid should have the appropriate right align template per our internal standards. Leaving the template off the definition will yield a left aligned column header which doesn't really break anything other than our internal standards. Given this is basically xml, I should easily be able to write a test that interrogates the xml element, detects the existence of a numeric column and checks to make sure that the file also defines a title template that is right aligned. This way I don't have to rely on the developer or QA to cover things that are easily testable like this.
I have access to the assembly during the unit test process and can get to all the baml resource files by reading the manifest resource stream. But I can't figure out how to read them into a useful format that I could load into something like an XDocument for parsing and perusing. Has anyone done this? I've tried using Baml2006Reader, etc... without any good success.
If you want to convert BAML to XAML, you could take a look at the following BamlTranslator class on GitHub.
It uses a BinaryReader to decompile the BAML.
How can i add semantic information to e.g. Run and Paragraph Elements e.g. to mark s.th as headlines or code?
This tagging should also survive save and reload of documents in preferable RTF.
I finally decided to use The Tag Attribute and to Store The document in xaml instead of rtf
Trying to separate the content of the page into a single file, so whenever a text on site changes, I dont have to go to every page and change the text but change it from the file and it will reflect on all pages, smth that can be useful for multi language support!
I currently dont have any code written as this is not as important as first thinking of organizing the structure for it, like, what format the text content would be, where to put the file, how to better extract etc.
Wouldn't it be better to just use custom settings and reference the custom settings on your pages instead of hardcoding the values?
I have a requirement to save emails written in a RichTextBox to a database. Obviously, I would like to persist the formatting to the DB and send out HTML emails. However, this requires converting XAML to HTML which will be stored and then converting back if they are reloaded from the DB.
I have tried out the XAMLtoHTML converter. The problem I am getting is that the converter only works partially. It sets up all the formatting correctly in HTML but the text part is missing. I have followed this post:: XAML to HTML Conversion - WPF RichTextBox and had the same error but adding the tags didnt solve the problem.
Has anyone got experience with XAML to HTML conversions? Thanks
Consider using this free HTML Editor for silverlight instead. Html RichTextArea Control (Silverlight 4 Only).
You then load and save HTML and not bother with Xaml at all. Just be careful with the fontsizes, last time I looked only px sizes worked, pt sizes were not supported. You may want to fiddle with the samples font drop down so that the actual value is 1.33 the displayed size.