-
Notifications
You must be signed in to change notification settings - Fork 76
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
23 changed files
with
7,286 additions
and
12,003 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
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,2 @@ | ||
dist | ||
node_modules |
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,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>CKEditor Vue example</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/src/main.ts"></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,22 @@ | ||
{ | ||
"name": "demo", | ||
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vue-tsc && vite build", | ||
"preview": "vite preview" | ||
}, | ||
"dependencies": { | ||
"@ckeditor/ckeditor5-build-classic": "^37.0.0-alpha.3", | ||
"@ckeditor/ckeditor5-vue": "file:..", | ||
"vue": "^3.2.47" | ||
}, | ||
"devDependencies": { | ||
"@vitejs/plugin-vue": "^4.1.0", | ||
"typescript": "^4.9.3", | ||
"vite": "^4.2.0", | ||
"vue-tsc": "^1.2.0" | ||
} | ||
} |
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,83 @@ | ||
<template> | ||
<h1>Example of using CKEditor 5 in Vue.js 3.x</h1> | ||
|
||
<ckeditor | ||
v-model="data" | ||
tag-name="textarea" | ||
:editor="ClassicEditor" | ||
:config="config" | ||
:disabled="disabled" | ||
@ready="onReady" | ||
@focus="onFocus" | ||
@blur="onBlur" | ||
@input="onInput" | ||
@destroy="onDestroy" | ||
/> | ||
|
||
<button @click="toggleEditorDisabled"> | ||
{{ disabled ? 'Enable' : 'Disable' }} editor | ||
</button> | ||
|
||
<h2>Live editor data</h2> | ||
|
||
<textarea v-model="data" /> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref, reactive } from 'vue'; | ||
import ClassicEditor from '@ckeditor/ckeditor5-build-classic'; | ||
import type { EventInfo } from '@ckeditor/ckeditor5-utils'; | ||
// State | ||
const data = ref( '<p>Hello world!</p>' ); | ||
const disabled = ref( false ); | ||
const config = reactive( { | ||
toolbar: [ 'heading', '|', 'bold', 'italic' ] | ||
} ); | ||
// Methods | ||
function toggleEditorDisabled() { | ||
disabled.value = !disabled.value; | ||
} | ||
function onReady( editor: ClassicEditor ) { | ||
window.editor = editor; | ||
console.log( 'Editor is ready.', { editor } ); | ||
} | ||
function onFocus( event: EventInfo, editor: ClassicEditor ) { | ||
console.log( 'Editor focused.', { event, editor } ); | ||
} | ||
function onBlur( event: EventInfo, editor: ClassicEditor ) { | ||
console.log( 'Editor blurred.', { event, editor } ); | ||
} | ||
function onInput( data: string, event: EventInfo, editor: ClassicEditor ) { | ||
console.log( 'Editor data input.', { event, editor, data } ); | ||
} | ||
function onDestroy( editor: ClassicEditor ) { | ||
console.log( 'Editor destroyed.', { editor } ); | ||
} | ||
</script> | ||
|
||
<style> | ||
body { | ||
max-width: 800px; | ||
margin: 20px auto; | ||
} | ||
textarea { | ||
width: 100%; | ||
height: 100px; | ||
font-family: monospace; | ||
} | ||
button { | ||
margin-top: 10px; | ||
} | ||
</style> |
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,7 @@ | ||
import { createApp } from 'vue'; | ||
import CKEditorPlugin from '@ckeditor/ckeditor5-vue'; | ||
import App from './App.vue'; | ||
|
||
createApp( App ) | ||
.use( CKEditorPlugin ) | ||
.mount( '#app' ); |
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,7 @@ | ||
import type ClassicEditor from '@ckeditor/ckeditor5-build-classic'; | ||
|
||
declare global { | ||
interface Window { | ||
editor: ClassicEditor; | ||
} | ||
} |
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 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ESNext", | ||
"useDefineForClassFields": true, | ||
"module": "ESNext", | ||
"moduleResolution": "Node", | ||
"strict": true, | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"esModuleInterop": true, | ||
"lib": ["ESNext", "DOM"], | ||
"skipLibCheck": true, | ||
"noEmit": true, | ||
"allowSyntheticDefaultImports": true, | ||
"types": [ | ||
"vite/client" | ||
] | ||
}, | ||
"include": [ | ||
"src/**/*.ts", | ||
"src/**/*.vue", | ||
"vite.config.ts" | ||
] | ||
} |
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,14 @@ | ||
import { defineConfig } from 'vite'; | ||
import vue from '@vitejs/plugin-vue'; | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig( { | ||
plugins: [ vue() ], | ||
optimizeDeps: { | ||
/** | ||
* This is required only because we use "npm link" for | ||
* testing purposes. See `dependencies` in `package.json`. | ||
*/ | ||
include: [ '@ckeditor/ckeditor5-vue' ] | ||
} | ||
} ); |
Oops, something went wrong.