Skip to content

Commit ab7452a

Browse files
authored
Merge pull request #2936 from ecency/nt/preserving-poll
Nt/preserving poll
2 parents ab4e18f + 549fe27 commit ab7452a

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

src/components/markdownEditor/children/editorToolbar.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ type Props = {
3030
paramFiles: any[];
3131
isEditing: boolean;
3232
isPreviewActive: boolean;
33+
isEditMode: boolean;
3334
setIsUploading: (isUploading: boolean) => void;
3435
handleMediaInsert: (data: MediaInsertData[]) => void;
3536
handleOnAddLinkPress: () => void;
@@ -44,6 +45,7 @@ export const EditorToolbar = ({
4445
paramFiles,
4546
isEditing,
4647
isPreviewActive,
48+
isEditMode,
4749
setIsUploading,
4850
handleMediaInsert,
4951
handleOnAddLinkPress,
@@ -284,14 +286,16 @@ export const EditorToolbar = ({
284286
name="text-short"
285287
/>
286288

287-
<IconButton
288-
size={18}
289-
style={[styles.rightIcons, !!pollDraft?.title && styles.iconBottomBar]}
290-
iconStyle={styles.icon}
291-
iconType="SimpleLineIcons"
292-
name="chart"
293-
onPress={_showPollsExtension}
294-
/>
289+
{!isEditMode && (
290+
<IconButton
291+
size={18}
292+
style={[styles.rightIcons, !!pollDraft?.title && styles.iconBottomBar]}
293+
iconStyle={styles.icon}
294+
iconType="SimpleLineIcons"
295+
name="chart"
296+
onPress={_showPollsExtension}
297+
/>
298+
)}
295299

296300
<IconButton
297301
onPress={_showImageUploads}

src/components/markdownEditor/view/markdownEditorView.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ const MarkdownEditorView = ({
447447
postBody={bodyTextRef.current}
448448
isPreviewActive={isPreviewActive}
449449
paramFiles={paramFiles}
450+
isEditMode={isEdit}
450451
setIsUploading={setIsUploading}
451452
handleMediaInsert={_handleMediaInsert}
452453
handleOnAddLinkPress={_handleOnAddLinkPress}

src/screens/editor/container/editorContainer.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,8 @@ class EditorContainer extends Component<EditorContainerProps, any> {
961961
videoThumbUrls: speakContentBuilder.thumbUrlsRef.current,
962962
thumbUrl,
963963
fetchRatios: true,
964+
postType: jsonMetadata.type,
965+
contentType: jsonMetadata.content_type,
964966
});
965967

966968
let jsonMeta = {};

src/utils/editor.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ export const extractMetadata = async ({
229229
videoThumbUrls,
230230
fetchRatios,
231231
postType,
232+
contentType,
232233
videoPublishMeta,
233234
pollDraft,
234235
}: {
@@ -237,14 +238,15 @@ export const extractMetadata = async ({
237238
videoThumbUrls: string[];
238239
fetchRatios?: boolean;
239240
postType?: PostTypes;
241+
contentType?: ContentType;
240242
videoPublishMeta?: ThreeSpeakVideo;
241243
pollDraft?: PollDraft;
242244
}) => {
243245
// NOTE: keepting regex to extract usernames as reference for later usage if any
244246
// const userReg = /(^|\s)(@[a-z][-.a-z\d]+[a-z\d])/gim;
245247

246248
let out: PostMetadata = {
247-
content_type: ContentType.GENERAL,
249+
content_type: contentType || ContentType.GENERAL,
248250
};
249251

250252
const mUrls = extractUrls(body);

0 commit comments

Comments
 (0)