Skip to content

Commit

Permalink
Cannot insert buildid into contenteditable text boxes (#253)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyoshino authored and whimboo committed Oct 4, 2017
1 parent 2834f01 commit def685d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ There are a couple of known issues due to the limited [WebExtensions APIs](https

* The changeset cannot be retrieved
* The extension list does not include system add-ons
* The textbox inserting options don't work on [some Mozilla sites](https://bugzilla.mozilla.org/show_bug.cgi?id=1310082) (including AMO due to a security restriction) as well as with a [textbox within an iframe](https://bugzilla.mozilla.org/show_bug.cgi?id=1405723) and certain rich text editors
* Some variables are not available for the custom title template

The following features found in the original XUL-based extension are not yet implemented, and some of them may not be implemented again:
Expand Down
9 changes: 6 additions & 3 deletions extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
*/
const handle_command = message => {
const $active = document.activeElement;
const is_textbox = 'placeholder' in $active && !$active.readOnly;

if (message.command === 'insert_to_textbox' && is_textbox) {
$active.value += ($active.value.length ? ' ' : '') + message.value;
if (message.command === 'insert_to_textbox') {
if ('placeholder' in $active && !$active.readOnly) {
$active.value += ($active.value.length ? ' ' : '') + message.value;
} else if ($active.isContentEditable) {
$active.textContent += ($active.textContent.length ? ' ' : '') + message.value;
}
}
};

Expand Down

0 comments on commit def685d

Please sign in to comment.