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
superdoc.goToSearchResult(match); // Pass in a match from the result of search()
243
-
// Or editor.commands.goToSearchResult(match);
244
-
245
-
### Customization
246
-
You can customize the color of the highlights from these styles:
247
-
248
-
```
249
-
.ProseMirror-search-match
250
-
.ProseMirror-active-search-match
251
-
```
252
-
253
207
## Next Steps
254
208
255
209
- See [Integration](/integration/) for framework-specific integration guides
256
210
- Check out [Resources](/resources/) for examples, FAQ, and community resources
257
211
- Learn more about [Getting Started](/) for basic concepts and setup
258
-
259
-
## SuperDoc Toolbar {#superdoc-toolbar}
260
-
261
-
The **SuperDoc** will render into a DOM element of your choosing, allowing for full control of placement and styling over the toolbar.
262
-
By default, we render a toolbar with all available buttons. You can customize this further by adding a `toolbar` object to the `modules` config in the **SuperDoc configuration** object.
263
-
264
-
## Customization
265
-
266
-
You can customize the toolbar configuration via the **SuperDoc config** object.
267
-
268
-
```
269
-
const config = {
270
-
// ... your SuperDoc config
271
-
modules: {
272
-
toolbar: {
273
-
selector: 'superdoc-toolbar', // The ID of the DOM element you want to render the toolbar into
274
-
275
-
toolbarGroups: ['left', 'center', 'right'],
276
-
277
-
// Optional: Specify what toolbar buttons to render. Overrides toolbarGroups.
278
-
groups: {
279
-
center: ['bold', 'italic'],
280
-
},
281
-
282
-
// Optional: Instead of specifying all the buttons you want, specify which ones to exclude
283
-
excludeItems: ['bold', italic'], // Will exclude these from the standard toolbar
The **SuperDoc** will render into a DOM element of your choosing, allowing for full control of placement and styling over the toolbar.
143
+
By default, we render a toolbar with all available buttons. You can customize this further by adding a `toolbar` object to the `modules` config in the **SuperDoc configuration** object.
144
+
145
+
## Customization
146
+
147
+
You can customize the toolbar configuration via the **SuperDoc config** object.
148
+
149
+
```
150
+
const config = {
151
+
// ... your SuperDoc config
152
+
modules: {
153
+
toolbar: {
154
+
selector: 'superdoc-toolbar', // The ID of the DOM element you want to render the toolbar into
155
+
156
+
toolbarGroups: ['left', 'center', 'right'],
157
+
158
+
// Optional: Specify what toolbar buttons to render. Overrides toolbarGroups.
159
+
groups: {
160
+
center: ['bold', 'italic'],
161
+
},
162
+
163
+
// Optional: Instead of specifying all the buttons you want, specify which ones to exclude
164
+
excludeItems: ['bold', italic'], // Will exclude these from the standard toolbar
165
+
166
+
}
167
+
}
168
+
}
169
+
```
170
+
171
+
### Default toolbar buttons
172
+
See all buttons in defaultItems.js
173
+
174
+
# Fields
175
+
176
+
SuperDoc by default has the **fields** extension enabled. You can learn more about the [**Field Annotation** node here](https://github.com/Harbour-Enterprises/SuperDoc/blob/main/packages/super-editor/src/extensions/field-annotation/field-annotation.js)
177
+
178
+
Fields can be used when placeholder / variable content is needed inside the document. They can contain various types of data:
179
+
- Plain text
180
+
- HTML rich text
181
+
- Images
182
+
- Links
183
+
- Checkboxes
184
+
185
+
## Commands
186
+
```
187
+
// Add a field annotation at the specified position
188
+
// editorFocus = true will re-focus the editor after the command, in cases where it is not in focus (ie: drag and drop)
displayLabel: 'My placeholder field', // Placeholder text
202
+
fieldId: MY_FIELD_ID, // The ID you'd like for this field
203
+
type: 'html', // from fieldTypes
204
+
fieldColor: '#000099', // Styling
205
+
}
206
+
207
+
// Add the field to the editor
208
+
addFieldAnnotationAtSelection(myField)
209
+
```
210
+
211
+
## Drag-and-drop
212
+
If you create a drag-and-drop system ([See this example](https://github.com/Harbour-Enterprises/SuperDoc/tree/main/examples/vue-fields-example)) for fields, you should listen for the Editor event 'fieldAnnotationDropped'.
0 commit comments