aboutsummaryrefslogtreecommitdiff
path: root/editor/editor.ts
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor.ts')
-rw-r--r--editor/editor.ts15
1 files changed, 14 insertions, 1 deletions
diff --git a/editor/editor.ts b/editor/editor.ts
index de52c98..4076474 100644
--- a/editor/editor.ts
+++ b/editor/editor.ts
@@ -82,6 +82,15 @@ export class Editor implements IEditor {
return res
}
+ clearSelection() {
+ if (!this.el) {
+ return
+ }
+ for (let x = 0; x < this.el.children.length; x++) {
+ this.el.children[x].setAttribute("style", "")
+ }
+ }
+
initStyle() {
let style = document.createElement("style")
style.type = "text/css"
@@ -214,7 +223,6 @@ export class Editor implements IEditor {
case "ContextMenu":
case "Delete":
case "End":
- case "Escape":
case "Home":
case "Insert":
case "OS":
@@ -395,6 +403,11 @@ export class Editor implements IEditor {
this.insertNewline(x + 1, textAfter)
break
+ case "Escape":
+ ev.preventDefault()
+ this.clearSelection()
+ break
+
case "r":
if (this.isKeyControl) {
ev.preventDefault()