mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-12-23 11:21:26 +00:00
Merge branch 'main' into fix/fix-joined-check-color
This commit is contained in:
commit
b3d096d41d
1 changed files with 5 additions and 3 deletions
|
@ -702,18 +702,20 @@ export class MarkdownTextArea extends Component<
|
||||||
quoteInsert() {
|
quoteInsert() {
|
||||||
const textarea: any = document.getElementById(this.id);
|
const textarea: any = document.getElementById(this.id);
|
||||||
const selectedText = window.getSelection()?.toString();
|
const selectedText = window.getSelection()?.toString();
|
||||||
const { content } = this.state;
|
let { content } = this.state;
|
||||||
if (selectedText) {
|
if (selectedText) {
|
||||||
const quotedText =
|
const quotedText =
|
||||||
selectedText
|
selectedText
|
||||||
.split("\n")
|
.split("\n")
|
||||||
.map(t => `> ${t}`)
|
.map(t => `> ${t}`)
|
||||||
.join("\n") + "\n\n";
|
.join("\n") + "\n\n";
|
||||||
|
|
||||||
if (!content) {
|
if (!content) {
|
||||||
this.setState({ content: "" });
|
content = "";
|
||||||
} else {
|
} else {
|
||||||
this.setState({ content: `${content}\n` });
|
content = `${content}\n\n`;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
content: `${content}${quotedText}`,
|
content: `${content}${quotedText}`,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue