It could be enabled through a separate template filter, such as:
{{type-cloze:Text}}
or through a combination of the existing type and cloze filters:
{{type:cloze:Text}}
Typed Cloze answers could encourage stronger active recall while also checking exact spelling and making cards feel more like genuine fill-in-the-blank exercises.
There is already an add-on that provides this functionality: Fill the blanks - Multiple type:cloze support, but, unfortunately, it is buggy and unusable for many people. The developer appears to be unreachable and has most likely abandoned the project.
It would be very useful to have this functionality supported natively in Anki.
What errors are there?
Also, here’s mine: https://ankiweb.net/shared/info/1599302255
But I’ve already reworked it, and I still haven’t gotten it perfectly debugged enough to post on the website.
The AI suggested this solution, but I only made the minimum 30px for the field.
I can’t fully confirm your error; it’s even in the preview, as it’s a browser setting issue, and there’s no way to change the style for the placeholder.
For this reason, I completely abandoned Input in my addon.
<script>
(function() {
// Находим все элементы input на странице
const inputs = document.querySelectorAll('input');
if (!inputs.length) return;
inputs.forEach(input => {
// Пропускаем input, у которых нет placeholder или он пустой
if (!input.placeholder) {
// Устанавливаем ширину input 30px
input.style.width = '30px';
return;
}
// Создаём временный элемент для измерения текста
const measure = document.createElement('span');
// Копируем стили шрифта и добавляем скрытие
const computed = getComputedStyle(input);
measure.style.cssText = `
position: absolute;
visibility: hidden;
white-space: pre;
font: ${computed.font};
letter-spacing: ${computed.letterSpacing};
padding: 0;
margin: 0;
border: none;
box-sizing: content-box;
`;
document.body.appendChild(measure);
// Устанавливаем текст плейсхолдера для измерения
measure.textContent = input.placeholder;
// Измеряем ширину текста
const textWidth = measure.offsetWidth;
// Удаляем временный элемент
document.body.removeChild(measure);
// Вычисляем дополнительные отступы и границы, которые занимают место
const leftPad = parseFloat(computed.paddingLeft) || 0;
const rightPad = parseFloat(computed.paddingRight) || 0;
const leftBorder = parseFloat(computed.borderLeftWidth) || 0;
const rightBorder = parseFloat(computed.borderRightWidth) || 0;
// Добавляем небольшой запас (чтобы текст не прилипал к краям)
const extraSpace = 5;
const totalWidth = textWidth + leftPad + rightPad + leftBorder + rightBorder + extraSpace;
// Устанавливаем ширину input
input.style.width = totalWidth + 'px';
});
})();
</script>
@ZornHadNoChoice
Thanks for the information. I didn’t know that.
Unfortunately, the way this feature is currently implemented in Anki doesn’t work very well for learning. The implementation shown in my screenshot is still much better and more desirable.
Everyone has their own needs; maybe you need a specific type, while someone else needs something else.
I don’t like using “type:.” If I write something incorrectly, I’ll remember it incorrectly, so I like this addon of yours too, but mine is even simpler: I can simply enter a space and immediately get the desired character if I’ve forgotten it. But even if I type something incorrectly, I correct it immediately. Effective memorization occurs when you immediately correct the error, whether in pronunciation or some other action, meaning doing it three times. So I can simply erase and enter the required number of times, or speak it with recognition and erase again.
But I miss the text-to-speech option. I always have voice-over in my browser, and there’s always a translation. It’s very important to hear correctly immediately, rather than misreading what you thought you read. So I’m making an addon so that you can also use voice-over when needed. So, if you remove the voiceover and input, it’s almost a basic addon. The addon’s advantage is that you can open other hidden sections. I’ve already added the ability to voice the hidden field both before it’s opened, so there’s an option for when the user already knows the word by ear but is still making mistakes in writing.
There’s also the option to insert an image and open it; if the image is large, you can open it full-screen for a closer look.
If a long file is playing, the stop button will stop all available playback modes (tested on Ankidroid and Ankid Desktop).
I think this is the bare minimum I need. I wouldn’t mind simply hiding part of the image, but I haven’t yet figured out a way to make it simple and user-friendly, so I’ll likely release this addon as is soon.