-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconstants.js
65 lines (54 loc) · 1.97 KB
/
constants.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { pluck } from "ramda";
export const EDITOR_OPTIONS = {
// DEFAULT EDITOR OPTIONS
BOLD: "bold",
ITALIC: "italic",
UNDERLINE: "underline",
STRIKETHROUGH: "strike",
LINK: "link",
PARAGRAPH: "paragraph",
H1: "h1",
H2: "h2",
H3: "h3",
LIST_BULLETS: "bullet-list",
LIST_ORDERED: "ordered-list",
CODE: "code",
// ADDON EDITOR OPTIONS
CODE_BLOCK: "code-block",
BLOCKQUOTE: "block-quote",
ATTACHMENTS: "attachments",
UNDO: "undo",
REDO: "redo",
HIGHLIGHT: "highlight",
EMOJI: "emoji",
IMAGE_UPLOAD: "image-upload",
IMAGE_UPLOAD_UNSPLASH: "image-upload-unsplash",
VIDEO_UPLOAD: "video-upload",
DIVIDER: "divider",
VIDEO_EMBED: "video-embed",
PASTE_UNFORMATTED: "paste-unformatted",
TABLE: "table",
TEXT_COLOR: "text-color",
};
export const UNSPLASH_BASE_URL = "https://api.unsplash.com/search/photos";
export const DIRECT_UPLOAD_ENDPOINT = "/api/direct_uploads";
export const URL_REGEXP =
/[(http(s)?)://(www.)?a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/;
export const YOUTUBE_URL_REGEXP =
/^((?:https?:)?\/\/)?((?:www|m)\.)?((?:youtube\.com|youtu.be))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S*?)(\?[^#]*)?$/;
export const VIMEO_URL_REGEXP =
/((?:http|https):\/\/)?(www\.|player\.)?vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|(?:manage\/)?videos?\/|)(\d+)(?:(?:\/|\?h=)(\w+))?(?:|\/\?)(\?[^#]*)?/;
export const LOOM_URL_REGEXP =
/((?:http|https):\/\/)?(www\.)?loom\.com\/(share|embed)\/([a-f0-9]{32})(?:\?sid=([a-f0-9-]{36}))?(?:\?t=(\d+))?(\?[^#]*)?/;
export const NEETO_RECORD_URL_REGEXP =
/((?:http|https):\/\/)?(www\.)?[a-zA-Z0-9-]+\.(neetorecord\.com)\/(watch)\/([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})/;
export const COMBINED_REGEX = new RegExp(
pluck("source", [
YOUTUBE_URL_REGEXP,
VIMEO_URL_REGEXP,
LOOM_URL_REGEXP,
NEETO_RECORD_URL_REGEXP,
]).join("|"),
"g"
);
export const EDITOR_SIZES = { MEDIUM: "medium", LARGE: "large" };