@contentful/field-editor-markdown 1.2.0 → 1.3.0
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/dist/cjs/MarkdownActions.js +235 -0
- package/dist/cjs/MarkdownEditor.js +180 -0
- package/dist/cjs/__fixtures__/FakeSdk.js +183 -0
- package/dist/cjs/__fixtures__/asset/index.js +37 -0
- package/dist/cjs/__fixtures__/content-type/index.js +16 -0
- package/dist/cjs/__fixtures__/entry/index.js +33 -0
- package/dist/cjs/__fixtures__/fixtures.js +71 -0
- package/dist/cjs/__fixtures__/locale/index.js +40 -0
- package/dist/cjs/__fixtures__/space/index.js +16 -0
- package/dist/cjs/codemirrorImports.js +9 -0
- package/dist/cjs/components/HeadingSelector.js +66 -0
- package/dist/cjs/components/InsertLinkSelector.js +86 -0
- package/dist/cjs/components/MarkdownBottomBar.js +111 -0
- package/dist/cjs/components/MarkdownConstraints.js +79 -0
- package/dist/cjs/components/MarkdownPreview.js +249 -0
- package/dist/cjs/components/MarkdownTabs.js +128 -0
- package/dist/cjs/components/MarkdownTextarea/CodeMirrorWrapper.js +383 -0
- package/dist/cjs/components/MarkdownTextarea/MarkdownCommands.js +233 -0
- package/dist/cjs/components/MarkdownTextarea/MarkdownTextarea.js +190 -0
- package/dist/cjs/components/MarkdownTextarea/createMarkdownEditor.js +101 -0
- package/dist/cjs/components/MarkdownToolbar.js +367 -0
- package/dist/cjs/components/icons.js +193 -0
- package/dist/cjs/dialogs/CheatsheetModalDialog.js +239 -0
- package/dist/cjs/dialogs/ConfirmInsertAssetModalDialog.js +94 -0
- package/dist/cjs/dialogs/EmdebExternalContentDialog.js +202 -0
- package/dist/cjs/dialogs/InsertLinkModalDialog.js +149 -0
- package/dist/cjs/dialogs/InsertTableModalDialog.js +140 -0
- package/dist/cjs/dialogs/SpecialCharacterModalDialog.js +146 -0
- package/dist/cjs/dialogs/ZenModeModalDialog.js +257 -0
- package/dist/cjs/dialogs/openMarkdownDialog.js +121 -0
- package/dist/cjs/dialogs/renderMarkdownDialog.js +108 -0
- package/dist/cjs/index.js +29 -0
- package/dist/cjs/types.js +20 -0
- package/dist/cjs/utils/insertAssetLinks.js +122 -0
- package/dist/cjs/utils/insertAssetLinks.spec.js +22 -0
- package/dist/cjs/utils/isValidUrl.js +22 -0
- package/dist/cjs/utils/linkOrganizer.js +187 -0
- package/dist/cjs/utils/linkOrganizer.spec.js +96 -0
- package/dist/cjs/utils/replaceMailtoAmp.js +15 -0
- package/dist/cjs/utils/replaceMailtoAmp.spec.js +22 -0
- package/dist/cjs/utils/specialCharacters.js +228 -0
- package/dist/cjs/utils/userAgent.js +28 -0
- package/dist/esm/MarkdownActions.js +186 -0
- package/dist/esm/MarkdownEditor.js +118 -0
- package/dist/esm/__fixtures__/FakeSdk.js +173 -0
- package/dist/esm/__fixtures__/asset/index.js +6 -0
- package/dist/esm/__fixtures__/content-type/index.js +2 -0
- package/dist/esm/__fixtures__/entry/index.js +5 -0
- package/dist/esm/__fixtures__/fixtures.js +6 -0
- package/dist/esm/__fixtures__/locale/index.js +15 -0
- package/dist/esm/__fixtures__/space/index.js +2 -0
- package/dist/esm/codemirrorImports.js +5 -0
- package/dist/esm/components/HeadingSelector.js +17 -0
- package/dist/esm/components/InsertLinkSelector.js +37 -0
- package/dist/esm/components/MarkdownBottomBar.js +46 -0
- package/dist/esm/components/MarkdownConstraints.js +25 -0
- package/dist/esm/components/MarkdownPreview.js +195 -0
- package/dist/esm/components/MarkdownTabs.js +74 -0
- package/dist/esm/components/MarkdownTextarea/CodeMirrorWrapper.js +329 -0
- package/dist/esm/components/MarkdownTextarea/MarkdownCommands.js +218 -0
- package/dist/esm/components/MarkdownTextarea/MarkdownTextarea.js +136 -0
- package/dist/esm/components/MarkdownTextarea/createMarkdownEditor.js +52 -0
- package/dist/esm/components/MarkdownToolbar.js +302 -0
- package/dist/esm/components/icons.js +112 -0
- package/dist/esm/dialogs/CheatsheetModalDialog.js +177 -0
- package/dist/esm/dialogs/ConfirmInsertAssetModalDialog.js +37 -0
- package/dist/esm/dialogs/EmdebExternalContentDialog.js +140 -0
- package/dist/esm/dialogs/InsertLinkModalDialog.js +92 -0
- package/dist/esm/dialogs/InsertTableModalDialog.js +78 -0
- package/dist/esm/dialogs/SpecialCharacterModalDialog.js +84 -0
- package/dist/esm/dialogs/ZenModeModalDialog.js +195 -0
- package/dist/esm/dialogs/openMarkdownDialog.js +72 -0
- package/dist/esm/dialogs/renderMarkdownDialog.js +59 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/types.js +10 -0
- package/dist/esm/utils/insertAssetLinks.js +99 -0
- package/dist/esm/utils/insertAssetLinks.spec.js +18 -0
- package/dist/esm/utils/isValidUrl.js +4 -0
- package/dist/esm/utils/linkOrganizer.js +152 -0
- package/dist/esm/utils/linkOrganizer.spec.js +53 -0
- package/dist/esm/utils/replaceMailtoAmp.js +5 -0
- package/dist/esm/utils/replaceMailtoAmp.spec.js +18 -0
- package/dist/esm/utils/specialCharacters.js +218 -0
- package/dist/esm/utils/userAgent.js +13 -0
- package/dist/{MarkdownActions.d.ts → types/MarkdownActions.d.ts} +38 -38
- package/dist/{MarkdownEditor.d.ts → types/MarkdownEditor.d.ts} +22 -22
- package/dist/types/__fixtures__/FakeSdk.d.ts +8 -0
- package/dist/types/__fixtures__/asset/index.d.ts +6 -0
- package/dist/types/__fixtures__/content-type/index.d.ts +2 -0
- package/dist/types/__fixtures__/entry/index.d.ts +5 -0
- package/dist/types/__fixtures__/fixtures.d.ts +6 -0
- package/dist/types/__fixtures__/locale/index.d.ts +42 -0
- package/dist/types/__fixtures__/space/index.d.ts +2 -0
- package/dist/{codemirrorImports.d.ts → types/codemirrorImports.d.ts} +5 -5
- package/dist/{components → types/components}/HeadingSelector.d.ts +7 -7
- package/dist/{components → types/components}/InsertLinkSelector.d.ts +9 -9
- package/dist/{components → types/components}/MarkdownBottomBar.d.ts +11 -11
- package/dist/{components → types/components}/MarkdownConstraints.d.ts +6 -6
- package/dist/{components → types/components}/MarkdownPreview.d.ts +14 -14
- package/dist/{components → types/components}/MarkdownTabs.d.ts +8 -8
- package/dist/{components → types/components}/MarkdownTextarea/CodeMirrorWrapper.d.ts +58 -58
- package/dist/{components → types/components}/MarkdownTextarea/MarkdownCommands.d.ts +33 -33
- package/dist/{components → types/components}/MarkdownTextarea/MarkdownTextarea.d.ts +17 -17
- package/dist/{components → types/components}/MarkdownTextarea/createMarkdownEditor.d.ts +55 -55
- package/dist/{components → types/components}/MarkdownToolbar.d.ts +12 -12
- package/dist/types/components/icons.d.ts +18 -0
- package/dist/{dialogs → types/dialogs}/CheatsheetModalDialog.d.ts +4 -4
- package/dist/{dialogs → types/dialogs}/ConfirmInsertAssetModalDialog.d.ts +23 -23
- package/dist/{dialogs → types/dialogs}/EmdebExternalContentDialog.d.ts +9 -9
- package/dist/{dialogs → types/dialogs}/InsertLinkModalDialog.d.ts +17 -17
- package/dist/{dialogs → types/dialogs}/InsertTableModalDialog.d.ts +13 -13
- package/dist/{dialogs → types/dialogs}/SpecialCharacterModalDialog.d.ts +9 -9
- package/dist/{dialogs → types/dialogs}/ZenModeModalDialog.d.ts +24 -24
- package/dist/{dialogs → types/dialogs}/openMarkdownDialog.d.ts +5 -5
- package/dist/{dialogs → types/dialogs}/renderMarkdownDialog.d.ts +8 -8
- package/dist/{index.d.ts → types/index.d.ts} +5 -5
- package/dist/{types.d.ts → types/types.d.ts} +75 -75
- package/dist/{utils → types/utils}/insertAssetLinks.d.ts +29 -29
- package/dist/types/utils/insertAssetLinks.spec.d.ts +1 -0
- package/dist/{utils → types/utils}/isValidUrl.d.ts +2 -2
- package/dist/{utils → types/utils}/linkOrganizer.d.ts +6 -6
- package/dist/types/utils/linkOrganizer.spec.d.ts +1 -0
- package/dist/{utils → types/utils}/replaceMailtoAmp.d.ts +1 -1
- package/dist/types/utils/replaceMailtoAmp.spec.d.ts +1 -0
- package/dist/{utils → types/utils}/specialCharacters.d.ts +4 -4
- package/dist/{utils → types/utils}/userAgent.d.ts +1 -1
- package/package.json +25 -11
- package/CHANGELOG.md +0 -308
- package/dist/components/icons.d.ts +0 -18
- package/dist/field-editor-markdown.cjs.development.js +0 -3605
- package/dist/field-editor-markdown.cjs.development.js.map +0 -1
- package/dist/field-editor-markdown.cjs.production.min.js +0 -216
- package/dist/field-editor-markdown.cjs.production.min.js.map +0 -1
- package/dist/field-editor-markdown.esm.js +0 -3595
- package/dist/field-editor-markdown.esm.js.map +0 -1
- package/dist/index.js +0 -8
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { KnownSDK } from '@contentful/app-sdk';
|
|
2
|
-
import { InitializedEditorType } from './components/MarkdownTextarea/MarkdownTextarea';
|
|
3
|
-
export declare function createMarkdownActions(props: {
|
|
4
|
-
sdk: KnownSDK;
|
|
5
|
-
editor: InitializedEditorType | null;
|
|
6
|
-
locale: string;
|
|
7
|
-
}): {
|
|
8
|
-
headings: {
|
|
9
|
-
h1: () => void;
|
|
10
|
-
h2: () => void;
|
|
11
|
-
h3: () => void;
|
|
12
|
-
};
|
|
13
|
-
simple: {
|
|
14
|
-
italic: () => void;
|
|
15
|
-
bold: () => void;
|
|
16
|
-
quote: () => void;
|
|
17
|
-
ol: () => void;
|
|
18
|
-
ul: () => void;
|
|
19
|
-
strike: () => void;
|
|
20
|
-
code: () => void;
|
|
21
|
-
hr: () => void;
|
|
22
|
-
indent: () => void;
|
|
23
|
-
dedent: () => void;
|
|
24
|
-
};
|
|
25
|
-
history: {
|
|
26
|
-
undo: () => void;
|
|
27
|
-
redo: () => void;
|
|
28
|
-
};
|
|
29
|
-
insertLink: () => Promise<void>;
|
|
30
|
-
insertSpecialCharacter: () => Promise<void>;
|
|
31
|
-
insertTable: () => Promise<void>;
|
|
32
|
-
organizeLinks: () => void;
|
|
33
|
-
embedExternalContent: () => Promise<void>;
|
|
34
|
-
addNewMedia: () => Promise<void>;
|
|
35
|
-
linkExistingMedia: () => Promise<void>;
|
|
36
|
-
openZenMode: () => Promise<void>;
|
|
37
|
-
closeZenMode: () => void;
|
|
38
|
-
};
|
|
1
|
+
import { KnownSDK } from '@contentful/app-sdk';
|
|
2
|
+
import { InitializedEditorType } from './components/MarkdownTextarea/MarkdownTextarea';
|
|
3
|
+
export declare function createMarkdownActions(props: {
|
|
4
|
+
sdk: KnownSDK;
|
|
5
|
+
editor: InitializedEditorType | null;
|
|
6
|
+
locale: string;
|
|
7
|
+
}): {
|
|
8
|
+
headings: {
|
|
9
|
+
h1: () => void;
|
|
10
|
+
h2: () => void;
|
|
11
|
+
h3: () => void;
|
|
12
|
+
};
|
|
13
|
+
simple: {
|
|
14
|
+
italic: () => void;
|
|
15
|
+
bold: () => void;
|
|
16
|
+
quote: () => void;
|
|
17
|
+
ol: () => void;
|
|
18
|
+
ul: () => void;
|
|
19
|
+
strike: () => void;
|
|
20
|
+
code: () => void;
|
|
21
|
+
hr: () => void;
|
|
22
|
+
indent: () => void;
|
|
23
|
+
dedent: () => void;
|
|
24
|
+
};
|
|
25
|
+
history: {
|
|
26
|
+
undo: () => void;
|
|
27
|
+
redo: () => void;
|
|
28
|
+
};
|
|
29
|
+
insertLink: () => Promise<void>;
|
|
30
|
+
insertSpecialCharacter: () => Promise<void>;
|
|
31
|
+
insertTable: () => Promise<void>;
|
|
32
|
+
organizeLinks: () => void;
|
|
33
|
+
embedExternalContent: () => Promise<void>;
|
|
34
|
+
addNewMedia: () => Promise<void>;
|
|
35
|
+
linkExistingMedia: () => Promise<void>;
|
|
36
|
+
openZenMode: () => Promise<void>;
|
|
37
|
+
closeZenMode: () => void;
|
|
38
|
+
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
3
|
-
import { PreviewComponents } from './types';
|
|
4
|
-
export interface MarkdownEditorProps {
|
|
5
|
-
/**
|
|
6
|
-
* is the field disabled initially
|
|
7
|
-
*/
|
|
8
|
-
isInitiallyDisabled: boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Minimum height to set for the markdown text area and preview
|
|
11
|
-
*/
|
|
12
|
-
minHeight?: string | number;
|
|
13
|
-
sdk: FieldExtensionSDK;
|
|
14
|
-
previewComponents?: PreviewComponents;
|
|
15
|
-
onReady?: Function;
|
|
16
|
-
}
|
|
17
|
-
export declare function MarkdownEditor(props: MarkdownEditorProps & {
|
|
18
|
-
disabled: boolean;
|
|
19
|
-
initialValue: string | null | undefined;
|
|
20
|
-
saveValueToSDK: Function;
|
|
21
|
-
}): JSX.Element;
|
|
22
|
-
export declare function MarkdownEditorConnected(props: MarkdownEditorProps): JSX.Element;
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
3
|
+
import { PreviewComponents } from './types';
|
|
4
|
+
export interface MarkdownEditorProps {
|
|
5
|
+
/**
|
|
6
|
+
* is the field disabled initially
|
|
7
|
+
*/
|
|
8
|
+
isInitiallyDisabled: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Minimum height to set for the markdown text area and preview
|
|
11
|
+
*/
|
|
12
|
+
minHeight?: string | number;
|
|
13
|
+
sdk: FieldExtensionSDK;
|
|
14
|
+
previewComponents?: PreviewComponents;
|
|
15
|
+
onReady?: Function;
|
|
16
|
+
}
|
|
17
|
+
export declare function MarkdownEditor(props: MarkdownEditorProps & {
|
|
18
|
+
disabled: boolean;
|
|
19
|
+
initialValue: string | null | undefined;
|
|
20
|
+
saveValueToSDK: Function;
|
|
21
|
+
}): React.JSX.Element;
|
|
22
|
+
export declare function MarkdownEditorConnected(props: MarkdownEditorProps): React.JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
2
|
+
import { Emitter } from 'mitt';
|
|
3
|
+
export type ReferenceEditorSdkProps = {
|
|
4
|
+
initialValue?: any;
|
|
5
|
+
validations?: any;
|
|
6
|
+
fetchDelay?: number;
|
|
7
|
+
};
|
|
8
|
+
export declare function newReferenceEditorFakeSdk(props?: ReferenceEditorSdkProps): [FieldExtensionSDK, Emitter];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import changed from './changed_asset.json';
|
|
2
|
+
import created from './created_asset.json';
|
|
3
|
+
import empty from './empty_asset.json';
|
|
4
|
+
import invalid from './invalid_asset.json';
|
|
5
|
+
import published from './published_asset.json';
|
|
6
|
+
export { changed, empty, published, invalid, created };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import englishDefault from './english_default_locale.json';
|
|
2
|
+
import german from './german_locale.json';
|
|
3
|
+
declare const list: {
|
|
4
|
+
sys: {
|
|
5
|
+
type: string;
|
|
6
|
+
};
|
|
7
|
+
total: number;
|
|
8
|
+
skip: number;
|
|
9
|
+
limit: number;
|
|
10
|
+
items: {
|
|
11
|
+
sys: {
|
|
12
|
+
id: string;
|
|
13
|
+
type: string;
|
|
14
|
+
createdAt: string;
|
|
15
|
+
updatedAt: string;
|
|
16
|
+
version: number;
|
|
17
|
+
space: {
|
|
18
|
+
sys: {
|
|
19
|
+
type: string;
|
|
20
|
+
linkType: string;
|
|
21
|
+
id: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
environment: {
|
|
25
|
+
sys: {
|
|
26
|
+
id: string;
|
|
27
|
+
type: string;
|
|
28
|
+
linkType: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
name: string;
|
|
33
|
+
code: string;
|
|
34
|
+
internal_code: string;
|
|
35
|
+
fallbackCode: null;
|
|
36
|
+
contentDeliveryApi: boolean;
|
|
37
|
+
contentManagementApi: boolean;
|
|
38
|
+
default: boolean;
|
|
39
|
+
optional: boolean;
|
|
40
|
+
}[];
|
|
41
|
+
};
|
|
42
|
+
export { englishDefault, german, list };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import 'codemirror/mode/markdown/markdown';
|
|
2
|
-
import 'codemirror/mode/xml/xml';
|
|
3
|
-
import 'codemirror/addon/edit/continuelist';
|
|
4
|
-
import 'codemirror/addon/mode/overlay';
|
|
5
|
-
import 'codemirror/addon/display/autorefresh';
|
|
1
|
+
import 'codemirror/mode/markdown/markdown';
|
|
2
|
+
import 'codemirror/mode/xml/xml';
|
|
3
|
+
import 'codemirror/addon/edit/continuelist';
|
|
4
|
+
import 'codemirror/addon/mode/overlay';
|
|
5
|
+
import 'codemirror/addon/display/autorefresh';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { HeadingType } from '../types';
|
|
3
|
-
export declare const HeadingSelector: (props: {
|
|
4
|
-
children: React.ReactElement;
|
|
5
|
-
onSelect: (heading: HeadingType) => void;
|
|
6
|
-
tooltip?: string | undefined;
|
|
7
|
-
}) => JSX.Element;
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { HeadingType } from '../types';
|
|
3
|
+
export declare const HeadingSelector: (props: {
|
|
4
|
+
children: React.ReactElement;
|
|
5
|
+
onSelect: (heading: HeadingType) => void;
|
|
6
|
+
tooltip?: string | undefined;
|
|
7
|
+
}) => React.JSX.Element;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
interface InsertLinkSelectorProps {
|
|
3
|
-
onSelectExisting: Function;
|
|
4
|
-
onAddNew: Function;
|
|
5
|
-
canAddNew: boolean;
|
|
6
|
-
disabled: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare const InsertLinkSelector: (props: InsertLinkSelectorProps) => JSX.Element;
|
|
9
|
-
export {};
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface InsertLinkSelectorProps {
|
|
3
|
+
onSelectExisting: Function;
|
|
4
|
+
onAddNew: Function;
|
|
5
|
+
canAddNew: boolean;
|
|
6
|
+
disabled: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const InsertLinkSelector: (props: InsertLinkSelectorProps) => React.JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export declare function MarkdownCounter(props: {
|
|
3
|
-
words: number;
|
|
4
|
-
characters: number;
|
|
5
|
-
}): JSX.Element;
|
|
6
|
-
export declare function MarkdownHelp(props: {
|
|
7
|
-
onClick: () => void;
|
|
8
|
-
}): JSX.Element;
|
|
9
|
-
export declare function MarkdownBottomBar(props: {
|
|
10
|
-
children: React.ReactNode;
|
|
11
|
-
}): JSX.Element;
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare function MarkdownCounter(props: {
|
|
3
|
+
words: number;
|
|
4
|
+
characters: number;
|
|
5
|
+
}): React.JSX.Element;
|
|
6
|
+
export declare function MarkdownHelp(props: {
|
|
7
|
+
onClick: () => void;
|
|
8
|
+
}): React.JSX.Element;
|
|
9
|
+
export declare function MarkdownBottomBar(props: {
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
}): React.JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
3
|
-
export declare function MarkdownConstraints(props: {
|
|
4
|
-
sdk: FieldExtensionSDK;
|
|
5
|
-
value: string;
|
|
6
|
-
}): JSX.Element;
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
3
|
+
export declare function MarkdownConstraints(props: {
|
|
4
|
+
sdk: FieldExtensionSDK;
|
|
5
|
+
value: string;
|
|
6
|
+
}): React.JSX.Element;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { EditorDirection, PreviewComponents } from '../types';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Minimum height to set for the markdown preview
|
|
6
|
-
*/
|
|
7
|
-
minHeight?: string | number;
|
|
8
|
-
mode: 'default' | 'zen';
|
|
9
|
-
direction: EditorDirection;
|
|
10
|
-
value: string;
|
|
11
|
-
previewComponents?: PreviewComponents;
|
|
12
|
-
};
|
|
13
|
-
export declare const MarkdownPreview: React.MemoExoticComponent<(props: MarkdownPreviewProps) => JSX.Element>;
|
|
14
|
-
export {};
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { EditorDirection, PreviewComponents } from '../types';
|
|
3
|
+
type MarkdownPreviewProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Minimum height to set for the markdown preview
|
|
6
|
+
*/
|
|
7
|
+
minHeight?: string | number;
|
|
8
|
+
mode: 'default' | 'zen';
|
|
9
|
+
direction: EditorDirection;
|
|
10
|
+
value: string;
|
|
11
|
+
previewComponents?: PreviewComponents;
|
|
12
|
+
};
|
|
13
|
+
export declare const MarkdownPreview: React.MemoExoticComponent<(props: MarkdownPreviewProps) => React.JSX.Element>;
|
|
14
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import { MarkdownTab } from '../types';
|
|
3
|
-
interface MarkdownTabsProps {
|
|
4
|
-
active: MarkdownTab;
|
|
5
|
-
onSelect: (selected: MarkdownTab) => void;
|
|
6
|
-
}
|
|
7
|
-
export declare function MarkdownTabs(props: MarkdownTabsProps): JSX.Element;
|
|
8
|
-
export {};
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { MarkdownTab } from '../types';
|
|
3
|
+
interface MarkdownTabsProps {
|
|
4
|
+
active: MarkdownTab;
|
|
5
|
+
onSelect: (selected: MarkdownTab) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function MarkdownTabs(props: MarkdownTabsProps): React.JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
import CodeMirror from 'codemirror';
|
|
2
|
-
import 'codemirror/addon/edit/matchbrackets';
|
|
3
|
-
import { EditorDirection } from '../../types';
|
|
4
|
-
export declare function create(host: HTMLElement, options: {
|
|
5
|
-
direction: EditorDirection;
|
|
6
|
-
readOnly: boolean;
|
|
7
|
-
fixedHeight?: number | boolean;
|
|
8
|
-
height?: number | string;
|
|
9
|
-
}): {
|
|
10
|
-
destroy: () => void;
|
|
11
|
-
disable: () => void;
|
|
12
|
-
enable: () => void;
|
|
13
|
-
attachEvent: (name: string, fn: Function, throttleInterval: number) => void;
|
|
14
|
-
addKeyShortcuts: (map: any) => void;
|
|
15
|
-
setValue: (value?: string
|
|
16
|
-
cmd: (name: string) => void;
|
|
17
|
-
moveToLineBeginning: (lineNumber?: number
|
|
18
|
-
moveIfNotEmpty: () => void;
|
|
19
|
-
restoreCursor: (character: number, lineNumber?: number
|
|
20
|
-
moveToLineEnd: (lineNumber?: number
|
|
21
|
-
usePrimarySelection: () => void;
|
|
22
|
-
focus: () => void;
|
|
23
|
-
select: (from: CodeMirror.Position, to: CodeMirror.Position) => void;
|
|
24
|
-
selectBackwards: (skip: number, len: number) => void;
|
|
25
|
-
selectAll: () => void;
|
|
26
|
-
extendSelectionBy: (modifier: number) => void;
|
|
27
|
-
insertAtCursor: (text: string) => void;
|
|
28
|
-
insertAtLineBeginning: (text: string) => void;
|
|
29
|
-
wrapSelection: (wrapper: string) => void;
|
|
30
|
-
removeFromLineBeginning: (charCount: number) => void;
|
|
31
|
-
removeSelectedText: () => void;
|
|
32
|
-
replaceSelectedText: (replacement: string, select?: string
|
|
33
|
-
getCursor: () => CodeMirror.Position;
|
|
34
|
-
setCursor: (cursor: number | CodeMirror.Position) => void;
|
|
35
|
-
getSelection: () => CodeMirror.Range | null;
|
|
36
|
-
getLine: (lineNumber: number) => string;
|
|
37
|
-
isLineEmpty: (lineNumber?: number
|
|
38
|
-
getSelectedText: () => string;
|
|
39
|
-
getSelectionLength: () => number;
|
|
40
|
-
getCurrentLine: () => string;
|
|
41
|
-
getCurrentLineNumber: () => number;
|
|
42
|
-
getCurrentCharacter: () => number;
|
|
43
|
-
getCurrentLineLength: () => number;
|
|
44
|
-
lineStartsWith: (text: string) => boolean;
|
|
45
|
-
getIndentation: () => string;
|
|
46
|
-
getNl: (n?: number) => string;
|
|
47
|
-
getValue: () => string;
|
|
48
|
-
getLinesCount: () => number;
|
|
49
|
-
getHistorySize: (which?:
|
|
50
|
-
undo: number;
|
|
51
|
-
redo: number;
|
|
52
|
-
};
|
|
53
|
-
setReadOnly: (value: boolean) => void;
|
|
54
|
-
getHistory: () => any;
|
|
55
|
-
setHistory: (history: any) => void;
|
|
56
|
-
setFullsize: () => void;
|
|
57
|
-
refresh: () => void;
|
|
58
|
-
};
|
|
1
|
+
import CodeMirror from 'codemirror';
|
|
2
|
+
import 'codemirror/addon/edit/matchbrackets';
|
|
3
|
+
import { EditorDirection } from '../../types';
|
|
4
|
+
export declare function create(host: HTMLElement, options: {
|
|
5
|
+
direction: EditorDirection;
|
|
6
|
+
readOnly: boolean;
|
|
7
|
+
fixedHeight?: number | boolean;
|
|
8
|
+
height?: number | string;
|
|
9
|
+
}): {
|
|
10
|
+
destroy: () => void;
|
|
11
|
+
disable: () => void;
|
|
12
|
+
enable: () => void;
|
|
13
|
+
attachEvent: (name: string, fn: Function, throttleInterval: number) => void;
|
|
14
|
+
addKeyShortcuts: (map: any) => void;
|
|
15
|
+
setValue: (value?: string) => void;
|
|
16
|
+
cmd: (name: string) => void;
|
|
17
|
+
moveToLineBeginning: (lineNumber?: number) => void;
|
|
18
|
+
moveIfNotEmpty: () => void;
|
|
19
|
+
restoreCursor: (character: number, lineNumber?: number, noFocus?: boolean) => void;
|
|
20
|
+
moveToLineEnd: (lineNumber?: number) => void;
|
|
21
|
+
usePrimarySelection: () => void;
|
|
22
|
+
focus: () => void;
|
|
23
|
+
select: (from: CodeMirror.Position, to: CodeMirror.Position) => void;
|
|
24
|
+
selectBackwards: (skip: number, len: number) => void;
|
|
25
|
+
selectAll: () => void;
|
|
26
|
+
extendSelectionBy: (modifier: number) => void;
|
|
27
|
+
insertAtCursor: (text: string) => void;
|
|
28
|
+
insertAtLineBeginning: (text: string) => void;
|
|
29
|
+
wrapSelection: (wrapper: string) => void;
|
|
30
|
+
removeFromLineBeginning: (charCount: number) => void;
|
|
31
|
+
removeSelectedText: () => void;
|
|
32
|
+
replaceSelectedText: (replacement: string, select?: string) => void;
|
|
33
|
+
getCursor: () => CodeMirror.Position;
|
|
34
|
+
setCursor: (cursor: number | CodeMirror.Position) => void;
|
|
35
|
+
getSelection: () => CodeMirror.Range | null;
|
|
36
|
+
getLine: (lineNumber: number) => string;
|
|
37
|
+
isLineEmpty: (lineNumber?: number) => boolean;
|
|
38
|
+
getSelectedText: () => string;
|
|
39
|
+
getSelectionLength: () => number;
|
|
40
|
+
getCurrentLine: () => string;
|
|
41
|
+
getCurrentLineNumber: () => number;
|
|
42
|
+
getCurrentCharacter: () => number;
|
|
43
|
+
getCurrentLineLength: () => number;
|
|
44
|
+
lineStartsWith: (text: string) => boolean;
|
|
45
|
+
getIndentation: () => string;
|
|
46
|
+
getNl: (n?: number) => string;
|
|
47
|
+
getValue: () => string;
|
|
48
|
+
getLinesCount: () => number;
|
|
49
|
+
getHistorySize: (which?: 'undo' | 'redo') => number | {
|
|
50
|
+
undo: number;
|
|
51
|
+
redo: number;
|
|
52
|
+
};
|
|
53
|
+
setReadOnly: (value: boolean) => void;
|
|
54
|
+
getHistory: () => any;
|
|
55
|
+
setHistory: (history: any) => void;
|
|
56
|
+
setFullsize: () => void;
|
|
57
|
+
refresh: () => void;
|
|
58
|
+
};
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import * as CodeMirrorWrapper from './CodeMirrorWrapper';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @description
|
|
5
|
-
* A collection of commands used by the user bound to a
|
|
6
|
-
* CodeMirrorWrapper instance.
|
|
7
|
-
*
|
|
8
|
-
* The command collection only depends on the wrapper instance and is
|
|
9
|
-
* used by UI from code mirror stuff.
|
|
10
|
-
*/
|
|
11
|
-
export declare function create(editor: EditorInstanceType): {
|
|
12
|
-
bold: () => void;
|
|
13
|
-
italic: () => void;
|
|
14
|
-
strike: () => void;
|
|
15
|
-
quote: () => void;
|
|
16
|
-
code: () => void;
|
|
17
|
-
link: (url: string, text?: string
|
|
18
|
-
h1: () => void;
|
|
19
|
-
h2: () => void;
|
|
20
|
-
h3: () => void;
|
|
21
|
-
ul: () => void;
|
|
22
|
-
ol: () => void;
|
|
23
|
-
undo: () => void;
|
|
24
|
-
redo: () => void;
|
|
25
|
-
hr: () => void;
|
|
26
|
-
indent: () => void;
|
|
27
|
-
dedent: () => void;
|
|
28
|
-
table: (config: {
|
|
29
|
-
rows: number;
|
|
30
|
-
cols: number;
|
|
31
|
-
}) => void;
|
|
32
|
-
};
|
|
33
|
-
export {};
|
|
1
|
+
import * as CodeMirrorWrapper from './CodeMirrorWrapper';
|
|
2
|
+
type EditorInstanceType = ReturnType<typeof CodeMirrorWrapper.create>;
|
|
3
|
+
/**
|
|
4
|
+
* @description
|
|
5
|
+
* A collection of commands used by the user bound to a
|
|
6
|
+
* CodeMirrorWrapper instance.
|
|
7
|
+
*
|
|
8
|
+
* The command collection only depends on the wrapper instance and is
|
|
9
|
+
* used by UI from code mirror stuff.
|
|
10
|
+
*/
|
|
11
|
+
export declare function create(editor: EditorInstanceType): {
|
|
12
|
+
bold: () => void;
|
|
13
|
+
italic: () => void;
|
|
14
|
+
strike: () => void;
|
|
15
|
+
quote: () => void;
|
|
16
|
+
code: () => void;
|
|
17
|
+
link: (url: string, text?: string, title?: string) => void;
|
|
18
|
+
h1: () => void;
|
|
19
|
+
h2: () => void;
|
|
20
|
+
h3: () => void;
|
|
21
|
+
ul: () => void;
|
|
22
|
+
ol: () => void;
|
|
23
|
+
undo: () => void;
|
|
24
|
+
redo: () => void;
|
|
25
|
+
hr: () => void;
|
|
26
|
+
indent: () => void;
|
|
27
|
+
dedent: () => void;
|
|
28
|
+
table: (config: {
|
|
29
|
+
rows: number;
|
|
30
|
+
cols: number;
|
|
31
|
+
}) => void;
|
|
32
|
+
};
|
|
33
|
+
export {};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { EditorDirection } from '../../types';
|
|
3
|
-
import { createMarkdownEditor } from './createMarkdownEditor';
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Minimum height to set for the markdown text area
|
|
8
|
-
*/
|
|
9
|
-
minHeight?: string | number;
|
|
10
|
-
mode: 'default' | 'zen';
|
|
11
|
-
direction: EditorDirection;
|
|
12
|
-
disabled: boolean;
|
|
13
|
-
visible: boolean;
|
|
14
|
-
onReady: (editor: InitializedEditorType) => void;
|
|
15
|
-
};
|
|
16
|
-
export declare const MarkdownTextarea: React.MemoExoticComponent<(props: MarkdownTextareaProps) => JSX.Element>;
|
|
17
|
-
export {};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { EditorDirection } from '../../types';
|
|
3
|
+
import { createMarkdownEditor } from './createMarkdownEditor';
|
|
4
|
+
export type InitializedEditorType = ReturnType<typeof createMarkdownEditor>;
|
|
5
|
+
type MarkdownTextareaProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Minimum height to set for the markdown text area
|
|
8
|
+
*/
|
|
9
|
+
minHeight?: string | number;
|
|
10
|
+
mode: 'default' | 'zen';
|
|
11
|
+
direction: EditorDirection;
|
|
12
|
+
disabled: boolean;
|
|
13
|
+
visible: boolean;
|
|
14
|
+
onReady: (editor: InitializedEditorType) => void;
|
|
15
|
+
};
|
|
16
|
+
export declare const MarkdownTextarea: React.MemoExoticComponent<(props: MarkdownTextareaProps) => React.JSX.Element>;
|
|
17
|
+
export {};
|