TYPO3 Mask Elements - Wrong output - typo3

I am using TYPO3's mask element extension to create a mask element. There I'm using a RTE to enter some text and print it to the screen. The HTML for the mask element looks like this:
<f:if condition="{data.tx_mask_text}">{data.tx_mask_text}<br /></f:if>
The problem now is that I can add some text here and it also is printed. But the text also includes HTML tags. So if I type in "Hello" as text into the RTE, then the output is <p>Hello</p>.
Any idea how to fix this?

I had a similar issue. All you need to do is add some ViewHelper to your variable, which should be printed, in your case:
<f:if condition="{data.tx_mask_text}">{data.tx_mask_text -> f:format.html(parseFuncTSPath: 'lib.parseFunc')}<br /></f:if>
The ViewHelper removes all the tags from the text. See further information here:
https://docs.typo3.org/other/typo3/view-helper-reference/9.5/en-us/typo3/fluid/latest/Format/Html.html

Related

How to display newline in TimelineItem control's text property?

We have a SAPUI5 timeline control, where we are showing the comments coming from server.
The issue is, if the comments contain a newline \n, then the Timeline control is not able to display the text in newline. Instead, it introduces space wherever \n is present.
We have tried formatting \n to unicode character also but that also didn't worked. Timeline control aggregates TimelineItem.
The control we are using is: https://ui5.sap.com/#/api/sap.suite.ui.commons.TimelineItem
Code snippet can be found at:
https://jsbin.com/kuluyehilu/edit?html,output
I inspected your example and came up with the following solution.
Since the text is embedded in a <span>, all unnecessary whitespace will be trimmed. What you can do is telling the span (via CSS) that it should display the whitespace anyway.
If you don't have a CSS file in your project yet, create one. Then add the following lines
div.sapSuiteUiCommonsTimelineItemShellBody>span {
white-space: pre;
}
This should do the trick.
JSBin: https://jsbin.com/feladeneso/1/edit?html,output
If you inspect the rendered element, you will see it actually put in the break:
<span id="__item0-realtext">x
y</span>
...but did not convert it to a <br/> tag. You cannot add the tag yourself since it will be escaped, either. Maybe you can try to override the renderer, and convert any line breaks to html breaks

tinymce removes line breaks so all text is in a continuous chunk with no paragraphs

I'm using TinyMce textarea editor and have a problem. As you probably know Tinymce transforms a standard html textarea into a rich text editor.
On our 'edit listing' page we call up some text from our db for the user to edit (previously in a standard textarea, now in the tinymce textarea.
Previously the standard textarea would preserve linebreaks and the user would get several paragraphs of text in the text area, now with tinyMCE they get a huge chunk of text with no linebreaks. (I have pasted an example of an entry in our db below - as you can see it has line breaks in it by tinymce seems to be ignoring them when it displays them in the editor).
Just to clarify my issue is now that tinymce is stripping something when I submit the form, it's that when I pull text (that contains line breaks) from the db and populate the tinymce textarea with that data (for the user to edit) in the tinymce textarea - the text appears (in the tinymce textarea) as one massive chunk of text with my paragraphs (whereas in a standard textarea it is nicely formatted with linebreaks)
Any help on how to resolve this would be greatly appreciated - do I need to use some sort of populate() type function to put the text in, or maybe I need to replace all the linebreaks with a different special character that tinyMCE will recognise as a line break and preserve?..
Thanks in advance.
Nick
example from db:
Here is line one
Here is line two
And here is line three
Which appears in tinymce as:
Here is line one Here is line two And here is line three
I faced a similar a problem, a while back and had questions just like yours. Also I finally ended up on SE just like you.
Anyway, I think I have the solution to your problem. If you are using PHP as your server side language, then you should use nl2br() PHP function.
Suppose you have stored your content fetched from the database in a php variable. Something like this:
$content = $row['content'];
Now when displaying it on to your screen, use the nl2br() function.
echo nl2br("<p>".$content."<p>");
Now, this part inside () depends on how you want to output the data. And I will leave it to you to figure that part out.
Hope this helps.

How to highlight a text with double simple quotes '' in a HTML section

I'd like to highlight one or two words in a <HTML></HTML> section in a dokuwiki (2014-05-05 "Ponder Stibbons") page like I'd do outside of the section with ''one or two words'' or with apostrophe in SE markdown. How can I achieve that? Example (embedded HTML option has to be enabled in configuration):
====== Title ======
<HTML>
<ul>
<li>Magic should happen ''here'', except not with '' because it isn't recognized</li>
</ul>
</HTML>
The following doesn't suit my needs
<tt>one two</tt> simply doesn't look the same
Besides this I don't have any ideas...
Try enclosing the string in &quot tag like &quotkey&quot i.e. &quot tag appended with semicolon
May be misunderstood your question , now more clear
Try something like this if it helps by enclosing in code tags as shown in :
https://www.dokuwiki.org/faq:lists
Magic should happen 'here', expect not with because it isn't recognized
Also,check out the following link :
https://www.dokuwiki.org/wiki:syntax

In Tritium, how do I remove text from a node?

I have some HTML content structured like this:
<div>
random text I want to remove
<span>Important Text #1</span>
more text I want to remove
<span>Important Text #2</span>
</div>
How do I remove the text in this div while keeping the important content?
Use remove_text_nodes() to remove text.
Please check this url for solution :- http://tritium.moovweb.com/c3387d70958324469350596c6ef334a7da4ac4f1

Defining what html tag to follow another given html tag with TinyMCE

I want to define an html tag to follow another tag. E.g. if I insert a dt tag and hit return, I'd like it to insert a dd and vice versa in the same way it defaults to a p tag following a heading tag. Is this something built into TinyMCE? Or something that can be achieved simply otherwise?
I assume you are talking about inserting your tags by keyboard directly into the editor.
There is nothing prebuilt inside tinymce with this functionality. You will have to write your own plugin and check for each keyboard press if dt or dd has been inserted. Then you will have to replace dt&dd with the tag you wish.
This insertion will have to take place manipulating the dom (and not the editors text).
Be aware that you will need to take care that dt- and dd- tags don't get cleaned out by setting the custom_elements in your configuration.