Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
ruibaby committed Oct 4, 2024
2 parents 6bc57d2 + ce11166 commit 0a73cd9
Show file tree
Hide file tree
Showing 4 changed files with 1,248 additions and 1,003 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
sed -i "s/version=.*-SNAPSHOT$/version=$version/1" gradle.properties
./gradlew clean build -x test
- name: Archive plugin-comment-widget jar
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: plugin-comment-widget
path: |
Expand All @@ -75,7 +75,7 @@ jobs:
if: github.event_name == 'release'
steps:
- name: Download plugin-comment-widget jar
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: plugin-comment-widget
path: build/libs
Expand Down Expand Up @@ -123,7 +123,7 @@ jobs:
with:
submodules: true
- name: Download plugin-comment-widget jar
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: plugin-comment-widget
path: build/libs
Expand Down
4 changes: 3 additions & 1 deletion packages/comment-widget/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@
"dayjs": "^1.11.10",
"emoji-mart": "^5.5.2",
"javascript-time-ago": "^2.5.9",
"lit": "^3.1.2"
"lit": "^3.1.2",
"lodash-es": "^4.17.21"
},
"devDependencies": {
"@types/lodash-es": "^4.17.12",
"lit-analyzer": "^2.0.3"
}
}
13 changes: 9 additions & 4 deletions packages/comment-widget/src/base-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { consume } from '@lit/context';
import { css, html, LitElement } from 'lit';
import { property, state } from 'lit/decorators.js';
import { createRef, Ref, ref } from 'lit/directives/ref.js';
import { debounce } from 'lodash-es';
import {
allowAnonymousCommentsContext,
baseUrlContext,
Expand Down Expand Up @@ -254,6 +255,13 @@ export class BaseForm extends LitElement {
`;
}

private debouncedSubmit = debounce((data: Record<string, unknown>) => {
const event = new CustomEvent('submit', {
detail: data,
});
this.dispatchEvent(event);
}, 300);

onSubmit(e: Event) {
e.preventDefault();
const form = e.target as HTMLFormElement;
Expand All @@ -270,10 +278,7 @@ export class BaseForm extends LitElement {
})
);

const event = new CustomEvent('submit', {
detail: data,
});
this.dispatchEvent(event);
this.debouncedSubmit(data);
}

resetForm() {
Expand Down
Loading

0 comments on commit 0a73cd9

Please sign in to comment.