fix(spec): use config debounce delay in editor
and 0 delay in spec
This commit is contained in:
parent
59e68ab2c7
commit
43438f0018
1 changed files with 11 additions and 2 deletions
|
@ -4,12 +4,21 @@ import {
|
||||||
httpRequest,
|
httpRequest,
|
||||||
isSelectElement,
|
isSelectElement,
|
||||||
isCheckboxOrRadioInputElement,
|
isCheckboxOrRadioInputElement,
|
||||||
isTextInputElement
|
isTextInputElement,
|
||||||
|
getConfig
|
||||||
} from '@utils';
|
} from '@utils';
|
||||||
import { useIntersection } from 'stimulus-use';
|
import { useIntersection } from 'stimulus-use';
|
||||||
import { AutoUpload } from '../shared/activestorage/auto-upload';
|
import { AutoUpload } from '../shared/activestorage/auto-upload';
|
||||||
import { ApplicationController } from './application_controller';
|
import { ApplicationController } from './application_controller';
|
||||||
|
|
||||||
|
const {
|
||||||
|
autosave: { debounce_delay }
|
||||||
|
} = getConfig();
|
||||||
|
|
||||||
|
const AUTOSAVE_DEBOUNCE_DELAY = debounce_delay;
|
||||||
|
|
||||||
|
console.log(AUTOSAVE_DEBOUNCE_DELAY);
|
||||||
|
|
||||||
export class TypeDeChampEditorController extends ApplicationController {
|
export class TypeDeChampEditorController extends ApplicationController {
|
||||||
static values = {
|
static values = {
|
||||||
typeDeChampStableId: String,
|
typeDeChampStableId: String,
|
||||||
|
@ -78,7 +87,7 @@ export class TypeDeChampEditorController extends ApplicationController {
|
||||||
|
|
||||||
if (target.form && isTextInputElement(target)) {
|
if (target.form && isTextInputElement(target)) {
|
||||||
this.#dirtyForms.add(target.form);
|
this.#dirtyForms.add(target.form);
|
||||||
this.debounce(this.save, 600);
|
this.debounce(this.save, AUTOSAVE_DEBOUNCE_DELAY);
|
||||||
} else if (target.form && target.type == 'file' && target.files?.length) {
|
} else if (target.form && target.type == 'file' && target.files?.length) {
|
||||||
const autoupload = new AutoUpload(target, target.files[0]);
|
const autoupload = new AutoUpload(target, target.files[0]);
|
||||||
autoupload.start();
|
autoupload.start();
|
||||||
|
|
Loading…
Reference in a new issue