Skip to content
Snippets Groups Projects
Commit 240b2bf1 authored by chris's avatar chris
Browse files

alt autoFocus

parent ebfdf001
No related branches found
No related tags found
1 merge request!434Fixes
......@@ -63,6 +63,7 @@ export default {
SchemaService: DefaultSchema,
RulesService: [emDash, ellipsis],
ImageService: { showAlt: true },
PmPlugins: [columnResizing(), tableEditing(), invisibles([hardBreak()])],
services: [
......
/* eslint-disable react/prop-types */
import React, { useContext, useLayoutEffect, useRef, useState } from 'react';
import styled from 'styled-components';
import { WaxContext } from 'wax-prosemirror-core';
......@@ -65,10 +66,14 @@ export default ({ setPosition, position }) => {
const imageConfig = app.config.get('config.ImageService');
const showAlt = imageConfig && imageConfig.showAlt;
const autoFocus =
activeView.state.selection &&
activeView.state.selection.node &&
activeView.state.selection.node.attrs.alt === '';
return !readOnly && showAlt ? (
<StyledInputAlt
autoFocus="autoFocus"
autoFocus={autoFocus}
key="alt"
onChange={altTextOnChange}
placeholder="Alt Text"
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment