anki/ts/editor/BUILD.bazel
Henrik Giesel 3beea5e1e4
Split/Merge editor.py for its three use cases (#1581)
* Forbid inserting object and iframe tags via PlainTextInput

* Add optional browserMode parameter to Editor

* Create new ts modules for three editor instances

- note-creator for AddCards
- browser-editor for the editor in the Browser
- reviewer-editor for the EditCurrent

* Revert "Forbid inserting object and iframe tags via PlainTextInput"

This reverts commit ab90ae8194494d883a1863126496e2d8f332509e.

* Refactor browserMode to editorMode

* Move new editor variants inside /ts/editor directory

* Fix typo
2022-01-12 14:51:43 +10:00

108 lines
2.1 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",
"@npm//@fluent",
"@npm//@types/codemirror",
"@npm//codemirror",
"@npm//svelte",
]
compile_svelte(deps = _ts_deps)
typescript(
name = "editor",
deps = _ts_deps + [
":svelte",
],
)
_esbuild_deps = [
":editor",
":editor_css",
"//sass:button_mixins_lib",
"@npm//@mdi",
"@npm//bootstrap-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/editable:editable_ts",
"@npm//@types/bootstrap",
"@npm//@types/codemirror",
"@npm//codemirror",
],
)