Initial commit

pull/44/head
Franklin Tse 5 years ago
parent 3551c6c003
commit 4e6b0876e9

30
package-lock.json generated

@ -24,6 +24,30 @@
"js-tokens": "^4.0.0"
}
},
"@types/codemirror": {
"version": "0.0.71",
"resolved": "https://registry.npmjs.org/@types/codemirror/-/codemirror-0.0.71.tgz",
"integrity": "sha512-b2oEEnno1LIGKMR7uBEsr40al1UijF1HEpRn0+Yf1xOLl24iQgB7DBpZVMM7y54G5wCNoclDrRO65E6KHPNO2w==",
"dev": true,
"requires": {
"@types/tern": "*"
}
},
"@types/estree": {
"version": "0.0.39",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz",
"integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==",
"dev": true
},
"@types/tern": {
"version": "0.22.1",
"resolved": "https://registry.npmjs.org/@types/tern/-/tern-0.22.1.tgz",
"integrity": "sha512-CRzPRkg8hYLwunsj61r+rqPJQbiCIEQqlMMY/0k7krgIsoSaFgGg1ZH2f9qaR1YpenaMl6PnlTtUkCbNH/uo+A==",
"dev": true,
"requires": {
"@types/estree": "*"
}
},
"JSONStream": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz",
@ -5198,6 +5222,12 @@
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=",
"dev": true
},
"typescript": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.2.2.tgz",
"integrity": "sha512-VCj5UiSyHBjwfYacmDuc/NOk4QQixbE+Wn7MFJuS0nRuPQbof132Pw4u53dm264O8LPc2MVsc7RJNml5szurkg==",
"dev": true
},
"typo-js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/typo-js/-/typo-js-1.0.3.tgz",

@ -10,6 +10,7 @@
"fontawesome"
],
"main": "./src/js/easymde.js",
"types": "types/easymde.d.ts",
"license": "MIT",
"author": "Jeroen Akkerman",
"bugs": {
@ -21,6 +22,7 @@
"marked": "^0.5.1"
},
"devDependencies": {
"@types/codemirror": "0.0.71",
"browserify": "^16.2.3",
"gulp": "^4.0.0",
"gulp-clean-css": "^3.10.0",
@ -29,6 +31,7 @@
"gulp-header": "^2.0.5",
"gulp-rename": "^1.4.0",
"gulp-uglify": "^3.0.1",
"typescript": "^3.2.2",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^2.0.0"
},
@ -37,6 +40,7 @@
"url": "https://github.com/ionaru/easy-markdown-editor"
},
"scripts": {
"prepare": "gulp"
"prepare": "gulp",
"test:types": "tsc --project types/tsconfig.json"
}
}

@ -0,0 +1,10 @@
new EasyMDE({
autoDownloadFontAwesome: false,
element: document.getElementById("mdEditor")!,
hideIcons: ["side-by-side", "fullscreen"],
shortcuts: {
drawTable: "Cmd-Alt-T",
toggleFullScreen: null
},
spellChecker: false
});

129
types/easymde.d.ts vendored

@ -0,0 +1,129 @@
/// <reference types="codemirror"/>
declare namespace EasyMDE {
interface AutoSaveOptions {
enabled?: boolean;
delay?: number;
uniqueId: string;
}
interface BlockStyleOptions {
bold?: string;
code?: string;
italic?: string;
}
interface InsertTextOptions {
horizontalRule?: string[];
image?: string[];
link?: string[];
table?: string[];
}
interface ParsingOptions {
allowAtxHeaderWithoutSpace?: boolean;
strikethrough?: boolean;
underscoresBreakWords?: boolean;
}
interface RenderingOptions {
singleLineBreaks?: boolean;
codeSyntaxHighlighting: boolean;
}
interface ShortcutsArray {
[action: string]: string | undefined | null;
toggleBlockquote?: string | null;
toggleBold?: string | null;
cleanBlock?: string | null;
toggleHeadingSmaller?: string | null;
toggleItalic?: string | null;
drawLink?: string | null;
toggleUnorderedList?: string | null;
togglePreview?: string | null;
toggleCodeBlock?: string | null;
drawImage?: string | null;
toggleOrderedList?: string | null;
toggleHeadingBigger?: string | null;
toggleSideBySide?: string | null;
toggleFullScreen?: string | null;
}
interface StatusBarItem {
className: string;
defaultValue: (element: HTMLElement) => void;
onUpdate: (element: HTMLElement) => void;
}
interface ToolbarIcon {
name: string;
action: string|((editor: EasyMDE) => void);
className: string;
title: string;
}
interface Options {
autoDownloadFontAwesome?: boolean;
autofocus?: boolean;
autosave?: AutoSaveOptions;
blockStyles?: BlockStyleOptions;
element?: HTMLElement;
forceSync?: boolean;
hideIcons?: string[];
indentWithTabs?: boolean;
initialValue?: string;
insertTexts?: InsertTextOptions;
lineWrapping?: boolean;
parsingConfig?: ParsingOptions;
placeholder?: string;
previewRender?: (markdownPlaintext: string, previewElement: HTMLElement) => string;
promptURLs?: boolean;
renderingConfig?: RenderingOptions;
shortcuts?: ShortcutsArray;
showIcons?: string[];
spellChecker?: boolean;
status?: boolean|Array<string|StatusBarItem>;
styleSelectedText?: boolean;
tabSize?: number;
toolbar?: boolean|Array<string|ToolbarIcon>;
toolbarTips?: boolean;
}
}
declare class EasyMDE {
constructor(options?: EasyMDE.Options);
value(): string;
value(val: string): void;
codemirror: CodeMirror.Editor;
toTextArea(): void;
isPreviewActive(): boolean;
isSideBySideActive(): boolean;
isFullscreenActive(): boolean;
clearAutosavedValue(): void;
static toggleBold: (editor: EasyMDE) => void;
static toggleItalic: (editor: EasyMDE) => void;
static toggleStrikethrough: (editor: EasyMDE) => void;
static toggleHeadingSmaller: (editor: EasyMDE) => void;
static toggleHeadingBigger: (editor: EasyMDE) => void;
static toggleHeading1: (editor: EasyMDE) => void;
static toggleHeading2: (editor: EasyMDE) => void;
static toggleHeading3: (editor: EasyMDE) => void;
static toggleCodeBlock: (editor: EasyMDE) => void;
static toggleBlockquote: (editor: EasyMDE) => void;
static toggleUnorderedList: (editor: EasyMDE) => void;
static toggleOrderedList: (editor: EasyMDE) => void;
static cleanBlock: (editor: EasyMDE) => void;
static drawLink: (editor: EasyMDE) => void;
static drawImage: (editor: EasyMDE) => void;
static drawTable: (editor: EasyMDE) => void;
static drawHorizontalRule: (editor: EasyMDE) => void;
static togglePreview: (editor: EasyMDE) => void;
static toggleSideBySide: (editor: EasyMDE) => void;
static toggleFullScreen: (editor: EasyMDE) => void;
static undo: (editor: EasyMDE) => void;
static redo: (editor: EasyMDE) => void;
}
export as namespace EasyMDE;
export = EasyMDE;

@ -0,0 +1,8 @@
{
"compilerOptions": {
"target": "es3",
"strict": true,
"noImplicitReturns": true,
"noEmit": true
}
}
Loading…
Cancel
Save