[英]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. 我正在通过有关水银的railscast ,我无法显示可编辑区域。
gemfile 的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
显示页面的URL是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" 虽然“未捕获的TypeError:无法读取未定义的属性'konqueror',但我在javascript终端中收到错误”
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. 事实证明,汞正在使用jquery方法jQuery.browser
,它在jquery 1.9升级中已被弃用 。
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
. 我正在使用gem 'mercury-rails', git: 'git://github.com/jejacks0n/mercury'
所以这可能会得到修复,我不知道如何记录这个解决方案是否与您相关,但这是我从水银宝石中使用的最新一次提交, 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. 并且在需要其他jquery文件之后,不要忘记在application.js文件中//= require jquery-migrate-min
。
I have same issue here by following railscast for mercury. 我在跟踪railscast for mercury时遇到了同样的问题。
after re-read mercury documentation on the mercury js file, then i found a solution by changing : 重新读取汞js文件上的汞文档后,我通过更改找到了解决方案:
<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. 我发现了Slim引擎的问题,它可以是相关的。 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. 由于水银带有它需要的查询版本(1.7),只需确保app/views/layouts
中的mercury.html.(slim|erb|haml)
使用该版本。 Of course this is just for iframe implementation technique 当然这仅适用于iframe实现技术
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.