Skip to content

Commit c979c49

Browse files
authored
Merge pull request #698 from NotePlan/jgclark/issue654
Test improvements to calcDateOffsetStr and other new tests and edge case fix
2 parents 3c155a0 + 8e6197c commit c979c49

File tree

5 files changed

+605
-94
lines changed

5 files changed

+605
-94
lines changed

helpers/NPWindows.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,10 @@
55
// ----------------------------------------------------------------------------
66

77
import { clo, logDebug, logError, logInfo, logWarn } from '@helpers/dev'
8+
import { usersVersionHas } from '@helpers/NPVersions'
89
import { caseInsensitiveMatch, caseInsensitiveStartsWith } from '@helpers/search'
910
import { inputIntegerBounded } from '@helpers/userInput'
1011

11-
// ----------------------------------------------------------------------------
12-
// CONSTANTS
13-
14-
export const MAIN_SIDEBAR_CONTROL_BUILD_VERSION = 1440 // v3.19.2
15-
export const FOLDER_VIEWS_CONTROL_BUILD_VERSION = 1340 // v3.18???
16-
1712
// ----------------------------------------------------------------------------
1813
// TYPES
1914

@@ -78,7 +73,7 @@ export async function setEditorWidth(widthIn?: number, mainSidebarWidth?: number
7873
}
7974

8075
logDebug('setEditorWidth', `Attempting to set width for main NP Window to ${String(width)}`)
81-
if (NotePlan.environment.buildVersion >= MAIN_SIDEBAR_CONTROL_BUILD_VERSION && mainSidebarWidth && !isNaN(mainSidebarWidth)) {
76+
if (usersVersionHas('mainSidebarControl') && mainSidebarWidth && !isNaN(mainSidebarWidth)) {
8277
if (mainSidebarWidth === 0) {
8378
logDebug('setEditorWidth', `- will hide main sidebar`)
8479
NotePlan.toggleSidebar(true, false, true)
@@ -690,7 +685,7 @@ export async function constrainMainWindow(): Promise<void> {
690685
}
691686

692687
export function logSidebarWidth(): void {
693-
if (NotePlan.environment.buildVersion >= MAIN_SIDEBAR_CONTROL_BUILD_VERSION) {
688+
if (usersVersionHas('mainSidebarControl')) {
694689
const sidebarWidth = NotePlan.getSidebarWidth()
695690
logInfo('logSidebarWidth', `Sidebar width: ${sidebarWidth} -- WARNING: This cannot tell if the sidebar is actually visible or not!`)
696691
} else {
@@ -700,7 +695,7 @@ export function logSidebarWidth(): void {
700695

701696
// eslint-disable-next-line require-await
702697
export async function setSidebarWidth(widthIn?: number): Promise<void> {
703-
if (NotePlan.environment.buildVersion >= MAIN_SIDEBAR_CONTROL_BUILD_VERSION) {
698+
if (usersVersionHas('mainSidebarControl')) {
704699
const width = widthIn ?? await inputIntegerBounded('Set Width for main NP Window', `Width (pixels)? (up to ${String(NotePlan.environment.screenWidth)})`, NotePlan.environment.screenWidth)
705700
NotePlan.setSidebarWidth(width)
706701
logDebug('setSidebarWidth', `Sidebar width set to ${width}`)

0 commit comments

Comments
 (0)