2016-10-26 08:02:58 +00:00
|
|
|
/* eslint-disable */
|
2016-06-24 19:43:46 +00:00
|
|
|
((global) => {
|
|
|
|
class IssuableTemplateSelectors {
|
2016-10-05 10:48:18 +00:00
|
|
|
constructor({ $dropdowns, editor } = {}) {
|
|
|
|
this.$dropdowns = $dropdowns || $('.js-issuable-selector');
|
|
|
|
this.editor = editor || this.initEditor();
|
2016-06-24 19:43:46 +00:00
|
|
|
|
|
|
|
this.$dropdowns.each((i, dropdown) => {
|
2016-10-05 10:48:18 +00:00
|
|
|
const $dropdown = $(dropdown);
|
|
|
|
new gl.IssuableTemplateSelector({
|
2016-06-24 19:43:46 +00:00
|
|
|
pattern: /(\.md)/,
|
|
|
|
data: $dropdown.data('data'),
|
|
|
|
wrapper: $dropdown.closest('.js-issuable-selector-wrap'),
|
|
|
|
dropdown: $dropdown,
|
|
|
|
editor: this.editor
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
initEditor() {
|
|
|
|
let editor = $('.markdown-area');
|
|
|
|
// Proxy ace-editor's .setValue to jQuery's .val
|
|
|
|
editor.setValue = editor.val;
|
|
|
|
editor.getValue = editor.val;
|
|
|
|
return editor;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
global.IssuableTemplateSelectors = IssuableTemplateSelectors;
|
2016-10-05 10:48:18 +00:00
|
|
|
})(window.gl || (window.gl = {}));
|