Skip to content

Commit

Permalink
Fixed issue with SD importer paste event listner
Browse files Browse the repository at this point in the history
  • Loading branch information
PrototypeESBU committed Oct 21, 2024
1 parent f20ed98 commit e635e29
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion scss/apps/_shadowdarkling-importer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@use "../mixins" as *;

.shadowdarkling-importer {
fieldset {
textarea {
height:120px;
border:2px solid #111;
display: flex;
Expand Down
8 changes: 4 additions & 4 deletions system/src/apps/ShadowdarklingImporterSD.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ export default class ShadowdarklingImporterSD extends FormApplication {
/** @inheritdoc */
activateListeners(html) {
super.activateListeners(html);
window.addEventListener("paste", e => this._onPaste(e));
html.on("paste", ".SDImporterJson", this._onPaste.bind(this));
}

/** @inheritdoc */
_onSubmit(event) {
event.preventDefault();

this._createActor();
super._onSubmit(event);
}

/** @override */
async _updateObject(event, data) {
this._createActor();
// required method
}

/** @override */
Expand All @@ -76,7 +76,7 @@ export default class ShadowdarklingImporterSD extends FormApplication {

let postedJson = "";
try {
postedJson = JSON.parse(event.clipboardData.getData("text/plain"));
postedJson = JSON.parse(event.originalEvent.clipboardData.getData("text/plain"));
}
catch(error) {
ui.notifications.error("JSON not found in clipboard");
Expand Down
8 changes: 5 additions & 3 deletions system/templates/apps/shadowdarkling-importer.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@
<br>

{{else}}
<fieldset>
<h3>{{localize "SHADOWDARK.apps.shadowdarkling-importer.instruction3"}}</h3>
</fieldset>
<textarea
class="SDImporterJson centered"
placeholder="{{localize "SHADOWDARK.apps.shadowdarkling-importer.instruction3"}}"
autofocus="true"
></textarea>
<br>
<div>{{localize "SHADOWDARK.apps.shadowdarkling-importer.instruction1"}}</div>
<div>{{localize "SHADOWDARK.apps.shadowdarkling-importer.instruction2"}}</div>
Expand Down

0 comments on commit e635e29

Please sign in to comment.