Skip to content

Commit fa32f8d

Browse files
committed
Add the documentation for CKEditor5 plugins
1 parent 7bf7204 commit fa32f8d

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/javascript/components_ckeditor5.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,24 @@ listenToCkeditor(element).submitOnEnter(({ ckeditor, html }) => {
8585
// Do something with the resulting `html`.
8686
});
8787
```
88+
89+
## Creating Plugins
90+
91+
CKEditor 5 was designed to be compiled as a single bundle, relying a lot on identity checks to access and associate data.
92+
Any extra plugin that should be added to the editor must be built using the modules exposed through the `setupConfiguration()` event otherwise the identity checks will fail.
93+
94+
```ts
95+
listenToCkeditor(element).setupConfiguration(({ configuration, CKEditor5 }) => {
96+
class FooPlugin extends CKEditor5.Core.Plugin {
97+
static get pluginName() {
98+
return "FooPlugin";
99+
}
100+
101+
init(): void {
102+
//
103+
}
104+
}
105+
106+
configuration.extraPlugins.push(FooPlugin);
107+
});
108+
```

0 commit comments

Comments
 (0)