@contentful/field-editor-markdown 1.2.1 → 1.3.1

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.
Files changed (136) hide show
  1. package/dist/cjs/MarkdownActions.js +235 -0
  2. package/dist/cjs/MarkdownEditor.js +180 -0
  3. package/dist/cjs/__fixtures__/FakeSdk.js +183 -0
  4. package/dist/cjs/__fixtures__/asset/index.js +37 -0
  5. package/dist/cjs/__fixtures__/content-type/index.js +16 -0
  6. package/dist/cjs/__fixtures__/entry/index.js +33 -0
  7. package/dist/cjs/__fixtures__/fixtures.js +71 -0
  8. package/dist/cjs/__fixtures__/locale/index.js +40 -0
  9. package/dist/cjs/__fixtures__/space/index.js +16 -0
  10. package/dist/cjs/codemirrorImports.js +9 -0
  11. package/dist/cjs/components/HeadingSelector.js +66 -0
  12. package/dist/cjs/components/InsertLinkSelector.js +86 -0
  13. package/dist/cjs/components/MarkdownBottomBar.js +111 -0
  14. package/dist/cjs/components/MarkdownConstraints.js +79 -0
  15. package/dist/cjs/components/MarkdownPreview.js +249 -0
  16. package/dist/cjs/components/MarkdownTabs.js +128 -0
  17. package/dist/cjs/components/MarkdownTextarea/CodeMirrorWrapper.js +383 -0
  18. package/dist/cjs/components/MarkdownTextarea/MarkdownCommands.js +233 -0
  19. package/dist/cjs/components/MarkdownTextarea/MarkdownTextarea.js +190 -0
  20. package/dist/cjs/components/MarkdownTextarea/createMarkdownEditor.js +101 -0
  21. package/dist/cjs/components/MarkdownToolbar.js +367 -0
  22. package/dist/cjs/components/icons.js +193 -0
  23. package/dist/cjs/dialogs/CheatsheetModalDialog.js +239 -0
  24. package/dist/cjs/dialogs/ConfirmInsertAssetModalDialog.js +94 -0
  25. package/dist/cjs/dialogs/EmdebExternalContentDialog.js +202 -0
  26. package/dist/cjs/dialogs/InsertLinkModalDialog.js +149 -0
  27. package/dist/cjs/dialogs/InsertTableModalDialog.js +140 -0
  28. package/dist/cjs/dialogs/SpecialCharacterModalDialog.js +146 -0
  29. package/dist/cjs/dialogs/ZenModeModalDialog.js +257 -0
  30. package/dist/cjs/dialogs/openMarkdownDialog.js +121 -0
  31. package/dist/cjs/dialogs/renderMarkdownDialog.js +108 -0
  32. package/dist/cjs/index.js +29 -0
  33. package/dist/cjs/types.js +20 -0
  34. package/dist/cjs/utils/insertAssetLinks.js +122 -0
  35. package/dist/cjs/utils/insertAssetLinks.spec.js +22 -0
  36. package/dist/cjs/utils/isValidUrl.js +22 -0
  37. package/dist/cjs/utils/linkOrganizer.js +187 -0
  38. package/dist/cjs/utils/linkOrganizer.spec.js +96 -0
  39. package/dist/cjs/utils/replaceMailtoAmp.js +15 -0
  40. package/dist/cjs/utils/replaceMailtoAmp.spec.js +22 -0
  41. package/dist/cjs/utils/specialCharacters.js +228 -0
  42. package/dist/cjs/utils/userAgent.js +28 -0
  43. package/dist/esm/MarkdownActions.js +186 -0
  44. package/dist/esm/MarkdownEditor.js +118 -0
  45. package/dist/esm/__fixtures__/FakeSdk.js +173 -0
  46. package/dist/esm/__fixtures__/asset/index.js +6 -0
  47. package/dist/esm/__fixtures__/content-type/index.js +2 -0
  48. package/dist/esm/__fixtures__/entry/index.js +5 -0
  49. package/dist/esm/__fixtures__/fixtures.js +6 -0
  50. package/dist/esm/__fixtures__/locale/index.js +15 -0
  51. package/dist/esm/__fixtures__/space/index.js +2 -0
  52. package/dist/esm/codemirrorImports.js +5 -0
  53. package/dist/esm/components/HeadingSelector.js +17 -0
  54. package/dist/esm/components/InsertLinkSelector.js +37 -0
  55. package/dist/esm/components/MarkdownBottomBar.js +46 -0
  56. package/dist/esm/components/MarkdownConstraints.js +25 -0
  57. package/dist/esm/components/MarkdownPreview.js +195 -0
  58. package/dist/esm/components/MarkdownTabs.js +74 -0
  59. package/dist/esm/components/MarkdownTextarea/CodeMirrorWrapper.js +329 -0
  60. package/dist/esm/components/MarkdownTextarea/MarkdownCommands.js +218 -0
  61. package/dist/esm/components/MarkdownTextarea/MarkdownTextarea.js +136 -0
  62. package/dist/esm/components/MarkdownTextarea/createMarkdownEditor.js +52 -0
  63. package/dist/esm/components/MarkdownToolbar.js +302 -0
  64. package/dist/esm/components/icons.js +112 -0
  65. package/dist/esm/dialogs/CheatsheetModalDialog.js +177 -0
  66. package/dist/esm/dialogs/ConfirmInsertAssetModalDialog.js +37 -0
  67. package/dist/esm/dialogs/EmdebExternalContentDialog.js +140 -0
  68. package/dist/esm/dialogs/InsertLinkModalDialog.js +92 -0
  69. package/dist/esm/dialogs/InsertTableModalDialog.js +78 -0
  70. package/dist/esm/dialogs/SpecialCharacterModalDialog.js +84 -0
  71. package/dist/esm/dialogs/ZenModeModalDialog.js +195 -0
  72. package/dist/esm/dialogs/openMarkdownDialog.js +72 -0
  73. package/dist/esm/dialogs/renderMarkdownDialog.js +59 -0
  74. package/dist/esm/index.js +5 -0
  75. package/dist/esm/types.js +10 -0
  76. package/dist/esm/utils/insertAssetLinks.js +99 -0
  77. package/dist/esm/utils/insertAssetLinks.spec.js +18 -0
  78. package/dist/esm/utils/isValidUrl.js +4 -0
  79. package/dist/esm/utils/linkOrganizer.js +152 -0
  80. package/dist/esm/utils/linkOrganizer.spec.js +53 -0
  81. package/dist/esm/utils/replaceMailtoAmp.js +5 -0
  82. package/dist/esm/utils/replaceMailtoAmp.spec.js +18 -0
  83. package/dist/esm/utils/specialCharacters.js +218 -0
  84. package/dist/esm/utils/userAgent.js +13 -0
  85. package/dist/{MarkdownActions.d.ts → types/MarkdownActions.d.ts} +38 -38
  86. package/dist/{MarkdownEditor.d.ts → types/MarkdownEditor.d.ts} +22 -22
  87. package/dist/types/__fixtures__/FakeSdk.d.ts +8 -0
  88. package/dist/types/__fixtures__/asset/index.d.ts +6 -0
  89. package/dist/types/__fixtures__/content-type/index.d.ts +2 -0
  90. package/dist/types/__fixtures__/entry/index.d.ts +5 -0
  91. package/dist/types/__fixtures__/fixtures.d.ts +6 -0
  92. package/dist/types/__fixtures__/locale/index.d.ts +42 -0
  93. package/dist/types/__fixtures__/space/index.d.ts +2 -0
  94. package/dist/{codemirrorImports.d.ts → types/codemirrorImports.d.ts} +5 -5
  95. package/dist/{components → types/components}/HeadingSelector.d.ts +7 -7
  96. package/dist/{components → types/components}/InsertLinkSelector.d.ts +9 -9
  97. package/dist/{components → types/components}/MarkdownBottomBar.d.ts +11 -11
  98. package/dist/{components → types/components}/MarkdownConstraints.d.ts +6 -6
  99. package/dist/{components → types/components}/MarkdownPreview.d.ts +14 -14
  100. package/dist/{components → types/components}/MarkdownTabs.d.ts +8 -8
  101. package/dist/{components → types/components}/MarkdownTextarea/CodeMirrorWrapper.d.ts +58 -58
  102. package/dist/{components → types/components}/MarkdownTextarea/MarkdownCommands.d.ts +33 -33
  103. package/dist/{components → types/components}/MarkdownTextarea/MarkdownTextarea.d.ts +17 -17
  104. package/dist/{components → types/components}/MarkdownTextarea/createMarkdownEditor.d.ts +55 -55
  105. package/dist/{components → types/components}/MarkdownToolbar.d.ts +12 -12
  106. package/dist/types/components/icons.d.ts +18 -0
  107. package/dist/{dialogs → types/dialogs}/CheatsheetModalDialog.d.ts +4 -4
  108. package/dist/{dialogs → types/dialogs}/ConfirmInsertAssetModalDialog.d.ts +23 -23
  109. package/dist/{dialogs → types/dialogs}/EmdebExternalContentDialog.d.ts +9 -9
  110. package/dist/{dialogs → types/dialogs}/InsertLinkModalDialog.d.ts +17 -17
  111. package/dist/{dialogs → types/dialogs}/InsertTableModalDialog.d.ts +13 -13
  112. package/dist/{dialogs → types/dialogs}/SpecialCharacterModalDialog.d.ts +9 -9
  113. package/dist/{dialogs → types/dialogs}/ZenModeModalDialog.d.ts +24 -24
  114. package/dist/{dialogs → types/dialogs}/openMarkdownDialog.d.ts +5 -5
  115. package/dist/{dialogs → types/dialogs}/renderMarkdownDialog.d.ts +8 -8
  116. package/dist/{index.d.ts → types/index.d.ts} +5 -5
  117. package/dist/{types.d.ts → types/types.d.ts} +75 -75
  118. package/dist/{utils → types/utils}/insertAssetLinks.d.ts +29 -29
  119. package/dist/types/utils/insertAssetLinks.spec.d.ts +1 -0
  120. package/dist/{utils → types/utils}/isValidUrl.d.ts +2 -2
  121. package/dist/{utils → types/utils}/linkOrganizer.d.ts +6 -6
  122. package/dist/types/utils/linkOrganizer.spec.d.ts +1 -0
  123. package/dist/{utils → types/utils}/replaceMailtoAmp.d.ts +1 -1
  124. package/dist/types/utils/replaceMailtoAmp.spec.d.ts +1 -0
  125. package/dist/{utils → types/utils}/specialCharacters.d.ts +4 -4
  126. package/dist/{utils → types/utils}/userAgent.d.ts +1 -1
  127. package/package.json +25 -12
  128. package/CHANGELOG.md +0 -314
  129. package/dist/components/icons.d.ts +0 -18
  130. package/dist/field-editor-markdown.cjs.development.js +0 -3609
  131. package/dist/field-editor-markdown.cjs.development.js.map +0 -1
  132. package/dist/field-editor-markdown.cjs.production.min.js +0 -216
  133. package/dist/field-editor-markdown.cjs.production.min.js.map +0 -1
  134. package/dist/field-editor-markdown.esm.js +0 -3599
  135. package/dist/field-editor-markdown.esm.js.map +0 -1
  136. package/dist/index.js +0 -8
@@ -1,55 +1,55 @@
1
- /// <reference types="codemirror" />
2
- import { EditorDirection } from '../../types';
3
- export declare function createMarkdownEditor(host: HTMLElement, options: {
4
- direction: EditorDirection;
5
- readOnly: boolean;
6
- fixedHeight?: number | boolean;
7
- height?: number | string;
8
- }): {
9
- actions: {
10
- bold: () => void;
11
- italic: () => void;
12
- strike: () => void;
13
- quote: () => void;
14
- code: () => void;
15
- link: (url: string, text?: string | undefined, title?: string | undefined) => void;
16
- h1: () => void;
17
- h2: () => void;
18
- h3: () => void;
19
- ul: () => void;
20
- ol: () => void;
21
- undo: () => void;
22
- redo: () => void;
23
- hr: () => void;
24
- indent: () => void;
25
- dedent: () => void;
26
- table: (config: {
27
- rows: number;
28
- cols: number;
29
- }) => void;
30
- };
31
- history: {
32
- hasUndo: () => boolean;
33
- hasRedo: () => boolean;
34
- };
35
- events: {
36
- onScroll: (fn: Function) => void;
37
- onChange: (fn: Function) => void;
38
- onPaste: (fn: Function) => void;
39
- };
40
- insert: (text: string) => void;
41
- focus: () => void;
42
- getContent: () => string;
43
- destroy: () => void;
44
- setContent: (value?: string | undefined) => void;
45
- getSelectedText: () => string;
46
- usePrimarySelection: () => void;
47
- setReadOnly: (value: boolean) => void;
48
- selectBackwards: (skip: number, len: number) => void;
49
- getCursor: () => import("codemirror").Position;
50
- setCursor: (cursor: number | import("codemirror").Position) => void;
51
- clear: () => void;
52
- selectAll: () => void;
53
- setFullsize: () => void;
54
- refresh: () => void;
55
- };
1
+ /// <reference types="codemirror" />
2
+ import { EditorDirection } from '../../types';
3
+ export declare function createMarkdownEditor(host: HTMLElement, options: {
4
+ direction: EditorDirection;
5
+ readOnly: boolean;
6
+ fixedHeight?: number | boolean;
7
+ height?: number | string;
8
+ }): {
9
+ actions: {
10
+ bold: () => void;
11
+ italic: () => void;
12
+ strike: () => void;
13
+ quote: () => void;
14
+ code: () => void;
15
+ link: (url: string, text?: string | undefined, title?: string | undefined) => void;
16
+ h1: () => void;
17
+ h2: () => void;
18
+ h3: () => void;
19
+ ul: () => void;
20
+ ol: () => void;
21
+ undo: () => void;
22
+ redo: () => void;
23
+ hr: () => void;
24
+ indent: () => void;
25
+ dedent: () => void;
26
+ table: (config: {
27
+ rows: number;
28
+ cols: number;
29
+ }) => void;
30
+ };
31
+ history: {
32
+ hasUndo: () => boolean;
33
+ hasRedo: () => boolean;
34
+ };
35
+ events: {
36
+ onScroll: (fn: Function) => void;
37
+ onChange: (fn: Function) => void;
38
+ onPaste: (fn: Function) => void;
39
+ };
40
+ insert: (text: string) => void;
41
+ focus: () => void;
42
+ getContent: () => string;
43
+ destroy: () => void;
44
+ setContent: (value?: string | undefined) => void;
45
+ getSelectedText: () => string;
46
+ usePrimarySelection: () => void;
47
+ setReadOnly: (value: boolean) => void;
48
+ selectBackwards: (skip: number, len: number) => void;
49
+ getCursor: () => import("codemirror").Position;
50
+ setCursor: (cursor: number | import("codemirror").Position) => void;
51
+ clear: () => void;
52
+ selectAll: () => void;
53
+ setFullsize: () => void;
54
+ refresh: () => void;
55
+ };
@@ -1,12 +1,12 @@
1
- import React from 'react';
2
- import { MarkdownActions } from '../types';
3
- interface MarkdownToolbarProps {
4
- canUploadAssets: boolean;
5
- disabled: boolean;
6
- actions: MarkdownActions;
7
- mode: 'default' | 'zen';
8
- }
9
- export declare function DefaultMarkdownToolbar(props: MarkdownToolbarProps): JSX.Element;
10
- export declare function ZenMarkdownToolbar(props: MarkdownToolbarProps): JSX.Element;
11
- export declare const MarkdownToolbar: React.MemoExoticComponent<(props: MarkdownToolbarProps) => JSX.Element>;
12
- export {};
1
+ import * as React from 'react';
2
+ import { MarkdownActions } from '../types';
3
+ interface MarkdownToolbarProps {
4
+ canUploadAssets: boolean;
5
+ disabled: boolean;
6
+ actions: MarkdownActions;
7
+ mode: 'default' | 'zen';
8
+ }
9
+ export declare function DefaultMarkdownToolbar(props: MarkdownToolbarProps): React.JSX.Element;
10
+ export declare function ZenMarkdownToolbar(props: MarkdownToolbarProps): React.JSX.Element;
11
+ export declare const MarkdownToolbar: React.MemoExoticComponent<(props: MarkdownToolbarProps) => React.JSX.Element>;
12
+ export {};
@@ -0,0 +1,18 @@
1
+ import * as React from 'react';
2
+ type IconProps = {
3
+ width?: number;
4
+ height?: number;
5
+ className?: string;
6
+ label: string;
7
+ };
8
+ export declare const Zen: ({ label, ...rest }: IconProps) => React.JSX.Element;
9
+ export declare const Strikethrough: ({ label, ...rest }: IconProps) => React.JSX.Element;
10
+ export declare const Indent: ({ label, ...rest }: IconProps) => React.JSX.Element;
11
+ export declare const Dedent: ({ label, ...rest }: IconProps) => React.JSX.Element;
12
+ export declare const Cubes: ({ label, ...rest }: IconProps) => React.JSX.Element;
13
+ export declare const Table: ({ label, ...rest }: IconProps) => React.JSX.Element;
14
+ export declare const SpecialChar: ({ label, ...rest }: IconProps) => React.JSX.Element;
15
+ export declare const OrgLinks: ({ label, ...rest }: IconProps) => React.JSX.Element;
16
+ export declare const Undo: ({ label, ...rest }: IconProps) => React.JSX.Element;
17
+ export declare const Redo: ({ label, ...rest }: IconProps) => React.JSX.Element;
18
+ export {};
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
2
- import { DialogsAPI } from '@contentful/app-sdk';
3
- export declare const CheatsheetModalDialog: () => JSX.Element;
4
- export declare const openCheatsheetModal: (dialogs: DialogsAPI) => Promise<void>;
1
+ import * as React from 'react';
2
+ import { DialogsAPI } from '@contentful/app-sdk';
3
+ export declare const CheatsheetModalDialog: () => React.JSX.Element;
4
+ export declare const openCheatsheetModal: (dialogs: DialogsAPI) => Promise<void>;
@@ -1,23 +1,23 @@
1
- /// <reference types="react" />
2
- import { DialogsAPI } from '@contentful/app-sdk';
3
- interface ConfirmInsertAssetModalDialogProps {
4
- onClose: (result: boolean) => void;
5
- assets: Array<{
6
- title: string;
7
- description: string;
8
- thumbnailUrl: string;
9
- thumbnailAltText: string;
10
- }>;
11
- locale: string;
12
- }
13
- export declare const ConfirmInsertAssetModalDialog: ({ onClose, assets, locale, }: ConfirmInsertAssetModalDialogProps) => JSX.Element;
14
- export declare const openConfirmInsertAsset: (dialogs: DialogsAPI, options: {
15
- locale: string;
16
- assets: Array<{
17
- title: string;
18
- description: string;
19
- thumbnailUrl: string;
20
- thumbnailAltText: string;
21
- }>;
22
- }) => Promise<boolean>;
23
- export {};
1
+ import * as React from 'react';
2
+ import { DialogsAPI } from '@contentful/app-sdk';
3
+ interface ConfirmInsertAssetModalDialogProps {
4
+ onClose: (result: boolean) => void;
5
+ assets: Array<{
6
+ title: string;
7
+ description: string;
8
+ thumbnailUrl: string;
9
+ thumbnailAltText: string;
10
+ }>;
11
+ locale: string;
12
+ }
13
+ export declare const ConfirmInsertAssetModalDialog: ({ onClose, assets, locale, }: ConfirmInsertAssetModalDialogProps) => React.JSX.Element;
14
+ export declare const openConfirmInsertAsset: (dialogs: DialogsAPI, options: {
15
+ locale: string;
16
+ assets: Array<{
17
+ title: string;
18
+ description: string;
19
+ thumbnailUrl: string;
20
+ thumbnailAltText: string;
21
+ }>;
22
+ }) => Promise<boolean>;
23
+ export {};
@@ -1,9 +1,9 @@
1
- /// <reference types="react" />
2
- import { DialogsAPI } from '@contentful/app-sdk';
3
- export declare type EmbedExternalContentModalResult = string | false | undefined;
4
- declare type EmbedExternalContentModalProps = {
5
- onClose: (result: EmbedExternalContentModalResult) => void;
6
- };
7
- export declare const EmbedExternalContentModal: ({ onClose }: EmbedExternalContentModalProps) => JSX.Element;
8
- export declare const openEmbedExternalContentDialog: (dialogs: DialogsAPI) => Promise<EmbedExternalContentModalResult>;
9
- export {};
1
+ import React from 'react';
2
+ import { DialogsAPI } from '@contentful/app-sdk';
3
+ export type EmbedExternalContentModalResult = string | false | undefined;
4
+ type EmbedExternalContentModalProps = {
5
+ onClose: (result: EmbedExternalContentModalResult) => void;
6
+ };
7
+ export declare const EmbedExternalContentModal: ({ onClose }: EmbedExternalContentModalProps) => React.JSX.Element;
8
+ export declare const openEmbedExternalContentDialog: (dialogs: DialogsAPI) => Promise<EmbedExternalContentModalResult>;
9
+ export {};
@@ -1,17 +1,17 @@
1
- /// <reference types="react" />
2
- import { DialogsAPI } from '@contentful/app-sdk';
3
- declare type InsertLinkModalPositiveResult = {
4
- url: string;
5
- text: string;
6
- title: string;
7
- };
8
- export declare type InsertLinkModalResult = InsertLinkModalPositiveResult | false | undefined;
9
- declare type InsertLinkModalProps = {
10
- selectedText?: string;
11
- onClose: (result: InsertLinkModalResult) => void;
12
- };
13
- export declare const InsertLinkModal: ({ selectedText, onClose }: InsertLinkModalProps) => JSX.Element;
14
- export declare const openInsertLinkDialog: (dialogs: DialogsAPI, params: {
15
- selectedText?: string;
16
- }) => Promise<InsertLinkModalResult>;
17
- export {};
1
+ import React from 'react';
2
+ import { DialogsAPI } from '@contentful/app-sdk';
3
+ type InsertLinkModalPositiveResult = {
4
+ url: string;
5
+ text: string;
6
+ title: string;
7
+ };
8
+ export type InsertLinkModalResult = InsertLinkModalPositiveResult | false | undefined;
9
+ type InsertLinkModalProps = {
10
+ selectedText?: string;
11
+ onClose: (result: InsertLinkModalResult) => void;
12
+ };
13
+ export declare const InsertLinkModal: ({ selectedText, onClose }: InsertLinkModalProps) => React.JSX.Element;
14
+ export declare const openInsertLinkDialog: (dialogs: DialogsAPI, params: {
15
+ selectedText?: string;
16
+ }) => Promise<InsertLinkModalResult>;
17
+ export {};
@@ -1,13 +1,13 @@
1
- /// <reference types="react" />
2
- import { DialogsAPI } from '@contentful/app-sdk';
3
- declare type InsertTableModalPositiveResult = {
4
- cols: number;
5
- rows: number;
6
- };
7
- export declare type InsertTableModalResult = InsertTableModalPositiveResult | false | undefined;
8
- declare type InsertTableModalProps = {
9
- onClose: (result: InsertTableModalResult) => void;
10
- };
11
- export declare const InsertTableModal: ({ onClose }: InsertTableModalProps) => JSX.Element;
12
- export declare const openInsertTableDialog: (dialogs: DialogsAPI) => Promise<InsertTableModalResult>;
13
- export {};
1
+ import React from 'react';
2
+ import { DialogsAPI } from '@contentful/app-sdk';
3
+ type InsertTableModalPositiveResult = {
4
+ cols: number;
5
+ rows: number;
6
+ };
7
+ export type InsertTableModalResult = InsertTableModalPositiveResult | false | undefined;
8
+ type InsertTableModalProps = {
9
+ onClose: (result: InsertTableModalResult) => void;
10
+ };
11
+ export declare const InsertTableModal: ({ onClose }: InsertTableModalProps) => React.JSX.Element;
12
+ export declare const openInsertTableDialog: (dialogs: DialogsAPI) => Promise<InsertTableModalResult>;
13
+ export {};
@@ -1,9 +1,9 @@
1
- /// <reference types="react" />
2
- import { DialogsAPI } from '@contentful/app-sdk';
3
- export declare type SpecialCharacterModalResult = string | false | undefined;
4
- declare type SpecialCharacterModalDialogProps = {
5
- onClose: (result: SpecialCharacterModalResult) => void;
6
- };
7
- export declare const SpecialCharacterModalDialog: ({ onClose }: SpecialCharacterModalDialogProps) => JSX.Element;
8
- export declare const openInsertSpecialCharacter: (dialogs: DialogsAPI) => Promise<SpecialCharacterModalResult>;
9
- export {};
1
+ import React from 'react';
2
+ import { DialogsAPI } from '@contentful/app-sdk';
3
+ export type SpecialCharacterModalResult = string | false | undefined;
4
+ type SpecialCharacterModalDialogProps = {
5
+ onClose: (result: SpecialCharacterModalResult) => void;
6
+ };
7
+ export declare const SpecialCharacterModalDialog: ({ onClose }: SpecialCharacterModalDialogProps) => React.JSX.Element;
8
+ export declare const openInsertSpecialCharacter: (dialogs: DialogsAPI) => Promise<SpecialCharacterModalResult>;
9
+ export {};
@@ -1,24 +1,24 @@
1
- /// <reference types="react" />
2
- import { DialogsAPI, DialogExtensionSDK } from '@contentful/app-sdk';
3
- import { PreviewComponents } from '../types';
4
- export declare type ZenModeResult = {
5
- value: string;
6
- cursor?: {
7
- ch: number;
8
- line: number;
9
- };
10
- };
11
- declare type ZenModeDialogProps = {
12
- saveValueToSDK: (value: string | null | undefined) => void;
13
- onClose: (result: ZenModeResult) => void;
14
- initialValue: string;
15
- locale: string;
16
- sdk: DialogExtensionSDK;
17
- previewComponents?: PreviewComponents;
18
- };
19
- export declare const ZenModeModalDialog: (props: ZenModeDialogProps) => JSX.Element;
20
- export declare const openZenMode: (dialogs: DialogsAPI, options: {
21
- initialValue: string;
22
- locale: string;
23
- }) => Promise<ZenModeResult>;
24
- export {};
1
+ import * as React from 'react';
2
+ import { DialogExtensionSDK, DialogsAPI } from '@contentful/app-sdk';
3
+ import { PreviewComponents } from '../types';
4
+ export type ZenModeResult = {
5
+ value: string;
6
+ cursor?: {
7
+ ch: number;
8
+ line: number;
9
+ };
10
+ };
11
+ type ZenModeDialogProps = {
12
+ saveValueToSDK: (value: string | null | undefined) => void;
13
+ onClose: (result: ZenModeResult) => void;
14
+ initialValue: string;
15
+ locale: string;
16
+ sdk: DialogExtensionSDK;
17
+ previewComponents?: PreviewComponents;
18
+ };
19
+ export declare const ZenModeModalDialog: (props: ZenModeDialogProps) => React.JSX.Element;
20
+ export declare const openZenMode: (dialogs: DialogsAPI, options: {
21
+ initialValue: string;
22
+ locale: string;
23
+ }) => Promise<ZenModeResult>;
24
+ export {};
@@ -1,5 +1,5 @@
1
- import { FieldExtensionSDK, OpenCustomWidgetOptions } from '@contentful/app-sdk';
2
- import { MarkdownDialogsParams, PreviewComponents } from '../types';
3
- export declare const openMarkdownDialog: (sdk: FieldExtensionSDK, previewComponents?: PreviewComponents | undefined) => (options: OpenCustomWidgetOptions & {
4
- parameters?: MarkdownDialogsParams;
5
- }) => Promise<unknown>;
1
+ import { FieldExtensionSDK, OpenCustomWidgetOptions } from '@contentful/app-sdk';
2
+ import { MarkdownDialogsParams, PreviewComponents } from '../types';
3
+ export declare const openMarkdownDialog: (sdk: FieldExtensionSDK, previewComponents?: PreviewComponents) => (options: OpenCustomWidgetOptions & {
4
+ parameters?: MarkdownDialogsParams;
5
+ }) => Promise<unknown>;
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
2
- import { DialogExtensionSDK } from '@contentful/app-sdk';
3
- import { MarkdownDialogsParams } from '../types';
4
- export declare const renderMarkdownDialog: (sdk: DialogExtensionSDK & {
5
- parameters: {
6
- invocation: MarkdownDialogsParams;
7
- };
8
- }) => JSX.Element;
1
+ import * as React from 'react';
2
+ import { DialogExtensionSDK } from '@contentful/app-sdk';
3
+ import { MarkdownDialogsParams } from '../types';
4
+ export declare const renderMarkdownDialog: (sdk: DialogExtensionSDK & {
5
+ parameters: {
6
+ invocation: MarkdownDialogsParams;
7
+ };
8
+ }) => React.JSX.Element;
@@ -1,5 +1,5 @@
1
- import './codemirrorImports';
2
- export { MarkdownEditorConnected as MarkdownEditor } from './MarkdownEditor';
3
- export { MarkdownPreview } from './components/MarkdownPreview';
4
- export { openMarkdownDialog } from './dialogs/openMarkdownDialog';
5
- export { renderMarkdownDialog } from './dialogs/renderMarkdownDialog';
1
+ import './codemirrorImports';
2
+ export { MarkdownEditorConnected as MarkdownEditor } from './MarkdownEditor';
3
+ export { MarkdownPreview } from './components/MarkdownPreview';
4
+ export { openMarkdownDialog } from './dialogs/openMarkdownDialog';
5
+ export { renderMarkdownDialog } from './dialogs/renderMarkdownDialog';
@@ -1,75 +1,75 @@
1
- /// <reference types="react" />
2
- export declare type MarkdownTab = 'editor' | 'preview';
3
- export declare type HeadingType = 'h1' | 'h2' | 'h3';
4
- export declare type EditorDirection = 'ltr' | 'rtl';
5
- export declare enum MarkdownDialogType {
6
- cheatsheet = "markdown-cheatsheet",
7
- insertLink = "markdown-insertLink",
8
- insertSpecialCharacter = "markdown-insertSpecialCharacter",
9
- insertTable = "markdown-insertTable",
10
- embedExternalContent = "markdown-embedExternalContent",
11
- confirmInsertAsset = "markdown-confirmInsertAsset",
12
- zenMode = "markdown-zenMode"
13
- }
14
- export declare type MarkdownDialogsParams = {
15
- type: MarkdownDialogType.zenMode;
16
- initialValue: string;
17
- locale: string;
18
- } | {
19
- type: MarkdownDialogType.cheatsheet;
20
- } | {
21
- type: MarkdownDialogType.insertLink;
22
- selectedText?: string;
23
- } | {
24
- type: MarkdownDialogType.insertSpecialCharacter;
25
- } | {
26
- type: MarkdownDialogType.insertTable;
27
- } | {
28
- type: MarkdownDialogType.embedExternalContent;
29
- } | {
30
- type: MarkdownDialogType.confirmInsertAsset;
31
- locale: string;
32
- assets: Array<{
33
- title: string;
34
- description: string;
35
- thumbnailUrl: string;
36
- thumbnailAltText: string;
37
- }>;
38
- };
39
- export declare type MarkdownActions = {
40
- simple: {
41
- bold: Function;
42
- italic: Function;
43
- quote: Function;
44
- ol: Function;
45
- ul: Function;
46
- strike: Function;
47
- code: Function;
48
- hr: Function;
49
- indent: Function;
50
- dedent: Function;
51
- };
52
- headings: {
53
- h1: Function;
54
- h2: Function;
55
- h3: Function;
56
- };
57
- history: {
58
- undo: Function;
59
- redo: Function;
60
- };
61
- insertLink: Function;
62
- embedExternalContent: Function;
63
- insertTable: Function;
64
- insertSpecialCharacter: Function;
65
- linkExistingMedia: Function;
66
- addNewMedia: Function;
67
- organizeLinks: Function;
68
- openZenMode: Function;
69
- closeZenMode: Function;
70
- };
71
- export declare type PreviewComponents = {
72
- embedly?: React.ComponentType<{
73
- url: string;
74
- }>;
75
- };
1
+ /// <reference types="react" />
2
+ export type MarkdownTab = 'editor' | 'preview';
3
+ export type HeadingType = 'h1' | 'h2' | 'h3';
4
+ export type EditorDirection = 'ltr' | 'rtl';
5
+ export declare enum MarkdownDialogType {
6
+ cheatsheet = "markdown-cheatsheet",
7
+ insertLink = "markdown-insertLink",
8
+ insertSpecialCharacter = "markdown-insertSpecialCharacter",
9
+ insertTable = "markdown-insertTable",
10
+ embedExternalContent = "markdown-embedExternalContent",
11
+ confirmInsertAsset = "markdown-confirmInsertAsset",
12
+ zenMode = "markdown-zenMode"
13
+ }
14
+ export type MarkdownDialogsParams = {
15
+ type: MarkdownDialogType.zenMode;
16
+ initialValue: string;
17
+ locale: string;
18
+ } | {
19
+ type: MarkdownDialogType.cheatsheet;
20
+ } | {
21
+ type: MarkdownDialogType.insertLink;
22
+ selectedText?: string;
23
+ } | {
24
+ type: MarkdownDialogType.insertSpecialCharacter;
25
+ } | {
26
+ type: MarkdownDialogType.insertTable;
27
+ } | {
28
+ type: MarkdownDialogType.embedExternalContent;
29
+ } | {
30
+ type: MarkdownDialogType.confirmInsertAsset;
31
+ locale: string;
32
+ assets: Array<{
33
+ title: string;
34
+ description: string;
35
+ thumbnailUrl: string;
36
+ thumbnailAltText: string;
37
+ }>;
38
+ };
39
+ export type MarkdownActions = {
40
+ simple: {
41
+ bold: Function;
42
+ italic: Function;
43
+ quote: Function;
44
+ ol: Function;
45
+ ul: Function;
46
+ strike: Function;
47
+ code: Function;
48
+ hr: Function;
49
+ indent: Function;
50
+ dedent: Function;
51
+ };
52
+ headings: {
53
+ h1: Function;
54
+ h2: Function;
55
+ h3: Function;
56
+ };
57
+ history: {
58
+ undo: Function;
59
+ redo: Function;
60
+ };
61
+ insertLink: Function;
62
+ embedExternalContent: Function;
63
+ insertTable: Function;
64
+ insertSpecialCharacter: Function;
65
+ linkExistingMedia: Function;
66
+ addNewMedia: Function;
67
+ organizeLinks: Function;
68
+ openZenMode: Function;
69
+ closeZenMode: Function;
70
+ };
71
+ export type PreviewComponents = {
72
+ embedly?: React.ComponentType<{
73
+ url: string;
74
+ }>;
75
+ };
@@ -1,29 +1,29 @@
1
- declare type Asset = any;
2
- declare type LinkWithMedia = {
3
- title: string;
4
- asset: Asset;
5
- url: string;
6
- isLocalized: boolean;
7
- isFallback: boolean;
8
- asMarkdown: string;
9
- };
10
- declare type Locales = {
11
- localeCode: string;
12
- fallbackCode: string | undefined;
13
- defaultLocaleCode: string;
14
- };
15
- export declare function replaceAssetDomain(fileUrl: string): string;
16
- export declare function insertAssetLinks(assets: Array<Asset>, locales: Locales): Promise<{
17
- fallbacks: {
18
- title: string;
19
- thumbnailUrl: any;
20
- thumbnailAltText: string;
21
- description: string;
22
- asset: any;
23
- }[];
24
- links: LinkWithMedia[];
25
- } | {
26
- links: LinkWithMedia[];
27
- fallbacks?: undefined;
28
- }>;
29
- export {};
1
+ type Asset = any;
2
+ type LinkWithMedia = {
3
+ title: string;
4
+ asset: Asset;
5
+ url: string;
6
+ isLocalized: boolean;
7
+ isFallback: boolean;
8
+ asMarkdown: string;
9
+ };
10
+ type Locales = {
11
+ localeCode: string;
12
+ fallbackCode: string | undefined;
13
+ defaultLocaleCode: string;
14
+ };
15
+ export declare function replaceAssetDomain(fileUrl: string): string;
16
+ export declare function insertAssetLinks(assets: Array<Asset>, locales: Locales): Promise<{
17
+ fallbacks: {
18
+ title: string;
19
+ thumbnailUrl: any;
20
+ thumbnailAltText: string;
21
+ description: string;
22
+ asset: any;
23
+ }[];
24
+ links: LinkWithMedia[];
25
+ } | {
26
+ links: LinkWithMedia[];
27
+ fallbacks?: undefined;
28
+ }>;
29
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,2 @@
1
- export declare const urlRegex: RegExp;
2
- export declare function isValidUrl(value: string): boolean;
1
+ export declare const urlRegex: RegExp;
2
+ export declare function isValidUrl(value: string): boolean;
@@ -1,6 +1,6 @@
1
- export declare const findInline: (text: string) => Array<any>;
2
- export declare const findRefs: (text: string) => Array<any>;
3
- export declare const findLabels: (text: string) => Array<any>;
4
- export declare function convertInlineToRef(text: string): string;
5
- export declare function rewriteRefs(text: string): string;
6
- export declare function findMaxLabelId(textOrLabels: any): number;
1
+ export declare const findInline: (text: string) => Array<any>;
2
+ export declare const findRefs: (text: string) => Array<any>;
3
+ export declare const findLabels: (text: string) => Array<any>;
4
+ export declare function convertInlineToRef(text: string): string;
5
+ export declare function rewriteRefs(text: string): string;
6
+ export declare function findMaxLabelId(textOrLabels: any): number;
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1 @@
1
- export declare const replaceMailtoAmp: (string: string) => string;
1
+ export declare const replaceMailtoAmp: (string: string) => string;