Giter Club home page Giter Club logo

anki's Introduction

Anki

Build status

This repo contains the source code for the computer version of Anki.

About

Anki is a spaced repetition program. Please see the website to learn more.

Getting Started

Anki Betas

If you'd like to try development builds of Anki but don't feel comfortable building the code, please see Anki betas

Developing

For more information on building and developing, please see Development.

Contributing

Want to contribute to Anki? Check out the Contribution Guidelines.

Anki Contributors

CONTRIBUTORS

License

Anki's license: LICENSE

anki's People

Contributors

dae avatar hgiesel avatar rumovz avatar abdnh avatar arthur-milchior avatar evandrocoan avatar glutanimate avatar kleinerpirat avatar sobjornstad avatar hikaru-y avatar bluegreenmagick avatar agentydragon avatar alanhdu avatar kelciour avatar l-m-sherlock avatar hssm avatar mkrump avatar krmanik avatar simgunz avatar ankitest avatar tatsumoto-ren avatar brownbat avatar zjosua avatar winterhazel avatar julienbaley avatar dependabot[bot] avatar phwoo avatar user1823 avatar frostschutz avatar sam1penny avatar

anki's Issues

One-way sync between WYSIWYG editor and CodeMirror

CM6

yarn upgrade --latest codemirror
@codemirror/highlight
As of 0.20.0, this package has been split between @lezer/highlight and @codemirror/language
個別のパッケージを使った方がいい
cd ts
./yarn.sh remove codemirror @types/codemirror
./yarn.sh add @codemirror/commands @codemirror/lang-html @codemirror/language @codemirror/legacy-modes @codemirror/state @codemirror/theme-one-dark @codemirror/view @lezer/highlight

line wrapping
https://discuss.codemirror.net/t/how-to-make-linewrapping-work-in-codemirror-next/2444
https://discuss.codemirror.net/t/how-to-use-line-wrapping-in-codemirror-6/4924

WYSIWYG editor

function useDOMMirror(): DOMMirrorAPI {

デコレート要素をDBに送るHTMLに変換

function adjustOutputHTML(html: string): string {

  • RichTextInput
  • contextでcontent取得
  • storedToFragment()

CodeMirror

<anki-mathjax>とかも\[にしてDBに保存するHTMLで管理した方がいい?

初期値

const code = writable($content);

export function storedToUndecorated(html: string): string {

export function undecoratedToStored(html: string): string {


<anki-editable>
document.querySelector(".rich-text-editable").shadowRoot.querySelector("anki-editable")


editable = document.querySelector(".rich-text-editable").shadowRoot.querySelector("anki-editable");
r = document.createRange();
console.log(r.toString());
r.selectNodeContents(editable);
console.log(r.toString());
tmpl = document.createElement("template");
tmpl.innerHTML = `<anki-mathjax>f(a) = \\frac{1}{2\pi i} \\oint\\frac{f(z)}{z-a}dz</anki-mathjax>`;
r.deleteContents();
r.insertNode(tmpl.content);

Misc

import { context as editingAreaContext } from "../EditingArea.svelte";
const { content } = editingAreaContext.get();

[I/O] Some event listeners are not removed when mask editor is unmounted

Some event listeners are not removed when the mask editor is closed

When the mask editor is closed, some event listeners are not deleted and continue to accumulate, leading to memory leaks.

マスク・エディタを閉じたときに、一部のイベントリスナーが削除されず蓄積し続け、メモリーリークに繋がります。

Screenshot

io-event-listeners

Causes

  1. https://github.com/ankitects/anki/blob/ff536254081fbbda48b56033e8e4fd80a66042e3/ts/image-occlusion/MaskEditor.svelte#L52-L62
    • I don't think anonymous event listeners can be removed unless we use AbortController, which is not available in Qt5.15.
    • Possible fixes
      • Name the function or use <svelte:window>
  2. https://github.com/ankitects/anki/blob/ff536254081fbbda48b56033e8e4fd80a66042e3/ts/image-occlusion/Toolbar.svelte#L43-L48
  3. Event listeners added via canvas.on(eventName, handler) are not removed when the mask editor is closed.
    • Possible fixes
      • If we create a new canvas every time we switch notes as we do now, we would need to call removeListeners() or dispose() when the component is destroyed. Alternatively, if we reuse one canvas all the way from opening the editor to closing it, we shouldn't have to care about the event listeners not being removed.

Some issues that arise when switching notes at high speed by holding down the up/down arrow keys or shortcut keys in the browser or by hitting them repeatedly

ブラウザで上下の矢印キーやショートカットキーを押しっぱなし、あるいは連打して高速でノートを切り替える際に起こるいくつかの問題点

The size of the canvas and image is sometimes set to the optimum size calculated for the image of the previous note (or possibly even earlier) rather than for the image of the current note.

キャンバスと画像のサイズが現在のノートの画像にたいするものではなく、一つ前のノート(あるいはもしかしたらさらに前の場合もあるかも)の画像に対して対して計算された最適サイズに設定されることがある

Holding down the up/down arrow keys or shortcut keys (Ctrl + P/N) in the browser to switch notes at high speed causes the following two errors

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'insertRule')
Uncaught TypeError: Cannot read properties of null (reading 'clientWidth')
After this error, the drawing tools on the left toolbar will not function properly

ブラウザで上下の矢印キーやショートカットキーを押しっぱなしにして高速でノートを切り替えると以下の2つのエラーが発生します。

Undo/redo

The change event is not dispatched when undo/redo is performed. Therefore, if the user closes the editor or switches to another note after undoing or redoing without performing an operation that dispatches the change event, the changes will not be saved.

アンドゥ、リドゥをする時にchangeイベントがディスパッチされません。したがってアンドゥ、リドゥした後にchangeイベントがディスパッチされる操作をユーザーがしないでエディタを閉じる、あるいは別のノートにスイッチすると変更が保存されません

The change event is not dispatched when undo or redo is performed. Therefore, if the user closes the editor or switches to another note after undoing or redoing without performing an action that would cause the change event to be dispatched, the undone or redone changes will not be saved.

取り消しややり直しを実行した時にchangeイベントがディスパッチされません。したがって、取り消しややり直しを実行した後にchangeイベントがディスパッチされる操作をユーザーがしないでエディタを閉じる、あるいは別のノートにスイッチすると取り消しややり直しをした変更が保存されません

When Edit current or Browse is opened (i.e. mode.kind===edit), if you click the undo button before making changes to an existing mask or adding a new mask, the existing masks will disappear and they will not be restored when you redo.

Edit currentあるいはBrowseを開いた時(つまりmode.kind===edit)、既存のマスクに変更を加える、あるいは新たにマスクを追加する前にアンドゥボタンをクリックすると、既存のマスク達が消えてしまい、リドゥをしてもそれらは復元されません。

When you open Edit Current or Browse (i.e. mode.kind===edit), the beginning of the undo history is a blank canvas, not a canvas with existing masks. Therefore, if you continue to undo to the end of the undo history, the masks that existed when you opened the editor will be lost, and they will not be restored when you redo.

Edit CurrentあるいはBrowse(つまりmode.kind===edit)を開いた時、アンドゥ履歴の最初には、既存のマスク達を伴ったcanvasではなく、まっさらなcanvasが記録されています。したがって、アンドゥ履歴の最後まで元に戻すを実行し続けると、エディタを開いた時点で存在したマスク達が消えてしまい、やり直しを実行してもそれらは復元されません。

In the Add dialog, the undo history is not reset when starting a new note after adding a note.

Addダイアログで、ノートを追加した後続けて新たにノートを作成し始める際にアンドゥ履歴がリセットされない。
In the Add dialog, the undo history is not reset when starting to create another note after adding a note.

If you create a polygon and then manipulate another object, the polygon disappears. The issue does not seem to occur in the Add dialog (KIND===add).

Fix some issues with undo/redo in mask editor; make undo/redo buttons reactive

The undo or redo button is now disabled when there is no action to undo or redo.
The undo/redo button will now be disabled if there is no action that can be undone/redone.
今やアンドゥあるいはリドゥボタンはアンドゥ、リドゥできるアクションが無い時は無効化されます。


ポリゴンを作成し、それから他のオブジェクトを操作するとポリゴンが消えてしまう。この問題はAddダイアログ(kind===add)では起こらないようだ。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.