How do you replace text with images within a html text box - html

I have a messenger application that allows users to send messages through a HTML text area. I have emoticons that I want to change the text out for when the right code is entered.
For example if a user writes "hi :)" the smiley face should be replaced with the image.
Is there a way to achieve this using Typescript & Angular2?

Related

How to insert or embed sample code to my html page's with the right color?

example is stackoverflow's sample code area, where you see the code being presented,
I tried using the the and tags, but it only display a plain black text,
I want to look like this enter image description here
enter image description here
You need to parse each and every word being typed. Words that you see coloured are nothing but 'reserved words'.Simply use a rich text-editor like tinymce. Or you need to write a custom parser for the same.

Saving text as HTML from form

I have a form with a text field that users input text into. They can use multiple lines, put in bold text, underlined text, etc., but the text, when saved to SQL Server doesn't have any formatting saved, just the text is saved. What is the best way to save the text with the HTML so that when it gets viewed by another user and pulled up from Sql Server the HTML is saved and the formatting is saved?
Ex.
hello
Paul
This would be saved as
helloPaul
you can't see it but there are bold and carriage return html tags rapped around the text
When receiving data from the user, on the server side code, use HTML encode to safely store the data:
var inputData = Server.HtmlEncode("<strong>some data input from user</strong>"); //insert your user input data variable here
Then when displaying the data in your cshtml page, decode the data to display it as the user entered it:
HttpUtility.HtmlDecode(saveUserDataFromDatabaseVariable);
All this is assuming you have a rich text editor being plugged into the input field. CKEditor and TinyMCE are good ones.
You can use a text editor. Take a look at CKEditor. It's free and easy to use :)
Can you post some code and more details?
I have had good success with CKEditor. It is customizable, and its content can easily be saved via postback to a standard asp:TextBox.
It is possible that the editor you are using is not actually updating the input/textarea that you are using, it may be cloning the text and drawing the formatting in an overlay. You can use developer tools, or javascript, to verify this by checking the value property of the input or textarea element. If it is being saved via AJAX or javascript the code may be using the textContent or innerText properties instead of innerHTML.
I used the richtexteditor dll that's free online. it gave me a wiziwig box that the user can edit texxt in.

Sending HTML e-mail with Lotusscript agent

How to send a e-mail with html content and inline images using lotusscript agent?
GMail removes the inline images to file attachments.
IS it possible to prevent this?
Modification as requested in comments:
I have created a document to be used as mail template. This can be a normal memo in your mail file. In the body I added an image, like company logo, and some text. This memo is sent with lotusscript insted of manual sending button.
The lotusscript agent first remove the body and copy its content to a temporary rtitem. The text is replaced with merge field values. Then a new rich text item is created with the replaced text. The result of the text processing is a removed inline image in gmail.
Hope this information is enough, and this is the reason I think the code is not interesting here.
"MIME HTML inline"
look here http://www-10.lotus.com/ldd/nd6forum.nsf/0/c570f4a6e09a0d7585257333005217e9?OpenDocument
on gmail works.
all best

iOS - Converting HTML to Normal text

In my application, I'm receiving an html file from a news server.
After receiving, I want to remove the tags, images, URL anchors, etc and just show the text in text view.
There's a website which functions similar to the one that I'm looking for. The website takes html as input and removes the tags and displays just plain text as result. I want to achieve similar function in my app and display only the text from the news received.
Any libraries or open source web services available for this?
There is this library here, you could do something like this:
NSString *htmlStripped = [[NSAttributedString attributedStringWithHTML:DATA_FOR_MY_HTML options:nil] string];

How to create readonly textbox-like structure using html (div/span) and css?

I have a web page with a read-only text box which shows some HTML code:
<input type="text" readonly="true" value="<table>...</table>"/>
There is also submit button, which causes page post back and XSS validation to trigger. I don't want to turn off XSS.
I also tried disabled="disabled", but then the user is not able to copy the text in the text box.
So I thought that using div and span which can give same look and feel would suffice and negate the need for turning off the validation. While trying this, I am struggling to restrict the string in one line. As in text box, it is a single row with column size and text is shown nicely, we can also copy text.
Is there a better solution for what I'm trying to do?
If I understand you correctly you're trying to show some example code in a web interface that is formatted for easy consumption by the end user.
As a general rule, you should wrap code snippets in <pre></pre> tags, I would then suggest having a go at using: http://alexgorbatchev.com/wiki/SyntaxHighlighter to format the code as if you were viewing in an IDE.
This will prevent you from having to turn of the XSS checker.
you could use <pre> tags
check this link