From d755a0dfbdd5acf6ecc7fb02cdc1eaa0089746b6 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Sat, 24 Jun 2023 14:53:04 -0400 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9B=20Sync=20local=20storage=20for?= =?UTF-8?q?=20escape=20key?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SquareEdit/InsertHandler.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/SquareEdit/InsertHandler.ts b/src/SquareEdit/InsertHandler.ts index 07ca4d599..7754b9b9f 100644 --- a/src/SquareEdit/InsertHandler.ts +++ b/src/SquareEdit/InsertHandler.ts @@ -3,6 +3,7 @@ import { EditorAction, InsertAction } from '../Types'; import * as d3 from 'd3'; import { getSVGRelCoords, isOutOfSVGBounds, Point } from '../utils/Coordinates'; import { queueNotification } from '../utils/Notification'; +import { setSettings } from '../utils/LocalSettings'; /** * Class that handles insert mode, events, and actions. @@ -160,6 +161,8 @@ class InsertHandler { insertPanel.querySelector('.side-panel-btn.insertel.is-active').classList.add('unfocused'); editPanel.querySelector('.side-panel-btn.sel-by.is-active').classList.remove('unfocused'); + + setSettings({ userMode: 'edit' }); }).bind(this); From 38b13487840cbaadeac50b456637b6539f5195fc Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 26 Jun 2023 14:15:18 -0400 Subject: [PATCH 2/2] Make default userMode edit --- src/SquareEdit/SingleEditMode.ts | 7 +++---- src/TextView.ts | 2 +- src/utils/LocalSettings.ts | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/SquareEdit/SingleEditMode.ts b/src/SquareEdit/SingleEditMode.ts index ad62900c4..4627cb2e6 100644 --- a/src/SquareEdit/SingleEditMode.ts +++ b/src/SquareEdit/SingleEditMode.ts @@ -59,14 +59,13 @@ class SingleEditMode implements NeumeEditInterface { document.getElementById(insertMode).classList.add('is-active'); document.getElementById(selectionMode).classList.add('is-active'); switch (userMode) { - case 'edit': - document.getElementById(selectionMode).click(); - break; case 'insert': document.getElementById(insertMode).click(); break; + case 'edit': default: - return; + document.getElementById(selectionMode).click(); + break; } } diff --git a/src/TextView.ts b/src/TextView.ts index 0383bc39e..ca1a3334d 100644 --- a/src/TextView.ts +++ b/src/TextView.ts @@ -92,7 +92,7 @@ class TextView implements TextViewInterface { document.querySelectorAll('.syl.selected .sylTextRect-display') .forEach((rect: HTMLElement) => { rect.style.fill = 'red'; }); - if (this.neonView.TextEdit !== undefined) { + if (this.neonView.getUserMode() !== 'viewer' && this.neonView.TextEdit !== undefined) { this.neonView.TextEdit.initSelectByBBoxButton(); } diff --git a/src/utils/LocalSettings.ts b/src/utils/LocalSettings.ts index f5fbf8613..7caf4b943 100644 --- a/src/utils/LocalSettings.ts +++ b/src/utils/LocalSettings.ts @@ -44,7 +44,7 @@ const DEFAULT_SETTINGS: Settings = { glyphOpacity: 100, imageOpacity: 100, highlightMode: 'none', - userMode: 'viewer', + userMode: 'edit', insertMode: 'punctum', insertTab: 'primitiveTab', selectionMode: 'selBySyllable',