@contentful/field-editor-markdown 1.9.6 → 1.10.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/MarkdownEditor.js +12 -12
- package/dist/cjs/components/HeadingSelector.js +3 -3
- package/dist/cjs/components/InsertLinkSelector.js +9 -9
- package/dist/cjs/components/MarkdownBottomBar.js +10 -10
- package/dist/cjs/components/MarkdownConstraints.js +3 -3
- package/dist/cjs/components/MarkdownPreview.js +6 -6
- package/dist/cjs/components/MarkdownPreviewSkeleton.js +2 -2
- package/dist/cjs/components/MarkdownTabs.js +4 -4
- package/dist/cjs/components/MarkdownTextarea/MarkdownTextarea.js +2 -2
- package/dist/cjs/components/MarkdownToolbar.js +59 -59
- package/dist/cjs/components/icons.js +30 -30
- package/dist/cjs/dialogs/CheatsheetModalDialog.js +45 -45
- package/dist/cjs/dialogs/ConfirmInsertAssetModalDialog.js +4 -4
- package/dist/cjs/dialogs/EmdebExternalContentDialog.js +15 -15
- package/dist/cjs/dialogs/InsertLinkModalDialog.js +10 -10
- package/dist/cjs/dialogs/InsertTableModalDialog.js +7 -7
- package/dist/cjs/dialogs/SpecialCharacterModalDialog.js +10 -10
- package/dist/cjs/dialogs/ZenModeModalDialog.js +17 -17
- package/dist/cjs/dialogs/openMarkdownDialog.js +7 -7
- package/dist/cjs/dialogs/renderMarkdownDialog.js +8 -8
- package/dist/cjs/types.js +3 -3
- package/dist/esm/MarkdownEditor.js +12 -12
- package/dist/esm/components/HeadingSelector.js +3 -3
- package/dist/esm/components/InsertLinkSelector.js +9 -9
- package/dist/esm/components/MarkdownBottomBar.js +10 -10
- package/dist/esm/components/MarkdownConstraints.js +3 -3
- package/dist/esm/components/MarkdownPreview.js +6 -6
- package/dist/esm/components/MarkdownPreviewSkeleton.js +2 -2
- package/dist/esm/components/MarkdownTabs.js +4 -4
- package/dist/esm/components/MarkdownTextarea/MarkdownTextarea.js +2 -2
- package/dist/esm/components/MarkdownToolbar.js +59 -59
- package/dist/esm/components/icons.js +30 -30
- package/dist/esm/dialogs/CheatsheetModalDialog.js +45 -45
- package/dist/esm/dialogs/ConfirmInsertAssetModalDialog.js +4 -4
- package/dist/esm/dialogs/EmdebExternalContentDialog.js +15 -15
- package/dist/esm/dialogs/InsertLinkModalDialog.js +10 -10
- package/dist/esm/dialogs/InsertTableModalDialog.js +7 -7
- package/dist/esm/dialogs/SpecialCharacterModalDialog.js +10 -10
- package/dist/esm/dialogs/ZenModeModalDialog.js +17 -17
- package/dist/esm/dialogs/openMarkdownDialog.js +7 -7
- package/dist/esm/dialogs/renderMarkdownDialog.js +8 -8
- package/dist/esm/types.js +3 -3
- package/package.json +6 -4
|
@@ -74,7 +74,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
74
74
|
}
|
|
75
75
|
return newObj;
|
|
76
76
|
}
|
|
77
|
-
const MarkdownPreview = _react.lazy(()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../components/MarkdownPreview"))));
|
|
77
|
+
const MarkdownPreview = /*#__PURE__*/ _react.lazy(()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../components/MarkdownPreview"))));
|
|
78
78
|
const styles = {
|
|
79
79
|
root: (0, _emotion.css)({
|
|
80
80
|
display: 'grid',
|
|
@@ -166,21 +166,21 @@ const ZenModeModalDialog = (props)=>{
|
|
|
166
166
|
});
|
|
167
167
|
};
|
|
168
168
|
const direction = props.sdk.locales.direction[props.locale] ?? 'ltr';
|
|
169
|
-
return _react.createElement(_f36components.Grid, {
|
|
169
|
+
return /*#__PURE__*/ _react.createElement(_f36components.Grid, {
|
|
170
170
|
className: styles.root,
|
|
171
171
|
"data-test-id": "zen-mode-markdown-editor"
|
|
172
|
-
}, _react.createElement(_f36components.Grid.Item, {
|
|
172
|
+
}, /*#__PURE__*/ _react.createElement(_f36components.Grid.Item, {
|
|
173
173
|
className: styles.topSplit
|
|
174
|
-
}, _react.createElement(_MarkdownToolbar.MarkdownToolbar, {
|
|
174
|
+
}, /*#__PURE__*/ _react.createElement(_MarkdownToolbar.MarkdownToolbar, {
|
|
175
175
|
mode: "zen",
|
|
176
176
|
disabled: false,
|
|
177
177
|
canUploadAssets: false,
|
|
178
178
|
actions: actions
|
|
179
|
-
})), _react.createElement(_f36components.Grid.Item, {
|
|
179
|
+
})), /*#__PURE__*/ _react.createElement(_f36components.Grid.Item, {
|
|
180
180
|
className: (0, _emotion.cx)(styles.editorSplit, {
|
|
181
181
|
[styles.editorSplitFullscreen]: showPreview === false
|
|
182
182
|
})
|
|
183
|
-
}, _react.createElement(_MarkdownTextarea.MarkdownTextarea, {
|
|
183
|
+
}, /*#__PURE__*/ _react.createElement(_MarkdownTextarea.MarkdownTextarea, {
|
|
184
184
|
mode: "zen",
|
|
185
185
|
visible: true,
|
|
186
186
|
disabled: false,
|
|
@@ -195,40 +195,40 @@ const ZenModeModalDialog = (props)=>{
|
|
|
195
195
|
props.saveValueToSDK(value);
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
|
-
})), showPreview && _react.createElement(_f36components.Grid.Item, {
|
|
198
|
+
})), showPreview && /*#__PURE__*/ _react.createElement(_f36components.Grid.Item, {
|
|
199
199
|
className: styles.previewSplit
|
|
200
|
-
}, _react.createElement(_react.Suspense, {
|
|
201
|
-
fallback: _react.createElement(_MarkdownPreviewSkeleton.default, null)
|
|
202
|
-
}, _react.createElement(MarkdownPreview, {
|
|
200
|
+
}, /*#__PURE__*/ _react.createElement(_react.Suspense, {
|
|
201
|
+
fallback: /*#__PURE__*/ _react.createElement(_MarkdownPreviewSkeleton.default, null)
|
|
202
|
+
}, /*#__PURE__*/ _react.createElement(MarkdownPreview, {
|
|
203
203
|
direction: direction,
|
|
204
204
|
mode: "zen",
|
|
205
205
|
value: currentValue,
|
|
206
206
|
previewComponents: props.previewComponents
|
|
207
|
-
}))), showPreview && _react.createElement(_f36components.Grid.Item, {
|
|
207
|
+
}))), showPreview && /*#__PURE__*/ _react.createElement(_f36components.Grid.Item, {
|
|
208
208
|
className: styles.separator
|
|
209
|
-
}), showPreview && _react.createElement("button", {
|
|
209
|
+
}), showPreview && /*#__PURE__*/ _react.createElement("button", {
|
|
210
210
|
className: (0, _emotion.cx)(styles.button, styles.hideButton),
|
|
211
211
|
"aria-label": "Hide preview",
|
|
212
212
|
onClick: ()=>{
|
|
213
213
|
setShowPreview(false);
|
|
214
214
|
}
|
|
215
|
-
}, _react.createElement(_f36icons.ChevronRightIcon, {
|
|
215
|
+
}, /*#__PURE__*/ _react.createElement(_f36icons.ChevronRightIcon, {
|
|
216
216
|
variant: "muted",
|
|
217
217
|
size: "tiny",
|
|
218
218
|
className: styles.icon
|
|
219
|
-
})), !showPreview && _react.createElement("button", {
|
|
219
|
+
})), !showPreview && /*#__PURE__*/ _react.createElement("button", {
|
|
220
220
|
className: (0, _emotion.cx)(styles.button, styles.showButton),
|
|
221
221
|
"aria-label": "Show preview",
|
|
222
222
|
onClick: ()=>{
|
|
223
223
|
setShowPreview(true);
|
|
224
224
|
}
|
|
225
|
-
}, _react.createElement(_f36icons.ChevronLeftIcon, {
|
|
225
|
+
}, /*#__PURE__*/ _react.createElement(_f36icons.ChevronLeftIcon, {
|
|
226
226
|
variant: "muted",
|
|
227
227
|
size: "tiny",
|
|
228
228
|
className: styles.icon
|
|
229
|
-
})), _react.createElement(_f36components.Grid.Item, {
|
|
229
|
+
})), /*#__PURE__*/ _react.createElement(_f36components.Grid.Item, {
|
|
230
230
|
className: styles.bottomSplit
|
|
231
|
-
}, _react.createElement(_MarkdownBottomBar.MarkdownBottomBar, null, _react.createElement(_MarkdownBottomBar.MarkdownHelp, {
|
|
231
|
+
}, /*#__PURE__*/ _react.createElement(_MarkdownBottomBar.MarkdownBottomBar, null, /*#__PURE__*/ _react.createElement(_MarkdownBottomBar.MarkdownHelp, {
|
|
232
232
|
mode: "zen",
|
|
233
233
|
onClick: ()=>{
|
|
234
234
|
(0, _CheatsheetModalDialog.openCheatsheetModal)(props.sdk.dialogs);
|
|
@@ -62,31 +62,31 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
62
62
|
const openMarkdownDialog = (sdk, previewComponents)=>(options)=>{
|
|
63
63
|
if (options.parameters?.type === _types.MarkdownDialogType.cheatsheet) {
|
|
64
64
|
return _fieldeditorshared.ModalDialogLauncher.openDialog(options, ()=>{
|
|
65
|
-
return _react.createElement(_CheatsheetModalDialog.CheatsheetModalDialog, null);
|
|
65
|
+
return /*#__PURE__*/ _react.createElement(_CheatsheetModalDialog.CheatsheetModalDialog, null);
|
|
66
66
|
});
|
|
67
67
|
} else if (options.parameters?.type === _types.MarkdownDialogType.insertLink) {
|
|
68
68
|
const selectedText = options.parameters.selectedText;
|
|
69
69
|
return _fieldeditorshared.ModalDialogLauncher.openDialog(options, ({ onClose })=>{
|
|
70
|
-
return _react.createElement(_InsertLinkModalDialog.InsertLinkModal, {
|
|
70
|
+
return /*#__PURE__*/ _react.createElement(_InsertLinkModalDialog.InsertLinkModal, {
|
|
71
71
|
selectedText: selectedText,
|
|
72
72
|
onClose: onClose
|
|
73
73
|
});
|
|
74
74
|
});
|
|
75
75
|
} else if (options.parameters?.type === _types.MarkdownDialogType.insertSpecialCharacter) {
|
|
76
76
|
return _fieldeditorshared.ModalDialogLauncher.openDialog(options, ({ onClose })=>{
|
|
77
|
-
return _react.createElement(_SpecialCharacterModalDialog.SpecialCharacterModalDialog, {
|
|
77
|
+
return /*#__PURE__*/ _react.createElement(_SpecialCharacterModalDialog.SpecialCharacterModalDialog, {
|
|
78
78
|
onClose: onClose
|
|
79
79
|
});
|
|
80
80
|
});
|
|
81
81
|
} else if (options.parameters?.type === _types.MarkdownDialogType.insertTable) {
|
|
82
82
|
return _fieldeditorshared.ModalDialogLauncher.openDialog(options, ({ onClose })=>{
|
|
83
|
-
return _react.createElement(_InsertTableModalDialog.InsertTableModal, {
|
|
83
|
+
return /*#__PURE__*/ _react.createElement(_InsertTableModalDialog.InsertTableModal, {
|
|
84
84
|
onClose: onClose
|
|
85
85
|
});
|
|
86
86
|
});
|
|
87
87
|
} else if (options.parameters?.type === _types.MarkdownDialogType.embedExternalContent) {
|
|
88
88
|
return _fieldeditorshared.ModalDialogLauncher.openDialog(options, ({ onClose })=>{
|
|
89
|
-
return _react.createElement(_EmdebExternalContentDialog.EmbedExternalContentModal, {
|
|
89
|
+
return /*#__PURE__*/ _react.createElement(_EmdebExternalContentDialog.EmbedExternalContentModal, {
|
|
90
90
|
onClose: onClose
|
|
91
91
|
});
|
|
92
92
|
});
|
|
@@ -94,7 +94,7 @@ const openMarkdownDialog = (sdk, previewComponents)=>(options)=>{
|
|
|
94
94
|
const locale = options.parameters.locale;
|
|
95
95
|
const assets = options.parameters.assets;
|
|
96
96
|
return _fieldeditorshared.ModalDialogLauncher.openDialog(options, ({ onClose })=>{
|
|
97
|
-
return _react.createElement(_ConfirmInsertAssetModalDialog.ConfirmInsertAssetModalDialog, {
|
|
97
|
+
return /*#__PURE__*/ _react.createElement(_ConfirmInsertAssetModalDialog.ConfirmInsertAssetModalDialog, {
|
|
98
98
|
onClose: onClose,
|
|
99
99
|
locale: locale,
|
|
100
100
|
assets: assets
|
|
@@ -104,7 +104,7 @@ const openMarkdownDialog = (sdk, previewComponents)=>(options)=>{
|
|
|
104
104
|
const initialValue = options.parameters.initialValue;
|
|
105
105
|
const locale = options.parameters.locale;
|
|
106
106
|
return _fieldeditorshared.ModalDialogLauncher.openDialog(options, ({ onClose })=>{
|
|
107
|
-
return _react.createElement(_ZenModeModalDialog.ZenModeModalDialog, {
|
|
107
|
+
return /*#__PURE__*/ _react.createElement(_ZenModeModalDialog.ZenModeModalDialog, {
|
|
108
108
|
saveValueToSDK: (value)=>{
|
|
109
109
|
if (value) {
|
|
110
110
|
return sdk?.field?.setValue(value);
|
|
@@ -62,34 +62,34 @@ const renderMarkdownDialog = (sdk)=>{
|
|
|
62
62
|
const parameters = sdk.parameters.invocation;
|
|
63
63
|
if (parameters.type === _types.MarkdownDialogType.cheatsheet) {
|
|
64
64
|
sdk.window.startAutoResizer();
|
|
65
|
-
return _react.createElement(_CheatsheetModalDialog.CheatsheetModalDialog, null);
|
|
65
|
+
return /*#__PURE__*/ _react.createElement(_CheatsheetModalDialog.CheatsheetModalDialog, null);
|
|
66
66
|
} else if (parameters.type === _types.MarkdownDialogType.insertLink) {
|
|
67
67
|
const selectedText = parameters.selectedText;
|
|
68
68
|
sdk.window.startAutoResizer();
|
|
69
|
-
return _react.createElement(_InsertLinkModalDialog.InsertLinkModal, {
|
|
69
|
+
return /*#__PURE__*/ _react.createElement(_InsertLinkModalDialog.InsertLinkModal, {
|
|
70
70
|
selectedText: selectedText,
|
|
71
71
|
onClose: sdk.close
|
|
72
72
|
});
|
|
73
73
|
} else if (parameters.type === _types.MarkdownDialogType.insertSpecialCharacter) {
|
|
74
74
|
sdk.window.startAutoResizer();
|
|
75
|
-
return _react.createElement(_SpecialCharacterModalDialog.SpecialCharacterModalDialog, {
|
|
75
|
+
return /*#__PURE__*/ _react.createElement(_SpecialCharacterModalDialog.SpecialCharacterModalDialog, {
|
|
76
76
|
onClose: sdk.close
|
|
77
77
|
});
|
|
78
78
|
} else if (parameters.type === _types.MarkdownDialogType.insertTable) {
|
|
79
79
|
sdk.window.startAutoResizer();
|
|
80
|
-
return _react.createElement(_InsertTableModalDialog.InsertTableModal, {
|
|
80
|
+
return /*#__PURE__*/ _react.createElement(_InsertTableModalDialog.InsertTableModal, {
|
|
81
81
|
onClose: sdk.close
|
|
82
82
|
});
|
|
83
83
|
} else if (parameters.type === _types.MarkdownDialogType.embedExternalContent) {
|
|
84
84
|
sdk.window.startAutoResizer();
|
|
85
|
-
return _react.createElement(_EmdebExternalContentDialog.EmbedExternalContentModal, {
|
|
85
|
+
return /*#__PURE__*/ _react.createElement(_EmdebExternalContentDialog.EmbedExternalContentModal, {
|
|
86
86
|
onClose: sdk.close
|
|
87
87
|
});
|
|
88
88
|
} else if (parameters.type === _types.MarkdownDialogType.confirmInsertAsset) {
|
|
89
89
|
const locale = parameters.locale;
|
|
90
90
|
const assets = parameters.assets;
|
|
91
91
|
sdk.window.startAutoResizer();
|
|
92
|
-
return _react.createElement(_ConfirmInsertAssetModalDialog.ConfirmInsertAssetModalDialog, {
|
|
92
|
+
return /*#__PURE__*/ _react.createElement(_ConfirmInsertAssetModalDialog.ConfirmInsertAssetModalDialog, {
|
|
93
93
|
onClose: sdk.close,
|
|
94
94
|
locale: locale,
|
|
95
95
|
assets: assets
|
|
@@ -98,7 +98,7 @@ const renderMarkdownDialog = (sdk)=>{
|
|
|
98
98
|
const locale = parameters.locale;
|
|
99
99
|
const initialValue = parameters.initialValue;
|
|
100
100
|
sdk.window.updateHeight('100%');
|
|
101
|
-
return _react.createElement(_ZenModeModalDialog.ZenModeModalDialog, {
|
|
101
|
+
return /*#__PURE__*/ _react.createElement(_ZenModeModalDialog.ZenModeModalDialog, {
|
|
102
102
|
onClose: sdk.close,
|
|
103
103
|
saveValueToSDK: ()=>{},
|
|
104
104
|
initialValue: initialValue,
|
|
@@ -106,5 +106,5 @@ const renderMarkdownDialog = (sdk)=>{
|
|
|
106
106
|
sdk: sdk
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
|
-
return _react.createElement("div", null);
|
|
109
|
+
return /*#__PURE__*/ _react.createElement("div", null);
|
|
110
110
|
};
|
package/dist/cjs/types.js
CHANGED
|
@@ -8,7 +8,8 @@ Object.defineProperty(exports, "MarkdownDialogType", {
|
|
|
8
8
|
return MarkdownDialogType;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
var MarkdownDialogType
|
|
11
|
+
var MarkdownDialogType;
|
|
12
|
+
(function(MarkdownDialogType) {
|
|
12
13
|
MarkdownDialogType["cheatsheet"] = "markdown-cheatsheet";
|
|
13
14
|
MarkdownDialogType["insertLink"] = "markdown-insertLink";
|
|
14
15
|
MarkdownDialogType["insertSpecialCharacter"] = "markdown-insertSpecialCharacter";
|
|
@@ -16,5 +17,4 @@ var MarkdownDialogType = /*#__PURE__*/ function(MarkdownDialogType) {
|
|
|
16
17
|
MarkdownDialogType["embedExternalContent"] = "markdown-embedExternalContent";
|
|
17
18
|
MarkdownDialogType["confirmInsertAsset"] = "markdown-confirmInsertAsset";
|
|
18
19
|
MarkdownDialogType["zenMode"] = "markdown-zenMode";
|
|
19
|
-
|
|
20
|
-
}({});
|
|
20
|
+
})(MarkdownDialogType || (MarkdownDialogType = {}));
|
|
@@ -10,7 +10,7 @@ import { MarkdownTextarea } from './components/MarkdownTextarea/MarkdownTextarea
|
|
|
10
10
|
import { MarkdownToolbar } from './components/MarkdownToolbar';
|
|
11
11
|
import { openCheatsheetModal } from './dialogs/CheatsheetModalDialog';
|
|
12
12
|
import { createMarkdownActions } from './MarkdownActions';
|
|
13
|
-
const MarkdownPreview = React.lazy(()=>import('./components/MarkdownPreview'));
|
|
13
|
+
const MarkdownPreview = /*#__PURE__*/ React.lazy(()=>import('./components/MarkdownPreview'));
|
|
14
14
|
const styles = {
|
|
15
15
|
container: css({
|
|
16
16
|
display: 'flex',
|
|
@@ -78,22 +78,22 @@ export function MarkdownEditor(props) {
|
|
|
78
78
|
const openMarkdownHelp = React.useCallback(()=>{
|
|
79
79
|
openCheatsheetModal(props.sdk.dialogs);
|
|
80
80
|
}, []);
|
|
81
|
-
return React.createElement("div", {
|
|
81
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
82
82
|
className: styles.container,
|
|
83
83
|
"data-test-id": "markdown-editor"
|
|
84
|
-
}, React.createElement(MarkdownTabs, {
|
|
84
|
+
}, /*#__PURE__*/ React.createElement(MarkdownTabs, {
|
|
85
85
|
active: selectedTab,
|
|
86
86
|
onSelect: (tab)=>{
|
|
87
87
|
if (props.enableTab) return;
|
|
88
88
|
setSelectedTab(tab);
|
|
89
89
|
},
|
|
90
90
|
enableTab: props.enableTab
|
|
91
|
-
}), React.createElement(MarkdownToolbar, {
|
|
91
|
+
}), /*#__PURE__*/ React.createElement(MarkdownToolbar, {
|
|
92
92
|
mode: "default",
|
|
93
93
|
disabled: isActionDisabled,
|
|
94
94
|
canUploadAssets: canUploadAssets,
|
|
95
95
|
actions: actions
|
|
96
|
-
}), React.createElement(MarkdownTextarea, {
|
|
96
|
+
}), /*#__PURE__*/ React.createElement(MarkdownTextarea, {
|
|
97
97
|
minHeight: props.minHeight,
|
|
98
98
|
mode: "default",
|
|
99
99
|
visible: selectedTab === 'editor',
|
|
@@ -109,29 +109,29 @@ export function MarkdownEditor(props) {
|
|
|
109
109
|
setCurrentValue(value);
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
|
-
}), selectedTab === 'preview' && React.createElement(React.Suspense, {
|
|
113
|
-
fallback: React.createElement(MarkdownPreviewSkeleton, null)
|
|
114
|
-
}, React.createElement(MarkdownPreview, {
|
|
112
|
+
}), selectedTab === 'preview' && /*#__PURE__*/ React.createElement(React.Suspense, {
|
|
113
|
+
fallback: /*#__PURE__*/ React.createElement(MarkdownPreviewSkeleton, null)
|
|
114
|
+
}, /*#__PURE__*/ React.createElement(MarkdownPreview, {
|
|
115
115
|
direction: direction,
|
|
116
116
|
minHeight: props.minHeight,
|
|
117
117
|
mode: "default",
|
|
118
118
|
value: currentValue,
|
|
119
119
|
previewComponents: props.previewComponents
|
|
120
|
-
})), React.createElement(MarkdownBottomBar, null, React.createElement(MarkdownHelp, {
|
|
120
|
+
})), /*#__PURE__*/ React.createElement(MarkdownBottomBar, null, /*#__PURE__*/ React.createElement(MarkdownHelp, {
|
|
121
121
|
mode: selectedTab,
|
|
122
122
|
onClick: openMarkdownHelp
|
|
123
|
-
})), React.createElement(MarkdownConstraints, {
|
|
123
|
+
})), /*#__PURE__*/ React.createElement(MarkdownConstraints, {
|
|
124
124
|
sdk: props.sdk,
|
|
125
125
|
value: currentValue
|
|
126
126
|
}));
|
|
127
127
|
}
|
|
128
128
|
export function MarkdownEditorConnected(props) {
|
|
129
|
-
return React.createElement(FieldConnector, {
|
|
129
|
+
return /*#__PURE__*/ React.createElement(FieldConnector, {
|
|
130
130
|
debounce: 300,
|
|
131
131
|
field: props.sdk.field,
|
|
132
132
|
isInitiallyDisabled: props.isInitiallyDisabled,
|
|
133
133
|
isDisabled: props.isDisabled
|
|
134
|
-
}, ({ value, disabled, setValue, externalReset })
|
|
134
|
+
}, ({ value, disabled, setValue, externalReset })=>/*#__PURE__*/ React.createElement(MarkdownEditor, {
|
|
135
135
|
...props,
|
|
136
136
|
value: value,
|
|
137
137
|
isDisabled: disabled,
|
|
@@ -4,13 +4,13 @@ export const HeadingSelector = (props)=>{
|
|
|
4
4
|
const handleMenuClick = (heading)=>{
|
|
5
5
|
props.onSelect(heading);
|
|
6
6
|
};
|
|
7
|
-
return React.createElement(Menu, null, React.createElement(Menu.Trigger, null, props.children), React.createElement(Menu.List, null, React.createElement(Menu.Item, {
|
|
7
|
+
return /*#__PURE__*/ React.createElement(Menu, null, /*#__PURE__*/ React.createElement(Menu.Trigger, null, props.children), /*#__PURE__*/ React.createElement(Menu.List, null, /*#__PURE__*/ React.createElement(Menu.Item, {
|
|
8
8
|
testId: "markdown-action-button-heading-h1",
|
|
9
9
|
onClick: ()=>handleMenuClick('h1')
|
|
10
|
-
}, "Heading 1"), React.createElement(Menu.Item, {
|
|
10
|
+
}, "Heading 1"), /*#__PURE__*/ React.createElement(Menu.Item, {
|
|
11
11
|
testId: "markdown-action-button-heading-h2",
|
|
12
12
|
onClick: ()=>handleMenuClick('h2')
|
|
13
|
-
}, "Heading 2"), React.createElement(Menu.Item, {
|
|
13
|
+
}, "Heading 2"), /*#__PURE__*/ React.createElement(Menu.Item, {
|
|
14
14
|
testId: "markdown-action-button-heading-h3",
|
|
15
15
|
onClick: ()=>handleMenuClick('h3')
|
|
16
16
|
}, "Heading 3")));
|
|
@@ -3,11 +3,11 @@ import { Button, Menu } from '@contentful/f36-components';
|
|
|
3
3
|
import { AssetIcon, ChevronDownIcon } from '@contentful/f36-icons';
|
|
4
4
|
export const InsertLinkSelector = (props)=>{
|
|
5
5
|
if (props.canAddNew) {
|
|
6
|
-
return React.createElement(MultipleMediaContextMenu, props);
|
|
6
|
+
return /*#__PURE__*/ React.createElement(MultipleMediaContextMenu, props);
|
|
7
7
|
} else {
|
|
8
|
-
return React.createElement(Button, {
|
|
8
|
+
return /*#__PURE__*/ React.createElement(Button, {
|
|
9
9
|
isDisabled: props.disabled,
|
|
10
|
-
startIcon: React.createElement(AssetIcon, null),
|
|
10
|
+
startIcon: /*#__PURE__*/ React.createElement(AssetIcon, null),
|
|
11
11
|
testId: "markdownEditor.linkExistingAssets",
|
|
12
12
|
size: "small",
|
|
13
13
|
variant: "secondary",
|
|
@@ -18,19 +18,19 @@ export const InsertLinkSelector = (props)=>{
|
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
const MultipleMediaContextMenu = (props)=>{
|
|
21
|
-
return React.createElement(Menu, {
|
|
21
|
+
return /*#__PURE__*/ React.createElement(Menu, {
|
|
22
22
|
placement: "bottom-end"
|
|
23
|
-
}, React.createElement(Menu.Trigger, null, React.createElement(Button, {
|
|
24
|
-
endIcon: React.createElement(ChevronDownIcon, null),
|
|
23
|
+
}, /*#__PURE__*/ React.createElement(Menu.Trigger, null, /*#__PURE__*/ React.createElement(Button, {
|
|
24
|
+
endIcon: /*#__PURE__*/ React.createElement(ChevronDownIcon, null),
|
|
25
25
|
isDisabled: props.disabled,
|
|
26
|
-
startIcon: React.createElement(AssetIcon, null),
|
|
26
|
+
startIcon: /*#__PURE__*/ React.createElement(AssetIcon, null),
|
|
27
27
|
testId: "markdownEditor.insertMediaDropdownTrigger",
|
|
28
28
|
size: "small",
|
|
29
29
|
variant: "secondary"
|
|
30
|
-
}, "Insert media")), React.createElement(Menu.List, null, React.createElement(Menu.Item, {
|
|
30
|
+
}, "Insert media")), /*#__PURE__*/ React.createElement(Menu.List, null, /*#__PURE__*/ React.createElement(Menu.Item, {
|
|
31
31
|
testId: "markdownEditor.uploadAssetsAndLink",
|
|
32
32
|
onClick: ()=>props.onAddNew()
|
|
33
|
-
}, "Add new media and link"), React.createElement(Menu.Item, {
|
|
33
|
+
}, "Add new media and link"), /*#__PURE__*/ React.createElement(Menu.Item, {
|
|
34
34
|
testId: "markdownEditor.linkExistingAssets",
|
|
35
35
|
onClick: ()=>props.onSelectExisting()
|
|
36
36
|
}, "Link existing media")));
|
|
@@ -23,13 +23,13 @@ const styles = {
|
|
|
23
23
|
})
|
|
24
24
|
};
|
|
25
25
|
export function MarkdownCounter(props) {
|
|
26
|
-
return React.createElement(Paragraph, {
|
|
26
|
+
return /*#__PURE__*/ React.createElement(Paragraph, {
|
|
27
27
|
marginBottom: "none",
|
|
28
28
|
className: styles.help
|
|
29
29
|
}, props.words, " ", props.words !== 1 ? 'words' : 'word', ", ", props.characters, ' ', props.characters !== 1 ? 'characters' : 'character');
|
|
30
30
|
}
|
|
31
31
|
function SanitizeMessage() {
|
|
32
|
-
return React.createElement("span", null, "The preview of the content in this field will be sanitized.", ' ', React.createElement(TextLink, {
|
|
32
|
+
return /*#__PURE__*/ React.createElement("span", null, "The preview of the content in this field will be sanitized.", ' ', /*#__PURE__*/ React.createElement(TextLink, {
|
|
33
33
|
as: "a",
|
|
34
34
|
target: "_blank",
|
|
35
35
|
rel: "noopener noreferrer",
|
|
@@ -37,7 +37,7 @@ function SanitizeMessage() {
|
|
|
37
37
|
}, "Learn more."));
|
|
38
38
|
}
|
|
39
39
|
function CheatSheetMessage({ onClick }) {
|
|
40
|
-
return React.createElement("span", null, "Format your text like a pro with the", ' ', React.createElement(TextLink, {
|
|
40
|
+
return /*#__PURE__*/ React.createElement("span", null, "Format your text like a pro with the", ' ', /*#__PURE__*/ React.createElement(TextLink, {
|
|
41
41
|
as: "button",
|
|
42
42
|
testId: "open-markdown-cheatsheet-button",
|
|
43
43
|
onClick: onClick
|
|
@@ -47,33 +47,33 @@ export function MarkdownHelp(props) {
|
|
|
47
47
|
let content;
|
|
48
48
|
switch(props.mode){
|
|
49
49
|
case 'preview':
|
|
50
|
-
content = React.createElement(SanitizeMessage, null);
|
|
50
|
+
content = /*#__PURE__*/ React.createElement(SanitizeMessage, null);
|
|
51
51
|
break;
|
|
52
52
|
case 'editor':
|
|
53
|
-
content = React.createElement(CheatSheetMessage, {
|
|
53
|
+
content = /*#__PURE__*/ React.createElement(CheatSheetMessage, {
|
|
54
54
|
onClick: props.onClick
|
|
55
55
|
});
|
|
56
56
|
break;
|
|
57
57
|
case 'zen':
|
|
58
|
-
content = React.createElement(Stack, {
|
|
58
|
+
content = /*#__PURE__*/ React.createElement(Stack, {
|
|
59
59
|
flexDirection: "column",
|
|
60
60
|
spacing: "spacing2Xs",
|
|
61
61
|
alignItems: "flex-start"
|
|
62
|
-
}, React.createElement(CheatSheetMessage, {
|
|
62
|
+
}, /*#__PURE__*/ React.createElement(CheatSheetMessage, {
|
|
63
63
|
onClick: props.onClick
|
|
64
|
-
}), React.createElement(SanitizeMessage, null));
|
|
64
|
+
}), /*#__PURE__*/ React.createElement(SanitizeMessage, null));
|
|
65
65
|
break;
|
|
66
66
|
default:
|
|
67
67
|
content = null;
|
|
68
68
|
throw new Error(`Invalid HelpMode provided in MarkdownHelp: ${props.mode}`);
|
|
69
69
|
}
|
|
70
|
-
return React.createElement(Paragraph, {
|
|
70
|
+
return /*#__PURE__*/ React.createElement(Paragraph, {
|
|
71
71
|
marginBottom: "none",
|
|
72
72
|
className: styles.help
|
|
73
73
|
}, content);
|
|
74
74
|
}
|
|
75
75
|
export function MarkdownBottomBar(props) {
|
|
76
|
-
return React.createElement("div", {
|
|
76
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
77
77
|
className: styles.root
|
|
78
78
|
}, props.children);
|
|
79
79
|
}
|
|
@@ -14,12 +14,12 @@ const styles = {
|
|
|
14
14
|
export function MarkdownConstraints(props) {
|
|
15
15
|
const constraints = ConstraintsUtils.fromFieldValidations(props.sdk.field.validations, props.sdk.field.type);
|
|
16
16
|
const checkConstraint = ConstraintsUtils.makeChecker(constraints);
|
|
17
|
-
return React.createElement("div", {
|
|
17
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
18
18
|
className: styles.root
|
|
19
|
-
}, React.createElement(CharCounter, {
|
|
19
|
+
}, /*#__PURE__*/ React.createElement(CharCounter, {
|
|
20
20
|
value: props.value,
|
|
21
21
|
checkConstraint: checkConstraint
|
|
22
|
-
}), React.createElement(CharValidation, {
|
|
22
|
+
}), /*#__PURE__*/ React.createElement(CharValidation, {
|
|
23
23
|
constraints: constraints
|
|
24
24
|
}));
|
|
25
25
|
}
|
|
@@ -159,24 +159,24 @@ const styles = {
|
|
|
159
159
|
function MarkdownLink(props) {
|
|
160
160
|
const { Embedly, children, ...rest } = props;
|
|
161
161
|
if (props.className === 'embedly-card' && Embedly) {
|
|
162
|
-
return React.createElement(Embedly, {
|
|
162
|
+
return /*#__PURE__*/ React.createElement(Embedly, {
|
|
163
163
|
url: props.href ?? ''
|
|
164
164
|
});
|
|
165
165
|
}
|
|
166
|
-
return React.createElement("a", {
|
|
166
|
+
return /*#__PURE__*/ React.createElement("a", {
|
|
167
167
|
...rest,
|
|
168
168
|
target: "_blank",
|
|
169
169
|
rel: "noopener noreferrer"
|
|
170
170
|
}, children);
|
|
171
171
|
}
|
|
172
|
-
const MarkdownPreview = React.memo((props)=>{
|
|
172
|
+
const MarkdownPreview = /*#__PURE__*/ React.memo((props)=>{
|
|
173
173
|
const className = cx(props.minHeight !== undefined ? css({
|
|
174
174
|
minHeight: props.minHeight
|
|
175
175
|
}) : undefined, props.mode === 'default' ? styles.framed : styles.zen, props.direction === 'rtl' ? styles.rtl : undefined);
|
|
176
|
-
return React.createElement("div", {
|
|
176
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
177
177
|
className: className,
|
|
178
178
|
"data-test-id": "markdown-preview"
|
|
179
|
-
}, React.createElement(ReactMarkdown, {
|
|
179
|
+
}, /*#__PURE__*/ React.createElement(ReactMarkdown, {
|
|
180
180
|
className: styles.root,
|
|
181
181
|
rehypePlugins: [
|
|
182
182
|
rehypeRaw,
|
|
@@ -189,7 +189,7 @@ const MarkdownPreview = React.memo((props)=>{
|
|
|
189
189
|
allowDangerousHtml: true
|
|
190
190
|
},
|
|
191
191
|
components: {
|
|
192
|
-
a: (markdownProps)
|
|
192
|
+
a: (markdownProps)=>/*#__PURE__*/ React.createElement(MarkdownLink, {
|
|
193
193
|
...markdownProps,
|
|
194
194
|
Embedly: props.previewComponents?.embedly
|
|
195
195
|
})
|
|
@@ -11,9 +11,9 @@ const styles = {
|
|
|
11
11
|
})
|
|
12
12
|
};
|
|
13
13
|
export default function MarkdownPreviewSkeleton() {
|
|
14
|
-
return React.createElement(Skeleton.Container, {
|
|
14
|
+
return /*#__PURE__*/ React.createElement(Skeleton.Container, {
|
|
15
15
|
className: styles.root
|
|
16
|
-
}, React.createElement(Skeleton.DisplayText, null), React.createElement(Skeleton.BodyText, {
|
|
16
|
+
}, /*#__PURE__*/ React.createElement(Skeleton.DisplayText, null), /*#__PURE__*/ React.createElement(Skeleton.BodyText, {
|
|
17
17
|
offsetTop: 37,
|
|
18
18
|
numberOfLines: 5
|
|
19
19
|
}));
|
|
@@ -45,7 +45,7 @@ const styles = {
|
|
|
45
45
|
})
|
|
46
46
|
};
|
|
47
47
|
function MarkdownTabItem(props) {
|
|
48
|
-
return React.createElement("div", {
|
|
48
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
49
49
|
className: cx(styles.tab, {
|
|
50
50
|
[styles.inactiveTab]: props.isActive === false,
|
|
51
51
|
[styles.disabledTab]: props.isDisabled === true
|
|
@@ -66,15 +66,15 @@ function MarkdownTabItem(props) {
|
|
|
66
66
|
}, props.children);
|
|
67
67
|
}
|
|
68
68
|
export function MarkdownTabs(props) {
|
|
69
|
-
return React.createElement("div", {
|
|
69
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
70
70
|
className: styles.root
|
|
71
|
-
}, React.createElement(MarkdownTabItem, {
|
|
71
|
+
}, /*#__PURE__*/ React.createElement(MarkdownTabItem, {
|
|
72
72
|
name: "editor",
|
|
73
73
|
onSelect: props.onSelect,
|
|
74
74
|
isActive: props.active === 'editor',
|
|
75
75
|
testId: "markdown-tab-md",
|
|
76
76
|
isDisabled: props.enableTab && props.enableTab !== 'editor'
|
|
77
|
-
}, "Editor"), React.createElement(MarkdownTabItem, {
|
|
77
|
+
}, "Editor"), /*#__PURE__*/ React.createElement(MarkdownTabItem, {
|
|
78
78
|
name: "preview",
|
|
79
79
|
onSelect: props.onSelect,
|
|
80
80
|
isActive: props.active === 'preview',
|
|
@@ -98,7 +98,7 @@ const styles = {
|
|
|
98
98
|
}
|
|
99
99
|
`
|
|
100
100
|
};
|
|
101
|
-
export const MarkdownTextarea = React.memo((props)=>{
|
|
101
|
+
export const MarkdownTextarea = /*#__PURE__*/ React.memo((props)=>{
|
|
102
102
|
const hostRef = useRef(null);
|
|
103
103
|
const [editor, setEditor] = useState(null);
|
|
104
104
|
useEffect(()=>{
|
|
@@ -124,7 +124,7 @@ export const MarkdownTextarea = React.memo((props)=>{
|
|
|
124
124
|
const className = cx(styles.root, props.minHeight !== undefined ? css({
|
|
125
125
|
minHeight: props.minHeight
|
|
126
126
|
}) : undefined, props.mode === 'default' ? styles.framed : styles.zen, props.disabled && styles.disabled);
|
|
127
|
-
return React.createElement("div", {
|
|
127
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
128
128
|
className: className,
|
|
129
129
|
ref: hostRef,
|
|
130
130
|
"data-test-id": "markdown-textarea",
|