5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-15 12:21:42 +00:00

Merge branch 'void/editor' into 'rails'

desactivar alt input si es placeholder

Closes #970

See merge request sutty/sutty!3
This commit is contained in:
void 2021-04-16 13:53:29 +00:00
commit 9c2ad4f858

View file

@ -61,8 +61,13 @@ function select (editor: Editor, el: HTMLElement): void {
const innerEl = el.querySelector<HTMLElement>('[data-multimedia-inner]') const innerEl = el.querySelector<HTMLElement>('[data-multimedia-inner]')
if (!innerEl) throw new Error('No hay multimedia válida') if (!innerEl) throw new Error('No hay multimedia válida')
if (innerEl.tagName !== 'P') if (innerEl.tagName === "P") {
editor.toolbar.auxiliary.multimedia.altEl.value = getAlt(innerEl) || '' 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) 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) setAlt(el, editor.toolbar.auxiliary.multimedia.altEl.value)
selectedEl.replaceChild(el, innerEl) selectedEl.replaceChild(el, innerEl)
select(editor, selectedEl)
delete selectedEl.dataset.editorError delete selectedEl.dataset.editorError
}) })
.catch(err => { .catch(err => {