Skip to content

Commit

Permalink
[Fixes #1309] HTML tags in the title on pressing enter from the edit …
Browse files Browse the repository at this point in the history
…info form (#1322) (#1355)

Co-authored-by: David Quartey <[email protected]>
  • Loading branch information
allyoucanmap and DavidQuartz authored Dec 2, 2022
1 parent 0127df4 commit e241a5a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,17 @@ Map.displayName = 'Map';
const MapThumbnailButtonToolTip = tooltip(Button);
const CopyToClipboard = tooltip(CopyToClipboardCmp);

const EditTitle = ({ title, onEdit, tagName, disabled }) => {
const EditTitle = ({ title, onEdit, disabled }) => {
const [textValue, setTextValue] = React.useState(title);
return (
<div className="editContainer">
<TextEditable
tagName={tagName}
onEdit={onEdit}
text={title}
<input
className="editContainer-input"
onChange={(evt) => {
setTextValue(evt.target.value);
onEdit(evt.target.value);
}}
value={textValue}
disabled={disabled}
/>
</div>);
Expand Down Expand Up @@ -543,7 +547,7 @@ function DetailsPanel({

<div className="gn-details-panel-content-text">
<div className="gn-details-panel-title" >
<span className="gn-details-panel-title-icon" >{!downloading ? <FaIcon name={icon} /> : <Spinner />} </span> <EditTitle disabled={!activeEditMode} tagName="h1" title={resource?.title} onEdit={editTitle} >
<span className="gn-details-panel-title-icon" >{!downloading ? <FaIcon name={icon} /> : <Spinner />} </span> <EditTitle disabled={!activeEditMode} title={resource?.title} onEdit={editTitle} >

</EditTitle>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,14 @@
h6 {
margin-top: 0
}
[contenteditable]:focus-visible {
.editContainer-input {
border: none;
font-size: 1.4rem;
width: 100%;
text-overflow: ellipsis;
line-height: 1.4;
}
[contenteditable]:focus-visible, .editContainer-input {
outline-color: @gn-editable-border;
}
&.imagepreview {
Expand Down

0 comments on commit e241a5a

Please sign in to comment.