diff --git a/ui/component/publishAdditionalOptions/license-type.jsx b/ui/component/publishAdditionalOptions/license-type.jsx index 214a98942..54b4b8b59 100644 --- a/ui/component/publishAdditionalOptions/license-type.jsx +++ b/ui/component/publishAdditionalOptions/license-type.jsx @@ -78,7 +78,7 @@ class LicenseType extends React.PureComponent { {licenseType === OTHER && (
- {__('Provide a description and link to your license')} +
{__('Provide a description and link to your license')}
- {!hideSection && ( -
- {/* @if TARGET='app' */} - {/* {showLbryFirstCheckbox && ( + <> +

{__('Additional Options')}

+ + {!hideSection && ( + <> +
+ +
+
+ {/* @if TARGET='app' */} + {/* {showLbryFirstCheckbox && (
<>
)} */} - {/* @endif */} -
- {!showSchedulingOptions && } + {/* @endif */} +
+
{!showSchedulingOptions && }
- updatePublishForm({ languages: [event.target.value] })} - > - {sortLanguageMap(SUPPORTED_LANGUAGES).map(([langKey, langName]) => ( - - ))} - +
+ updatePublishForm({ languages: [event.target.value] })} + > + {sortLanguageMap(SUPPORTED_LANGUAGES).map(([langKey, langName]) => ( + + ))} + +
- - updatePublishForm({ - licenseType: newLicenseType, - licenseUrl: newLicenseUrl, - }) - } - handleLicenseDescriptionChange={(event) => - updatePublishForm({ - otherLicenseDescription: event.target.value, - }) - } - handleLicenseUrlChange={(event) => updatePublishForm({ licenseUrl: event.target.value })} - /> -
+
+ + updatePublishForm({ + licenseType: newLicenseType, + licenseUrl: newLicenseUrl, + }) + } + handleLicenseDescriptionChange={(event) => + updatePublishForm({ + otherLicenseDescription: event.target.value, + }) + } + handleLicenseUrlChange={(event) => updatePublishForm({ licenseUrl: event.target.value })} + /> +
+
+
+ + )} + +
+
- )} - -
-
- - } - /> + + } + /> + ); } diff --git a/ui/component/publishDescription/view.jsx b/ui/component/publishDescription/view.jsx index a345e2886..3fced195b 100644 --- a/ui/component/publishDescription/view.jsx +++ b/ui/component/publishDescription/view.jsx @@ -20,26 +20,30 @@ function PublishDescription(props: Props) { } return ( - - updatePublishForm({ description: !SIMPLE_SITE && advancedEditor ? value : value.target.value }) - } - quickActionLabel={!SIMPLE_SITE && (advancedEditor ? __('Simple Editor') : __('Advanced Editor'))} - quickActionHandler={toggleMarkdown} - textAreaMaxLength={FF_MAX_CHARS_IN_DESCRIPTION} - /> - } - /> + <> + {disabled &&

{__('Description')}

} + {!disabled &&

{__('Description')}

} + + updatePublishForm({ description: !SIMPLE_SITE && advancedEditor ? value : value.target.value }) + } + quickActionLabel={!SIMPLE_SITE && (advancedEditor ? __('Simple Editor') : __('Advanced Editor'))} + quickActionHandler={toggleMarkdown} + textAreaMaxLength={FF_MAX_CHARS_IN_DESCRIPTION} + /> + } + /> + ); } diff --git a/ui/component/publishFile/view.jsx b/ui/component/publishFile/view.jsx index 7be0c429e..883f0b0e9 100644 --- a/ui/component/publishFile/view.jsx +++ b/ui/component/publishFile/view.jsx @@ -149,6 +149,12 @@ function PublishFile(props: Props) { } }, [currentFileType, mode, isStillEditing, updatePublishForm]); + // Reset title when form gets cleared + + useEffect(() => { + updatePublishForm({ title: title }); + }, [filePath]); + // Initialize default file source state for each mode. useEffect(() => { setShowSourceSelector(false); @@ -365,9 +371,7 @@ function PublishFile(props: Props) { } function handleTitleChange(event) { - const title = event.target.value; - // Update title - updatePublishForm({ title }); + updatePublishForm({ title: event.target.value }); } function handleFileReaderLoaded(event: ProgressEvent) { @@ -430,6 +434,10 @@ function PublishFile(props: Props) { updateFileInfo(0, file.size, isVideo); } + // Strip off extention and replace invalid characters + let fileName = name || (file.name && file.name.substr(0, file.name.lastIndexOf('.'))) || ''; + autofillTitle(file); + if (isTextPost) { // Create reader const reader = new FileReader(); @@ -457,8 +465,6 @@ function PublishFile(props: Props) { // File.path will be undefined from web due to browser security, so it will default to the File Object. filePath: file.path || file, }; - // Strip off extention and replace invalid characters - let fileName = name || (file.name && file.name.substr(0, file.name.lastIndexOf('.'))) || ''; if (!isStillEditing) { publishFormParams.name = parseName(fileName); @@ -469,12 +475,19 @@ function PublishFile(props: Props) { updatePublishForm(publishFormParams); } + function autofillTitle(file) { + const newTitle = (file && file.name && file.name.substr(0, file.name.lastIndexOf('.'))) || name || ''; + if (!title) updatePublishForm({ title: newTitle }); + } + const showFileUpload = mode === PUBLISH_MODES.FILE || PUBLISH_MODES.LIVESTREAM; const isPublishPost = mode === PUBLISH_MODES.POST; return ( {header} {/* display mode buttons from parent */} @@ -482,8 +495,8 @@ function PublishFile(props: Props) { {inProgress && (
-
- {fileSource === SOURCE_SELECT && ( -