Fix error with contentEditable ()

pull/807/head
Jed Fox committed by GitHub
parent 277eeb47cc
commit 43236bed68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -31,12 +31,19 @@ export class ProjectName extends Component<Props> {
e.currentTarget.blur();
}
};
private makeEditable = (editable: HTMLSpanElement) => {
try {
editable.contentEditable = "plaintext-only";
} catch {
editable.contentEditable = "true";
}
};
public render() {
return (
<span
suppressContentEditableWarning
contentEditable={"plaintext-only" as any}
ref={this.makeEditable}
data-type="wysiwyg"
className="ProjectName"
role="textbox"

@ -34,7 +34,11 @@ export function textWysiwyg({
// But this solution has an issue — it allows to paste
// multiline text, which is not currently supported
const editable = document.createElement("div");
editable.contentEditable = "plaintext-only";
try {
editable.contentEditable = "plaintext-only";
} catch {
editable.contentEditable = "true";
}
editable.tabIndex = 0;
editable.innerText = initText;
editable.dataset.type = "wysiwyg";

Loading…
Cancel
Save