Skip to content

Commit bd69cc6

Browse files
committed
Compatible (partially) with GitHub Writer
1 parent 001de34 commit bd69cc6

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Github_Reply_Comments/Github_Reply_Comments.user.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,20 @@
146146
bubbles: true,
147147
cancelable: false
148148
}));
149+
150+
// This will render GitHub Writer - https://github.com/ckeditor/github-writer
151+
// https://github.com/ckeditor/github-writer/blob/8dbc12cb01b7903d0d6c90202078214a8637de6d/src/app/plugins/quoteselection.js#L116-L127
152+
const githubWriter = newComment.closest([
153+
'form.js-new-comment-form[data-github-writer-id]',
154+
'form.js-inline-comment-form[data-github-writer-id]'
155+
].join());
156+
if (githubWriter) {
157+
window.postMessage({
158+
type: 'GitHub-Writer-Quote-Selection',
159+
id: Number(githubWriter.getAttribute('data-github-writer-id')),
160+
text: text
161+
}, '*');
162+
}
149163
});
150164

151165
var svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");

0 commit comments

Comments
 (0)