Skip to content

Commit 21f11f6

Browse files
jet-pangclaude
andcommitted
feat: add premium plugin support, custom plugin builder, and comprehensive code improvements
- Add VaadinCKEditorPremium class with @NpmPackage for ckeditor5-premium-features - Add CustomPlugin.fromPremium() factory and import path validation (SSRF protection) - Add premium plugin dependency resolution in CKEditorPluginDependencies - Add document-editor.css for decoupled editor layout - Enhance vaadin-ckeditor.ts with minimap, document outline, sticky toolbar improvements - Enhance upload-adapter.ts with timeout, retry, and cleanup on disconnect - Translate all Chinese comments to English across Java, TypeScript, and CSS files - Add comprehensive tests for premium features, custom plugins, and upload manager - Update README and PREMIUM_INTEGRATION docs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 57fa30f commit 21f11f6

37 files changed

+2654
-757
lines changed

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,25 @@ editor.setReadOnly(false);
155155

156156
Premium features require a CKEditor license. Get yours at [ckeditor.com/pricing](https://ckeditor.com/pricing).
157157

158-
### Step 1: Install Premium Package
158+
### Step 1: Enable Premium Package
159+
160+
**Option A: Use `VaadinCKEditorPremium` class (Recommended)**
161+
162+
Simply call `VaadinCKEditorPremium.enable()` once at application startup to automatically install the premium npm package:
163+
164+
```java
165+
import com.wontlost.ckeditor.VaadinCKEditorPremium;
166+
167+
@SpringBootApplication
168+
public class Application implements AppShellConfigurator {
169+
public static void main(String[] args) {
170+
VaadinCKEditorPremium.enable(); // Enable premium features
171+
SpringApplication.run(Application.class, args);
172+
}
173+
}
174+
```
175+
176+
**Option B: Manual npm installation**
159177

160178
In your Vaadin project's frontend directory:
161179

docs/PREMIUM_INTEGRATION.md

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,28 @@ All plans include a **14-day free trial** with full access.
2828
2. Start a free trial or purchase a plan
2929
3. Copy your license key from the dashboard
3030

31-
### 2. Install Premium Package
31+
### 2. Enable Premium Features (Recommended)
3232

33-
In your Vaadin project's `frontend/` directory:
33+
**Option A: Use `VaadinCKEditorPremium` class (Recommended)**
34+
35+
The simplest way to enable premium features is to call `VaadinCKEditorPremium.enable()` once at application startup. This automatically installs the `ckeditor5-premium-features` npm package:
36+
37+
```java
38+
import com.wontlost.ckeditor.VaadinCKEditorPremium;
39+
40+
@SpringBootApplication
41+
public class Application implements AppShellConfigurator {
42+
public static void main(String[] args) {
43+
// Enable premium features - call once at startup
44+
VaadinCKEditorPremium.enable();
45+
SpringApplication.run(Application.class, args);
46+
}
47+
}
48+
```
49+
50+
**Option B: Manual npm installation**
51+
52+
Alternatively, install the package manually in your Vaadin project's `frontend/` directory:
3453

3554
```bash
3655
cd frontend
@@ -65,6 +84,23 @@ VaadinCKEditor editor = VaadinCKEditor.create()
6584
.build();
6685
```
6786

87+
### 4. Using PremiumPlugin Enum (Type-Safe)
88+
89+
For type-safe premium plugin configuration, use the `PremiumPlugin` enum:
90+
91+
```java
92+
import com.wontlost.ckeditor.*;
93+
import com.wontlost.ckeditor.VaadinCKEditorPremium.PremiumPlugin;
94+
95+
VaadinCKEditor editor = VaadinCKEditor.create()
96+
.withPreset(CKEditorPreset.FULL)
97+
.withLicenseKey(System.getenv("CKEDITOR_LICENSE_KEY"))
98+
.addCustomPlugin(PremiumPlugin.EXPORT_PDF.toCustomPlugin())
99+
.addCustomPlugin(PremiumPlugin.EXPORT_WORD.toCustomPlugin())
100+
.addCustomPlugin(PremiumPlugin.FORMAT_PAINTER.toCustomPlugin())
101+
.build();
102+
```
103+
68104
## Premium Plugins Reference
69105

70106
### Document Conversion

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<groupId>com.wontlost</groupId>
66
<artifactId>ckeditor-vaadin</artifactId>
77
<packaging>jar</packaging>
8-
<version>5.0.3</version>
8+
<version>5.0.4</version>
99
<name>CKEditorVaadin</name>
1010
<description>Integration of CKEditor 5 for Vaadin</description>
1111
<url>https://github.com/wontlost-ltd/vaadin-ckeditor</url>

0 commit comments

Comments
 (0)