fix(spec): use config debounce delay in editor

and 0 delay in spec
This commit is contained in:
simon lehericey 2022-10-26 22:38:33 +02:00
parent 59e68ab2c7
commit 43438f0018

View file

@ -4,12 +4,21 @@ import {
httpRequest,
isSelectElement,
isCheckboxOrRadioInputElement,
isTextInputElement
isTextInputElement,
getConfig
} from '@utils';
import { useIntersection } from 'stimulus-use';
import { AutoUpload } from '../shared/activestorage/auto-upload';
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 {
static values = {
typeDeChampStableId: String,
@ -78,7 +87,7 @@ export class TypeDeChampEditorController extends ApplicationController {
if (target.form && isTextInputElement(target)) {
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) {
const autoupload = new AutoUpload(target, target.files[0]);
autoupload.start();