Skip to content

Commit

Permalink
Reproduces problem with guide
Browse files Browse the repository at this point in the history
  • Loading branch information
woto committed Oct 6, 2019
1 parent 2a5966c commit 94f9938
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/controllers/ckeditors_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class CkeditorsController < ApplicationController
def show
render inline: "", :layout => "application"
end
end
33 changes: 33 additions & 0 deletions app/javascript/packs/Ckeditor.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React, { Component } from 'react';
import CKEditor from '@ckeditor/ckeditor5-react';
import ClassicEditor from '@ckeditor/ckeditor5-build-classic';

class App extends Component {
render() {
return (
<div className="App">
<h2>Using CKEditor 5 build in React</h2>
<CKEditor
editor={ ClassicEditor }
data="<p>Hello from CKEditor 5!</p>"
onInit={ editor => {
// You can store the "editor" and use when it is needed.
console.log( 'Editor is ready to use!', editor );
} }
onChange={ ( event, editor ) => {
const data = editor.getData();
console.log( { event, editor, data } );
} }
onBlur={ ( event, editor ) => {
console.log( 'Blur.', editor );
} }
onFocus={ ( event, editor ) => {
console.log( 'Focus.', editor );
} }
/>
</div>
);
}
}

export default App;
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,15 @@ require("channels")
//
// const images = require.context('../images', true)
// const imagePath = (name) => images(name, true)

import React from 'react'
import ReactDOM from 'react-dom'
import PropTypes from 'prop-types'
import Ckeditor from './Ckeditor'

document.addEventListener('DOMContentLoaded', () => {
ReactDOM.render(
<Ckeditor />,
document.body.appendChild(document.createElement('div')),
)
})
3 changes: 2 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Rails.application.routes.draw do
resource 'ckeditor'
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
end
end

0 comments on commit 94f9938

Please sign in to comment.