tiny-markdown-editor 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/package.json +1 -5
- package/lib/TinyMDE.d.ts +0 -100
- package/lib/TinyMDE.js +0 -1519
- package/lib/TinyMDECommandBar.d.ts +0 -35
- package/lib/TinyMDECommandBar.js +0 -329
- package/lib/grammar.d.ts +0 -77
- package/lib/grammar.js +0 -311
- package/lib/index.d.ts +0 -3
- package/lib/index.js +0 -10
- package/lib/svg/svg.d.ts +0 -2
- package/lib/svg/svg.js +0 -21
- package/lib/tiny.d.ts +0 -2
- package/lib/tiny.js +0 -8
package/README.md
CHANGED
|
@@ -360,10 +360,10 @@ npm install
|
|
|
360
360
|
|
|
361
361
|
# You may need to run npm install --force
|
|
362
362
|
|
|
363
|
-
npm run
|
|
363
|
+
npm run build
|
|
364
364
|
```
|
|
365
365
|
|
|
366
|
-
The latter command generates the `dist`
|
|
366
|
+
The latter command generates the `dist` directory. You will find the following files there:
|
|
367
367
|
|
|
368
368
|
- `dist/tiny-mde.css` and `dist/tiny-mde.min.css`: CSS files to style the editor. These can be edited at will to make the editor look like you want to. `dist/tiny-mde.min.css` has the same content as `dist/tiny-mde.css`, it's just minified. You will only need to use one of the files on your page. If you want to edit the CSS file, it's easier to edit `dist/tiny-mde.css` and then minify the edited version.
|
|
369
369
|
- `dist/tiny-mde.js`: Debug version of the editor. The JS file is not minified and contains a sourcemap. It is not recommended to use this in production settings, since the file is large.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tiny-markdown-editor",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "TinyMDE: A tiny, ultra low dependency, embeddable HTML/JavaScript Markdown editor.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -19,11 +19,8 @@
|
|
|
19
19
|
"test:chromium": "npx gulp && npx jest --selectProjects chromium",
|
|
20
20
|
"test:firefox": "npx gulp && npx jest --selectProjects firefox",
|
|
21
21
|
"test:webkit": "npx gulp && npx jest --selectProjects webkit",
|
|
22
|
-
"test:single": "npx gulp test",
|
|
23
22
|
"build": "npx gulp",
|
|
24
23
|
"dev": "npx gulp dev",
|
|
25
|
-
"typecheck": "npx tsc --noEmit",
|
|
26
|
-
"prepublishOnly": "npx gulp prepublish",
|
|
27
24
|
"releasePatch": "npx gulp releasePatch",
|
|
28
25
|
"release": "npx gulp release"
|
|
29
26
|
},
|
|
@@ -47,7 +44,6 @@
|
|
|
47
44
|
"@babel/plugin-transform-modules-commonjs": "^7.27.1",
|
|
48
45
|
"@babel/preset-env": "^7.27.2",
|
|
49
46
|
"@babel/preset-typescript": "^7.27.1",
|
|
50
|
-
"@octokit/rest": "^22.0.0",
|
|
51
47
|
"@playwright/test": "^1.54.1",
|
|
52
48
|
"@rollup/plugin-babel": "^6.0.4",
|
|
53
49
|
"@rollup/plugin-commonjs": "^28.0.3",
|
package/lib/TinyMDE.d.ts
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { GrammarRule } from "./grammar";
|
|
2
|
-
export interface EditorProps {
|
|
3
|
-
element?: string | HTMLElement;
|
|
4
|
-
editor?: string | HTMLElement;
|
|
5
|
-
content?: string;
|
|
6
|
-
textarea?: string | HTMLTextAreaElement;
|
|
7
|
-
customInlineGrammar?: Record<string, GrammarRule>;
|
|
8
|
-
}
|
|
9
|
-
export interface Position {
|
|
10
|
-
row: number;
|
|
11
|
-
col: number;
|
|
12
|
-
}
|
|
13
|
-
export interface HistoryState {
|
|
14
|
-
content: string;
|
|
15
|
-
selection: Position | null;
|
|
16
|
-
anchor: Position | null;
|
|
17
|
-
}
|
|
18
|
-
export interface ChangeEvent {
|
|
19
|
-
content: string;
|
|
20
|
-
linesDirty: boolean[];
|
|
21
|
-
}
|
|
22
|
-
export interface SelectionEvent {
|
|
23
|
-
focus: Position;
|
|
24
|
-
anchor: Position;
|
|
25
|
-
commandState: Record<string, boolean | null>;
|
|
26
|
-
}
|
|
27
|
-
export interface DropEvent {
|
|
28
|
-
dataTransfer: DataTransfer;
|
|
29
|
-
}
|
|
30
|
-
type EventType = 'change' | 'selection' | 'drop';
|
|
31
|
-
type EventHandler<T> = (event: T) => void;
|
|
32
|
-
export declare class Editor {
|
|
33
|
-
e: HTMLDivElement | null;
|
|
34
|
-
textarea: HTMLTextAreaElement | null;
|
|
35
|
-
lines: string[];
|
|
36
|
-
lineElements: NodeListOf<ChildNode> | HTMLCollection | ChildNode[];
|
|
37
|
-
lineTypes: string[];
|
|
38
|
-
lineCaptures: RegExpExecArray[];
|
|
39
|
-
lineReplacements: string[];
|
|
40
|
-
linkLabels: string[];
|
|
41
|
-
lineDirty: boolean[];
|
|
42
|
-
lastCommandState: Record<string, boolean | null> | null;
|
|
43
|
-
private customInlineGrammar;
|
|
44
|
-
private mergedInlineGrammar;
|
|
45
|
-
private hasFocus;
|
|
46
|
-
listeners: {
|
|
47
|
-
change: EventHandler<ChangeEvent>[];
|
|
48
|
-
selection: EventHandler<SelectionEvent>[];
|
|
49
|
-
drop: EventHandler<DropEvent>[];
|
|
50
|
-
};
|
|
51
|
-
private undoStack;
|
|
52
|
-
private redoStack;
|
|
53
|
-
private isRestoringHistory;
|
|
54
|
-
private maxHistory;
|
|
55
|
-
constructor(props?: EditorProps);
|
|
56
|
-
get canUndo(): boolean;
|
|
57
|
-
get canRedo(): boolean;
|
|
58
|
-
private pushHistory;
|
|
59
|
-
private pushCurrentState;
|
|
60
|
-
undo(): void;
|
|
61
|
-
redo(): void;
|
|
62
|
-
private handleUndoRedoKey;
|
|
63
|
-
private createEditorElement;
|
|
64
|
-
setContent(content: string): void;
|
|
65
|
-
getContent(): string;
|
|
66
|
-
private updateFormatting;
|
|
67
|
-
private updateLinkLabels;
|
|
68
|
-
private replace;
|
|
69
|
-
private applyLineTypes;
|
|
70
|
-
private updateLineTypes;
|
|
71
|
-
getSelection(getAnchor?: boolean): Position | null;
|
|
72
|
-
setSelection(focus: Position, anchor?: Position | null): void;
|
|
73
|
-
paste(text: string, anchor?: Position | null, focus?: Position | null): void;
|
|
74
|
-
wrapSelection(pre: string, post: string, focus?: Position | null, anchor?: Position | null): void;
|
|
75
|
-
addEventListener<T extends EventType>(type: T, listener: T extends 'change' ? EventHandler<ChangeEvent> : T extends 'selection' ? EventHandler<SelectionEvent> : T extends 'drop' ? EventHandler<DropEvent> : never): void;
|
|
76
|
-
private fireChange;
|
|
77
|
-
private handleInputEvent;
|
|
78
|
-
private handleSelectionChangeEvent;
|
|
79
|
-
private handlePaste;
|
|
80
|
-
private handleDrop;
|
|
81
|
-
private processInlineStyles;
|
|
82
|
-
private computeColumn;
|
|
83
|
-
private computeNodeAndOffset;
|
|
84
|
-
private updateLineContentsAndFormatting;
|
|
85
|
-
private clearDirtyFlag;
|
|
86
|
-
private updateLineContents;
|
|
87
|
-
private processNewParagraph;
|
|
88
|
-
private spliceLines;
|
|
89
|
-
private fixNodeHierarchy;
|
|
90
|
-
private parseLinkOrImage;
|
|
91
|
-
private computeCommonAncestor;
|
|
92
|
-
private computeEnclosingMarkupNode;
|
|
93
|
-
getCommandState(focus?: Position | null, anchor?: Position | null): Record<string, boolean | null>;
|
|
94
|
-
setCommandState(command: string, state: boolean): void;
|
|
95
|
-
private isInlineFormattingAllowed;
|
|
96
|
-
toggleCommandState(command: string): void;
|
|
97
|
-
private fireDrop;
|
|
98
|
-
private fireSelection;
|
|
99
|
-
}
|
|
100
|
-
export default Editor;
|