tsechingho / ckeditor-rails Goto Github PK
View Code? Open in Web Editor NEWIntegrate CKEditor javascript library with Rails asset pipeline
Home Page: https://github.com/tsechingho/ckeditor-rails
License: MIT License
Integrate CKEditor javascript library with Rails asset pipeline
Home Page: https://github.com/tsechingho/ckeditor-rails
License: MIT License
Please help me on this, the WYSIWYG editor doesnot appear in IE8, it appears and is usuable in other browsers but? Please give some solution
Hi,
Since version 4.2 ckeditor supports retina displays. Problem is that when using the latest gem version of ckeditor-rails (4.2.2), position of icons is wrong:
When using a normal display they are fine. It's only with hidpi resolutions that they are wrong.
Regards
I installed this using bundler and it says that v 0.0.5 is installed but when I add "//= require ckeditor-jquery" to the application.js I get this error:
couldn't find file 'ckeditor-jquery'
After bundle install
ruby@debian:~/projects/bulkin$ rake update-ckeditor VERSION=4.0
rake aborted!
Don't know how to build task 'update-ckeditor'
/home/ruby/.rvm/gems/ruby-1.9.3-p327/bin/ruby_noexec_wrapper:14:in eval' /home/ruby/.rvm/gems/ruby-1.9.3-p327/bin/ruby_noexec_wrapper:14:in
"NetworkError: 404 Not Found - http:/bulkin.ru:3000/assets/ckeditor/init.js"
I am customizing my toolbar like the following (my actual Rails version is 4.2.2, I tried this code in 4.2.0 and there is no problem)
config.toolbar = [
[ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ],
[ 'Find', 'Replace', '-', 'SelectAll', '-', 'Scayt' ],
['Font', 'FontSize','superlink'],
['TextColor', 'BGColor'],
'/',
[ 'Bold', 'Italic', 'Underline', 'Strike' ],
[ 'Undo', 'Redo' ],
['Link', 'Unlink']
];
But some buttons are missing like 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', 'NumberedList', 'BulletedList' ...
PS: Also without customizing the toolbar, those buttons don't show up !!
Is this a bug ?
Thanks!
The config JS file doesn't seem to be read from inside the application itself, it just pulls the version that inside the gem itself.
For example, http://localhost:3000/assets/ckeditor/config.js shows the contents of bundled JS, no matter what I try as contents inside my app.
Tried without the coffee script as well, to no avail.
Any thoughts? I'm using a Rails 3.1.3 application.
SyntaxError: reserved word "var"
on basepath.js.coffee while running the application with ck editor..i followed all the steps https://github.com/tsechingho/ckeditor-rails
I am pretty new to rails.now the ckeditor window has came.but i cant find image upload button when click the image button on tool box. plz help me
Advance thanks ...
I'm deploying to Heroku, and for some reason, the icons are not showing up in the editor. I tried adding Ckeditor.assets
to my list of precompiled assets, but it had no effect. I looked at the contents of that array, and I saw that it only contains the CSS and JS, not the images.
Any references to images result in a 404, and when I list the assets that are on the server, the images aren't there (neither with nor without a hash).
What's causing this? Is it a bug, or some configuration option that I'm missing?
I'm using Devise to authenticate sessions and I'm getting kicked out after image upload.
When first time deploy, the ckeditor-rails will create a digested config.js and no-digested config.js. The browser will cache the no-digested config.js while it hit by someone first time. If the content of config.js is changed again, the browser will still use the old no-digested config.js. This is a bug.
There are two ways to resolve this issue.
customConfig
in ckeditor.js
while compiling the ckeditor.js by parsing the asset manifest file.CKEDITOR.config.customConfig
by rails asset file path helper in a js.erb file. The only consideration is where to put this file.My config is like
Ckeditor::Rails.configure do |config|
# default is nil for all languages, or set as %w[en zh]
config.assets_languages = %w(en nl fr)
# default is nil for all plugins,
# or set as white list: %w[image link liststyle table tabletools]
# or set as black list: config.default_plugins - %w[about a11yhelp]
config.assets_plugins = %w(image link liststyle table tabletools pastefromword clipboard)
# default is nil for all skins, or set as %w[moono]
#config.assets_skins = %w(simple)
end
When loading my site with a locale of en-GB (although the I18n.locale is set to nl) it crashes with the following
Failed to load resource: the server responded with a status of 404 (Not Found) (https://www.radarwerk.be/assets/ckeditor/lang/en-gb.js?t=F7J9)
application-8f9c169d5aa34a687e102e32d9f95e62ac04221196e4dba7ce4916508c71bec1.js:89 Uncaught TypeError: Cannot set property 'dir' of undefined (https://www.radarwerk.be/assets/application-8f9c169d5aa34a687e102e32d9f95e62ac04221196e4dba7ce4916508c71bec1.js:89)
When I don't compile the language the user is in, I want it to fallback properly (first to the language independant language, then to en (same in this case)).
In the first place I want to use the language of the site in all honesty (nl)
to make ckeditor to work we want to download or not.if we download means where to put.i have an issue.thats y i asking this.because i downloaded ckeditor from ckeditor .com but i dont include in the application.when i running my application ckeditor can viewable but it does not showing any buttons to upload image. can u help me..i am struggling 1 day with this error.and also my background change to yellow.without doing any advanced usage which is said by you.
Advance thanks
It's the job of the asset pipeline to minimize / compress / etc the source.
Among other things, we want uncompressed sources in development, in case we need stepping in the code...
If not, can you please update to CKEditor 4.4.8?
The team addressed a vulnerability.
Thank you
I can do it, I just want to figure out how it needs to be done. The main problem is that with the Rails 4 asset pipeline, compiled assets must be referenced by their digested filename - so no longer can we access the CKEditor javascript/css files directly (which it does a lot), unless you turn on config.assets.compile
, which I don't think people will be willing to do just for this library.
I propose a new object inside of the CKEDITOR object, assetPaths
, which would be a manifest mapping any file that ckeditor.js
is referencing directly to the corresponding digested asset:
CKEDITOR.assetPaths = {
"config.js": "<%= asset_path('ckeditor/config.js') %>"
"dialogs/templates.js": "<%= asset_path('ckeditor/dialogs/templates.js') %>"
# ... etc
}
And then gsub the ckeditor.js
file to replace any instance of, say, config.js
, with CKEDITOR.assetPaths['config.js']
when pulling a new version.
I'm not 100% sold on this solution but it's the best I can come up with on a whim. The biggest problem is the gsubbing and suddenly having to keep a list of all the file references in ckeditor.js - something which could possibly change frequently. Can anybody think of something better? Maybe we could turn ckeditor.js
into ckeditor.js.erb
, and wrap every file reference in asset_path
?
Hi tsechingho,
I'm using rails 4, bootstrap and ckeditor_rails.
Using the following in my _form view:
<%= f.text_area :content, :class => 'ckeditor' %>
results in a regular bootstrap flavored text_area the first time I visit new or edit. However, if I reload the page, it works. The text_area becomes fully ckeditor enabled.
I have tried loading js file (//= require ckeditor-jquery) before and after bootstrap but this has no effect.
Any ideas?
"Since version 4.1.3, non-digested assets of ckeditor-rails will simply be copied after digested assets were compiled."
I read the closed issues about the asset-pipeline in rails4 and Eric's solution.
Is this the reason why the task takes about 5 minutes during every deploy?
I am trying to add the CodeSnippet plugin to CKEditor (installed in my Rails app using ckeditor-rails).
To do this, I first added the CodeSnippet plugin folder and all of its dependencies to the directory app > assets > javascripts > ckeditor > plugins (so my plugins folder contains folders for codesnippet, dialog, dialogui, lineutils, and widget).
I then updated my app/assets/javascripts/ckeditor/config.js.coffee to include the following:
CKEDITOR.editorConfig = (config) ->
config.startupShowBorders = true
config.resize_enabled = false
config.scayt_autoStartup = true
config.language = 'en'
config.width = '445px'
config.extraPlugins = 'widget,dialog,dialogui,lineutils,codesnippet'
config.toolbar_Default = [
{ name: 'basicstyles', items: [ 'Bold','Italic','Underline', '-', 'NumberedList','BulletedList', 'Link','Unlink', 'CodeSnippet','RemoveFormat' ] }
]
config.toolbar = 'Default'
true
When I try to load a webpage with the CKEditor, I get the following errors in my javascript console:
Uncaught TypeError: undefined is not a function
referring to this line of widgets/plugin.js:
CKEDITOR.style.addCustomHandler( {
and the same error
Uncaught TypeError: undefined is not a function
referring to this line of codesnippets/plugin.js:
editor.addContentsCss( path + 'lib/highlight/styles/' + editor.config.codeSnippet_theme + '.css' );
Anyone able to configure this CKEditor to use the CodeSnippet plugin using this gem?
Stackoverflow question posted here: http://stackoverflow.com/questions/28119912/adding-codesnippet-plugin-to-ckeditor-in-rails-app
Hi, got issue with loading fckeditor when included gem turbolinks in project. While in inline mode works fine.
Sorry for bad English.
I created my app/assets/javascripts/config.js.coffee like this:
CKEDITOR.editorConfig = (config) ->
config.docType = ''
When I start up my server in development env and access the page, I noticed that the default ckeditor/config.js always executes AFTER my custom one, and my config gets ignored.
Here is my application.js:
//= require jquery
//= require jquery_ujs
//= require ckeditor-jquery
//= require ckeditor/config
//= require_tree .
Either CKEditor 3.6.2 or 2.6.3 does not show up editor pannel on IE (8 or 9) in production mode.
It works well in Chrome, Firefox and Safari in production.
I found people had discussed this bug in galetahub/ckeditor#94.
It should be fixed ASAP.
Using the ckeditor/override per the instructions to get asset hashes breaks when we use turbo sprockets. The override.js.erb isn't happy with calls to asset_path. If I remove turbo sprockets, it works, but then we get two sweeps of asset:precompile which takes forever.
rake aborted!
/tmp/build_df42e508-d471-4b83-a109-1006bcee772b/vendor/bundle/ruby/2.1.0/bundler/gems/ckeditor-fd8e29ee5036/app/assets/javascripts/ckeditor/init.js.erb has already been required
(in /tmp/build_df42e508-d471-4b83-a109-1006bcee772b/vendor/bundle/ruby/2.1.0/bundler/gems/ckeditor-fd8e29ee5036/app/assets/javascripts/ckeditor/override.js.erb)
Hello,
This gem is set to Full version of CKEditor. How do I use the "Standard" version as well as the "Basic" version.
I wish to provide a default configuration inside my Rails engine that mounting apps can implicitly accept (by not writing any CKEDITOR js in their application). However with the absence of app/assets/javascripts/ckeditor/config.js
in the mounting app, the following config.js
file is served after the engine's config.js.coffee
and effectively overwrites the method definition:
/**
* @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.editorConfig = function( config ) {
// Define changes to default configuration here. For example:
// config.language = 'fr';
// config.uiColor = '#AADC6E';
};
Here's a screencap of the network requests in the Inspector panel:
When I deploy a rails 3.2.22 app using the ckeditor-rails gem everything was ok and the assets were compiled. But this no longer works with the latest release (4.4.8).
Test using
RAILS_ENV=development bundle exec rake assets:precompile
All notes are due to a Rails 4 App.
Everything is fine in development mode, but in production the background-position of all item icons are seem to be "shifted" (see picture below).
Inspecting the buttons with firebug led me to the following css-class, e.g. for the "bold"-button:
.cke_button__bold_icon {
background: url(icons.png) no-repeat 0 -32px !important;
}
This seems to collide with some other class, since disabling the class .cke_button__bold_icon solves the problem and lets the button look nice.
Can anyone reproduce this?
Best wishes,
Robin
Hi tsechingho,
I am running into this issue and hope you can provide some insights.
I am deploying my rails app as a WAR file in JBoss and the application is deployed under a path, say, /sytong/app.
When I accessed the deployed app, I saw that the .js and .css file path are generated like this (I masked the hostname with '<HOSTNAME>'):
<script type="text/javascript" src="http://<HOSTNAME>/assets/ckeditor/config.js?t=D5AC" style=""></script>
However, to make it work, the path should look like this (note the path /sytong/app before /assets)
<script type="text/javascript" src="http://<HOSTNAME>/sytong/app/assets/ckeditor/config.js?t=D5AC" style=""></script>
I have defined my relative path in production.rb:
config.relative_url_root = "/sytong/app"
I have tried to add this by overriding basepath.js.erb as you have mentioned in the README but I don't think my basepath.js.erb was actually used.
Would you have any suggestion for me in this case?
Thanks.
When I copied the default contents.css from source (with one simple change to set font-weight:bold for h1-h5) and saved it as
app/assets/stylesheets/ckeditor/contents.css.scss
it worked locally as expected. This is how the README suggests doing it. However when I deployed to production, my modified file did not override the defaults.
When I renamed
app/assets/stylesheets/ckeditor/contents.css.scss
to
app/assets/stylesheets/ckeditor/contents.css
(removing the .scss extension) it worked all the way through.
Rails 3.2.0
ckeditor_rails 4.1.1
I am using scss for other styles in the application, and that works OK.
Production settings are:
config.serve_static_assets = false
config.assets.compress = true
config.assets.compile = true
config.assets.digest = true
rake update_ckeditor VERSION=4.2
rake aborted!
Don't know how to build task 'update_ckeditor'
I am getting this error. I want to implement inline editor. Can you help me in the same.
Hellow,
Am using ckeditor-rails for my app, I successfuly added the gem, installed, configured, and awesomely working, but when i click on browse button, the routing error displays on the screen, here am attaching the screenshot for reference,
and this is my optional configured config.js file details:-
CKEDITOR.editorConfig = function( config ) {
config.filebrowserBrowseUrl = "/ckeditor/attachment_files";
config.filebrowserImageBrowseLinkUrl = "/ckeditor/pictures";
config.filebrowserImageBrowseUrl = "/ckeditor/pictures";
config.filebrowserImageUploadUrl = "/ckeditor/pictures";
config.filebrowserUploadUrl = "/ckeditor/attachment_files";
config.toolbar_basic = [
[ 'Save', '-', 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord',
'-', 'Undo', 'Redo' ],
[ 'Bold', 'Italic', 'Underline',
'-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
['Smiley', 'Preview', 'Find', 'Replace', 'Link', 'Unlink', '-', 'Image' ],
['Table', 'Font', 'FontSize', '-', 'TextColor', 'BGColor', '-','Maximize']
];
config.uiColor = "#eff4ff"
config.toolbar = config.toolbar_basic;
};
My environment details: Ubuntu 12.04, ruby 1.9.3, rails 3.2.13.
Rake routes log:
ckeditor_rails_engine /ckeditor
Ckeditor::Rails::Engine
Routes for Ckeditor::Rails::Engine:
Please help me! many Thanks.. :)
I upload my app to heroku, and the editors didn't shown
I started my app in production locally and the editors didnd't show up too...in development, they work well
How do one add custom plugins to the ckeditor with this gem?
// Gemfile
gem 'ckeditor', '>= 4.0.0.rc1'
// config.js
CKEDITOR.editorConfig = function( config ){
config.skin = 'moono',
config.disableNativeSpellChecker = true,
config.scayt_autoStartup = true,
config.toolbar = [
[ 'Bold', 'Italic', 'Underline', 'Strike', 'Blockquote', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink', '-', 'SpellChecker', 'Scayt' ]
]
};
I have been testing many possible solutions, I think that it is a problem with v4.0
In here http://drupal.org/node/1870398 user called "vinmassaro " posted that if you set "Spell Check as You Type" on toolbar it work because the two type of spellcheck was compress in one button, but dosent work :S
Hey,
This gem ignores any asset host set.
One possible fix would be to add
base_path << ActionController::Base.asset_host
to basepath.js.erb
I notice on the CKEditor demo pages that iframes only get embedded using the "Full featured" version and not the "Standard editor."
With my install of ckeditor using ckeditor-rails, it seems like iframes cannot be added via the "Source" button. Is there any way to enable the Full Featured version of the ckeditor so I can add iframes via "Source"?
This is my config.js.coffee file:
CKEDITOR.editorConfig = (config) ->
config.startupShowBorders = true
config.resize_enabled = false
config.scayt_autoStartup = true
config.language = 'en'
config.width = '500px'
config.toolbar_Default = [
{ name: 'basicstyles', items: [ 'Bold','Italic','Underline','RemoveFormat', '-',
'NumberedList','BulletedList', '-',
'Link','Unlink', '-', 'Source' ] }
]
config.toolbar = 'Default'
true
Versions 4.1.2, 4.1.3 and 4.2.0 are out. Is there a plan to have new releases of this gem for them?
hi tsechingho,
i have cleared that "var" error with your help..after that.I have another error on the same basepath.js.coffee
SyntaxError: unexpected COMPARE.here is my file (basepath.js.coffee
<%
base_path = ' '
if ENV['PROJECT'] =~ /editor/i
base_path << "/#{Rails.root.basename.to_s}/"
end
base_path << Rails.application.config.assets.prefix
base_path << '/ckeditor/'
%>
CKEDITOR_BASEPATH = '<%= base_path %>'
Hi, I have a question, when I submit some text with the ckeditor and then go to the view, the text shows up with the html tags in the view. How do I get it to not show the tags? Thanks!
I can't seem to add the superscript and subscript buttons to the toolbar. I've tried downloading the stylescombo plugin and setting removeButtons to empty string. The documentation says I just need to add it to the list of basic styles and it should appear. Anyone else getting this issue?
Hi,
I am using ckeditor_rails (4.2.2). It is working fine. But it is not precompiling
assets.On this command it gives me error.
rake assets:precompile
Invalid CSS after "..._footer{filter:": expected expression (e.g. 1px, bold), was "}"
(in /home/kashif/.rvm/gems/ruby-1.9.3-p392@met/gems/rich-
1.4.1/vendor/assets/ckeditor/ckeditor/skins/moono/dialog_iequirks.css)
(sass):6
How i can precompile assets for production?
Thanks
I'm trying to use ckeditor-rails with active_admin, it "works" fine but looks terrible, all the css is overridden by active_admin's styles. I've fiddled all evening to work around it but cannot find a way. (I know its possible because the galetahub/ckeditor gem does, but for other reasons i'm not using that gem).
apparently active_admin normalizes
body.active_admin * {...}
when i use firebug to remove the active_admin class from the < body > tag, the ckeditor tools look right, but of course the rest of the admin page is unstyled. Any suggestions please? if you have ideas that might require changes to ckeditor-rails i'll do it and send a pull request. Thanks!
The gem works great on my local machine in dev. But when I push to heroku the editor doesn't show up on my text area.
Ive used this gem before with no problems. This time though I customized it by adding the ckeditor folder in the assets/javascripts like directed in the readme. Could this be causing the issue? Any known way to fix it?
is there a way to limit the number of languages and plugins to reduce precompilation time.
this takes a long on heroku and causes heroku compilation time out....
I have ckeditor-rails and font-awesome-rails in my rails app. font-awesome-rails uses fontawesome 4.4.
I am getting problems with my icons, where clicking on them causes the icon to change to a different fontawesome icon (always to angle-right first, then toggles between angle-right and angle-down). See bokmann/font-awesome-rails#150 for more details.
If you use IE and see this message:
SCRIPT14: Not enough storage is available to complete this operation
here is one suggestion:
how to implement it?
please copy vendor/assets/javascripts/ckeditor/ckeditor.js
from ckeditor_rails
gem to app/assets/javascripts/ckeditor/ckeditor.js
of your project.
find
if(this.$.createStyleSheet)this.$.createStyleSheet`
and replace with
if(false)this.$.createStyleSheet
honestly say, I don't try it for IE. But that's how rails assets pipeline works.
the new release v4.1 also has this piece of code. the bug may not be resolved by CKEDITOR team.
also see
Hi, I would like to know how to setup the editor for individuals to be able to upload images in stead of using a link
Maybe I'm a complete idiot from lack of sleep, but am I supposed to copy what's in /vendor by hand? Following instructions in the readme, I get a "couldn't find file 'ckeditor-jquery'" error and sure enough, it doesn't exist anywhere I can tell. I looked for a generator that might install it. Maybe I need a nap.
It seems that even if I add a custom basepath as described here, the basepath.js file included with the gem is always precompiled afterwards, overriding its value.
I include the custom file like this:
//= require ckeditor/basepath
//= require ckeditor-jquery
But looking at the generated application.js
, though I can see the CKEDITOR_BASEPATH
I define, the default basepath is included subsequently, overriding it.
It seems that even if I add my own basepath.js.erb
file to javascript/ckeditor
, the default basepath.js.erb
file included with the gem is included after it, overriding the CKEDITOR_BASEPATH
variable.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.