Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/lib/utils/text_markdown.js')
-rw-r--r--app/assets/javascripts/lib/utils/text_markdown.js27
1 files changed, 5 insertions, 22 deletions
diff --git a/app/assets/javascripts/lib/utils/text_markdown.js b/app/assets/javascripts/lib/utils/text_markdown.js
index f4c6e4e3584..dfb86787788 100644
--- a/app/assets/javascripts/lib/utils/text_markdown.js
+++ b/app/assets/javascripts/lib/utils/text_markdown.js
@@ -42,9 +42,7 @@ function convertMonacoSelectionToAceFormat(sel) {
}
function getEditorSelectionRange(editor) {
- return window.gon.features?.monacoBlobs
- ? convertMonacoSelectionToAceFormat(editor.getSelection())
- : editor.getSelectionRange();
+ return convertMonacoSelectionToAceFormat(editor.getSelection());
}
function editorBlockTagText(text, blockTag, selected, editor) {
@@ -56,9 +54,6 @@ function editorBlockTagText(text, blockTag, selected, editor) {
if (shouldRemoveBlock) {
if (blockTag !== null) {
- // ace is globally defined
- // eslint-disable-next-line no-undef
- const { Range } = ace.require('ace/range');
const lastLine = lines[selectionRange.end.row + 1];
const rangeWithBlockTags = new Range(
lines[selectionRange.start.row - 1],
@@ -110,12 +105,7 @@ function moveCursor({
const endPosition = startPosition + select.length;
return textArea.setSelectionRange(startPosition, endPosition);
} else if (editor) {
- if (window.gon.features?.monacoBlobs) {
- editor.selectWithinSelection(select, tag);
- } else {
- editor.navigateLeft(tag.length - tag.indexOf(select));
- editor.getSelection().selectAWord();
- }
+ editor.selectWithinSelection(select, tag);
return;
}
}
@@ -139,11 +129,7 @@ function moveCursor({
}
} else if (editor && editorSelectionStart.row === editorSelectionEnd.row) {
if (positionBetweenTags) {
- if (window.gon.features?.monacoBlobs) {
- editor.moveCursor(tag.length * -1);
- } else {
- editor.navigateLeft(tag.length);
- }
+ editor.moveCursor(tag.length * -1);
}
}
}
@@ -166,6 +152,7 @@ export function insertMarkdownText({
let editorSelectionEnd;
let lastNewLine;
let textToInsert;
+ selected = selected.toString();
if (editor) {
const selectionRange = getEditorSelectionRange(editor);
@@ -265,11 +252,7 @@ export function insertMarkdownText({
}
if (editor) {
- if (window.gon.features?.monacoBlobs) {
- editor.replaceSelectedText(textToInsert, select);
- } else {
- editor.insert(textToInsert);
- }
+ editor.replaceSelectedText(textToInsert, select);
} else {
insertText(textArea, textToInsert);
}