mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-09-07 10:29:12 +00:00
Restructure the sqlite3 store as a separate plugin
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
"tiddlywiki/codemirror",
|
||||
"tiddlywiki/menubar",
|
||||
"tiddlywiki/jszip",
|
||||
"tiddlywiki/demo-alternate-store"
|
||||
"tiddlywiki/sqlite3store"
|
||||
],
|
||||
"themes": [
|
||||
"tiddlywiki/vanilla",
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"tiddlywiki/evernote",
|
||||
"tiddlywiki/internals",
|
||||
"tiddlywiki/menubar",
|
||||
"tiddlywiki/demo-alternate-store"
|
||||
"tiddlywiki/sqlite3store"
|
||||
],
|
||||
"themes": [
|
||||
"tiddlywiki/vanilla",
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
title: $:/config/DemoAlternateStore/CurrentStore
|
||||
text: $:/plugins/tiddlywiki/demo-alternate-store/engines/sqlite/main
|
||||
@@ -1,6 +0,0 @@
|
||||
title: $:/plugins/tiddlywiki/demo-alternate-store/engines/sqlite/main
|
||||
tags: $:/tags/AlternateStoreArea
|
||||
|
||||
{{$:/plugins/tiddlywiki/demo-alternate-store/engines/sqlite/sqlite3.js}}
|
||||
`var sqlite3wasm = "`<$text text={{$:/plugins/tiddlywiki/demo-alternate-store/engines/sqlite/sqlite3.wasm}}/>`";`
|
||||
{{$:/plugins/tiddlywiki/demo-alternate-store/engines/sqlite/rawmarkup.js}}
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*\
|
||||
title: $:/plugins/tiddlywiki/demo-alternate-store/engines/plain-js/rawmarkup.js
|
||||
title: $:/plugins/tiddlywiki/demo-alternate-store/rawmarkup.js
|
||||
type: text/plain
|
||||
tags: $:/tags/AlternateStoreArea
|
||||
|
||||
@@ -423,4 +423,4 @@ $tw.Wiki = function(options) {
|
||||
};
|
||||
|
||||
})();
|
||||
//# sourceURL=$:/plugins/tiddlywiki/demo-alternate-store/engines/plain-js/rawmarkup.js
|
||||
//# sourceURL=$:/plugins/tiddlywiki/demo-alternate-store/rawmarkup.js
|
||||
@@ -2,5 +2,5 @@ title: $:/plugins/tiddlywiki/demo-alternate-store/rawmarkup
|
||||
tags: $:/tags/RawMarkupWikified
|
||||
|
||||
`<script>`
|
||||
<$transclude $tiddler={{{ [[$:/config/DemoAlternateStore/CurrentStore]get[text]else[$:/plugins/tiddlywiki/demo-alternate-store/engines/plain-js/rawmarkup.js]] }}} mode="inline"/>
|
||||
{{$:/plugins/tiddlywiki/demo-alternate-store/rawmarkup.js}}
|
||||
`</script>`
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@
|
||||
"file": "sqlite3.js",
|
||||
"fields": {
|
||||
"type": "text/plain",
|
||||
"title": "$:/plugins/tiddlywiki/demo-alternate-store/engines/sqlite/sqlite3.js"
|
||||
"title": "$:/plugins/tiddlywiki/sqlite3store/sqlite3.js"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -12,7 +12,7 @@
|
||||
"encoding": "base64",
|
||||
"fields": {
|
||||
"type": "application/wasm",
|
||||
"title": "$:/plugins/tiddlywiki/demo-alternate-store/engines/sqlite/sqlite3.wasm"
|
||||
"title": "$:/plugins/tiddlywiki/sqlite3store/sqlite3.wasm"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"title": "$:/plugins/tiddlywiki/sqlite3store",
|
||||
"name": "Sqlite3-based store",
|
||||
"description": "Sqlite3-based wiki store implementation",
|
||||
"list": "readme"
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*\
|
||||
title: $:/plugins/tiddlywiki/sqlite3store/rawmarkup-bottombody.js
|
||||
type: text/plain
|
||||
|
||||
Startup code injected as raw markup at the bottom of the body section
|
||||
|
||||
\*/
|
||||
|
||||
(function() {
|
||||
|
||||
// Create a Blob URL for our wasm data
|
||||
var decodedData = window.atob(sqlite3wasm),
|
||||
uInt8Array = new Uint8Array(decodedData.length);
|
||||
for (var i = 0; i < decodedData.length; ++i) {
|
||||
uInt8Array[i] = decodedData.charCodeAt(i);
|
||||
}
|
||||
var blobUrl = URL.createObjectURL(new Blob([uInt8Array],{type: "application/wasm"}));
|
||||
|
||||
// Pass sqlite an URLSearchParams object containing the Blob URL of our wasm data
|
||||
self.sqlite3InitModuleState.urlParams = new URLSearchParams();
|
||||
self.sqlite3InitModuleState.urlParams.set("sqlite3.wasm",blobUrl);
|
||||
|
||||
// Initialise sqlite
|
||||
self.sqlite3InitModule().then((sqlite3)=>{
|
||||
// Save a reference to the sqlite3 object
|
||||
$tw.sqlite3 = sqlite3;
|
||||
// Boot TiddlyWiki
|
||||
$tw.boot.boot();
|
||||
});
|
||||
|
||||
})();
|
||||
//# sourceURL=$:/plugins/tiddlywiki/sqlite3store/rawmarkup-bottombody.js
|
||||
@@ -0,0 +1,8 @@
|
||||
title: $:/plugins/tiddlywiki/sqlite3store/rawmarkup/bottombody
|
||||
tags: $:/tags/RawMarkupWikified/BottomBody
|
||||
|
||||
`<script>`
|
||||
{{$:/plugins/tiddlywiki/sqlite3store/sqlite3.js}}
|
||||
`var sqlite3wasm = "`<$text text={{$:/plugins/tiddlywiki/sqlite3store/sqlite3.wasm}}/>`";`
|
||||
{{$:/plugins/tiddlywiki/sqlite3store/rawmarkup-bottombody.js}}
|
||||
`</script>`
|
||||
+2
-24
@@ -1,5 +1,5 @@
|
||||
/*\
|
||||
title: $:/plugins/tiddlywiki/demo-alternate-store/engines/sqlite/rawmarkup.js
|
||||
title: $:/plugins/tiddlywiki/sqlite3store/rawmarkup.js
|
||||
type: text/plain
|
||||
|
||||
Startup code injected as raw markup
|
||||
@@ -17,28 +17,6 @@ $tw.boot.preloadDirty = $tw.boot.preloadDirty || [];
|
||||
// Tell TiddlyWiki not to boot itself
|
||||
$tw.boot.suppressBoot = true;
|
||||
|
||||
// Create a Blob URL for our wasm data
|
||||
var decodedData = window.atob(sqlite3wasm),
|
||||
uInt8Array = new Uint8Array(decodedData.length);
|
||||
for (var i = 0; i < decodedData.length; ++i) {
|
||||
uInt8Array[i] = decodedData.charCodeAt(i);
|
||||
}
|
||||
var blobUrl = URL.createObjectURL(new Blob([uInt8Array],{type: "application/wasm"}));
|
||||
|
||||
// Pass sqlite an URLSearchParams object containing the Blob URL of our wasm data
|
||||
self.sqlite3InitModuleState.urlParams = new URLSearchParams();
|
||||
self.sqlite3InitModuleState.urlParams.set("sqlite3.wasm",blobUrl);
|
||||
|
||||
// Initialise sqlite
|
||||
self.sqlite3InitModule().then((sqlite3)=>{
|
||||
// Save a reference to the sqlite3 object
|
||||
$tw.sqlite3 = sqlite3;
|
||||
// Boot TiddlyWiki – the timeout appears to be needed to give boot.js a chance to run
|
||||
setTimeout(function() {
|
||||
$tw.boot.boot();
|
||||
},0);
|
||||
});
|
||||
|
||||
$tw.Wiki = function(options) {
|
||||
options = options || {};
|
||||
var self = this,
|
||||
@@ -447,4 +425,4 @@ $tw.Wiki = function(options) {
|
||||
};
|
||||
|
||||
})();
|
||||
//# sourceURL=$:/plugins/tiddlywiki/demo-alternate-store/engines/sqlite/rawmarkup.js
|
||||
//# sourceURL=$:/plugins/tiddlywiki/sqlite3store/rawmarkup.js
|
||||
@@ -0,0 +1,6 @@
|
||||
title: $:/plugins/tiddlywiki/sqlite3store/rawmarkup
|
||||
tags: $:/tags/RawMarkupWikified
|
||||
|
||||
`<script>`
|
||||
{{$:/plugins/tiddlywiki/sqlite3store/rawmarkup.js}}
|
||||
`</script>`
|
||||
@@ -0,0 +1,3 @@
|
||||
title: $:/plugins/tiddlywiki/sqlite3store/readme
|
||||
|
||||
Wiki store implementation based on sqlite3 WASM build.
|
||||
Reference in New Issue
Block a user