@notum-cz/strapi-plugin-tiptap-editor 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +103 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -88,7 +88,11 @@
88
88
  - [Links](#links)
89
89
  - [Tables](#tables)
90
90
  - [Text Alignment](#text-alignment)
91
+ - [Text Color \& Highlight Color](#text-color--highlight-color)
91
92
  - [Images](#images)
93
+ - [Theme](#theme)
94
+ - [Colors](#colors)
95
+ - [Custom Stylesheet](#custom-stylesheet)
92
96
  - [Configuration Reference](#configuration-reference)
93
97
  - [Feature Values](#feature-values)
94
98
  - [Full Preset Example](#full-preset-example)
@@ -393,6 +397,22 @@ Enables all four alignment buttons (left, center, right, justify).
393
397
  }
394
398
  ```
395
399
 
400
+ ### Text Color & Highlight Color
401
+
402
+ | Key | Description | Toolbar |
403
+ | ---------------- | --------------------------------- | ---------------------- |
404
+ | `textColor` | Change the color of selected text | Font color picker |
405
+ | `highlightColor` | Apply a background highlight | Highlight color picker |
406
+
407
+ Both features use a color picker popover that displays the colors defined in the [theme configuration](#colors). If no colors are configured, the buttons will not appear.
408
+
409
+ ```ts
410
+ {
411
+ textColor: true,
412
+ highlightColor: true,
413
+ }
414
+ ```
415
+
396
416
  ### Images
397
417
 
398
418
  | Key | Description | Toolbar |
@@ -416,6 +436,85 @@ The image stores both the URL (`src`) and the Strapi asset ID (`data-asset-id`)
416
436
  }
417
437
  ```
418
438
 
439
+ ## Theme
440
+
441
+ The `theme` key in the plugin config lets you define colors for the color pickers and inject custom CSS into the editor.
442
+
443
+ ### Colors
444
+
445
+ Define a `colors` array to populate the text color and highlight color pickers. Each entry needs a `label` (shown as a tooltip) and a `color` value (hex, rgb, rgba, hsl, hsla, or CSS variable).
446
+
447
+ ```ts
448
+ // config/plugins.ts
449
+
450
+ export default () => ({
451
+ 'tiptap-editor': {
452
+ config: {
453
+ theme: {
454
+ colors: [
455
+ { label: 'Black', color: '#000000' },
456
+ { label: 'Dark gray', color: '#4A4A4A' },
457
+ { label: 'Red', color: '#E53E3E' },
458
+ { label: 'Orange', color: '#DD6B20' },
459
+ { label: 'Blue', color: '#3182CE' },
460
+ { label: 'Green', color: '#38A169' },
461
+ { label: 'Brand primary', color: 'var(--color-primary)' },
462
+ ],
463
+ },
464
+ presets: {
465
+ blog: {
466
+ bold: true,
467
+ italic: true,
468
+ textColor: true,
469
+ highlightColor: true,
470
+ },
471
+ },
472
+ },
473
+ },
474
+ });
475
+ ```
476
+
477
+ ### Custom Stylesheet
478
+
479
+ You can inject custom CSS to style the editor content area. There are two options — use one or the other, not both.
480
+
481
+ **Option 1: `css`** — Inline CSS content (recommended for monorepos and production deployments)
482
+
483
+ Read the file at Strapi startup so the CSS is captured as a string. This works reliably across all environments (local dev, Docker, Azure Container Apps, etc.) because the file is resolved in your app's Node process at boot time.
484
+
485
+ ```ts
486
+ // config/plugins.ts
487
+ import { readFileSync } from 'fs';
488
+
489
+ export default () => ({
490
+ 'tiptap-editor': {
491
+ config: {
492
+ theme: {
493
+ css: readFileSync(require.resolve('@repo/design-system/strapi-styles.css'), 'utf-8'),
494
+ },
495
+ },
496
+ },
497
+ });
498
+ ```
499
+
500
+ **Option 2: `stylesheet`** — A URL the browser can fetch directly
501
+
502
+ Use this when the stylesheet is hosted at a known URL (CDN, public path, etc.).
503
+
504
+ ```ts
505
+ // config/plugins.ts
506
+
507
+ export default () => ({
508
+ 'tiptap-editor': {
509
+ config: {
510
+ theme: {
511
+ stylesheet: 'https://cdn.example.com/editor-styles.css',
512
+ },
513
+ },
514
+ },
515
+ });
516
+ ```
517
+
419
518
  ## Configuration Reference
420
519
 
421
520
  ### Feature Values
@@ -474,6 +573,10 @@ export default () => ({
474
573
  // Text alignment (left, center, right, justify)
475
574
  textAlign: true,
476
575
 
576
+ // Text and highlight colors (requires theme.colors)
577
+ textColor: true,
578
+ highlightColor: true,
579
+
477
580
  // Images from Strapi Media Library
478
581
  mediaLibrary: true,
479
582
  },
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.1.0",
2
+ "version": "1.1.1",
3
3
  "keywords": [
4
4
  "strapi",
5
5
  "plugin",