anki/ts/editor/BUILD.bazel
Henrik Giesel 8f8f3bd465
Insert symbols overlay (#2051)
* Add flag for enabling insert symbols feature

* Add symbols overlay directory

* Detect if :xy is inserted into editable

* Allow naive updating of overlay, and special handling of ':'

* First step towards better Virtual Element support

* Update floating to reference range on insert text

* Position SymbolsOverlay always on top or bottom

* Add a data-provider to emulate API

* Show correct suggestions in symbols overlay

* Rename to replacementLength

* Allow replacing via clicking in menu

* Optionally remove inline padding of Popover

* Hide Symbols overlay on blur of content editable

* Add specialKey to inputHandler and generalize how arrow movement is detected

- This way macOS users can use Ctrl-N to mean down, etc.

* Detect special key from within SymbolsOverlay

* Implement full backwards search while typing

* Allow navigating symbol menu and accepting with enter

* Add some entries to data-provider

* Satisfy eslint

* Generate symbolsTable from sources

* Use other github source, allow multiple names

In return, symbol must be unique

* Automatically scroll in symbols dropdown

* Use from npm packages rather than downloading from URL

* Remove console.log

* Remove print

* Add pointerDown event to input-handler

- so that SymbolsOverlay can reset on field click

* Make tab do the same as enter

* Make font a bit smaller but increase relative icon size

* Satisfy type requirement of handlerlist

* Revert changing default size of DropdownItems

* Remove some now unused code for bootstrap dropdowns
2022-09-10 18:46:59 +10:00

116 lines
2.3 KiB
Python

load("//ts/svelte:svelte.bzl", "compile_svelte", "svelte_check")
load("//ts:prettier.bzl", "prettier_test")
load("//ts:eslint.bzl", "eslint_test")
load("//ts:esbuild.bzl", "esbuild")
load("//ts:compile_sass.bzl", "compile_sass")
load("//ts:typescript.bzl", "typescript")
compile_sass(
srcs = [
"editor-base.scss",
"legacy.scss",
],
group = "editor_css",
visibility = ["//visibility:public"],
deps = [
"//sass:base_lib",
"//sass:button_mixins_lib",
"//sass:scrollbar_lib",
],
)
_ts_deps = [
"//ts/components",
"//ts/editable:editable_ts",
"//ts/html-filter",
"//ts/lib",
"//ts/domlib",
"//ts/sveltelib",
"//ts/tag-editor",
"@npm//@fluent",
"@npm//@types/codemirror",
"@npm//codemirror",
"@npm//svelte",
"@npm//character-entities",
"@npm//gemoji",
]
compile_svelte(
visibility = ["//visibility:public"],
deps = _ts_deps,
)
typescript(
name = "editor",
deps = _ts_deps + [
":svelte",
],
)
_esbuild_deps = [
":editor",
":editor_css",
"//sass:button_mixins_lib",
"@npm//@mdi",
"@npm//bootstrap-icons",
"//ts/icons",
"@npm//protobufjs",
]
esbuild(
name = "browser_editor",
args = {
"loader": {".svg": "text"},
},
entry_point = "index_browser.ts",
output_css = "browser_editor.css",
visibility = ["//visibility:public"],
deps = _esbuild_deps,
)
esbuild(
name = "reviewer_editor",
args = {
"loader": {".svg": "text"},
},
entry_point = "index_reviewer.ts",
output_css = "reviewer_editor.css",
visibility = ["//visibility:public"],
deps = _esbuild_deps,
)
esbuild(
name = "note_creator",
args = {
"loader": {".svg": "text"},
},
entry_point = "index_creator.ts",
output_css = "note_creator.css",
visibility = ["//visibility:public"],
deps = _esbuild_deps,
)
# Tests
################
prettier_test()
eslint_test()
svelte_check(
name = "svelte_check",
srcs = glob([
"**/*.ts",
"**/*.svelte",
]) + [
"//sass:button_mixins_lib",
"//sass/bootstrap",
"//ts/components",
"//ts/tag-editor",
"//ts/editable:editable_ts",
"@npm//@types/bootstrap",
"@npm//@types/codemirror",
"@npm//codemirror",
],
)