@vicacha-devs/strapi-plugin-tiptap-editor 0.0.0-stage → 1.3.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.
- package/LICENSE +21 -0
- package/README.md +227 -2
- package/dist/admin/RichTextInput-D28dIMNs.js +23128 -0
- package/dist/admin/RichTextInput-DiDQ5XMM.mjs +23103 -0
- package/dist/admin/SettingsPage-1oR0QxC5.js +988 -0
- package/dist/admin/SettingsPage-CA0UzBSH.mjs +988 -0
- package/dist/admin/ar-BD5rrXHS.mjs +449 -0
- package/dist/admin/ar-Bz7sBXdV.js +449 -0
- package/dist/admin/cs-BDhq-i-g.mjs +449 -0
- package/dist/admin/cs-D5RxK4Hh.js +449 -0
- package/dist/admin/de-BrQTf53x.mjs +449 -0
- package/dist/admin/de-DXHVXq5r.js +449 -0
- package/dist/admin/en-B4KC0Bd9.mjs +449 -0
- package/dist/admin/en-bV6CkE7c.js +449 -0
- package/dist/admin/es-5J7F-hp5.mjs +449 -0
- package/dist/admin/es-BNkM2q8a.js +449 -0
- package/dist/admin/fr-B_NcyJ87.js +449 -0
- package/dist/admin/fr-DrHoPY5C.mjs +449 -0
- package/dist/admin/index-CP3JzGBV.js +19545 -0
- package/dist/admin/index-DjVOc_t-.mjs +19524 -0
- package/dist/admin/index.js +22 -0
- package/dist/admin/index.mjs +22 -0
- package/dist/admin/it-BpCpiXE6.mjs +449 -0
- package/dist/admin/it-x-zhlYK1.js +449 -0
- package/dist/admin/nl-DW32hWWr.js +449 -0
- package/dist/admin/nl-cmEr-Y0k.mjs +449 -0
- package/dist/admin/pl-39nZ593t.js +449 -0
- package/dist/admin/pl-COCG11Ku.mjs +449 -0
- package/dist/admin/pt-79V4o0wh.mjs +449 -0
- package/dist/admin/pt-FuzbrWcS.js +449 -0
- package/dist/admin/src/builtins/button.d.ts +8 -0
- package/dist/admin/src/components/BaseTiptapInput.d.ts +22 -0
- package/dist/admin/src/components/ColorPickerPopover.d.ts +13 -0
- package/dist/admin/src/components/ComponentAttributeForm.d.ts +12 -0
- package/dist/admin/src/components/ComponentDialog.d.ts +18 -0
- package/dist/admin/src/components/ComponentNodeView.d.ts +3 -0
- package/dist/admin/src/components/EditorErrorBoundary.d.ts +21 -0
- package/dist/admin/src/components/EditorFooterAndModes.d.ts +26 -0
- package/dist/admin/src/components/ImageAltPopover.d.ts +7 -0
- package/dist/admin/src/components/ImageAltPopoverForm.d.ts +32 -0
- package/dist/admin/src/components/ImageEditorModal.d.ts +8 -0
- package/dist/admin/src/components/Initializer.d.ts +6 -0
- package/dist/admin/src/components/InlineComponentNodeView.d.ts +8 -0
- package/dist/admin/src/components/LinkDialog.d.ts +14 -0
- package/dist/admin/src/components/MediaLibraryWrapper.d.ts +23 -0
- package/dist/admin/src/components/PresetSelect.d.ts +21 -0
- package/dist/admin/src/components/ResponsiveToolbar.d.ts +18 -0
- package/dist/admin/src/components/RichTextInput.d.ts +21 -0
- package/dist/admin/src/components/RichTextToolbarItems.d.ts +65 -0
- package/dist/admin/src/components/Spacer.d.ts +6 -0
- package/dist/admin/src/components/TableSizeDialog.d.ts +10 -0
- package/dist/admin/src/components/TiptapInput.d.ts +6 -0
- package/dist/admin/src/components/TiptapInputStyles.d.ts +1 -0
- package/dist/admin/src/components/ToolbarButton.d.ts +19 -0
- package/dist/admin/src/components/imageEditorHelpers.d.ts +37 -0
- package/dist/admin/src/components/richTextInputHelpers.d.ts +15 -0
- package/dist/admin/src/extensions/Attachment.d.ts +28 -0
- package/dist/admin/src/extensions/Audio.d.ts +16 -0
- package/dist/admin/src/extensions/Components.d.ts +22 -0
- package/dist/admin/src/extensions/EmojiPicker.d.ts +16 -0
- package/dist/admin/src/extensions/Heading.d.ts +18 -0
- package/dist/admin/src/extensions/HighlightColor.d.ts +9 -0
- package/dist/admin/src/extensions/Iframe.d.ts +14 -0
- package/dist/admin/src/extensions/IframeNodeView.d.ts +21 -0
- package/dist/admin/src/extensions/Image.d.ts +15 -0
- package/dist/admin/src/extensions/InformationPane.d.ts +24 -0
- package/dist/admin/src/extensions/Link.d.ts +7 -0
- package/dist/admin/src/extensions/Linker.d.ts +32 -0
- package/dist/admin/src/extensions/Mathematics.d.ts +17 -0
- package/dist/admin/src/extensions/MathematicsNodeView.d.ts +13 -0
- package/dist/admin/src/extensions/PasteStripper.d.ts +2 -0
- package/dist/admin/src/extensions/Script.d.ts +10 -0
- package/dist/admin/src/extensions/SemanticMarks.d.ts +28 -0
- package/dist/admin/src/extensions/SlashCommand.d.ts +15 -0
- package/dist/admin/src/extensions/SpeechTools.d.ts +14 -0
- package/dist/admin/src/extensions/StarterKit.d.ts +17 -0
- package/dist/admin/src/extensions/StructuredBlocks.d.ts +22 -0
- package/dist/admin/src/extensions/StructuredBlocksToc.d.ts +19 -0
- package/dist/admin/src/extensions/Table.d.ts +17 -0
- package/dist/admin/src/extensions/TableCellBackground.d.ts +9 -0
- package/dist/admin/src/extensions/TextAlign.d.ts +14 -0
- package/dist/admin/src/extensions/TextColor.d.ts +9 -0
- package/dist/admin/src/extensions/TypographyControls.d.ts +30 -0
- package/dist/admin/src/extensions/Video.d.ts +25 -0
- package/dist/admin/src/extensions/VideoNodeView.d.ts +11 -0
- package/dist/admin/src/extensions/slashCommandItems.d.ts +13 -0
- package/dist/admin/src/extensions/useAudio.d.ts +11 -0
- package/dist/admin/src/fields/richTextField.d.ts +118 -0
- package/dist/admin/src/hooks/useKeyboardNavigation.d.ts +13 -0
- package/dist/admin/src/hooks/usePresetConfig.d.ts +10 -0
- package/dist/admin/src/hooks/useRelationalSync.d.ts +67 -0
- package/dist/admin/src/hooks/useThemeConfig.d.ts +2 -0
- package/dist/admin/src/icons/SubScript.d.ts +6 -0
- package/dist/admin/src/icons/SuperScript.d.ts +6 -0
- package/dist/admin/src/icons/TextAlignCenter.d.ts +6 -0
- package/dist/admin/src/icons/TextAlignJustify.d.ts +6 -0
- package/dist/admin/src/icons/TextAlignLeft.d.ts +6 -0
- package/dist/admin/src/icons/TextAlignRight.d.ts +6 -0
- package/dist/admin/src/index.d.ts +22 -0
- package/dist/admin/src/pages/SettingsFeatureMatrixSection.d.ts +16 -0
- package/dist/admin/src/pages/SettingsGlobalSection.d.ts +12 -0
- package/dist/admin/src/pages/SettingsPage.d.ts +9 -0
- package/dist/admin/src/pages/settingsConstants.d.ts +14 -0
- package/dist/admin/src/registry/richTextComponents.d.ts +12 -0
- package/dist/admin/src/registry/types.d.ts +70 -0
- package/dist/admin/src/utils/attributeCodec.d.ts +10 -0
- package/dist/admin/src/utils/buildExtensions.d.ts +11 -0
- package/dist/admin/src/utils/componentAttrs.d.ts +21 -0
- package/dist/admin/src/utils/customExtensionRegistry.d.ts +120 -0
- package/dist/admin/src/utils/formatLabel.d.ts +8 -0
- package/dist/admin/src/utils/getTranslation.d.ts +3 -0
- package/dist/admin/src/utils/strapiApp.d.ts +44 -0
- package/dist/admin/src/utils/themeCache.d.ts +3 -0
- package/dist/admin/src/utils/tiptapUtils.d.ts +62 -0
- package/dist/admin/tr-B6YfR9Mp.mjs +449 -0
- package/dist/admin/tr-DgWjBZ0-.js +449 -0
- package/dist/server/index.js +2401 -0
- package/dist/server/index.mjs +2395 -0
- package/dist/server/src/bootstrap.d.ts +12 -0
- package/dist/server/src/config/index.d.ts +8 -0
- package/dist/server/src/content-types/index.d.ts +2 -0
- package/dist/server/src/controllers/index.d.ts +2 -0
- package/dist/server/src/controllers/media.d.ts +18 -0
- package/dist/server/src/controllers/preset.d.ts +9 -0
- package/dist/server/src/controllers/search.d.ts +22 -0
- package/dist/server/src/controllers/settings.d.ts +18 -0
- package/dist/server/src/controllers/theme.d.ts +8 -0
- package/dist/server/src/controllers/types.d.ts +13 -0
- package/dist/server/src/destroy.d.ts +5 -0
- package/dist/server/src/fields/richTextField.d.ts +10 -0
- package/dist/server/src/index.d.ts +4 -0
- package/dist/server/src/middlewares/index.d.ts +2 -0
- package/dist/server/src/policies/index.d.ts +2 -0
- package/dist/server/src/register.d.ts +10 -0
- package/dist/server/src/routes/index.d.ts +78 -0
- package/dist/server/src/services/index.d.ts +2 -0
- package/dist/server/src/services/media.d.ts +38 -0
- package/dist/server/src/services/mediaSecurity.d.ts +39 -0
- package/dist/server/src/services/preset.d.ts +36 -0
- package/dist/server/src/services/search.d.ts +50 -0
- package/dist/server/src/services/settings.d.ts +55 -0
- package/dist/server/src/services/theme.d.ts +8 -0
- package/dist/shared/index.js +2372 -0
- package/dist/shared/index.mjs +2370 -0
- package/dist/shared/src/components/button.d.ts +4 -0
- package/dist/shared/src/components/index.d.ts +6 -0
- package/dist/shared/src/components/names.d.ts +5 -0
- package/dist/shared/src/components/toNodeSpec.d.ts +5 -0
- package/dist/shared/src/components/types.d.ts +62 -0
- package/dist/shared/src/contentSerializer.d.ts +61 -0
- package/dist/shared/src/fields.d.ts +1 -0
- package/dist/shared/src/index.d.ts +8 -0
- package/dist/shared/src/pluginId.d.ts +1 -0
- package/dist/shared/src/relations.d.ts +33 -0
- package/dist/shared/src/sanitize.d.ts +27 -0
- package/dist/shared/src/serializers/inlineMarkdownParser.d.ts +8 -0
- package/dist/shared/src/serializers/markdownBlockHelpers.d.ts +13 -0
- package/dist/shared/src/serializers/markdownParser.d.ts +12 -0
- package/dist/shared/src/serializers/markdownSerializer.d.ts +19 -0
- package/dist/shared/src/serializers/nodeTreeSanitizer.d.ts +18 -0
- package/dist/shared/src/serializers/sanitizers.d.ts +39 -0
- package/dist/shared/src/table.d.ts +17 -0
- package/dist/shared/src/types.d.ts +166 -0
- package/dist/shared/src/urlSafety.d.ts +9 -0
- package/package.json +130 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Notum Technologies
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,228 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@vicacha-devs/strapi-plugin-tiptap-editor`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TipTap v3 + Edifice IO WYSIWYG editor plugin for Strapi v5. Includes 49 configurable rich-text features, schema-driven custom components, Edifice IO multimedia & structured blocks, relational media & internal link sync, in-editor HTML5 Canvas image studio & voice recorder, speech tools, and WCAG 2.1 AA accessibility.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Powered by [TipTap v3.20+](https://tiptap.dev/)** — headless ProseMirror architecture with React NodeViews and zero-side-effect state updates (`useEditorState`).
|
|
8
|
+
- **49 Configurable Features** across 4 built-in presets (`minimal`, `default`, `full`, `edifice`) plus custom presets in `config/plugins.ts` and runtime overrides in Strapi Admin Settings.
|
|
9
|
+
- **Schema-Driven Custom Components (`components`)** — reusable block or inline components (with built-in `button` included out of the box), generated attribute dialogs, custom React previews, and shared `./shared` schema helpers.
|
|
10
|
+
- **Multi-Format Serialization** — stores **ProseMirror JSON** by default, or outputs sanitized **HTML** or **Markdown** per field.
|
|
11
|
+
- **Edifice IO Multimedia Suite**:
|
|
12
|
+
- **Images (`mediaLibrary`)** with in-editor **HTML5 Canvas Image Crop/Rotate/Flip/Zoom Studio**, `<figure>`/`<figcaption>`, `alt`, `title`, Media Library metadata refresh, alignment, and drag-resize handle.
|
|
13
|
+
- **Videos (`video`)** via Strapi Media Library or privacy-enhanced YouTube (`youtube-nocookie.com`), Vimeo, and direct MP4 URLs.
|
|
14
|
+
- **Audio (`audio`)** via Strapi Media Library or **in-browser `MediaRecorder` Voice Note Recorder** with live timer and direct upload.
|
|
15
|
+
- **Attachments (`attachment`)** with downloadable file cards, MIME badge, and formatted byte size.
|
|
16
|
+
- **Iframes (`iframe`)** with strict `https:` enforcement, `sandbox` attributes, and domain allowlisting.
|
|
17
|
+
- **Relational Media & Internal Link Sync**:
|
|
18
|
+
- Automatically extracts all 4 embedded media types (`image`, `video`, `audio`, `attachment`) into a companion `<FieldName>Media` field and internal Strapi links (`strapi://collectionName/documentId` & `linker` nodes) into a companion `<FieldName>Links` component.
|
|
19
|
+
- **Structured Blocks & Editorial Tools**:
|
|
20
|
+
- `informationPane`, `accordion`, `columns`, `taskList`, `conversationHistory`, `tableOfContents`, `pageBreak`, `mathematics`, `emoji`, and `slashCommands`.
|
|
21
|
+
- **Typography & Semantic Accessibility Marks**:
|
|
22
|
+
- `fontFamily`, `fontSize`, `lineHeight`, `clearFormatting`, `typography`, `leadParagraph`, `abbr`, and `language` (`<span lang="..." dir="...">` for WCAG 2.1 SC 3.1.2).
|
|
23
|
+
- **Speech & Productivity Modes**:
|
|
24
|
+
- `speechToText`, `textToSpeech`, `characterCount`, `fullscreen`, Edifice Read-Only Preview, and JSON / HTML / Markdown Source Inspector.
|
|
25
|
+
- **Zero-Data-Loss Content Safety**:
|
|
26
|
+
- Disabling any rich node in a preset renders existing content via read-only NodeViews so content is never silently stripped on save, and unknown unregistered types surface a clear warning via `stripUnknownContent`.
|
|
27
|
+
|
|
28
|
+
## Supported Versions
|
|
29
|
+
|
|
30
|
+
| Plugin Version | Strapi Version | Node.js Version | TipTap Version |
|
|
31
|
+
| --- | --- | --- | --- |
|
|
32
|
+
| `1.3.x+` | `5.39.0` | `^20.19.0 \|\| ^22.13.0 \|\| >=24.0.0` | `3.20.1` |
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pnpm add @vicacha-devs/strapi-plugin-tiptap-editor
|
|
38
|
+
pnpm build && pnpm start
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Configuration
|
|
42
|
+
|
|
43
|
+
The plugin uses a hybrid **preset + runtime settings** architecture:
|
|
44
|
+
|
|
45
|
+
1. **Built-in Presets**: `minimal`, `default`, `full`, and `edifice` work out of the box with zero configuration.
|
|
46
|
+
2. **Code-first Presets (`config/plugins.ts`)**: Define custom named presets and theme options in version control.
|
|
47
|
+
3. **Runtime Settings UI (`/settings/tiptap-editor`)**: Override global defaults, allowed iframe domains, relational sync, and per-preset feature toggles stored in Strapi `core-store`.
|
|
48
|
+
|
|
49
|
+
### Built-In Presets
|
|
50
|
+
|
|
51
|
+
| Preset Name | Included Features |
|
|
52
|
+
| --- | --- |
|
|
53
|
+
| `minimal` | `bold`, `italic` |
|
|
54
|
+
| `default` | `bold`, `italic`, `underline`, `strike`, `code`, `codeBlock`, `blockquote`, `bulletList`, `orderedList`, `hardBreak`, `horizontalRule`, `history`, `heading`, `link`, `table`, `textAlign`, `mediaLibrary`, `characterCount` |
|
|
55
|
+
| `full` | All **49** feature keys enabled |
|
|
56
|
+
| `edifice` | All **49** feature keys enabled (complete Edifice IO Playground experience) |
|
|
57
|
+
|
|
58
|
+
### Defining Custom Presets (`config/plugins.ts`)
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
export default () => ({
|
|
62
|
+
'tiptap-editor': {
|
|
63
|
+
config: {
|
|
64
|
+
presets: {
|
|
65
|
+
minimal: { bold: true, italic: true, link: true },
|
|
66
|
+
editorial: {
|
|
67
|
+
bold: true,
|
|
68
|
+
italic: true,
|
|
69
|
+
underline: true,
|
|
70
|
+
heading: { levels: [1, 2, 3, 4] },
|
|
71
|
+
leadParagraph: true,
|
|
72
|
+
abbr: true,
|
|
73
|
+
language: true,
|
|
74
|
+
bulletList: true,
|
|
75
|
+
orderedList: true,
|
|
76
|
+
taskList: true,
|
|
77
|
+
blockquote: true,
|
|
78
|
+
informationPane: true,
|
|
79
|
+
accordion: true,
|
|
80
|
+
columns: true,
|
|
81
|
+
link: true,
|
|
82
|
+
linker: true,
|
|
83
|
+
mediaLibrary: { resize: { enabled: true } },
|
|
84
|
+
video: true,
|
|
85
|
+
audio: true,
|
|
86
|
+
attachment: true,
|
|
87
|
+
table: { resizable: true, cellBackground: true },
|
|
88
|
+
components: { button: true },
|
|
89
|
+
characterCount: { limit: 10000 },
|
|
90
|
+
fullscreen: true,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Field-Level Options (Content-Type Builder)
|
|
99
|
+
|
|
100
|
+
- **Output Format (`options.outputFormat`)**: `json` (default ProseMirror JSON), `html` (sanitized HTML string), or `markdown` (Markdown string).
|
|
101
|
+
- **Editor Preset (`options.preset`)**: Select which preset this field uses (`default`, `minimal`, `full`, `edifice`, or custom).
|
|
102
|
+
- **Character Limit (`options.characterLimit`)**: Optional maximum character count for the field.
|
|
103
|
+
- **Placeholder (`options.placeholder`)**: Custom placeholder text when the editor is empty.
|
|
104
|
+
|
|
105
|
+
## Custom Components
|
|
106
|
+
|
|
107
|
+
Components are enabled per preset under a `components` key mapping component names (`^[a-zA-Z][\w-]*$`, excluding `RESERVED_NODE_NAMES`) to `true`, `false`, or an options object:
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
import type { StrapiApp } from '@strapi/strapi/admin';
|
|
111
|
+
import {
|
|
112
|
+
defineRichTextComponent,
|
|
113
|
+
registerRichTextComponent,
|
|
114
|
+
} from '@vicacha-devs/strapi-plugin-tiptap-editor/strapi-admin';
|
|
115
|
+
import type { RichTextComponentSchema } from '@vicacha-devs/strapi-plugin-tiptap-editor/shared';
|
|
116
|
+
|
|
117
|
+
export const calloutSchema: RichTextComponentSchema = {
|
|
118
|
+
name: 'callout',
|
|
119
|
+
label: 'Callout',
|
|
120
|
+
content: 'block+',
|
|
121
|
+
attributes: {
|
|
122
|
+
tone: {
|
|
123
|
+
default: 'info',
|
|
124
|
+
form: {
|
|
125
|
+
type: 'select',
|
|
126
|
+
label: 'Tone',
|
|
127
|
+
options: [
|
|
128
|
+
{ value: 'info', label: 'Info' },
|
|
129
|
+
{ value: 'warning', label: 'Warning' },
|
|
130
|
+
],
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const calloutComponent = defineRichTextComponent<{ tone: 'info' | 'warning' }>({
|
|
137
|
+
...calloutSchema,
|
|
138
|
+
label: { id: 'app.components.callout.label', defaultMessage: 'Callout' },
|
|
139
|
+
defaultAttrs: { tone: 'info' },
|
|
140
|
+
validate: (attrs) => (attrs.tone ? null : { tone: 'Tone is required' }),
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
export default {
|
|
144
|
+
register(_app: StrapiApp) {
|
|
145
|
+
registerRichTextComponent(calloutComponent);
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
- **Inline Components**: Set `inline: true` on a schema (without `content`) to create an inline atom with `marks: ''` that renders as a compact `<span>` chip.
|
|
151
|
+
- **Shared Schema Helpers**: Import `RichTextComponentSchema`, `toNodeSpec`, `isInlineComponent`, `buttonSchema`, `BUILT_IN_COMPONENT_SCHEMAS`, `stripUnknownContent`, `isComponentEnabled`, `getComponentOptions`, and `RESERVED_NODE_NAMES` from `@vicacha-devs/strapi-plugin-tiptap-editor/shared`.
|
|
152
|
+
|
|
153
|
+
## Relational Media & Internal Links Synchronization
|
|
154
|
+
|
|
155
|
+
- **Companion `<FieldName>Media` Field**: Add a Multiple Media field named `<FieldName>Media` (e.g. `contentMedia`). `useRelationalSync` extracts all embedded `image`, `video`, `audio`, and `attachment` assets (`data-asset-id` / `data-document-id`) and updates `<FieldName>Media`.
|
|
156
|
+
- **Companion `<FieldName>Links` Component**: Define a `links.links` component in your Strapi project and add a `<FieldName>Links` field (e.g. `contentLinks`). Internal Strapi links inserted via `linker` or `strapi://api::collection.collection/documentId` URIs are grouped by collection and synced automatically.
|
|
157
|
+
|
|
158
|
+
## Available Extensions (49 Feature Keys)
|
|
159
|
+
|
|
160
|
+
### Inline Formatting, Typography & Semantic Marks
|
|
161
|
+
|
|
162
|
+
| Key | Description |
|
|
163
|
+
| --- | --- |
|
|
164
|
+
| `bold`, `italic`, `underline`, `strike`, `code`, `superscript`, `subscript` | Standard inline formatting marks (`<strong>`, `<em>`, `<u>`, `<s>`, `<code>`, `<sup>`, `<sub>`) |
|
|
165
|
+
| `clearFormatting` | Strip all inline marks and reset block to paragraph |
|
|
166
|
+
| `leadParagraph` | Lead / intro paragraph (`<p class="lead-paragraph" data-lead="true">`) |
|
|
167
|
+
| `abbr` | Semantic abbreviation (`<abbr title="...">`) with modal |
|
|
168
|
+
| `language` | WCAG 3.1.2 language & direction (`<span lang=".." dir="..">`) |
|
|
169
|
+
| `fontFamily`, `fontSize`, `lineHeight` | Customizable font family, font size (`12px`–`40px`), and line height (`1.0`–`2.0`) selectors |
|
|
170
|
+
| `typography` | Smart typography input rules (`--` → `—`, `...` → `…`, `(c)` → `©`) |
|
|
171
|
+
|
|
172
|
+
### Block Elements, Headings, Links, Tables & Colors
|
|
173
|
+
|
|
174
|
+
| Key | Description |
|
|
175
|
+
| --- | --- |
|
|
176
|
+
| `blockquote`, `codeBlock`, `bulletList`, `orderedList`, `taskList`, `hardBreak`, `horizontalRule`, `history` | Core block elements, interactive checklists, and undo/redo history |
|
|
177
|
+
| `heading` | Visual heading levels (`h1`–`h6`), independent SEO tag, and sanitized slug `id` attributes |
|
|
178
|
+
| `link` | External/internal hyperlinks with protocol validation (`https:`, `mailto:`) |
|
|
179
|
+
| `linker` | Internal Strapi Document Linker chip & live search modal |
|
|
180
|
+
| `table` | Resizable tables with row/column controls, `cellBackground` color picker (`TableCellWithBackground`, `TableHeaderWithBackground`), and cell merge/split |
|
|
181
|
+
| `textAlign`, `textColor`, `highlightColor` | Paragraph/heading alignment and theme-driven text/highlight color pickers |
|
|
182
|
+
| `informationPane`, `accordion`, `columns`, `conversationHistory`, `pageBreak`, `tableOfContents`, `components` | Edifice IO callout boxes, `<details>` accordions, 2/3-col CSS grids, discussion logs, page breaks, dynamic TOC, and custom components |
|
|
183
|
+
|
|
184
|
+
### Edifice IO Multimedia, Math, Emoji, Slash & Speech Tools
|
|
185
|
+
|
|
186
|
+
| Key | Description |
|
|
187
|
+
| --- | --- |
|
|
188
|
+
| `mediaLibrary` | Strapi Media Library images with alt/title/caption popover, metadata sync, resize handle, and HTML5 Canvas crop/rotate/flip/zoom studio |
|
|
189
|
+
| `video` | Strapi Media Library videos (`<video controls>`) or YouTube/Vimeo/MP4 embeds |
|
|
190
|
+
| `audio` | Strapi Media Library audio or in-browser `MediaRecorder` voice note recorder |
|
|
191
|
+
| `attachment` | Downloadable file cards with filename, extension badge, MIME type, and size |
|
|
192
|
+
| `iframe` | Sandboxed `https:` iframes (`sandbox="allow-scripts allow-popups"`, `allowedDomains`) |
|
|
193
|
+
| `mathematics`, `emoji`, `slashCommands` | Inline/block LaTeX math, searchable emoji picker + `:shortcode:`, and `/` command palette |
|
|
194
|
+
| `speechToText`, `textToSpeech` | Web Speech API voice dictation and read-aloud |
|
|
195
|
+
| `characterCount`, `fullscreen` | Live word/character/reading-time footer bar, fullscreen mode, read-only preview, and JSON/HTML/Markdown source inspector |
|
|
196
|
+
|
|
197
|
+
## Accessibility (WCAG 2.1 AA) & Security
|
|
198
|
+
|
|
199
|
+
- **WCAG 2.1 AA Toolbar Navigation**: Roving `ArrowRight`/`ArrowLeft`/`Home`/`End`/`Escape` keyboard navigation, `role="toolbar"`, `aria-label`, `aria-pressed`, `aria-live="polite"`, and WCAG 3.1.2 `language` marks.
|
|
200
|
+
- **Defense-in-Depth Security**:
|
|
201
|
+
- **URL & Attribute Sanitization**: Blocks `javascript:`, `vbscript:`, protocol-relative (`//`, `/\`), and `data:text/html` across links, media nodes, custom component `url` attributes, and preset `HTMLAttributes` overrides.
|
|
202
|
+
- **DNS-Aware SSRF Protection (`isSsrfSafeUrl` & `assertSafeResolvedHost`)**: Backend `/link-preview` and `/upload-by-url` routes validate hostnames and DNS-resolved IPv4/IPv6 addresses, pin DNS records via an undici `Agent` dispatcher, disable automatic redirects, and cap response streams (64 KB for link previews, 25 MB for uploads).
|
|
203
|
+
|
|
204
|
+
## Theme & Public Admin API
|
|
205
|
+
|
|
206
|
+
Configure `theme.colors` (`{ label, color }[]`) and `theme.css` / `theme.stylesheet` in `config/plugins.ts`.
|
|
207
|
+
|
|
208
|
+
Import from `@vicacha-devs/strapi-plugin-tiptap-editor/strapi-admin`:
|
|
209
|
+
|
|
210
|
+
- `registerRichTextComponent`, `defineRichTextComponent`, `listRichTextComponents`, `ColorPickerPopover`
|
|
211
|
+
- `registerTiptapExtension`, `unregisterTiptapExtension`, `getRegisteredTiptapExtension`, `getRegisteredTiptapExtensions`
|
|
212
|
+
- `MediaLibraryWrapper`, `ToolbarButton`
|
|
213
|
+
|
|
214
|
+
## Backend API Routes
|
|
215
|
+
|
|
216
|
+
All admin routes are mounted under `/tiptap-editor`:
|
|
217
|
+
|
|
218
|
+
| Method | Path | Description |
|
|
219
|
+
| --- | --- | --- |
|
|
220
|
+
| `GET` | `/tiptap-editor/presets` | List all available preset names (built-in + custom) |
|
|
221
|
+
| `GET` | `/tiptap-editor/presets/:preset` | Get resolved feature configuration for a preset |
|
|
222
|
+
| `GET` | `/tiptap-editor/theme` | Get theme colors and custom CSS/stylesheet |
|
|
223
|
+
| `GET` / `PUT` | `/tiptap-editor/settings` | Get or update runtime settings and preset overrides |
|
|
224
|
+
| `GET` | `/tiptap-editor/search?q=<query>&locale=<locale>` | Search linkable Strapi collection documents |
|
|
225
|
+
| `GET` | `/tiptap-editor/get/:collectionName/:documentId` | Resolve a single Strapi document's label and publish state |
|
|
226
|
+
| `GET` | `/tiptap-editor/identify/:collectionName` | Identify the human-readable title field for a collection |
|
|
227
|
+
| `GET` | `/tiptap-editor/link-preview?url=<https_url>` | DNS-aware SSRF-safe OpenGraph metadata preview |
|
|
228
|
+
| `POST` | `/tiptap-editor/upload-by-url` | DNS-aware SSRF-safe remote media URL upload |
|