prevent name change while editing and more fixes

This commit is contained in:
btzr-io 2020-07-30 14:31:55 -05:00 committed by Sean Yesmunt
parent 8067793379
commit 80e1965e46
4 changed files with 15 additions and 11 deletions

View file

@ -74,7 +74,7 @@ function PostEditor(props: Props) {
updatePublishForm({ fileText: text });
}
} catch (error) {
// Handle error..
console.error(error);
}
}
@ -100,7 +100,7 @@ function PostEditor(props: Props) {
return (
<FormField
type={!SIMPLE_SITE && advancedEditor ? 'markdown' : 'textarea'}
type={'markdown'}
name="content_post"
label={label}
placeholder={__('My content for this post...')}

View file

@ -277,10 +277,6 @@ function PublishForm(props: Props) {
}
}
function changePublishMode(modeName) {
setMode(modeName);
}
// Update mode on editing
useEffect(() => {
if (autoSwitchMode && editingURI && myClaimForUri) {
@ -304,7 +300,7 @@ function PublishForm(props: Props) {
label={modeName}
button="alt"
onClick={() => {
changePublishMode(modeName);
setPublishMode(modeName);
}}
className={classnames('button-toggle', { 'button-toggle--active': mode === modeName })}
/>
@ -363,9 +359,8 @@ function PublishForm(props: Props) {
</React.Fragment>
}
/>
<PublishName
disabled={formDisabled}
disabled={isStillEditing || formDisabled}
autoPopulateName={autoPopulateNameFromTitle}
setAutoPopulateName={setAutoPopulateNameFromTitle}
/>

View file

@ -17,7 +17,7 @@ function NameHelpText(props: Props) {
let nameHelpText;
if (isStillEditing) {
nameHelpText = __('You are currently editing this claim. If you change the URL, you will need to reselect a file.');
nameHelpText = __('You are currently editing this claim.');
} else if (uri && myClaimForUri) {
const editUri = buildURI({
streamName: myClaimForUri.name,

View file

@ -13,6 +13,7 @@ type Props = {
uri: string,
bid: number,
balance: number,
disabled: boolean,
isStillEditing: boolean,
myClaimForUri: ?StreamClaim,
isResolvingUri: boolean,
@ -28,6 +29,7 @@ function PublishName(props: Props) {
name,
channel,
uri,
disabled,
isStillEditing,
myClaimForUri,
bid,
@ -105,7 +107,14 @@ function PublishName(props: Props) {
!channel || channel === CHANNEL_ANONYMOUS || channel === CHANNEL_NEW ? '' : `${channel}/`
}`}</div>
</fieldset-section>
<FormField type="text" name="content_name" value={name} error={nameError} onChange={handleNameChange} />
<FormField
type="text"
name="content_name"
value={name}
disabled={disabled}
error={nameError}
onChange={handleNameChange}
/>
</fieldset-group>
<div className="form-field__help">
<NameHelpText