Is there any rich text editor available that can generate "AS3 Compatible" codes?
I want to add this to the web admin, where user can set the font size and color of the text and it should generate as3 compatible code like:
<p><font size="12" color="#000000">Welcome to</font> <font size="30" color="#ffffff">My Website</font></p>
I used the CKEditor, but it generates like this:
<p><span style="font-size:12px; color:#000000">Welcome to</span></p>
I am assigning this value in my textfield with txt.htmlText.
If there is not any such text editor available, is there any way to render the above "span style" in the as3 textfield?
Although you say that you've been using CKEditor, it seems that you haven't configured it correctly.
Check this sample: http://nightly.ckeditor.com/latest/ckeditor/_samples/output_for_flash.html
As nowadays CSS is common practice, I guess it'll be hard to find an editor that will spit old style html. Flash only supports a handful of html tags. So you might want to use the CKEditor output, strip the style part, scour it for tags that flash would support and inject those back into the html.
[edit] I found something related here
Related
I've just installed CKeditor rich text WYSIWYG editor on a site I'm building and it seems to be working ok except for the fact that it inserts text into my mysql database as encoded html rather than regular html and then when the browser outputs this text it converts the encoded data into regular html that then displays in the browser showing the html tags and none of the styling!?
eg I type:
"This is text"
into the editor and it then inserts
<p>This is text</p>
into the database. Then when the page is called the browser converts the above and outouts the following on the page:
<p>This is text</p>
obviously I just want "This is text" to display on the page.
Does anyone know why this is happening/how to solve it please?
Any suggestions would be most welcome.
Cheers
If you don't want CKEditor to create paragraphs for you, set config.autoParagraph to false. Additionally you may want to change enter key behaviour with config.enterMode set to CKEDITOR.ENTER_BR.
And regarding disappearing styles...
EDIT: OK, it seems I missed your point.
So your website is displaying HTML markup instead of HTML while rendering out what you typed?
Then the problem is your server side rather than CKEditor. You can verify in your console that CKEDITOR.instances.yourInstance.getData() yields the correct, unescaped HTML:
<p>This is text</p> // Right!
If it is so, and I strongly believe it is, CKEditor's just fine and this is your server app that is converting special chars into entities (i.e. like PHP htmlspecialchars) while saving to database. You didn't mention what kind of framework/language you use there, so I can just tell you that it is to secure user input to prevent cross-site scripting, breaking layouts etc. and all popular frameworks allow you to disable that feature for a particular field. Simply refer to documentation.
Modern templating languages tend to autoescape html input. For example, in DTL it would be displayed correctly in the template by simply using
{{ object.field_name|safe }}
This is a desired action, since user input is considered untrusted and may be considered malicious.
The browser is not parsing HTML, so on the page displaying (or in the php file) try using {! !} instead of {{ }}.
If you are using laravel, then you should use {!! $variable !!}.
For Laravel 7, 8, and 9 - foreaxample if there is a varable called- $student
and student varable holds "This is Text" in paragraph you must call the varable using singla culy brace front and back, inside two
TinyMCE is used in one of my projects as it was meant to be used; a WYSIWYG HTML editor.
I created a number of plug-ins for it that inserts certain fragments of text into the HTML and all is working fine. The plug-ins use TinyMCE's createMenuButton to create a menu button and tinyMCE.activeEditor.execCommand('mceInsertContent', ...) to do the inserting.
Now I need to add an editor for plain text in the same project. The text-only editor would also need to be able to insert those same fragments of text into plain <textarea> or <input type="text"> inputs.
Rather than duplicating code, I'd like to re-use the plug-ins written for TinyMCE.
Is there any way to either use TinyMCE as a plain text editor or use just the individual plug-ins?
I'm using TinyMCE 3 and can't upgrade to 4 due to missing essential features.
You could use the editor "as is", but strip the html tags afterwards.
I have problem with a web page where it is display some symbols wrongly only in mozilla. The page is click here In this page there are so many -> symbols used. It is displayed as ® in mozilla. So how can i make it to display properly as -> symbol in mozilla. The page has style which are created by micosoft word. I want to retain those as it is.So any css trick can i use it to do?
To get the error i am facing please go to this page and search for software ® click ‘Buy now’.
You use specific Microsoft extensions :
<span style="mso-list:Ignore">§<span style="font:7.0pt "Times New Roman""> </span></span>
And defining fonts in style enclosing them with " is clearly buggy.
I don't know what MSWord tries to do but it's obviously not trying to build a standard HTML document for the World Wide Web. Is that a recent version ?
You'll have to fix the generated HTML.
Another problem is that your rendering relies on the Times New Roman font, which isn't available in non Windows computer.
Using standard HTML and encoding your document in UTF-8, you could replace those spans with simple arrow characters.
But the better solution would be to simply forget the idea to convert a MSOffice document to HTML and to build a proper HTML document instead.
I currently have a textarea control on a page. The user will enter text into the control. The content of the control is bespoke code.
I want to (from code) be able to apply formatting (color / bold / italic / font) to different parts of the text- very much like visual studio.
Like visual studio, and any other IDE, i dont want the user to have control over formatting the textarea- most editors i see give a control which the user can change style.
Any thoughts would be much appreciated.
I'm guessing you're talking about a WYSIWYG editor for a textarea. You should try using TinyMCE or CKEditor. These editors use a html attribute called 'contentEditable'. So by setting this attribute to true (e.g. <p contentEditable="true"></p>) they can then use the content editable javascript methods to edit it, providing an interface that calls the javascript of course. You can read a little about contentEditable and the similar attribute designMode here on WebMonkey.
I am using the wysiwyg editor TinyMCE and I have stripped out most of the functions to create a simpler version. However, I need the make the formatting as basic as possible as well, e.g., instead of <p> tags i need to use <br /> tags. Also, I would like it to not convert ' in ’ as I will be using the output in Flash.
The only editing tools still left in it are bold, italic, underline and link/unlink.
You can enforce the use of <br> with the configuration option force_br_newlines and you can define the encoding with the configuration option entity_encoding.
entity_encoding: "raw"
force_br_newlines: true,