Skip to content

Commit ce3a300

Browse files
committed
feat: client side hook for controls.updateTextareaSelection
1 parent 7f2b2ec commit ce3a300

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

static/lib/composer/controls.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,20 @@ define('composer/controls', ['composer/preview'], function(preview) {
3434
preview.render(postContainer);
3535
};
3636

37-
controls.wrapSelectionInTextareaWith = function(textarea, leading, trailing){
37+
controls.wrapSelectionInTextareaWith = function(textarea, leading, trailing) {
38+
var payload = {
39+
context: this,
40+
textarea: textarea,
41+
leading: leading,
42+
trailing: trailing,
43+
preventDefault: false,
44+
};
45+
$(window).trigger('action:composer.wrapSelectionInTextareaWith', payload);
46+
47+
if (payload.preventDefault) {
48+
return;
49+
}
50+
3851
if (trailing === undefined) {
3952
trailing = leading;
4053
}
@@ -62,7 +75,7 @@ define('composer/controls', ['composer/preview'], function(preview) {
6275
return [matches[1].length, matches[3].length];
6376
};
6477

65-
controls.updateTextareaSelection = function(textarea, start, end){
78+
controls.updateTextareaSelection = function(textarea, start, end) {
6679
var payload = {
6780
context: this,
6881
textarea: textarea,

0 commit comments

Comments
 (0)