-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
46 changed files
with
4,736 additions
and
2,036 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ node_modules/ | |
coverage/ | ||
dist/ | ||
.idea | ||
.tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<title>CKEditor 5 – React Component – demo</title> | ||
<style> | ||
body { | ||
max-width: 800px; | ||
margin: 20px auto; | ||
} | ||
|
||
p.info, h1, h2.subtitle { | ||
text-align: center; | ||
} | ||
|
||
.buttons { | ||
margin: 10px 0; | ||
} | ||
|
||
.buttons button { | ||
margin-right: 5px; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
|
||
</html> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "demo", | ||
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "tsc && vite build", | ||
"preview": "vite preview" | ||
}, | ||
"dependencies": { | ||
"@ckeditor/ckeditor5-react": "link:..", | ||
"@ckeditor/ckeditor5-build-classic": "37.0.0-alpha.3", | ||
"react": "^16.13.1", | ||
"react-dom": "^16.13.1" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "^16.14.35", | ||
"@types/react-dom": "^16.9.18", | ||
"@vitejs/plugin-react": "^3.1.0", | ||
"typescript": "^4.9.3", | ||
"vite": "^4.2.0" | ||
} | ||
} |
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import React, { type ReactNode } from 'react'; | ||
import EditorDemo from './EditorDemo'; | ||
import ContextDemo from './ContextDemo'; | ||
|
||
type AppState = { | ||
demo: 'editor' | 'context'; | ||
}; | ||
|
||
const editorContent = ` | ||
<h2>Sample</h2> | ||
<p>This is an instance of the <a href="https://ckeditor.com/docs/ckeditor5/latest/builds/guides/overview.html#classic-editor"> | ||
classic editor build</a>. | ||
</p> | ||
<figure class="image"> | ||
<img src="/sample.jpg" alt="CKEditor 5 Sample image." /> | ||
</figure> | ||
<p>You can use this sample to validate whether your | ||
<a href="https://ckeditor.com/docs/ckeditor5/latest/builds/guides/development/custom-builds.html">custom build</a> works fine.</p> | ||
`; | ||
|
||
// eslint-disable-next-line @typescript-eslint/ban-types | ||
export default class App extends React.Component<{}, AppState> { | ||
public state: AppState = { | ||
demo: 'editor' | ||
}; | ||
|
||
public render(): ReactNode { | ||
return ( | ||
<> | ||
<h1>CKEditor 5 – React Component – development sample</h1> | ||
|
||
<div className="buttons" style={{ textAlign: 'center' }}> | ||
<button | ||
onClick={ () => this.showDemo( 'editor' ) } | ||
disabled={ this.state.demo == 'editor' } | ||
> | ||
Editor demo | ||
</button> | ||
|
||
<button | ||
onClick={ () => this.showDemo( 'context' ) } | ||
disabled={ this.state.demo == 'context' } | ||
> | ||
Context demo | ||
</button> | ||
</div> | ||
{ | ||
this.state.demo == 'editor' ? | ||
<EditorDemo content={ editorContent }/> : | ||
<ContextDemo content={ editorContent }/> | ||
} | ||
</> | ||
); | ||
} | ||
|
||
private showDemo( demo: AppState[ 'demo' ] ) { | ||
this.setState( { | ||
demo | ||
} ); | ||
} | ||
} |
Oops, something went wrong.