2 0
Contact Author Sign in to rate

Editor Scripts & Symbols

16.02MB. Updated 2022-06-12. Only supports Anki 2.1.x.
The author has shared 8 other item(s).

This item is large, and may take some time to download.

Description

EDITOR SCRIPTS & SYMBOLS Anki addon (https://ankiweb.net/shared/info/2065559429) to run custom scripts and insert symbols/strings in the Anki editor using keyboard shortcuts or popup menus (Anki forum https://forums.ankiweb.net/t/editor-js-snippets-support-thread/14958). Configure symbols/strings, JavaScript or Python snippets to be inserted/executed in the editor from keyboard shortcuts (Qt format, see https://doc.qt.io/qt-5/qkeysequence.html). General configuration Addon configuration of scripts and symbols to run/insert is made in the addon configuration. To speed up and facilitate editing of configured scripts and symbols a CodeMirror 6 editor with JSON syntax highlighting is available from the context menu from the editor fields. Alternatively you can use the built in Anki addon configuration editor available from the Tools → Addons → Configure addon menu. The ESS editor has the following key board shortcuts - https://codemirror.net/6/docs/ref/#commands.defaultKeymap - https://codemirror.net/6/docs/ref/#search.searchKeymap - https://codemirror.net/6/docs/ref/#commands.historyKeymap - https://codemirror.net/6/docs/ref/#language.foldKeymap - https://codemirror.net/6/docs/ref/#lint.lintKeymap - Ctrl+B is set to "jump to matching bracket" - Ctrl+Enter is "save and close editor" - Shift+Escape is "discard and close editor" - <unconfigured> is "open configuration editor" Addon general configuration is under ´Settings´. - Editor shortcut: Keyboard shorcut to open the ESS editor from the Anki editor. (optional, default none) - Popup shortcut: Keyboard shortcut to open root menu (corresponding to the 'Scripts & Symbols' node) at caret position when in an editor field. (optional) - Size mode: Size mode for config editor, valid options are last (same size as last time), parent (same size as editor window) and XXXXxYYYY where XXXX is the width in pixels and YYYY is the height. (optional, default last) - CSS: Custom CSS to be applied to the config editor, for instance .cm-editor .cm-content {white-space: pre-wrap; word-break: break-word;} to word wrap (see https://codemirror.net/6/examples/styling/ for styling). (optional, default none) - Last geometry: Used by addon to store last geometry, do not edit. Editing scripts and symbols Add scripts or symbols by adding JSON objects and lists in hierarchal "node tree" under "Scripts & Symbols" in the configuration. The current version of the configuration is backed up in the addon directory before saving new configuration (overwritten on next save). Each node is one of the following: Sample configuration below. { "Settings": { "Editor shortcut": "", "Popup shortcut": "Ctrl+Alt+j", "Size mode": "last", "CSS": "" }, "Scripts & Symbols": [ { "1. Menu": "Symbols", "2. Shortcut": "Shift+Alt+S", "3. Items": [ { "1. Menu": "Arrows", "2. Shortcut": "Shift+Alt+A", "3. Items": [ { "1. Symbol": "←", "2. Shortcut": "Alt+Left", "3. HTML": "false" }, { "1. Symbol": "→", "2. Shortcut": "Alt+Right", "3. HTML": "false" } ] }, { "1. Symbol": "α", "2. Shortcut": "Alt+a", "3. HTML": "false" }, { "1. Symbol": "β", "2. Shortcut": "Alt+b", "3. HTML": "false" } ] }, { "1. Script": "Lowercase", "2. Shortcut": "Shift+Alt+L", "3. Language": "JS", "4. Pre": "(function(){const sel = document.activeElement.shadowRoot.getSelection(); for (i = 0; i < sel.rangeCount; i++) { const rng = sel.getRangeAt(i); let input = new XMLSerializer().serializeToString(rng.extractContents()); input = input.toLowerCase(); rng.insertNode(rng.createContextualFragment(input)); sel.addRange(rng);}})();", "5. File": "", "6. Post": "" } ] }Misc Feel free to share your script snippets in https://forums.ankiweb.net/t/useful-javascript-snippets-for-the-editor/14536 CHANGELOG

Download

As add-ons are programs downloaded from the internet, they are potentially malicious. You should only download add-ons you trust.

Supported Anki versions:

To download this add-on, please copy and paste the following code into Anki 2.1:

2065559429

If you were linked to this page from the internet, please open Anki on your computer, go to the Tools menu and then Add-ons>Browse & Install to paste in the code.

All Anki 2.1.x Add-Ons Contact Author

Reviews

on 1655974057
Very well made Readme page.
on 1638880133
Great job! It will definitely be one of the future "must have" addons