As we have said, a software having customization is a software having soul. Tipex editor is highly customizable. You can customize the editor to your heart's content.
The in-built utility buttons consist of Copy
and Link
buttons.
Here's a basic example of how you can insert in-built utility buttons.
import {Utility} from "@friendofsvelte/tipex";
<Tipex htmlContent={htmlContent}>
<Utility slot="utilities"/>
</Tipex>
To append new buttons you can use the Utility.svelte
component, it has a slot
for you
to insert your buttons.
<Tipex htmlContent={htmlContent}>
<div aria-label="Custom utility button" slot="utilities">...</div>
</Tipex>
Slot Name | Default | Condition | Description |
---|---|---|---|
headComponent | null | N/A | Slot for rendering a component at the head of the editor. |
controlComponent | DefaultControls | if $$slots.controlComponent | Slot for customizing the control element of the editor. If not provided, DefaultControls are used. |
utilities | Utility | if $$slots.utilities within DefaultControls | Slot within the DefaultControls for adding extra utility controls. If not provided, default Utility is used. |
footComponent | null | N/A | Slot for rendering a component at the foot of the editor. |
Note: The
utilities
slot is only available if the$$slots.controlComponent
slot is not provided. The$$slots.controlComponent
overrides the default controls, and makes theutilities
slot unavailable.
You can override the default controls with your own custom controls. Here's an example of how you can do it.
<Tipex htmlContent={htmlContent}>
<div aria-label="New Custom Control" slot="controlComponent">...</div>
</Tipex>
Or, you can use <svelte:fragment
to append your buttons. Make sure that
slot="controlComponent"
is provided.
Tipex editor supports image upload. You can upload images by dragging and dropping them in the editor, or by copy pasting them from your clipboard, which is the most common way to upload images.
You can use utility customization for this. Apply the upper mentioned method to append your custom button.
Tipex, being a highly customizable editor, allows you to customize the editor to your heart's content and make it look like your own. Here's some ways you can customize the editor.
You can customize the controls of the editor by passing a controlComponent
slot.
<script lang="ts">
import {Tipex} from "@friendofsvelte/tipex";
import YourCustomHead from "./YourCustomHead.svelte";
import YourCustomFooter from "./YouCustomFooter.svelte";
import CustomControl from "./CustomControl.svelte";
</script>
<Tipex htmlContent={htmlContent}>
<YourCustomHead slot="headComponent"/>
<CustomControl slot="controlComponent"/>
<YourCustomFooter slot="footerComponent"/>
</Tipex>
You can also add a header and footer with using a slot.
Tipex provides an defaultExtensions
object which contains all the extensions that are used in the
editor. You can tweak the extensions, or add new extensions to the editor by passing a extensions
prop to the editor.
<script lang="ts">
import {defaultExtensions, Tipex} from "@friendofsvelte/tipex";
let extension = {
...defaultExtensions,
heading: Heading.configure({
levels: [2, 3, 4, 5, 6]
})
} // sample of tweaking extensions, so that only heading 2 to 6 are available
</script>
<Tipex extensions={extension} .../>