Skip to content

Commit 087ba23

Browse files
committed
Remove commented out console logs
1 parent 7e6d83a commit 087ba23

File tree

53 files changed

+5289
-334
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+5289
-334
lines changed

dwertheimer.EventAutomations/src/config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ export function validateAutoTimeBlockingConfig(config: AutoTimeBlockingConfig):
8484
// $FlowIgnore
8585
return validatedConfig
8686
} catch (error) {
87-
// console.log(`NPTimeblocking::validateAutoTimeBlockingConfig: ${String(error)}\nInvalid config:\n${JSON.stringify(config)}`)
8887
throw new Error(`${String(error)}`)
8988
}
9089
}

dwertheimer.EventAutomations/src/timeblocking-helpers.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ export function findTimeBlocks(timeMap: IntervalMap, config: { [key: string]: an
276276
let blockStart = timeMap[0]
277277
for (let i = 1; i < timeMap.length; i++) {
278278
const slot = timeMap[i]
279-
// console.log(`findTimeBlocks[${i}]: slot: ${slot.start} ${slot.index} ${slot.busy}}`)
279+
280280
const noBreakInContinuity = slot.index === lastSlot.index + 1 && i <= timeMap.length - 1 && lastSlot.busy === slot.busy
281281
if (noBreakInContinuity) {
282282
lastSlot = slot
@@ -312,9 +312,7 @@ export function findTimeBlocks(timeMap: IntervalMap, config: { [key: string]: an
312312
if (lastBlock) blocks.push(lastBlock)
313313
}
314314
} else {
315-
// console.log(`findTimeBlocks: timeMap array was empty`)
316315
}
317-
// console.log(`findTimeBlocks: found blocks: ${JSP(blocks)}`)
318316

319317
return blocks
320318
}

dwertheimer.MathSolver/src/support/solver.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,6 @@ export function parse(thisLineStr: string, lineIndex: number, cd: CurrentData):
298298
// SOURCE: https://stackoverflow.com/questions/12812902/javascript-regular-expression-matching-cityname // how to take only specific parts
299299
const reg = /(\d*[\.,])?(\d+)(\s?%)(\s+)(of)(\s+)(\d*[\.,])?(\d+\s?)/g
300300
while ((match = reg.exec(strToBeParsed))) {
301-
// console.log(match);
302301
const num = match[1] ? match[1] + match[2] : match[2]
303302
const dest = match[7] ? match[7] + match[8] : match[8]
304303
const sostituzione = (Number(dest) * (Number(num) / 100)).toString()

dwertheimer.ReactSkeleton/src/react/support/performRollup.node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const { rollupReactFiles, getRollupConfig } = rollupReactScript
3838
]
3939
// create one single base config with two output options
4040
const config = { ...rollupConfigs[0], ...{ output: [rollupConfigs[0].output, rollupConfigs[1].output] } }
41-
// console.log(JSON.stringify(config, null, 2))
41+
4242
await rollupReactFiles(config, watch, 'dwertheimer.ReactSkeleton: development && production')
4343
// const rollupsProms = rollups.map((obj) => rollupReactFiles({ ...obj, buildMode }, watch, buildMode))
4444
})().catch((error) => {

dwertheimer.TaskAutomations/src/react/EditableElement.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const EditableElement = (props) => {
2222
ref: element,
2323
onKeyUp: onMouseUp,
2424
})
25-
// console.log(`WebView: EditableElement elements=`, elements)
25+
2626
return elements
2727
}
2828

dwertheimer.TaskAutomations/src/react/ThemedSelect.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ const colourStyles = {
196196
// option: (styles) => ({ ...styles, backgroundColor: NP_THEME.base.backgroundColor, color: NP_THEME.base.textColor ?? 'black' }),
197197
// option: (styles, { data, isDisabled, isFocused, isSelected }) => {
198198
option: (styles, { isDisabled, isSelected }) => {
199-
// console.log('option', styles, data, isDisabled, isFocused, isSelected)
200199
return {
201200
...styles,
202201
// backgroundColor: isDisabled ? undefined : isSelected ? bgColor.css() : isFocused ? bgColor.alpha(0.1).css() : bgColor.css(),

dwertheimer.TaskAutomations/src/react/support/performRollup.node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const { rollupReactFiles, getCommandLineOptions, getRollupConfig } = rollupReact
3939
]
4040
// create one single base config with two output options
4141
const config = { ...rollupConfigs[0], ...{ output: [rollupConfigs[0].output, rollupConfigs[1].output] } }
42-
// console.log(JSON.stringify(config, null, 2))
42+
4343
await rollupReactFiles(config, watch, 'TaskAutomations: development && production')
4444
// const rollupsProms = rollups.map((obj) => rollupReactFiles({ ...obj, buildMode }, watch, buildMode))
4545
})()

dwertheimer.TaskSorting/__tests__/sortTasks.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ describe(`${PLUGIN_NAME}`, () => {
394394
// output order is the reverse of that order
395395
// Note that types will be unreliable because rawContent is being pasted
396396
// so we're just checking the content
397-
// console.log(`sortTasks result`, result)
397+
398398
expect(result[8].content).toEqual('6-checklistCancelled')
399399
expect(result[7].content).toEqual('5-cancelled')
400400
expect(result[6].content).toEqual('4-checklistDone')
@@ -579,7 +579,7 @@ describe(`${PLUGIN_NAME}`, () => {
579579
const shouldBe = `${p.rawContent}`
580580
const newContent = `${result[i].rawContent}`
581581
// uncomment the following line if this test is failing and it will give you more clues on how far it got
582-
// console.log(`sortTasks: [${i}]: (result) ${newContent} ${newContent === shouldBe ? '===' : ' !== '} "${shouldBe}" (expected)`)
582+
583583
// Put breakpoint on the expect and compare the objects in the debugger
584584
expect(newContent).toMatch(shouldBe)
585585
})

helpers/HTMLView.js

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
// Last updated 2025-05-31 by @jgclark
66
// ---------------------------------------------------------
77
import showdown from 'showdown' // for Markdown -> HTML from https://github.com/showdownjs/showdown
8-
import {
9-
hasFrontMatter
10-
} from '@helpers/NPFrontMatter'
8+
import { hasFrontMatter } from '@helpers/NPFrontMatter'
119
import { getFolderFromFilename } from '@helpers/folders'
1210
import { clo, logDebug, logError, logInfo, logWarn, JSP, timer } from '@helpers/dev'
1311
import { getStoredWindowRect, isHTMLWindowOpen, storeWindowRect } from '@helpers/NPWindows'
@@ -86,7 +84,7 @@ export function getCallbackCodeString(jsFunctionName: string, commandName: strin
8684
.replace("%%commandName%%", commandName)
8785
.replace("%%pluginID%%", pluginID)
8886
.replace("%%commandArgs%%", () => JSON.stringify(commandArgs)); //This is important because it works around problems with $$ in commandArgs
89-
// console.log(\`${jsFunctionName}: Sending command "\$\{commandName\}" to NotePlan: "\$\{pluginID\}" with args: \$\{JSON.stringify(commandArgs)\}\`);
87+
9088
console.log(\`window.${jsFunctionName}: Sending code: "\$\{code\}"\`)
9189
if (window.webkit) {
9290
window.webkit.messageHandlers.jsBridge.postMessage({
@@ -101,7 +99,6 @@ export function getCallbackCodeString(jsFunctionName: string, commandName: strin
10199
`
102100
}
103101

104-
105102
/**
106103
* Convert a note's content to HTML and include any images as base64
107104
* @param {string} content
@@ -164,22 +161,22 @@ export async function getNoteContentAsHTML(content: string, note: TNote): Promis
164161
tasklists: true,
165162
metadata: false, // otherwise metadata is swallowed
166163
requireSpaceBeforeHeadingText: true,
167-
simpleLineBreaks: true // Makes this GFM style. TODO: make an option?
164+
simpleLineBreaks: true, // Makes this GFM style. TODO: make an option?
168165
}
169166
const converter = new showdown.Converter(converterOptions)
170167
let body = converter.makeHtml(lines.join(`\n`))
171168
body = `<style>img { background: white; max-width: 100%; max-height: 100%; }</style>${body}` // fix for bug in showdown
172-
169+
173170
const imgTagRegex = /<img src=\"(.*?)\"/g
174171
const matches = [...body.matchAll(imgTagRegex)]
175172
const noteDirPath = getFolderFromFilename(note.filename)
176-
173+
177174
for (const match of matches) {
178175
const imagePath = match[1]
179176
try {
180177
// Handle both absolute and relative paths
181178
let fullPath = `../../../Notes/${noteDirPath}/${decodeURI(imagePath)}`
182-
if(fullPath.endsWith('.drawing')) {
179+
if (fullPath.endsWith('.drawing')) {
183180
fullPath = fullPath.replace('.drawing', '.png')
184181
}
185182
const data = await DataStore.loadData(fullPath, false)
@@ -237,14 +234,12 @@ export async function getNoteContentAsHTML(content: string, note: TNote): Promis
237234
modifiedLines.push(line)
238235
}
239236
return modifiedLines.join('\n')
240-
241237
} catch (error) {
242238
logError('getNoteContentAsHTML', error.message)
243239
return '<conversion error>'
244240
}
245241
}
246242

247-
248243
/**
249244
* This function creates the webkit console.log/error handler for HTML messages to get back to NP console.log
250245
* @returns {string} - the javascript (without a tag)
@@ -566,7 +561,10 @@ export async function showHTMLV2(body: string, opts: HtmlWindowOptions): Promise
566561
try {
567562
const screenWidth = NotePlan.environment.screenWidth
568563
const screenHeight = NotePlan.environment.screenHeight
569-
logDebug('HTMLView / showHTMLV2', `starting with customId ${opts.customId ?? ''} and reuseUsersWindowRect ${String(opts.reuseUsersWindowRect) ?? '??'} for screen dimensions ${screenWidth}x${screenHeight}`)
564+
logDebug(
565+
'HTMLView / showHTMLV2',
566+
`starting with customId ${opts.customId ?? ''} and reuseUsersWindowRect ${String(opts.reuseUsersWindowRect) ?? '??'} for screen dimensions ${screenWidth}x${screenHeight}`,
567+
)
570568

571569
// Assemble the parts of the HTML into a single string
572570
const fullHTMLStr = assembleHTMLParts(body, opts)
@@ -592,8 +590,8 @@ export async function showHTMLV2(body: string, opts: HtmlWindowOptions): Promise
592590
winOptions = {
593591
x: opts.x ?? (screenWidth - (screenWidth - (opts.paddingWidth ?? 0) * 2)) / 2,
594592
y: opts.y ?? (screenHeight - (screenHeight - (opts.paddingHeight ?? 0) * 2)) / 2,
595-
width: opts.width ?? (screenWidth - (opts.paddingWidth ?? 0) * 2),
596-
height: opts.height ?? (screenHeight - (opts.paddingHeight ?? 0) * 2),
593+
width: opts.width ?? screenWidth - (opts.paddingWidth ?? 0) * 2,
594+
height: opts.height ?? screenHeight - (opts.paddingHeight ?? 0) * 2,
597595
shouldFocus: opts.shouldFocus,
598596
id: cId, // don't need both ... but trying to work out which is the current one for the API
599597
windowId: cId,
@@ -603,7 +601,6 @@ export async function showHTMLV2(body: string, opts: HtmlWindowOptions): Promise
603601
// logDebug('showHTMLV2', `- Trying to use user's saved Rect from pref for ${cId}`)
604602
const storedRect = getStoredWindowRect(cId)
605603
if (storedRect) {
606-
607604
winOptions = {
608605
x: storedRect.x,
609606
y: storedRect.y,

helpers/NPFrontMatter.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ export function setFrontMatterVars(note: CoreNoteFields, varObj: { [string]: str
346346
logDebug(`setFrontMatterVars`, `- BEFORE ensureFM: hasFrontmatter:${String(noteHasFrontMatter(note) || '')} note has ${note.paragraphs.length} lines`)
347347
const hasFM = ensureFrontmatter(note, true, title)
348348
logDebug('note.paragraphs', `- AFTER ensureFM has ${note.paragraphs.length} lines, that starts:`)
349-
// console.log(note.paragraphs.slice(0, 7).map(p => p.content).join('\n'))
349+
350350
if (!hasFM) {
351351
throw new Error(`setFrontMatterVars: Could not add front matter to note which has no title. Note should have a title, or you should pass in a title in the varObj.`)
352352
}
@@ -364,7 +364,6 @@ export function setFrontMatterVars(note: CoreNoteFields, varObj: { [string]: str
364364
removeFrontMatter(note)
365365
writeFrontMatter(note, changedAttributes)
366366
logDebug('setFrontMatterVars', `- ENDING with ${note.paragraphs.length} lines, that starts:`)
367-
// console.log(note.paragraphs.slice(0, 7).map(p => p.content).join('\n'))
368367
} else {
369368
logError('setFrontMatterVars', `- could not change frontmatter for note "${note.filename || ''}" because it has no frontmatter.`)
370369
}

0 commit comments

Comments
 (0)