Question

I integrated nicEdit because it's very light unlike all the other ones that contain hundreds of kb's.

In Chrome it is however causing problems. It for example doesn't save the text into the textarea or make things bold. The problem can be observed at this website or see below code. Please don't provide a hack like one answerer did because that's not going to help anything.

I have disabled the editor for debugging purposes. You can enable it with your console through new nicEditor().panelInstance('comment');

<div class="rdd blog-item">
    <h1><a id="blog-item-title" href="/b/asdfssadfadf">this ia test</a></h1>
    <div class="blog-date">
         Date posted: 2013-03-01
    </div>
    <div class="blog-message">
        <p>
            asdfasdfas
        </p>
    </div>
    <div class="blog-keywords">
        Keywords: <a href="/k/dfsa sadfasd adfasf adfas">dfsa sadfasd adfasf adfas</a>
        - <a href="/k/jlk">jlk</a>
    </div>
    <h4>0 Comments</h4>
    <div class="blog-comment blog-new-comment">
        <form id="new_comment" name="new_comment">
            <div class="blog-comment-row">
                <h4></h4>
                <h4>Would you like to place a comment?</h4>
            </div>
            <div class="blog-comment-row">
                <label for="comment">Comment</label>
                <textarea name="comment" id="comment"></textarea>
            </div>
            <div class="blog-comment-row">
                <label for="name">Name</label>
                <input type="text" name="name" id="name" value="" title="Enter your name">
            </div>
            <div class="blog-comment-row">
                <label for="email">Email</label>
                <input type="text" name="email" id="email" value="" title="Enter your email">
            </div>
            <div class="blog-comment-row">
                <div class="blog-comment-cell">
                    &nbsp;
                </div>
                <div class="blog-comment-cell">
                    <a class="blog-comment-submit blog-comment-button" href="">Submit</a><br/>
                    Your ip address is 220.245.93.218
                </div>
            </div>
        </form>
    </div>
</div>
Was it helpful?

Solution

The Bold problem is caused by CSS inheritance. In your css file remove rdd blog-item span{} and it will work. nicEdit does not save the contents automatically in the textarea. At form submission you therefore have to run: nicEditors.findEditor('comment').saveContent(); to save it

OTHER TIPS

You can bind events on the editor and save it's contents when that event is fired.

When I run this code on your example page, it works for me (your server doesn't pickup the nicEditor HTML tags though):

var commentNicEditor = new nicEditor().panelInstance('comment');
commentNicEditor.addEvent("blur", function () {

    commentNicEditor.instanceById('comment').saveContent();

});

Updated with jQuery-free solution based on official documentation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top