How do i create rich text editor - javascript

I will be straight to the point how do i design this with css and html or are they external plugins I can use to achieve this. What we write our questions on stackoverflow. I have a client that needs this on their blog area

It is called it rich text editor and uses JS/jQuery, (or some other languages), to make it what it is.
After inspecting it, it looks like this text area is custom made, requiring much time and expertise.
I would advise using a different rich text editor. I have normally used CKEditor, but you could also use TinyMCE. There is a bunch more, just google "rich text editor".

As far as I know the best is, very easy to use and super powerful:
Example: https://jsfiddle.net/dalinhuang/5nt56n0y/
HTML:
<script src="https://cdn.ckeditor.com/4.6.2/standard/ckeditor.js"></script>
<textarea name="editor1"></textarea>
JS:
CKEDITOR.replace('editor1');
Offical site: http://ckeditor.com/

Related

How can I remove these specific tags "<div><p> </p></div>" found in my article using CSS if not using jQuery

<div><p> </p></div> - These tags has been added to my code because of a wysiwyg editor that I can't tweak or change. How can I remove it ideally using CSS or if not jQuery as it messes my layout.
Here is the structure generated by the wysiwyg and I need to clean it up. I can't change the wysiwyg editor because there are already lots of articles written using that editor. Only solution I can think of right now is purely frontend. By the way the platform is Rails
Thanks!
In your HTML
<div class="tempDiv" style="display:none"></div>
And then some jQuery:
var crappyString = "<div><p> </p></div>";
$(".tempDiv").html(crappyString);
var sanitisedString = $(".tempDiv").text();
Related to an issue I've encoutered in the past: When jQuery parsing html - Chrome throwing net::ERR_FILE_NOT_FOUND
can't tweak or change
Sometimes it helps when you can talk to other devs: TinyMCE- Get plain text
For SEO is better to get out wysiwyg and take by hand every article and clean it. I get same situation in Joomla, and I do same. Is hard to make a good css/js selector to clear just div, div > p, div + br with no text. The default wordpress editor make text more clean, try to see if is free on the market and add it on your app.

Creating a JS form that outputs usable HTML

I'm working on creating a way for editors at my school's newspaper to be able to go to a page that would have places to type in info (ie. img url, titles, captions) and it would output HTML code that is already stylized.
So they type into the form in the title area: "Title"
And in the paragraph area: "This is a test"
and it would output something like this:
<div class="div1">
<span>Title</span>
<p>This is a test</p>
</div>
(div1 since since it's the first one you put and could add more later)
I've been looking into finding something like this, which I know it's possible, I just don't know where to start with this or what I would even google search. Any help would be greatly appreciated.
Thank you.
EDIT: We can't set up a Wordpress due to contracts with outside companies.
It depends on whether you want to implement a solution yourself or use what is already out there.
This type of functionality is already built into platforms like Wordpress and SquareSpace out of the box via a WYSIWYG (what you see is what you get) editor - similar to Stackoverflow's question box.
If you are looking to implement a custom solution then I would recommend looking into into markdown languages.
For example, here is one markdown javascript library called Remarkable:
https://github.com/jonschlinkert/remarkable.
This code snippet is taken directly from their github README
var Remarkable = require('remarkable');
var md = new Remarkable();
console.log(md.render('# Remarkable rulezz!'));
// => <h1>Remarkable rulezz!</h1>
As you can see the markdown text is passed to a render function and it translates into html.
Alex

Is there any JSP equivalent for text editor as we use in ASP.net

i am designing a website where user can enter text in a formatted way, i have worked in asp.net where i have used AJAX toolkit and used HTML text editor control. i require similar kind of feature but i don't know how to achieve this feature in jsp.
As you will be answering this question you will be doing some formatting below, i just want to implement the similar kind of feature.
I couldn't show my work as this problem is what i have to solve first. Please let me know how can i do this. !
but i am talking of the answer box of stack overflow or similar
thanx...
If you want a free version then use TinyMCE. It is fast and uses jquery and setting it up is really easy and you can buy it to activate other features too.
But if you want to pay for it then you can use Cute Editor, from my experience you need to buy licence per domain.
javascript editor
jHtmlArea http://jhtmlarea.codeplex.com/
ckeditor http://ckeditor.com/
tinymce http://www.tinymce.com/
http://medleyweb.com/resources/10-best-free-javascript-or-jquery-wysiwyg-html-editors/

Formatting Buttons in jQuery for Forums

I want to do something as simple as emulate the buttons as can be seen here—albeit in jQuery and Django.
I have scoured the net and found nothing, which surprises me, but I figure it is because I am not using the right terminology.
Right now, I want to include inline tags like strong, em, and code and more tricky things like links and images (using Markdown and HTML syntax).
I figure that there are two to three different states for jQuery to act on:
Some text has been selected; the text is decorated.
Nothing has been selected; jQuery prompts the user to enter the text to be decorated.
The script can discern between highlighted text and a highlighted URL to decide for when it needs to produce a valid link.
I have already done some jQuery stuff, so the basics of it should be manageable (any potential JS regex aside); I just have no idea to which extent jQuery supports this.
You can utilize a Rich Text editor to perform your tasks. This blog post lists some of them -
http://www.queness.com/post/212/10-jquery-and-non-jquery-javascript-rich-text-editors
I have used TinyMCE and it is also very good. Apart from that I have used EphoxEdit Live( http://editlive.com/what-new ) and that is pretty good(though not a jQuery plugin) for heavy usage like content editing.
What you are looking for is a WYSIWYG(What You See Is What You Get) editor.
tinymce comes to mind.
or you can search the jQuery Plugins Page
This might be a good place to start: jQuery WYSIWYG Plugin

Which wysiwyg editor in Drupal will give me most control over markup?

At the moment I'm using the wysiwyg module for Drupal with tiny_mce. However, it keeps inserting all kinds of superfluous spans and other trash elements in my markup. I want to use wysiwyg mostly for semantic markup with css classes, any inline styles are a problem, because I have to clean up my html by hand - sort of defies the purpose of having a wysiwyg editor altogether. What other wysiwyg editor should I try, which will behave more sensibly?
WYMeditor, available via the WYSIWYG API, is not the fanciest editor, but it does produce XHTML markup.
BUEditor integrated via the BUEditor module, is an easily extensible system that allows you to easily define buttons and associated markup. It is a favorite of a markup-obsessed colleague of mine, so I imagine it does a good job.
In my experience ck editor is a very good solution.
The only problem i have seen it have is drop a instead of leaving a box blank
It has paste plain text and paste from word features that prevent extra markup from being dropped in
When working with a cms i think what is important usually is not how well you can enter markup, as a developer you can usually just use a text area and drop html, but how the editors will enter content.
Ck editor usually produces very clean results, as long as direct pasting from Word does not take place
As people have helped me out in the comments, there are two ways to integrate it with Drupal
WYSIWYG API module, and standalone module cKEditor
I really wanted to go with CKEditor myself but after trying to get rid of that adding breaks and spaces everywhere stuff I had to revert to plain text input.
I am currently considering markitup!, which you may want to investigate as well.
I am hopeful as I have good experiences with it on WP but I didn't get to try it on Drupal just yet.
I would suggest BUEditor, you can configure all buttons and thus control the output
Unfortunately I have yet to find an editor that doesn't try to mess with your code in one way or another. In Drupal, I've tried TinyMCE, FCKEditor, and CKEditor. In non-Drupal projects I've used Ephox EditLive and the YUI 2 Rich Text Editor. All of them try to "fix" or autoformat your code in one way or another, and to that end they are all frustrating. Of that group, Ephox EditLive is the worst offender, and ironically it's the only one that isn't free.
I've resigned myself to plain text editing in Drupal whenever there's a slight chance I may need to control the underlying HTML. My WYSIWYG editor is off by default; I whitelist pages in as needed. It's tedious, but for me it's better than playing tug-of-war with the WYSIWYG for control.

Categories

Resources