Skip to content

Commit 19741d2

Browse files
committed
Solve boolean pref issue
1 parent f18213b commit 19741d2

34 files changed

+1628
-1249
lines changed

.github/dependabot.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,8 @@ updates:
99
directory: "/" # Location of package manifests
1010
schedule:
1111
interval: "weekly"
12+
groups:
13+
all-non-major:
14+
update-types:
15+
- "minor"
16+
- "patch"

.github/renovate.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
{
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3-
"extends": ["config:recommended", ":semanticPrefixChore", ":prHourlyLimitNone", ":prConcurrentLimitNone", ":enableVulnerabilityAlerts", ":dependencyDashboard", "group:allNonMajor", "schedule:weekly"],
3+
"extends": [
4+
"config:recommended",
5+
":semanticPrefixChore",
6+
":prHourlyLimitNone",
7+
":prConcurrentLimitNone",
8+
":enableVulnerabilityAlerts",
9+
":dependencyDashboard",
10+
"group:allNonMajor",
11+
"schedule:weekly"
12+
],
413
"labels": ["dependencies"],
514
"packageRules": [
615
{
7-
"matchPackageNames": ["zotero-plugin-toolkit", "zotero-types", "zotero-plugin-scaffold"],
16+
"matchPackageNames": [
17+
"zotero-plugin-toolkit",
18+
"zotero-types",
19+
"zotero-plugin-scaffold"
20+
],
821
"schedule": ["at any time"],
922
"automerge": true
1023
}

.gitignore

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
### Local config files ###
2-
.env
2+
3+
4+
# dot files
5+
.DS_Store
36

47
### Runtime ###
58
node_modules/
6-
build/
9+
710
dist/
8-
logs/
11+
912
yarn.lock
1013
.DS_Store
1114

@@ -14,7 +17,18 @@ yarn.lock
1417
# .idea/
1518

1619
### Generated files ###
20+
eslint.config.js
1721

18-
22+
# Node.js
1923
node_modules
20-
.scaffold
24+
pnpm-lock.yaml
25+
yarn.lock
26+
27+
# TSC
28+
tsconfig.tsbuildinfo
29+
30+
# Scaffold
31+
.env
32+
.scaffold/
33+
build/
34+
logs/

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@
88
**/*.lock
99
logs
1010
**/node_modules
11+
package-lock.json
12+
yarn.lock
13+
pnpm-lock.yaml
1114
**/*_lintignore*
1215
**/*-lintignore*

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
<!-- [![GitHub Downloads release (by tag)](https://img.shields.io/github/downloads/daeh/zotero-markdb-connect/v0.0.25/total?style=for-the-badge)](https://github.com/daeh/zotero-markdb-connect/releases/tag/v0.0.27) -->
44

5-
<!-- [![GitHub release (with filter)](https://img.shields.io/github/v/release/daeh/zotero-markdb-connect?style=for-the-badge&filter=*v0.1.5*)](https://github.com/daeh/zotero-markdb-connect/releases/tag/v0.1.3) [![GitHub all releases](https://img.shields.io/github/downloads/daeh/zotero-markdb-connect/total?style=for-the-badge&color=forestgreen)](https://github.com/daeh/zotero-markdb-connect/releases/tag/v0.1.3) -->
5+
<!-- [![GitHub release (with filter)](https://img.shields.io/github/v/release/daeh/zotero-markdb-connect?style=for-the-badge&filter=*v0.1.6*)](https://github.com/daeh/zotero-markdb-connect/releases/tag/v0.1.3) [![GitHub all releases](https://img.shields.io/github/downloads/daeh/zotero-markdb-connect/total?style=for-the-badge&color=forestgreen)](https://github.com/daeh/zotero-markdb-connect/releases/tag/v0.1.3) -->
66

7-
<!-- [![GitHub release (latest by SemVer including pre-releases)](https://img.shields.io/github/downloads-pre/daeh/zotero-markdb-connect/latest/total?style=for-the-badge&label=downloads@prerelease)](https://github.com/daeh/zotero-markdb-connect/releases/tag/v0.1.5) [![GitHub release (by tag)](https://img.shields.io/github/downloads/daeh/zotero-markdb-connect/v0.0.25/total?style=for-the-badge)](https://github.com/daeh/zotero-markdb-connect/releases/tag/v0.0.27) -->
7+
<!-- [![GitHub release (latest by SemVer including pre-releases)](https://img.shields.io/github/downloads-pre/daeh/zotero-markdb-connect/latest/total?style=for-the-badge&label=downloads@prerelease)](https://github.com/daeh/zotero-markdb-connect/releases/tag/v0.1.6) [![GitHub release (by tag)](https://img.shields.io/github/downloads/daeh/zotero-markdb-connect/v0.0.25/total?style=for-the-badge)](https://github.com/daeh/zotero-markdb-connect/releases/tag/v0.0.27) -->
88

99
<!-- [![GitHub release (latest by date)](https://img.shields.io/github/v/release/daeh/zotero-markdb-connect?style=for-the-badge)](https://github.com/daeh/zotero-markdb-connect/releases/latest) [![GitHub all releases](https://img.shields.io/github/downloads/daeh/zotero-markdb-connect/total?style=for-the-badge&color=forestgreen)](https://github.com/daeh/zotero-markdb-connect/releases/latest) -->
1010

addon/bootstrap.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable no-undef */
2+
13
/**
24
* Most of this code is from Zotero team's official Make It Red example[1]
35
* or the Zotero 7 documentation[2].
@@ -21,7 +23,7 @@ async function startup({ id, version, resourceURI, rootURI }, reason) {
2123
Components.interfaces.amIAddonManagerStartup,
2224
)
2325
var manifestURI = Services.io.newURI(rootURI + 'manifest.json')
24-
chromeHandle = aomStartup.registerChrome(manifestURI, [['content', '__addonRef__', rootURI + 'chrome/content/']])
26+
chromeHandle = aomStartup.registerChrome(manifestURI, [['content', '__addonRef__', rootURI + 'content/']])
2527

2628
/**
2729
* Global variables for plugin code.
@@ -34,7 +36,7 @@ async function startup({ id, version, resourceURI, rootURI }, reason) {
3436
}
3537
ctx._globalThis = ctx
3638

37-
Services.scriptloader.loadSubScript(`${rootURI}/chrome/content/scripts/__addonRef__.js`, ctx)
39+
Services.scriptloader.loadSubScript(`${rootURI}/content/scripts/__addonRef__.js`, ctx)
3840
Zotero.__addonInstance__.hooks.onStartup()
3941
}
4042

@@ -58,7 +60,7 @@ function shutdown({ id, version, resourceURI, rootURI }, reason) {
5860

5961
Cc['@mozilla.org/intl/stringbundle;1'].getService(Components.interfaces.nsIStringBundleService).flushBundles()
6062

61-
Cu.unload(`${rootURI}/chrome/content/scripts/__addonRef__.js`)
63+
Cu.unload(`${rootURI}/content/scripts/__addonRef__.js`)
6264

6365
if (chromeHandle) {
6466
chromeHandle.destruct()
File renamed without changes.

addon/chrome/content/preferences.xhtml renamed to addon/content/preferences.xhtml

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</linkset>
1616
<vbox
1717
id="zotero-prefpane-__addonRef__"
18-
onload="Zotero.__addonInstance__.hooks.onPrefsEvent('load', {window})">
18+
onload="Zotero.__addonInstance__.hooks.onPrefsEvent('load', { window });">
1919
<groupbox>
2020
<!--<label class="mdbc-pref-text-center"><html:h1 data-l10n-id="pref-title"> </html:h1></label>-->
2121
<!--<caption-->
@@ -42,7 +42,7 @@
4242
<html:input
4343
type="text"
4444
id="zotero-prefpane-__addonRef__-sourcedir"
45-
preference="__prefsPrefix__.sourcedir"
45+
preference="sourcedir"
4646
readonly="true"
4747
class="mdbc-pref-textbox-flex1" />
4848
<button
@@ -57,7 +57,7 @@
5757

5858
<radiogroup
5959
id="zotero-prefpane-__addonRef__-filefilterstrategy"
60-
preference="__prefsPrefix__.filefilterstrategy">
60+
preference="filefilterstrategy">
6161
<radio
6262
id="zotero-prefpane-__addonRef__-filefilterstrategy-default"
6363
value="default"
@@ -98,7 +98,7 @@
9898
><html:input
9999
type="text"
100100
id="zotero-prefpane-__addonRef__-filepattern"
101-
preference="__prefsPrefix__.filepattern"
101+
preference="filepattern"
102102
class="mdbc-pref-textbox-partialwidth"
103103
onchange="return Zotero.__addonInstance__.hooks.onPrefsEvent('checkRegExpValid', {value: this.value})" /><html:span class="mdbc-pref-options-span-right mdbc-pref-options-code-span"
104104
><html:code>/i</html:code></html:span
@@ -124,7 +124,7 @@
124124

125125
<radiogroup
126126
id="zotero-prefpane-__addonRef__-matchstrategy"
127-
preference="__prefsPrefix__.matchstrategy">
127+
preference="matchstrategy">
128128
<groupbox>
129129
<radio
130130
id="zotero-prefpane-__addonRef__-matchstrategy-bbtcitekeyyaml"
@@ -147,7 +147,7 @@
147147
><html:input
148148
type="text"
149149
id="zotero-prefpane-__addonRef__-bbtyamlkeyword"
150-
preference="__prefsPrefix__.bbtyamlkeyword"
150+
preference="bbtyamlkeyword"
151151
class="mdbc-pref-textbox-partialwidth"
152152
onchange="Zotero.__addonInstance__.hooks.onPrefsEvent('checkMetadataFormat', {value: this.value})" /><html:span class="mdbc-pref-options-span-right"> </html:span>
153153
</hbox>
@@ -182,7 +182,7 @@
182182
><html:input
183183
type="text"
184184
id="zotero-prefpane-__addonRef__-bbtregexp"
185-
preference="__prefsPrefix__.bbtregexp"
185+
preference="bbtregexp"
186186
class="mdbc-pref-textbox-partialwidth"
187187
onchange="return Zotero.__addonInstance__.hooks.onPrefsEvent('checkRegExpValid', {value: this.value})" /><html:span class="mdbc-pref-options-span-right mdbc-pref-options-code-span"
188188
><html:code>/m</html:code></html:span
@@ -221,7 +221,7 @@
221221
><html:input
222222
type="text"
223223
id="zotero-prefpane-__addonRef__-zotkeyregexp"
224-
preference="__prefsPrefix__.zotkeyregexp"
224+
preference="zotkeyregexp"
225225
class="mdbc-pref-textbox-partialwidth"
226226
onchange="return Zotero.__addonInstance__.hooks.onPrefsEvent('checkRegExpValid', {value: this.value})" /><html:span class="mdbc-pref-options-span-right mdbc-pref-options-code-span"
227227
><html:code>/m</html:code></html:span
@@ -247,7 +247,7 @@
247247

248248
<radiogroup
249249
id="zotero-prefpane-__addonRef__-mdeditor"
250-
preference="__prefsPrefix__.mdeditor">
250+
preference="mdeditor">
251251
<!-- obsidian file resolution -->
252252
<groupbox>
253253
<radio
@@ -267,7 +267,7 @@
267267
><html:input
268268
type="text"
269269
id="zotero-prefpane-__addonRef__-obsidianvaultname"
270-
preference="__prefsPrefix__.obsidianvaultname"
270+
preference="obsidianvaultname"
271271
class="mdbc-pref-textbox-partialwidth" /><html:span class="mdbc-pref-options-span-right"> </html:span>
272272
</hbox>
273273
<label class="mdbc-pref-explication-minor"
@@ -278,14 +278,27 @@
278278
<separator />
279279

280280
<groupbox>
281-
<!-- filename or file path -->
282-
<checkbox
283-
label="Use filename instead of filepath in URI"
284-
id="zotero-prefpane-__addonRef__-obsidianresolvewithfile"
285-
preference="__prefsPrefix__.obsidianresolvewithfile" />
286281
<description class="mdbc-pref-explication-minor mdbc-pref-description-indent"
287282
>Use only the filename in the URI rather than using the full file path. This is only advised if the default is not working.</description
288283
>
284+
<hbox>
285+
<hbox align="center">
286+
<label value="URI param" />
287+
<menulist
288+
id="zotero-prefpane-__addonRef__-obsidianresolvespec"
289+
preference="obsidianresolvespec"
290+
native="true">
291+
<menupopup>
292+
<menuitem
293+
label="Path (recommended)"
294+
value="path" />
295+
<menuitem
296+
label="File"
297+
value="file" />
298+
</menupopup>
299+
</menulist>
300+
</hbox>
301+
</hbox>
289302
</groupbox>
290303
</html:div>
291304
</groupbox>
@@ -310,7 +323,7 @@
310323
><html:input
311324
type="text"
312325
id="zotero-prefpane-__addonRef__-logseqgraph"
313-
preference="__prefsPrefix__.logseqgraph"
326+
preference="logseqgraph"
314327
class="mdbc-pref-textbox-partialwidth" /><html:span class="mdbc-pref-options-span-right"> </html:span>
315328
</hbox>
316329
<label
@@ -324,7 +337,7 @@
324337
><html:input
325338
type="text"
326339
id="zotero-prefpane-__addonRef__-logseqprefix"
327-
preference="__prefsPrefix__.logseqprefix"
340+
preference="logseqprefix"
328341
class="mdbc-pref-textbox-partialwidth" /><html:span class="mdbc-pref-options-span-right"> </html:span>
329342
</hbox>
330343
<label
@@ -378,7 +391,7 @@
378391
><html:input
379392
type="text"
380393
id="zotero-prefpane-__addonRef__-tagstr"
381-
preference="__prefsPrefix__.tagstr"
394+
preference="tagstr"
382395
class="mdbc-pref-textbox-partialwidth"
383396
onchange="Zotero.__addonInstance__.hooks.onPrefsEvent('checkTagStr', {value: this.value})" /><html:span class="mdbc-pref-options-span-right"> </html:span>
384397
</hbox>
@@ -394,7 +407,7 @@
394407
<description>Whether to include items in Group Libraries when matching MD files, or only search for matches in the User Library.</description>
395408
<radiogroup
396409
id="zotero-prefpane-__addonRef__-grouplibraries"
397-
preference="__prefsPrefix__.grouplibraries">
410+
preference="grouplibraries">
398411
<radio
399412
label="Only match items in User Library."
400413
value="user" />
@@ -415,7 +428,7 @@
415428
<description>Whether to remove tags from Zotero items when no Markdown file is found.</description>
416429
<radiogroup
417430
id="zotero-prefpane-__addonRef__-removetags"
418-
preference="__prefsPrefix__.removetags">
431+
preference="removetags">
419432
<radio
420433
label="Keep Zotero tags synced with Markdown Database (recommended)."
421434
value="keepsynced" />
@@ -480,7 +493,7 @@
480493
<label value="Debug Log Level" />
481494
<menulist
482495
id="zotero-prefpane-__addonRef__-debugmode"
483-
preference="__prefsPrefix__.debugmode"
496+
preference="debugmode"
484497
native="true">
485498
<menupopup>
486499
<menuitem
@@ -501,7 +514,6 @@
501514
<!--<separator />-->
502515
</vbox>
503516

504-
505517
<vbox>
506518
<html:label
507519
data-l10n-id="pref-help"

addon/locale/en-US/preferences.ftl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ pref-filefilterstrategy-custom-desc2 = Default pattern is: ^@.+\.md$. NB optiona
2222
pref-matchstrategy-bbt-title = Match notes based on BetterBibTeX citekey
2323
pref-matchstrategy-bbt-desc = MarkDB-Connect will search for a BetterBibTeX citekey in the filename and/or metadata.
2424
25+
pref-dbapp-obsidian-resolve-with-file-checkbox =
26+
.label = Use filename instead of filepath in URI
27+
2528
calendar-view-toggle-day = Day
2629
.title = Switch to day view
2730

addon/manifest.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
"homepage_url": "__homepage__",
77
"author": "__author__",
88
"icons": {
9-
"48": "chrome/content/icons/favicon@0.5x.png",
10-
"96": "chrome/content/icons/favicon.png"
9+
"48": "content/icons/favicon@0.5x.png",
10+
"96": "content/icons/favicon.png"
1111
},
1212
"applications": {
1313
"zotero": {
1414
"id": "__addonID__",
1515
"update_url": "__updateURL__",
1616
"strict_min_version": "6.999",
17-
"strict_max_version": "7.1.*"
17+
"strict_max_version": "7.*"
1818
}
1919
}
2020
}

addon/prefs.js

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
11
/* eslint-disable no-undef */
2-
pref('__prefsPrefix__.enable', true)
2+
pref('enable', true)
33

44
//
55

6-
pref('__prefsPrefix__.configuration', '0.0.0')
7-
pref('__prefsPrefix__.debugmode', 'minimal')
6+
pref('configuration', '0.0.0')
7+
pref('debugmode', 'minimal')
88

9-
pref('__prefsPrefix__.sourcedir', '')
9+
pref('sourcedir', '')
1010

11-
pref('__prefsPrefix__.filefilterstrategy', ['default', 'customfileregexp'][0])
12-
pref('__prefsPrefix__.filepattern', '^@.+\\.md$')
11+
pref('filefilterstrategy', 'default') // ['default', 'customfileregexp'][0]
12+
pref('filepattern', '^@.+\\.md$')
1313

14-
pref('__prefsPrefix__.matchstrategy', ['bbtcitekeyyaml', 'bbtcitekeyregexp', 'zotitemkey'][0])
15-
pref('__prefsPrefix__.bbtyamlkeyword', '')
16-
pref('__prefsPrefix__.bbtregexp', '')
17-
pref('__prefsPrefix__.zotkeyregexp', '')
14+
pref('matchstrategy', 'bbtcitekeyyaml') // ['bbtcitekeyyaml', 'bbtcitekeyregexp', 'zotitemkey'][0]
15+
pref('bbtyamlkeyword', '')
16+
pref('bbtregexp', '')
17+
pref('zotkeyregexp', '')
1818

19-
pref('__prefsPrefix__.mdeditor', ['obsidian', 'logseq', 'system'][0])
20-
pref('__prefsPrefix__.obsidianvaultname', '')
21-
pref('__prefsPrefix__.obsidianresolvewithfile', [false, true][0])
19+
pref('mdeditor', 'obsidian') // ['obsidian', 'logseq', 'system'][0]
20+
pref('obsidianvaultname', '')
21+
// pref('obsidianresolvewithfile', false) // [false, true][0]
22+
pref('obsidianresolvespec', 'path') // ['path', 'file'][0]
2223

23-
pref('__prefsPrefix__.logseqgraph', '')
24-
pref('__prefsPrefix__.logseqprefix', '')
24+
pref('logseqgraph', '')
25+
pref('logseqprefix', '')
2526

26-
pref('__prefsPrefix__.grouplibraries', ['user', 'group'][0])
27-
pref('__prefsPrefix__.removetags', ['keepsynced', 'addonly'][0])
28-
pref('__prefsPrefix__.tagstr', 'ObsCite')
27+
pref('grouplibraries', 'user') // ['user', 'group'][0]
28+
pref('removetags', 'keepsynced') // ['keepsynced', 'addonly'][0]
29+
pref('tagstr', 'ObsCite')

0 commit comments

Comments
 (0)