ReactJS: get mediumtext from MySQL and view formatted text - mysql

I have a very specific problem, so:
I have a medium text in My MySQL database. for example (with breakline):
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
I would like to get this text now using the get HTTP method and on my site display, all Lorem Ipsum in bold.
Is something possible to get?
I use ReactJS with Redux + Redux-Saga
or Maybe IN databases, I can insert the medium text in html but how to display it on the frontend then?

Store html and use dangerouslySetInnerHTML to render it. You can have a deeper look into it reading this post.
const text = '<strong>Lorem ipsum</strong> dolor sit';
const App = ({html}) => (
<div dangerouslySetInnerHTML={{ __html: html }} />
)
ReactDOM.render(<App html={text} />, document.getElementById('root'));
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>
<div id="root"></div>

Related

Adding paragraphs to strings in JSON

I'm trying to add a paragraph to a long text. Already tried using tags like "\n", "\\n" and "\\r", but it's useless. Here's my string:
{
"text": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book."
}
Can't believe I've not been able to add a simple linebreak yet. Anyone, please?

How do I place this text below, on mobile view (blogger website)?

so I am brand new to web development (and to anything that requires code) and I've encountered this issue when working on my blogger website. I imported the theme template and I'm currently trying to learn to work with it.
this is how it looks on desktop (this is fine)
And this is how it looks like on something like an IphoneX (I suppose I'd want the text to be placed below instead
I'm not exactly sure what part of the code I should copy in here so I'll just type in the url:
psycoachalpha.blogspot.com
If anyone can help me fix this, or if you need any more information to do so, let me know. Thanks!
You can use a flexbox approach with flex-wrap: wrap, so the overflowing item gets on a new line
if you are using bootstrap you can use the Grid system which will allow you to display the blog side by side on desktops and for the text to go below the image on mobile
<div className="row">
<div className="col-sm-4 col-lg-4">
<div className="skill-item">
<img className="sticky" src="https://via.placeholder.com/400x790/444444.jpg" title="single-img-five" alt="single-img-five" />
</div>
</div>
<div className="col-sm-8 col-lg-8">
<div className="skill-item">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book</p>
</div>
</div>
</div>

Is there any way to open link in anew tab from inner html (angular 6)

I have a span tag with inner html like this
In my html :
<span [innerHTML]="description"></span>
and in my ts:
description = "some random text https://stackoverflow.com/ Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s"
It displays the link but when I click on that link it is opening in the same tab but I want it be opened in a new tab.
Is there any way to do this?
In this case that you are using innerHtml property binding you can place a html link in your description text with target="_blank" to open the link in a new tab:
description =
'some random text https://stackoverflow.com/ Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s';

Having issues adding a photo to XML file

Hello and thanks for looking into my issue, I am currently working with an XML file that is being pulled to create a directory list. What I am trying to achieve here is to display an image next to the person's name but it seems like no matter how I link it the image it doesn't display on the browser.
I have tried to add the image as ,
<profile>
<lastname>Sample Last name</lastname>
<firstname>Sample First name</firstname>
<middlename></middlename>
<lastfirstname>First_Last</lastfirstname>
<indextitle><![CDATA[Dean]]></indextitle>
<photo>photo.jpg</photo>
<bio>
<![CDATA[<p>Lorem Ipsum is simply dummied text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>]]>
</bio>
</profile>

How to select multiple blockquotes with sublime text and remove unecessary tags inside?

I have a huge XML file with multiple blockquotes code sections like this:
<blockquote>lorem Lorem Ipsum<i> is simply dummy text</i> of the printing and typesetting industry. "Lorem Ipsum has been the industry's standard dummy text" ever since the <b>1500s</b>, when an unknown printer <i>took a galley</i> of type and scrambled it to make a type specimen booki>
I need to select all the blockquote and content inside blockquote tags in order to remove and clean unnecessary tags like:
<i>, <em>, </em>, </p>, </i>, <b>, </b>, <strong>, </strong> and " inside the text.
End results:
<blockquote>lorem Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book</blockquote>