简体   繁体   中英

mercury rails gem issue with value

I am using ercury-rails gem, where you can find it here . Everything works well, except the params[:value]. I am keep getting "br tag" at the end of my text, that I want to update. So my parameter looks like this

Parameters: {"content"=>{"post_title"=>{"type"=>"full", "value"=>"yeah<br>"}

Anyone maybe has an idea, why that happens? Btw here is my code:

<script>
    $(window).on('mercury:ready', function () {
        var link = $('#mercury_iframe').contents().find('#edit_link');
        Mercury.saveUrl = "<%= mercury_update_admin_post_path(@post) %>";
        link.hide();
    });


</script>
<div id="container">
    <div><p id="notice"><%= notice %></p></div>

    <div>
        <h2><span id="post_title" class="mercury-region" data-type="editable" data-mercury="full"><%= @post.title %></span></h2>
    </div>

    <div>
        <p>
            <%= @post.date.strftime("%B %d, %Y")%>
        </p>
    </div>

    <div class="post-body">
        <div id="post_body" class="mercury-region" data-type="editable" data-mercury="full">
            <%= raw simple_format(@post.body) %>
        </div>
    </div>

    <div>
        <%= link_to 'Edit', "/editor" + request.path, :class => "btn", :id => "edit_link" %>
        <%= link_to 'Back', admin_posts_path, :class => "btn" %>
    </div>
</div>

Thanks. I would be really glad, if anyone can help.

Hi here is some documentation to removing the br tag from your content, please go though this. I hope if you go through this url you might be getting some solutions.

BR tag issue

In the above url you will have the some options to disble the br tag at the end.

pageEditor = new Mercury.FormPageEditor('form.mercury-form', options);
pageEditor.document.execCommand('insertBrOnReturn', false, false);

I hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM