Coder Social home page Coder Social logo

igorkasyanchuk / new_ckeditor Goto Github PK

View Code? Open in Web Editor NEW
33.0 3.0 6.0 3.53 MB

Ruby on Rails + CKEditor 5

Home Page: https://www.railsjazz.com/

License: MIT License

Ruby 54.62% JavaScript 1.99% CSS 17.33% HTML 26.06%
ruby rails ruby-on-rails ckeditor5 ckeditor wysiwyg

new_ckeditor's People

Contributors

igorkasyanchuk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

new_ckeditor's Issues

Missing ckeditor commands for superscript, subscript and page break.

Hi,

I wonder if it is possible to include superscript, subscript and pageBreak for the classic Editor.

ckeditor.js:5 toolbarview-item-unavailable: The requested toolbar item is unavailable. Read more: https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html#error-toolbarview-item-unavailable
{name: 'superscript'}

It seems that the build generated for classic/ckeditor.js does not include those options.

Upload an image to ActiveAdmin | Couldn't upload file:

Error: Couldn't upload file: IMG_0329.JPG

Greeting. First of all, thanks for the gem! I'm trying to install it on activeadmin. Everything is fine,
but an error occurs when loading the image. What should I try to check, recommendations for finding an error?

Everything is done according to the documentation

  1. gem 'new_ckeditor'
  2. bundle i
  3. rails g new_ckeditor
  4. add js in application.js (require 'new_ckeditor/classic/ckeditor')
  5. form: = f.ckeditor :body

It works fine, we add image loading

  1. Let's start with new controller rails g controller file_uploads upload
class FileUploadsController < ApplicationController
  # note
  # that method must return json with URL to an uploaded image
  # or error message
  def upload
    image = CkEditorImage.new(file: params["upload"])
    if image.save
      render json: {
        url: image.file.url
      }
    else
      render json: {
        "error": {
          "message": image.errors.full_messages.join(", ")
        }
      }
    end
  end
end

Create a new model where images will be stored: rails g model CkEditorImage file:string user_id:integer parent_id:integer parent_type:string

class CkEditorImage < ApplicationRecord
  mount_uploader :file, CkEditorImageUploader
  belongs_to :user, optional: true
  validates_presence_of :file
end

Code of migration may look like:

class CreateCkEditorImages < ActiveRecord::Migration[6.0]
  def change
    create_table :ck_editor_images do |t|
      t.string :file
      t.integer :user_id, index: true
      t.integer :parent_id
      t.string :parent_type

      t.datetime :created_at
      t.datetime :updated_at
    end
    add_index :ck_editor_images, :user_id
    add_index :ck_editor_images, [:parent_id, :parent_type]
  end
end

Run this migration.

Create Carrierwave uploader rails g uploader CkEditorImage. Open and edit it if needed.

Unable to find javascript files

Fantastic gem, thank you. I would like to use it in my CMS and I have added //= link new_ckeditor/classic/ckeditor.js
to the manifest.js but I am told The asset "new_ckeditor/classic/ckeditor.js" is not present in the asset pipeline
So I have looked for the javascript files and they are not present anywhere. I am obviously missing something.
I ran the new_ckeditor generator which generated the views fine
So where do the javascript file live please?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.