From c1204c1163aaa018d1368540924fcd6e48e315da Mon Sep 17 00:00:00 2001 From: void Date: Sat, 10 Apr 2021 22:20:13 +0000 Subject: [PATCH] desactivar alt input si es placeholder fixes #970 --- app/javascript/editor/types/multimedia.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/javascript/editor/types/multimedia.ts b/app/javascript/editor/types/multimedia.ts index e304a411..54c430f3 100644 --- a/app/javascript/editor/types/multimedia.ts +++ b/app/javascript/editor/types/multimedia.ts @@ -61,8 +61,13 @@ function select (editor: Editor, el: HTMLElement): void { const innerEl = el.querySelector('[data-multimedia-inner]') if (!innerEl) throw new Error('No hay multimedia vĂ¡lida') - if (innerEl.tagName !== 'P') - editor.toolbar.auxiliary.multimedia.altEl.value = getAlt(innerEl) || '' + if (innerEl.tagName === "P") { + editor.toolbar.auxiliary.multimedia.altEl.value = ""; + editor.toolbar.auxiliary.multimedia.altEl.disabled = true; + } else { + editor.toolbar.auxiliary.multimedia.altEl.value = getAlt(innerEl) || ""; + editor.toolbar.auxiliary.multimedia.altEl.disabled = false; + } setAuxiliaryToolbar(editor, editor.toolbar.auxiliary.multimedia.parentEl) } @@ -146,6 +151,8 @@ export function setupAuxiliaryToolbar (editor: Editor): void { setAlt(el, editor.toolbar.auxiliary.multimedia.altEl.value) selectedEl.replaceChild(el, innerEl) + select(editor, selectedEl) + delete selectedEl.dataset.editorError }) .catch(err => {