简体   繁体   中英

mercury-rails no editable area js error 'Uncaught TypeError: Cannot read property 'konqueror' of undefined '

I cannot for the life of me figure out why this isn't working!
I'm working through the railscast for mercury and I can't get the editable area to show up.

gemfile

source 'https://rubygems.org'
gem 'rails', '3.2.13'
gem 'mercury-rails', git: 'https://github.com/jejacks0n/mercury.git'
gem 'sqlite3'
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'

routes

MercuryRelational::Application.routes.draw do
  mount Mercury::Engine => '/'

  root to: "pages#show"

show page

<h1>Show Page</h1>
<div id="page_content" class="mercury-region" data-type="editable"><%= raw(@page.content)     %></div>

url to the show page is http://localhost:4002/editor

still there is no editable blue box around the text.

However! I do get an error in the javascript terminal though "Uncaught TypeError: Cannot read property 'konqueror' of undefined"

Please help!

I've found the problem and have solved it in the following way!

It turns out that mercury is using the jquery method jQuery.browser , which is deprecated in the jquery 1.9 upgrade.

I'm using gem 'mercury-rails', git: 'git://github.com/jejacks0n/mercury' so this will probably get fixed and I don't know how else to document if this solution is relevant to you, but this is the latest commit I'm using from the mercury gem, d065b2c31b895af03749254b521f0c0ee18fb25a .

Including this gem solved the issue for me.

gem 'jquery-migrate-rails'

and don't forget //= require jquery-migrate-min in the application.js file, after requiring the other jquery files.

I have same issue here by following railscast for mercury.

after re-read mercury documentation on the mercury js file, then i found a solution by changing :

<span id="page_name" class="mercury-region" data-type="editable">

to

<span id="page_name" data-mercury="full" contenteditable="true">

hope this will works properly with same issue

I found issue with Slim engine and it can be related. Since mercury ships with query version that it need(1.7), just make sure that mercury.html.(slim|erb|haml) that in app/views/layouts use that version. Of course this is just for iframe implementation technique

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