Opens a font picker panel in the editor, prompting the user to select a font. This function is intended for use in the settings panel of a site widget or plugin implemented with a custom element.
function selectFont(value: FontPickerValue, options: { onChange: (value: FontPickerValue) => void }): Promise<FontPickerValue>
Name | Type | Description |
---|---|---|
value | FontPickerValue | Optional. Value of the associated font and text-decoration CSS shorthand properties. |
options | SelectFontOptions | Optional. Options to use when opening the font picker panel. |
{
font: string;
textDecoration: string;
}
Name | Type | Description |
---|---|---|
font | string | Value of the associated font CSS shorthand property, which can include the following:
|
textDecoration | string | Optional. Value of the associated text-decoration CSS shorthand property. Can also be undefined . |
{
onChange: (value: FontPickerValue) => void
}
Name | Type | Description |
---|---|---|
onChange | Function | Optional. Callback function invoked when the font selection changes. It receives the updated FontPickerValue as a parameter. |
Promise<FontPickerValue>
The font selected by the user.
import { editor, inputs } from "@wix/editor";
import { createClient } from "@wix/sdk";
const client = createClient({
host: editor.host(),
modules: { inputs },
});
async function selectFont(font) {
const response = await client.inputs.selectFont(font, {
onChange: (value) => {
console.log("New font: ", value);
},
});
}