Commit 70aec343 authored by Brett Walker's avatar Brett Walker

Properly turn off markdown keydown listener

 for specific text area
parent f0402e3f
......@@ -332,13 +332,12 @@ export function keypressNoteText(e) {
select: '',
tagContent: '',
});
}
}
/* eslint-enable @gitlab/require-i18n-strings */
export function addMarkdownListeners(form) {
$('.markdown-area').on('keydown', keypressNoteText);
$('.markdown-area', form).on('keydown', keypressNoteText);
return $('.js-md', form)
.off('click')
.on('click', function() {
......@@ -377,6 +376,6 @@ export function addEditorMarkdownListeners(editor) {
}
export function removeMarkdownListeners(form) {
$('.markdown-area').off('keydown');
$('.markdown-area', form).off('keydown', keypressNoteText);
return $('.js-md', form).off('click');
}
---
title: Surround selected text in markdown fields on certain key presses
merge_request: 25748
merge_request: 37151
author:
type: added
......@@ -8,6 +8,7 @@ RSpec.describe 'Projects > Wiki > User previews markdown changes', :js do
let(:wiki_page) { create(:wiki_page, wiki: project.wiki, title: 'home', content: '[some link](other-page)') }
let(:wiki_content) do
<<-HEREDOC
Some text so key event for [ does not trigger an incorrect replacement.
[regular link](regular)
[relative link 1](../relative)
[relative link 2](./relative)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment