You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: document clipboard protection + full ContentProtector options (ROADMAP #3)
Clipboard protection was integrated and tested but undocumented. Adds it to the
README ContentProtector example, and replaces REFERENCE.md's stub with a
complete "ContentProtector Options" table: every top-level option (type,
default, description) plus per-strategy sub-tables for all 7 companion options
interfaces (ClipboardOptions, WatermarkOptions, ContextMenuOptions,
ScreenshotOptions, DevToolsOptions, BrowserExtensionOptions,
FrameEmbeddingOptions). Notes that preventSelection/preventPrinting/
preventKeyboardShortcuts are boolean-only. README stays a curated quickstart
that points to the reference.
Also fixes the REFERENCE.md table of contents, which previously listed ~15
sections (Advanced Usage, API Reference, per-strategy docs, Utility Classes)
that were never written — all dead anchors. TOC now reflects actual content.
Completes ROADMAP item #3.
@@ -45,6 +33,15 @@ const protector = new ContentProtector({
45
33
preventScreenshots:true,
46
34
preventExtensions:true,
47
35
preventEmbedding:true,
36
+
37
+
// Block copy/cut/paste (and the Clipboard API + execCommand)
38
+
preventClipboard:true,
39
+
clipboardOptions: {
40
+
preventCopy:true, // default: true
41
+
preventCut:true, // default: true
42
+
preventPaste:false, // default: false
43
+
replacementText:'Content copying is disabled for security reasons.'
44
+
},
48
45
49
46
// Enable watermarking
50
47
enableWatermark:true,
@@ -63,4 +60,97 @@ protector.protect();
63
60
64
61
// Remove all protections when needed
65
62
protector.unprotect();
66
-
```
63
+
```
64
+
65
+
## ContentProtector Options
66
+
67
+
All options are passed to the `ContentProtector` constructor. Every protection is **off by default** — you opt in per feature. Most `prevent*`/`enable*` toggles have an optional companion `*Options` object for fine-tuning; `preventSelection`, `preventPrinting`, and `preventKeyboardShortcuts` are boolean-only and take no further options.
68
+
69
+
| Option | Type | Default | Description |
70
+
|--------|------|---------|-------------|
71
+
|`targetElement`|`HTMLElement \| null`|`document.body`| Element to protect. |
72
+
|`preventSelection`|`boolean`|`false`| Block text selection. |
73
+
|`preventContextMenu`|`boolean`|`false`| Block the right-click context menu. |
74
+
|`contextMenuOptions`|`ContextMenuOptions`| — | Context-menu behaviour (see below). |
Copy file name to clipboardExpand all lines: ROADMAP.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,7 +63,7 @@ If screenshot detection later grows more independent heuristics, adopt the DevTo
63
63
-[x] Add `clipboardOptions` to `ContentProtectionOptions`
64
64
-[x] Integrate ClipboardStrategy initialization in `ContentProtector.initializeStrategies()`
65
65
-[x] Add unit tests for clipboard protection (`src/tests/strategies/ClipboardStrategy.test.ts`)
66
-
-[] Update documentation
66
+
-[x] Update documentation (README `ContentProtector` example + new complete "ContentProtector Options" table in REFERENCE.md covering `clipboardOptions` and all other strategy options)
0 commit comments