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

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

Related

VSCode Wrap HTML attributes each on their own line

I'm looking for a setting or extension in VSCode that provides the following functionality:
Format on save
wrap html attributes on their own line, even if there is only one attribute
put closing symbol of opening tag on new line, aligned with tag
alphabetically order attributes
do not align attributes according to the position of the first attribute, simple use one level of indentation
Example 1:
<span my-attr="value">Hello, world!</span>
becomes
<span
my-attr="value"
>
Hello, world!
</span>
Example 2:
<x-status-indicator wire:click="pushMe" class="block" :status="$status"
:description="$description" />
then becomes
<x-status-indicator
:description="$description"
:status="$status"
class="block"
wire:click="pushMe"
/>
So far there have been many posts about formatting, but I could not find a single post or extension that satisfies these requirements. Any suggestions would be greatly appreciated, thank you! :)

TYPO3 Mask Elements - Wrong output

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

How to make textarea to show text with HTML properties in Ionic?

I have added a textarea on my home.html page. The problem is if I am adding data line wise by pressing enter, now when i save it in the database and show it back on page, it comes in one line
This is how I type:
1. Line one
2. Line two
3. Line three
This is how it is seen on the page:
1. Line one 2. Line two 3. Line three
Below is my HTML code:
<ion-textarea rows="1" autosize #input (click)="focusInput(input)" (input)="change()" id="messageInputBox" placeholder="Type Something To Send.." type="text" name="TAG" [(ngModel)]="TAG" style="z-index:9.99999; color:#818993;font-size:18px; ">
</ion-textarea>
How can I resolve this issue?
Where you echo the contents of your TAG model in your HTML template, you should use a pipe like nl2br-pipe and use it like this:
<div [innerHtml]="TAG | nl2br"></div>
Be aware that you also should sanitize your HTML, before echoing it to your page, more on that here.

Stop nicEdit from creating <p> tags?

I have nicEdit implemented in the backend for uploading news items, and in the frontend each newsitem has a square in front of the beginning of the text body (image attached). This only occurs in the first paragraph of the text.
Due to the paragraph tags added by nicEdit, the text is displayed on a different line than the square. I have searched in the nicEdit docs and in previously answered questions on here but could not find a solution. Is there any way to change the paragraph formatting in nicEdit to use br at the end of a paragraph instead of having it wrap the text with p tags? Or if not, to have Nicdit automatically add the square to the beginning of each text?
Thank you in advance for any help!!
http://i.stack.imgur.com/dxxtu.png
Edit: Turns out the p tags were not caused by the nicedit but by the users copy-pasting the articles. I have used this to remove formatting from pasted text, but the tags are still there (it seems to only remove font properties).
As a temporary fix I have added the square to the nicedit wysiwyg as initial text, so that it is sent to the db along with the rest of the text and inside the same paragraph.
I realized there's a line in the code you modified that specifies all the unwanted tags. You should add the paragraph there.
Search for
/* remove undwanted tags */
newSnippet = newSnippet.replace(/<(div|span|style|meta|link){1}.*?>/gi,'');
in the nicEditorInstance class, and change it to
/* remove undwanted tags */
newSnippet = newSnippet.replace(/<(div|p|span|style|meta|link){1}.*?>/gi,'');
Notice the "p" has been added. That will prevent nicEdit to wrap the paragraphs in tags.

how to text wrap text using WriteHTML in FPDF?

Hi i want to word wrap writehtml()... I have tried $pdf->WriteHTML($text); but right side text display out side of pdf.. I want to fix this using WriteHTML not Cell..
<BR> tag in String works.
http://www.fpdf.de/downloads/addons/41/ ,
http://www.fpdf.org/en/script/ex41.pdf
$pdf->WriteHTML('You can<BR>add a horizontal rule:<BR><HR>');