Convert WMD editor content in HTML format - wmd

I am very new to using this WMD editor. In a simple way, I am using this editor in my page using ASP textbox with a "wmd-input" class. It is perfectly behaving like a WMD editor.
But when I enter some data and do some formatting like bold, italic, etc. and read the editor's content from the server side, I can see the data in plain text.
Is there any way I can read the data as HTML formatted data?

QnaUserClaims.GoldBadgesCount = InsertedUserObj.GoldBadgesCount.ToString();
QnaUserClaims.SilverBadgesCount = InsertedUserObj.SilverBadgesCount.ToString();
QnaUserClaims.BronzeBadgesCount = InsertedUserObj.BronzeBadgesCount.ToString();
QnaUserClaims.Reputat

Related

How to get and set the markdown for what's selected in wysiwyg mode?

I'm trying to add some extra toolbar tools and need to get and set the markup for what's selected while in wysiwyg mode.
When i use tuiEditor.getSelectedText on a link i just get the text label, and when i use tuiEditor.replaceSelection with the correct syntax it escapes the brackets to that text appears in the page (i.e. converts [text](url) to \[text\]\(url\).
It works fine in markdown mode.

Changing part of text to a different color in an input

Am a newbee to javascript but have plenty of experience in VB, C, and even 86 assembler. Maybe I am trying to do the impossible in porting a VB app to js here. Basically, I need to change the color for only part of the string in an input element. Here is the problem:
A function takes an entered input box text field, and processes it first to see if it is in conformity to a set of requirements. If part of that string is not in conformity, I would like to in some way highlight that part in the input field. For instance, maybe I can send back the string to the input element (eg using the value attribute) but with some highlighting for that part, such as changing its text color or background color. Is this possible in js?
I'm not sure whether you can change colors of partial text in a simple text box. But what you're trying to do is certainly possible with this: https://editorjs.io/
The example on the homepage shows you how.
I hope this is a possibility for you and not too heavy for your purpose.

Embed a font into PDF form

I have a PDF form generated by LibreOffice. Since to a known bug in LibreOffice only a font subset is embedded into PDF even when the font is used in form fields. Therefore the form is not usable or form fields are using a wrong front (depending on PDF viewer) if the font is not installed on computer.
So I have to replace form subset in PDF form by whole font after generation in LibreOffice. Normally using ps2pdf or gs is recommended to fix a font issue in a pdf. But both programs don't support PDF form. If using them on a PDF form the form fields are broken. I tested it with Ghostscript 9.10 under Unbunt 14.04 LTS.
I can use pdffonts to show fonts embedded in PDF. But is there also a command-line tool to embed another font into a PDF?
Libreoffice v5.2 embedding fonts for forms fields is easy:
Enable the font in the form field:
() Right-click form field > Control > Font
Then tell your document to include the used fonts into its file:
() File > Properties > Font tab > Embed fonts into document
In my case filesize increases from 50k to 5000k (using one font
with two styles).
At last check PDF options to include fonts into pdf:
() File > Export to Pdf > General tab:
x Enable Create PDF form (to make the form fields fill-in ready to the user).
Not shure whether both of the following options are needed:
x Tagged PDF and
x Hybrid PDF: The later will enlarge pdf to the size of the LibreOffice file.
Until the bug gets resolved, you can use PDF Toolbelt to fix your forms.
After downloading the JAR file, the font of all fields can be reset to the default values of Adobe Acrobat:
java -jar ./pdf-toolbelt.jar form-font-defaults input.pdf output.pdf
Disclaimer: I'm the author of the above-mentioned tool.
This is just a workaround: place a text edit field on the page that is invisible and locked which contains a default string of your likely character set. While you will still get a subset font, it would be a substantially larger subset.
There are a number of commercial solutions that can fully embed a font in a PDF, if a commercial application is a viable option in your case (they will be expensive to "just" do this probably). The two major contenders are probably callas pdfToolbox (caution: I'm associated with this product) and Enfocus Pitstop.

Can I use multiple font style in UITextView?

I have a requirement to use multiple font style in UITextView. Like Bold, Italic and Underline text in single Textview. Like:
One word is Bold second may be italic third Underline as per user selection.
I don't think this is allowed to do but still if any one have achieved and want to share. I need this all while enter text and same while displaying.
Thanks
You're right that the standard UITextView does not support rich editing. At the moment there are a few solutions to the problem.
The Omni Group has released their iOS and Mac frameworks under an open source license. These include a very powerful rich text editor (see: OUIEditorFrame.m). These are very powerful but also extremely complex. Their sample iPad app includes the rich text editor example. Further discussion can be found here
Secondly, this guy has been working on a custom rich text editing control and is offering it under a negotiable licensing agreement.
Finally, you can do it all yourself and create an editor control that implements the UITextInput protocol. Aside from the Apple documentation, there are some tips on doing this here.
Why don't you use attributed string and use its property to set the string as you like.
Reference link : https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/AttributedStrings/Tasks/CreatingAttributedStrings.html

Sharepoint: display plain text field as html

I have a Sharepoint list, where one of the columns is plain text - Description. When you edit a list item, Description field is normally a TextArea. I have it programmed that this TextArea is extended with JavaScript to accept rich text (html really), so I have my custom rich text field. The problem is that when I input the rich data everything looks fine but when I save the edited item and then display it, the text is displayed as plain text, not html, so instead of a bold text I get "< b >text< /b >". And I would like it to be displayed as html. What can I do with it?
Edit: I don't want to use the built-in editor, because I need some different behavious.
The code that reads in the text input from the form and saves it to the list will be doing a HTMLEncode operation that replaces
< with <
> with >
and so on (look at the source of the page after a save)
This occurs 'server side' so you won't be able to change this using JavaScript.
You've got two options I think
As F5 mentioned you can create a custom field type with your own behaviour for rendering and update. This is the 'correct' way to do this.
You could change your funky javascript to work on a rich text field, hack into the rendering of the built in RTE and replace it with your own.
Of cource as soon as you are taking input from a user and then rendering it back to your web page you open yourself up to all sorts of nasties such as Cross Site Scripting if you are not filtering out potential bad stuff (the very reason why the HtmlEncode is used) - less of a problem in a typical SharePoint site on an Intranet than a public facing site.
SharePoint supports rich text columns using its own in-built editor. You just have to change the column settings so it allows rich text.
If you are using a JavaScript editor because of browser compatability with the built-in rich text editor then SharePoint will always strip the html from whatever is entered as it expects the input to be plain text.
Re your comments
If you want the field to display in rich text it needs to be a rich text field, by setting it to plain text you are always going to lose your custom formatting.
You need to look into custom field types
So where exactly are the data being displayed incorrectly: on the List Display Form or on a Page Layout? If it's on the Page Layout the fix is easy: create a custom Field Control which will retrieve the value of the field (like SPContext.Current.ListItem["YourField"]) and decode the contents to get HTML instead of encoded HTML entities.

Resources