Skip to content

Commit e74ef4d

Browse files
committed
Add new option disableFormWhenSubmitting
1 parent a810cad commit e74ef4d

File tree

6 files changed

+19
-8
lines changed

6 files changed

+19
-8
lines changed

eslint.config.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ import tseslint from "typescript-eslint";
1616

1717
// Good reference: https://github.com/dustinspecker/awesome-eslint#readme
1818

19-
const CLIENT_ONLY_FILES = "src/**/*.{js,ts}";
20-
const TEST_ONLY_FILES = "src/**/__tests__/**";
21-
const STORYBOOK_FILES = ".storybook/**/*.{js,ts}";
19+
const CLIENT_ONLY_FILES = "./src/**/*.{js,ts}";
20+
const TEST_ONLY_FILES = "./src/**/__tests__/**";
21+
const STORYBOOK_FILES = "./.storybook/**/*.{js,ts}";
2222

2323
const ALL_FILES = [
2424
CLIENT_ONLY_FILES,
2525
STORYBOOK_FILES,
2626
// Root level files
27-
"*.{js,ts}",
27+
"./*.{js,ts}",
2828
// Scripts
29-
"etc/**/*.{js,ts}",
29+
"./etc/**/*.{js,ts}",
3030
];
3131

3232
/*

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"lint:fix": "eslint --color --fix .",
5050
"lint:inspect": "eslint --inspect-config",
5151
"prettier": "prettier --check ./etc ./src ./.storybook ./*.ts ./*.js",
52-
"prettier:fix": "prettier --write ./etc ./src ./.storybook ./*.ts",
52+
"prettier:fix": "prettier --write ./etc ./src ./.storybook ./*.ts ./*.js",
5353
"release": "release-it --only-version --config ./etc/release-it.ts",
5454
"storybook": "cross-env BROWSER=chromium storybook dev -p 8443 --https --ssl-cert ./etc/ssl-certs/localhost.crt --ssl-key ./etc/ssl-certs/localhost.key",
5555
"test": "cross-env ENVIRON=test vitest --watch=false",

src/options.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,12 @@ const options: VideomailClientOptions = {
161161
// when true, any errors will be sent to the videomail server for analysis
162162
reportErrors: true,
163163

164+
// This is because we need to set this to false by default for our WordPress plugin unfortunately.
165+
// Because WordPress plugins do overlap with each other.
166+
//
167+
// We will keep the default to `true` but offer an option to correct it on WP side.
168+
disableFormWhenSubmitting: true,
169+
164170
// just for testing purposes to simulate browser agent handling
165171
fakeUaString: undefined,
166172

src/types/options.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ export interface VideomailClientOptions {
132132
displayErrors: boolean;
133133
adjustFormOnBrowserError: boolean;
134134
reportErrors: boolean;
135+
disableFormWhenSubmitting?: boolean | undefined;
135136
fakeUaString?: string | undefined;
136137

137138
versions?: {

src/wrappers/container.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,11 @@ class Container extends Despot {
751751
this.options.logger.debug(`Container: submitAll(${output})`);
752752

753753
this.beginWaiting();
754-
this.disableForm(true);
754+
755+
if (this.options.disableFormWhenSubmitting) {
756+
this.disableForm(true);
757+
}
758+
755759
this.emit("SUBMITTING");
756760

757761
if (!hasVideomailKey) {

src/wrappers/visuals.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ class Visuals extends Despot {
204204
}
205205

206206
public removeChild(child: HTMLElement) {
207-
this.visualsElement?.removeChild(child);
207+
child.remove();
208208
}
209209

210210
public reset() {

0 commit comments

Comments
 (0)