BookStack/resources/js/wysiwyg/ui/defaults/form-definitions.ts

43 lines
1.1 KiB
TypeScript
Raw Normal View History

2024-05-30 23:50:55 +08:00
import {EditorFormDefinition, EditorFormFieldDefinition, EditorSelectFormFieldDefinition} from "../framework/forms";
import {EditorUiContext} from "../framework/core";
export const link: EditorFormDefinition = {
submitText: 'Apply',
cancelText: 'Cancel',
action(formData, context: EditorUiContext) {
// Todo
console.log('link-form-action', formData);
return true;
},
cancel() {
// Todo
console.log('link-form-cancel');
},
fields: [
{
label: 'URL',
name: 'url',
type: 'text',
},
{
label: 'Text to display',
name: 'text',
type: 'text',
},
{
label: 'Title',
name: 'title',
type: 'text',
},
{
label: 'Open link in...',
name: 'target',
type: 'select',
valuesByLabel: {
'Current window': '',
'New window': '_blank',
}
} as EditorSelectFormFieldDefinition,
],
};