Mercury editor with rails4

I am wondering how to use mercury stone with rails4. I tried following the manual http://asciicasts.com/episodes/296-mercury-editor if I load the page in the editor (/ editor / pages / 1), I see an error in the javascript console :

Uncaught TypeError: cannot read property 'konqueror' undefined

and the mercury area is not visible on the page at all

Gemfile:

gem 'mercury-rails', github: 'jejacks0n/mercury' 

app / views / pages / show.html.erb:

 <div id="page_body" class="mercury-region" data-type="editable"> <%= raw(@page.body) %> </div> 

after some delay, I get a javascript warning with the message:

Mercury.PageEditor failed to load: Region type is invalid, data is missing, or Full is unknown for the page_body area.

Try updating.

+4
source share
4 answers

mercury uses jquery.browser, this method is deprecated in the latest update.

If you include gem 'jquery-migrate-rails' in your gemfile, you should work favorably until mercury updates its code to the latest jquery or at least 1.9

You need to add // = jquery-migrate-min is required to your application.js after loading jquery.

+4
source

I had the same problem. I describe this better in my own question here , but basically the problem comes from an outdated jquery method called "konqueror". I do not think that this had anything to do with the fact that your application was in rails 4 by the way. I'm in gem 'rails', '3.2.13'

I would raise a question, but apparently I need a great reputation. hint, hint :)

+3
source

I had a similar problem with this due to turbolinks. I just disabled JS in application.js:

 //= require turbolinks 

~ to:

 // require turbolinks 

β€œUntil I figure out how to get them to play together.” At least Mercury pages need to beckon them somehow.

0
source

I also have some problems, it seems to be a problem with Turbolinks. I was able to get this by deleting the line:

 <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> 

from my application.html.erb file, not sure if this will cause problems in the future

0
source

Source: https://habr.com/ru/post/1497661/


All Articles