ContentEditable fixes
This commit is contained in:
parent
f5d1571e91
commit
061f79c473
|
|
@ -98,7 +98,6 @@ export const ContentEditable = ({ value, onInput, ...props }: Props) => {
|
||||||
<div
|
<div
|
||||||
ref={ref}
|
ref={ref}
|
||||||
contentEditable
|
contentEditable
|
||||||
style="white-space: pre"
|
|
||||||
onKeyDown={handleKeyDown}
|
onKeyDown={handleKeyDown}
|
||||||
onInput={onInput}
|
onInput={onInput}
|
||||||
{...props}
|
{...props}
|
||||||
|
|
|
||||||
|
|
@ -3,16 +3,17 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: hidden;
|
overflow-y: auto;
|
||||||
background: var(--bg);
|
background: var(--bg);
|
||||||
|
padding: 36px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editable {
|
.editable {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
min-height: 100%;
|
||||||
resize: none;
|
resize: none;
|
||||||
padding: 48px 72px;
|
padding: 0 72px;
|
||||||
font-family: 'Georgia', serif;
|
font-family: 'Georgia', serif;
|
||||||
font-size: 17px;
|
font-size: 17px;
|
||||||
line-height: 1.9;
|
line-height: 1.9;
|
||||||
|
|
@ -21,6 +22,9 @@
|
||||||
border: none;
|
border: none;
|
||||||
outline: none;
|
outline: none;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-wrap: break-word;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
|
||||||
&::placeholder {
|
&::placeholder {
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ export const Editor = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleInput = (e: Event) => {
|
const handleInput = (e: Event) => {
|
||||||
const text = (e.target as HTMLElement).textContent;
|
const text = (e.target as HTMLElement).textContent || '';
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'EDIT_STORY',
|
type: 'EDIT_STORY',
|
||||||
id: currentStory.id,
|
id: currentStory.id,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue