Is There a Faster Way to Create Clozes in AnkiDroid?

Hi,

I often cloze out longer texts, like book sections and articles. During review, I sometimes notice a missing cloze, but switching to HTML mode and scrolling to the text part I want to cloze is time-consuming.

Ideally, I’d like to tap on a word while reviewing the card, select “create cloze,” and have it added instantly.

Is this already possible in the app, and am I missing something?

If not, would this require a pull request?

Also, is there a possibility for plugins in AnkiDroid, similar to Anki for desktop? I think I saw the word “plugins” mentioned in the settings section.

Thanks!

I create clozes during reviewing. I have basically set up the pull down gesture to open the Note Editor. After I have opened the editor, I can simply tap and hold on a word and add the required clozes.

The note editor does it show just html tag stuff? or is it the already rendered html. not that experienced with ankidroid. maybe you are using another view of the UI?

Because my issue is that I have basically chapters of books or internet articles as cards. And finding the word / sentence between the html tags is hard.

https://www.reddit.com/r/Anki/comments/1e7084c/instant_note_editor_ankidroid/
https://www.reddit.com/r/Anki/comments/1cmmhyw/suggestions_for_instant_note_editor/

How come you have so many HTML tags? Can you show me an example? Just copy paste.

that is how it looks on mobile. as you can see there are also styling tags, which make it even more convoluted.

<div><h1>Creating an injectable service</h1><a href="https://github.com/angular/angular/edit/main/adev/src/content/guide/di/creating-injectable-service.md">edit</a></div><div>Service is a broad category encompassing any value, function, or feature that an application needs. A service is typically a class with a narrow, well-defined purpose. A component is one type of class that can use DI.</div><div>Angular distinguishes components from services to increase modularity and reusability. By separating a component's view-related features from other kinds of processing, you can make your component classes lean and efficient.</div><div>Ideally, a component's job is to enable the user experience and nothing more. A component should present properties and methods for data binding, to mediate between the view (rendered by the template) and the application logic (which often includes some notion of a model).</div><div>A component can delegate certain tasks to services, such as fetching data from the server, validating user input, or logging directly to the console. By defining such processing tasks in an injectable service class, you make those tasks available to any component. You can also make your application more adaptable by configuring different providers of the same kind of service, as appropriate in different circumstances.</div><div>Angular does not enforce these principles. Angular helps you follow these principles by making it easy to factor your application logic into services and make those services available to components through DI.</div><h2>On this page</h2><ul><li><a href="https://angular.dev/guide/di/creating-injectable-service#service-examples">Service examples</a></li><li><a href="https://angular.dev/guide/di/creating-injectable-service#creating-an-injectable-service">Creating an injectable service</a></li><li><a href="https://angular.dev/guide/di/creating-injectable-service#injecting-services">Injecting services</a></li><li><a href="https://angular.dev/guide/di/creating-injectable-service#injecting-services-in-other-services">Injecting services in other services</a></li><li><a href="https://angular.dev/guide/di/creating-injectable-service#whats-next">What's next</a></li></ul>arrow_upward_altBack to the top<h2><a href="https://angular.dev/guide/di/creating-injectable-service#service-examples">Service examples</a></h2><div>Here's an example of a service class that logs to the browser console:</div><div><div><h3>src/app/logger.service.ts (class)</h3></div><pre><code><div><span style="color: var(--bright-blue);">export</span> <span style="color: var(--bright-blue);">class</span> <span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">Logger</span> {</div><div>  <span style="color: var(--hot-pink);">log</span>(<span style="color: var(--bright-blue);"><span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">msg</span>: <span style="color: var(--bright-blue);">unknown</span></span>) { <span style="color: var(--bright-blue);">console</span>.<span style="color: var(--hot-pink);">log</span>(msg); }</div><div>  <span style="color: var(--hot-pink);">error</span>(<span style="color: var(--bright-blue);"><span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">msg</span>: <span style="color: var(--bright-blue);">unknown</span></span>) { <span style="color: var(--bright-blue);">console</span>.<span style="color: var(--hot-pink);">error</span>(msg); }</div><div>  <span style="color: var(--hot-pink);">warn</span>(<span style="color: var(--bright-blue);"><span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">msg</span>: <span style="color: var(--bright-blue);">unknown</span></span>) { <span style="color: var(--bright-blue);">console</span>.<span style="color: var(--hot-pink);">warn</span>(msg); }</div><div>}</div></code></pre><i></i>check</div><div>Services can depend on other services. For example, here's a&nbsp;<code>HeroService</code>&nbsp;that depends on the&nbsp;<code>Logger</code>&nbsp;service, and also uses&nbsp;<code>BackendService</code>&nbsp;to get heroes. That service in turn might depend on the&nbsp;<code>HttpClient</code>&nbsp;service to fetch heroes asynchronously from a server:</div><div><div><h3>src/app/hero.service.ts (class)</h3></div><pre><code><div><span style="color: var(--bright-blue);">export</span> <span style="color: var(--bright-blue);">class</span> <span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">HeroService</span> {</div><div>  <span style="color: var(--bright-blue);">private</span> <span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">heroes</span>: <span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">Hero</span>[] = [];</div><div></div><div>  <span style="color: var(--hot-pink);">constructor</span>(<span style="color: var(--bright-blue);"></span></div><div>    <span style="color: var(--bright-blue);">private</span> <span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">backend</span>: <span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">BackendService</span>,</div><div>    <span style="color: var(--bright-blue);">private</span> <span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">logger</span>: <span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">Logger</span>) {}</div><div></div><div>  <span style="color: var(--bright-blue);">async</span> <span style="color: var(--hot-pink);">getHeroes</span>(<span style="color: var(--bright-blue);"></span>) {</div><div>    <span style="color: var(--quaternary-contrast);">// Fetch</span></div><div>    <span style="color: var(--bright-blue);">this</span>.<span style="color: var(--hot-pink);">heroes</span> = <span style="color: var(--bright-blue);">await</span> <span style="color: var(--bright-blue);">this</span>.<span style="color: var(--hot-pink);">backend</span>.<span style="color: var(--hot-pink);">getAll</span>(<span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">Hero</span>);</div><div>    <span style="color: var(--quaternary-contrast);">// Log</span></div><div>    <span style="color: var(--bright-blue);">this</span>.<span style="color: var(--hot-pink);">logger</span>.<span style="color: var(--hot-pink);">log</span>(<span style="color: color-mix(in srgb,var(--orange-red) 80%,var(--full-contrast));">`Fetched <span style="color: var(--hot-red);">${<span style="color: var(--bright-blue);">this</span>.heroes.length}</span> heroes.`</span>);</div><div>    <span style="color: var(--bright-blue);">return</span> <span style="color: var(--bright-blue);">this</span>.<span style="color: var(--hot-pink);">heroes</span>;</div><div>  }</div><div>}</div></code></pre><i></i>check</div><h2><a href="https://angular.dev/guide/di/creating-injectable-service#creating-an-injectable-service">Creating an injectable service</a></h2><div>The Angular CLI provides a command to create a new service. In the following example, you add a new service to an existing application.</div><div>To generate a new&nbsp;<code>HeroService</code>&nbsp;class in the&nbsp;<code>src/app/heroes</code>&nbsp;folder, follow these steps:</div><ol><li>Run this&nbsp;<a href="https://angular.dev/tools/cli">Angular CLI</a>&nbsp;command:</li></ol><div><pre><code><div>ng generate service heroes/hero</div></code></pre><i></i>check</div><div>This command creates the following default&nbsp;<code>HeroService</code>:</div><div><div><h3>src/app/heroes/hero.service.ts (CLI-generated)</h3></div><pre><code><div><span style="color: var(--bright-blue);">import</span> { <span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">Injectable</span> } <span style="color: var(--bright-blue);">from</span> <span style="color: color-mix(in srgb,var(--orange-red) 80%,var(--full-contrast));">'@angular/core'</span>;</div><div></div><div><span style="color: var(--bright-blue);">@Injectable</span>({</div><div>  <span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">providedIn</span>: <span style="color: color-mix(in srgb,var(--orange-red) 80%,var(--full-contrast));">'root'</span>,</div><div>})</div><div><span style="color: var(--bright-blue);">export</span> <span style="color: var(--bright-blue);">class</span> <span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">HeroService</span> {}</div></code></pre><i></i>check</div><div>The&nbsp;<code>@Injectable()</code>&nbsp;decorator specifies that Angular can use this class in the DI system. The metadata,&nbsp;<code>providedIn: 'root'</code>, means that the&nbsp;<code>HeroService</code>&nbsp;is provided throughout the application.</div><div>Add a&nbsp;<code>getHeroes()</code>&nbsp;method that returns the heroes from&nbsp;<code>mock.heroes.ts</code>&nbsp;to get the hero mock data:</div><div><div><h3>src/app/heroes/hero.service.ts</h3></div><pre><code><div><span style="color: var(--bright-blue);">import</span> { <span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">Injectable</span> } <span style="color: var(--bright-blue);">from</span> <span style="color: color-mix(in srgb,var(--orange-red) 80%,var(--full-contrast));">'@angular/core'</span>;</div><div><span style="color: var(--bright-blue);">import</span> { <span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">HEROES</span> } <span style="color: var(--bright-blue);">from</span> <span style="color: color-mix(in srgb,var(--orange-red) 80%,var(--full-contrast));">'./mock-heroes'</span>;</div><div></div><div><span style="color: var(--bright-blue);">@Injectable</span>({</div><div>  <span style="color: var(--quaternary-contrast);">// declares that this service should be created</span></div><div>  <span style="color: var(--quaternary-contrast);">// by the root application injector.</span></div><div>  <span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">providedIn</span>: <span style="color: color-mix(in srgb,var(--orange-red) 80%,var(--full-contrast));">'root'</span>,</div><div>})</div><div><span style="color: var(--bright-blue);">export</span> <span style="color: var(--bright-blue);">class</span> <span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">HeroService</span> {</div><div>  <span style="color: var(--hot-pink);">getHeroes</span>(<span style="color: var(--bright-blue);"></span>) {</div><div>    <span style="color: var(--bright-blue);">return</span> <span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">HEROES</span>;</div><div>  }</div><div>}</div></code></pre><i></i>check</div><div>For clarity and maintainability, it is recommended that you define components and services in separate files.</div><h2><a href="https://angular.dev/guide/di/creating-injectable-service#injecting-services">Injecting services</a></h2><div>To inject a service as a dependency into a component, you can use the component's&nbsp;<code>constructor()</code>&nbsp;and supply a constructor argument with the dependency type.</div><div>The following example specifies the&nbsp;<code>HeroService</code>&nbsp;in the&nbsp;<code>HeroListComponent</code>&nbsp;constructor. The type of&nbsp;<code>heroService</code>&nbsp;is&nbsp;<code>HeroService</code>. Angular recognizes the&nbsp;<code>HeroService</code>&nbsp;type as a dependency, since that class was previously annotated with the&nbsp;<code>@Injectable</code>&nbsp;decorator:</div><div><div><h3>src/app/heroes/hero-list.component (constructor signature)</h3></div><pre><code><div><span style="color: var(--hot-pink);">constructor</span>(<span style="color: var(--bright-blue);"><span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">heroService</span>: <span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">HeroService</span></span>)</div></code></pre><i></i>check</div><h2><a href="https://angular.dev/guide/di/creating-injectable-service#injecting-services-in-other-services">Injecting services in other services</a></h2><div>When a service depends on another service, follow the same pattern as injecting into a component. In the following example,&nbsp;<code>HeroService</code>&nbsp;depends on a&nbsp;<code>Logger</code>&nbsp;service to report its activities:</div><div><div><h3>src/app/heroes/hero.service.ts</h3></div><pre><code><div><span style="color: var(--bright-blue);">import</span> { <span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">Injectable</span> } <span style="color: var(--bright-blue);">from</span> <span style="color: color-mix(in srgb,var(--orange-red) 80%,var(--full-contrast));">'@angular/core'</span>;</div><div><span style="color: var(--bright-blue);">import</span> { <span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">HEROES</span> } <span style="color: var(--bright-blue);">from</span> <span style="color: color-mix(in srgb,var(--orange-red) 80%,var(--full-contrast));">'./mock-heroes'</span>;</div><div><span style="color: var(--bright-blue);">import</span> { <span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">Logger</span> } <span style="color: var(--bright-blue);">from</span> <span style="color: color-mix(in srgb,var(--orange-red) 80%,var(--full-contrast));">'../logger.service'</span>;</div><div></div><div><span style="color: var(--bright-blue);">@Injectable</span>({</div><div>  <span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">providedIn</span>: <span style="color: color-mix(in srgb,var(--orange-red) 80%,var(--full-contrast));">'root'</span>,</div><div>})</div><div><span style="color: var(--bright-blue);">export</span> <span style="color: var(--bright-blue);">class</span> <span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">HeroService</span> {</div><div>  <span style="color: var(--hot-pink);">constructor</span>(<span style="color: var(--bright-blue);"><span style="color: var(--bright-blue);">private</span> <span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">logger</span>: <span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">Logger</span></span>) {}</div><div></div><div>  <span style="color: var(--hot-pink);">getHeroes</span>(<span style="color: var(--bright-blue);"></span>) {</div><div>    <span style="color: var(--bright-blue);">this</span>.<span style="color: var(--hot-pink);">logger</span>.<span style="color: var(--hot-pink);">log</span>(<span style="color: color-mix(in srgb,var(--orange-red) 80%,var(--full-contrast));">'Getting heroes.'</span>);</div><div>    <span style="color: var(--bright-blue);">return</span> <span style="color: color-mix(in srgb,var(--vivid-pink) 80%,var(--full-contrast));">HEROES</span>;</div><div>  }</div><div>}</div></code></pre><i></i>check</div><div>In this example, the&nbsp;<code>getHeroes()</code>&nbsp;method uses the&nbsp;<code>Logger</code>&nbsp;service by logging a message when fetching heroes.</div><h2><a href="https://angular.dev/guide/di/creating-injectable-service#whats-next">What's next</a></h2><a href="https://angular.dev/guide/di/dependency-injection-providers">Configuring dependency providers</a><a href="https://angular.dev/guide/di/dependency-injection-providers#using-an-injectiontoken-object"><code>InjectionTokens</code></a><div><div><div><h2>Social Media</h2><ul><li><a href="https://blog.angular.dev/">Blog</a></li><li><a href="https://x.com/angular">X (formerly Twitter)</a></li><li><a href="https://www.youtube.com/angular">YouTube</a></li><li><a href="https://discord.gg/angular">Discord</a></li><li><a href="https://github.com/angular/angular">GitHub</a></li><li><a href="https://stackoverflow.com/questions/tagged/angular">Stack Overflow</a></li></ul></div><div><h2>Community</h2><ul><li><a href="https://github.com/angular/angular/blob/main/CONTRIBUTING.md">Contribute</a></li><li><a href="https://github.com/angular/code-of-conduct/blob/main/CODE_OF_CONDUCT.md">Code of Conduct</a></li><li><a href="https://github.com/angular/angular/issues">Report Issues</a></li><li><a href="https://devlibrary.withgoogle.com/products/angular?sort=updated">Google's DevLibrary</a></li><li><a href="https://developers.google.com/community/experts/directory?specialization=angular">Angular Google Developer Experts</a></li></ul></div><div><h2>Resources</h2><ul><li><a href="https://angular.dev/press-kit">Press Kit</a></li><li><a href="https://angular.dev/roadmap">Roadmap</a></li></ul></div><div><h2>Languages</h2><ul><li><a href="https://angular.cn/">简体中文版</a></li><li><a href="https://angular.tw/">正體中文版</a></li><li><a href="https://angular.jp/">日本語版</a></li><li><a href="https://angular.kr/">한국어</a></li><li><a href="https://angular-gr.web.app/">Ελληνικά</a></li></ul></div></div></div>

its this page here Creating an injectable service • Angular. I just then add some clozes to it. but if I need to add some later then its a bit painful to scroll through on mobile

Impressive! :slight_smile: Awesome contribution! Can’t wait to try it out. It is under developer options?

https://www.reddit.com/r/Anki/comments/1e7084c/comment/ldww2yo/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button
The author promised to make a post about it later.

It will be out for public use in the next alpha version IIRC. But doesn’t this have a different use case?

1 Like

https://www.reddit.com/r/Anki/comments/1e9nf1o/ankidroid_instant_note_editor_guide/

1 Like

ah yeah its a different use case.

I just place the basic text in columns in a spreadsheet (I use LibreOffice Calc) and use formulæ to create the necessary code for the cloze.

do you have screenshot of it? not sure if I understand.

Sorry, I cannot find my working spreadsheet at the moment.
Assume you have 10 fields that you will use for possible cloze entries. Have a column for each of those fields with their values, and use the header of that column to hold their cloze code (e.g. “c2”).

Then build the necessary HTML by referring to the cloze code in the column desired together with its value. You will be doing this once per row.

See my Latin pronouns deck for an example of the type of cloze table I mean. Attached a screen shot from it.