fchat-rising/bbcode/editor.ts

106 lines
3.1 KiB
TypeScript
Raw Permalink Normal View History

import Vue from 'vue';
import {Keys} from '../keys';
2017-09-02 01:50:31 +00:00
export interface EditorButton {
title: string;
tag: string;
icon: string;
key?: Keys;
2017-09-02 01:50:31 +00:00
class?: string;
2023-05-28 03:00:51 +00:00
outerClass?: string;
2017-09-02 01:50:31 +00:00
startText?: string;
endText?: string;
handler?(vm: Vue): void;
}
export interface EditorSelection {
start: number;
end: number;
length: number;
text: string;
}
/*tslint:disable:max-line-length*/
export let defaultButtons: ReadonlyArray<EditorButton> = [
{
title: 'Bold (Ctrl+B)\n\nMakes text appear with a bold weight.',
tag: 'b',
icon: 'fa-bold',
key: Keys.KeyB
2017-09-02 01:50:31 +00:00
},
{
title: 'Italic (Ctrl+I)\n\nMakes text appear with an italic style.',
tag: 'i',
icon: 'fa-italic',
key: Keys.KeyI
2017-09-02 01:50:31 +00:00
},
{
title: 'Underline (Ctrl+U)\n\nMakes text appear with an underline beneath it.',
tag: 'u',
icon: 'fa-underline',
key: Keys.KeyU
2017-09-02 01:50:31 +00:00
},
{
title: 'Strikethrough (Ctrl+S)\n\nPlaces a horizontal line through the text. Usually used to signify a correction or redaction without omitting the text.',
tag: 's',
icon: 'fa-strikethrough',
key: Keys.KeyS
2017-09-02 01:50:31 +00:00
},
{
2018-04-16 23:14:13 +00:00
title: 'Color (Ctrl+D)\n\nStyles text with a color. Valid colors are: red, orange, yellow, green, cyan, blue, purple, pink, black, brown, white and gray.',
2017-09-02 01:50:31 +00:00
tag: 'color',
startText: '[color=]',
icon: 'fa-eye-dropper',
key: Keys.KeyD
2017-09-02 01:50:31 +00:00
},
{
title: 'Superscript (Ctrl+↑)\n\nLifts text above the text baseline. Makes text slightly smaller. Cannot be nested.',
tag: 'sup',
icon: 'fa-superscript',
key: Keys.ArrowUp
2017-09-02 01:50:31 +00:00
},
{
title: 'Subscript (Ctrl+↓)\n\nPushes text below the text baseline. Makes text slightly smaller. Cannot be nested.',
tag: 'sub',
icon: 'fa-subscript',
key: Keys.ArrowDown
2017-09-02 01:50:31 +00:00
},
{
title: 'URL (Ctrl+L)\n\nCreates a clickable link to another page of your choosing.',
tag: 'url',
startText: '[url=]',
icon: 'fa-link',
key: Keys.KeyL
2017-09-02 01:50:31 +00:00
},
{
title: 'User (Ctrl+R)\n\nLinks to a character\'s profile.',
tag: 'user',
icon: 'fa-user',
key: Keys.KeyR
2017-09-02 01:50:31 +00:00
},
{
title: 'Icon (Ctrl+O)\n\nShows a character\'s profile image, linking to their profile.',
tag: 'icon',
icon: 'fa-user-circle',
key: Keys.KeyO
2017-09-02 01:50:31 +00:00
},
{
title: 'EIcon (Ctrl+E)\n\nShows a previously uploaded eicon. If the icon is a gif, it will be shown as animated unless a user has turned this off.',
tag: 'eicon',
class: 'far ',
icon: 'fa-smile',
key: Keys.KeyE
2017-09-02 01:50:31 +00:00
},
2021-03-17 23:29:56 +00:00
{
title: 'Spoiler (Ctrl+K)\n\nHidden until explicitly clicked by the viewer.',
tag: 'spoiler',
icon: 'fa-eye-slash',
key: Keys.KeyK
},
2017-09-02 01:50:31 +00:00
{
title: 'Noparse (Ctrl+N)\n\nAll BBCode placed within this tag will be ignored and treated as text. Great for sharing structure without it being rendered.',
tag: 'noparse',
icon: 'fa-ban',
key: Keys.KeyN
2017-09-02 01:50:31 +00:00
}
2020-03-15 02:31:28 +00:00
];