mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-22 20:31:13 +00:00
Merge branch 'main' of https://github.com/LemmyNet/lemmy-ui
This commit is contained in:
commit
f977859f08
14 changed files with 25 additions and 14 deletions
2
src/assets/css/themes/cyborg.min.css
vendored
2
src/assets/css/themes/cyborg.min.css
vendored
File diff suppressed because one or more lines are too long
2
src/assets/css/themes/darkly.min.css
vendored
2
src/assets/css/themes/darkly.min.css
vendored
File diff suppressed because one or more lines are too long
2
src/assets/css/themes/i386.min.css
vendored
2
src/assets/css/themes/i386.min.css
vendored
File diff suppressed because one or more lines are too long
2
src/assets/css/themes/journal.min.css
vendored
2
src/assets/css/themes/journal.min.css
vendored
File diff suppressed because one or more lines are too long
2
src/assets/css/themes/litely.min.css
vendored
2
src/assets/css/themes/litely.min.css
vendored
File diff suppressed because one or more lines are too long
2
src/assets/css/themes/litera.min.css
vendored
2
src/assets/css/themes/litera.min.css
vendored
File diff suppressed because one or more lines are too long
2
src/assets/css/themes/materia.min.css
vendored
2
src/assets/css/themes/materia.min.css
vendored
File diff suppressed because one or more lines are too long
2
src/assets/css/themes/minty.min.css
vendored
2
src/assets/css/themes/minty.min.css
vendored
File diff suppressed because one or more lines are too long
2
src/assets/css/themes/sketchy.min.css
vendored
2
src/assets/css/themes/sketchy.min.css
vendored
File diff suppressed because one or more lines are too long
2
src/assets/css/themes/solar.min.css
vendored
2
src/assets/css/themes/solar.min.css
vendored
File diff suppressed because one or more lines are too long
2
src/assets/css/themes/united.min.css
vendored
2
src/assets/css/themes/united.min.css
vendored
File diff suppressed because one or more lines are too long
2
src/assets/css/themes/vaporwave-dark.min.css
vendored
2
src/assets/css/themes/vaporwave-dark.min.css
vendored
File diff suppressed because one or more lines are too long
2
src/assets/css/themes/vaporwave.min.css
vendored
2
src/assets/css/themes/vaporwave.min.css
vendored
File diff suppressed because one or more lines are too long
|
@ -475,7 +475,11 @@ export class MarkdownTextArea extends Component<
|
|||
|
||||
handleInsertCode(i: MarkdownTextArea, event: any) {
|
||||
event.preventDefault();
|
||||
i.simpleSurround("`");
|
||||
if (i.getSelectedText().split(/\r*\n/).length > 1){
|
||||
i.simpleSurroundBeforeAfter("```\n", "\n```");
|
||||
} else {
|
||||
i.simpleSurround('`');
|
||||
}
|
||||
}
|
||||
|
||||
handleInsertStrikethrough(i: MarkdownTextArea, event: any) {
|
||||
|
@ -552,4 +556,11 @@ export class MarkdownTextArea extends Component<
|
|||
setTimeout(() => autosize.update(textarea), 10);
|
||||
}
|
||||
}
|
||||
|
||||
getSelectedText(): string {
|
||||
let textarea: any = document.getElementById(this.id);
|
||||
let start: number = textarea.selectionStart;
|
||||
let end: number = textarea.selectionEnd;
|
||||
return start !== end ? this.state.content.substring(start, end) : '';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue