expo-tiddlywiki-filesystem-android-external-storage 2.1.1 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -832,27 +832,46 @@ class ExternalStorageModule : Module() {
|
|
|
832
832
|
val companionFile = File(companionPath)
|
|
833
833
|
|
|
834
834
|
if (companionFile.exists()) {
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
835
|
+
val tiddlerType = json.optString("type", "text/vnd.tiddlywiki")
|
|
836
|
+
val hasModuleType = json.has("module-type")
|
|
837
|
+
val hasPluginType = json.has("plugin-type")
|
|
838
|
+
|
|
839
|
+
// Determine whether this companion is a text file whose content
|
|
840
|
+
// should be loaded as the tiddler's "text" field.
|
|
841
|
+
// JS modules, CSS, JSON, and other text-based companions need their content.
|
|
842
|
+
// Binary companions (images, pdfs, etc.) should NOT have their content loaded;
|
|
843
|
+
// they use _canonical_uri instead (handled later by JS).
|
|
844
|
+
val isTextCompanion = companionPath.endsWith(".json") ||
|
|
845
|
+
companionPath.endsWith(".js") ||
|
|
846
|
+
companionPath.endsWith(".css") ||
|
|
847
|
+
companionPath.endsWith(".svg") ||
|
|
848
|
+
companionPath.endsWith(".txt") ||
|
|
849
|
+
companionPath.endsWith(".html") ||
|
|
850
|
+
companionPath.endsWith(".htm") ||
|
|
851
|
+
tiddlerType.startsWith("text/") ||
|
|
852
|
+
tiddlerType == "application/javascript" ||
|
|
853
|
+
tiddlerType == "application/json" ||
|
|
854
|
+
tiddlerType == "application/x-tiddler-dictionary"
|
|
855
|
+
|
|
856
|
+
if (isTextCompanion) {
|
|
838
857
|
val shouldIncludeText = if (quickLoadMode) {
|
|
839
858
|
shouldPreserveFullTextInQuickLoad(
|
|
840
859
|
json.optString("title", ""),
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
860
|
+
tiddlerType,
|
|
861
|
+
hasModuleType,
|
|
862
|
+
hasPluginType,
|
|
844
863
|
)
|
|
845
864
|
} else {
|
|
846
865
|
true
|
|
847
866
|
}
|
|
848
867
|
if (shouldIncludeText) {
|
|
849
|
-
val
|
|
850
|
-
json.put("text",
|
|
868
|
+
val textContent = companionFile.readText(Charsets.UTF_8)
|
|
869
|
+
json.put("text", textContent)
|
|
851
870
|
} else {
|
|
852
871
|
json.put("_is_skinny", "yes")
|
|
853
872
|
}
|
|
854
873
|
}
|
|
855
|
-
// For
|
|
874
|
+
// For binary companions (images, etc.), we don't set _canonical_uri here —
|
|
856
875
|
// that requires knowing the workspace base path. JS side handles it.
|
|
857
876
|
}
|
|
858
877
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-tiddlywiki-filesystem-android-external-storage",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Expo native module for TidGi-Mobile: external storage I/O + TiddlyWiki .tid/.meta/.json batch parsing in Kotlin",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|