Fix error with contentEditable (#803)
This commit is contained in:
parent
277eeb47cc
commit
43236bed68
@ -31,12 +31,19 @@ export class ProjectName extends Component<Props> {
|
|||||||
e.currentTarget.blur();
|
e.currentTarget.blur();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
private makeEditable = (editable: HTMLSpanElement) => {
|
||||||
|
try {
|
||||||
|
editable.contentEditable = "plaintext-only";
|
||||||
|
} catch {
|
||||||
|
editable.contentEditable = "true";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
return (
|
return (
|
||||||
<span
|
<span
|
||||||
suppressContentEditableWarning
|
suppressContentEditableWarning
|
||||||
contentEditable={"plaintext-only" as any}
|
ref={this.makeEditable}
|
||||||
data-type="wysiwyg"
|
data-type="wysiwyg"
|
||||||
className="ProjectName"
|
className="ProjectName"
|
||||||
role="textbox"
|
role="textbox"
|
||||||
|
@ -34,7 +34,11 @@ export function textWysiwyg({
|
|||||||
// But this solution has an issue — it allows to paste
|
// But this solution has an issue — it allows to paste
|
||||||
// multiline text, which is not currently supported
|
// multiline text, which is not currently supported
|
||||||
const editable = document.createElement("div");
|
const editable = document.createElement("div");
|
||||||
|
try {
|
||||||
editable.contentEditable = "plaintext-only";
|
editable.contentEditable = "plaintext-only";
|
||||||
|
} catch {
|
||||||
|
editable.contentEditable = "true";
|
||||||
|
}
|
||||||
editable.tabIndex = 0;
|
editable.tabIndex = 0;
|
||||||
editable.innerText = initText;
|
editable.innerText = initText;
|
||||||
editable.dataset.type = "wysiwyg";
|
editable.dataset.type = "wysiwyg";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user