mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-06-21 07:54:07 +00:00
Improve import logging
This commit is contained in:
parent
52d29ac0cf
commit
a9eab1b8fc
@ -127,6 +127,9 @@ DropZoneWidget.prototype.importData = function(dataTransfer) {
|
|||||||
var data = dataTransfer.getData(dataType.type);
|
var data = dataTransfer.getData(dataType.type);
|
||||||
// Import the tiddlers in the data
|
// Import the tiddlers in the data
|
||||||
if(data !== "" && data !== null) {
|
if(data !== "" && data !== null) {
|
||||||
|
if($tw.log.IMPORT) {
|
||||||
|
console.log("Importing data type '" + dataType.type + "', data: '" + data + "'")
|
||||||
|
}
|
||||||
var tiddlerFields = dataType.convertToFields(data);
|
var tiddlerFields = dataType.convertToFields(data);
|
||||||
if(!tiddlerFields.title) {
|
if(!tiddlerFields.title) {
|
||||||
tiddlerFields.title = this.wiki.generateNewTitle("Untitled");
|
tiddlerFields.title = this.wiki.generateNewTitle("Untitled");
|
||||||
@ -208,6 +211,9 @@ DropZoneWidget.prototype.handlePasteEvent = function(event) {
|
|||||||
text: str,
|
text: str,
|
||||||
type: type
|
type: type
|
||||||
};
|
};
|
||||||
|
if($tw.log.IMPORT) {
|
||||||
|
console.log("Importing string '" + str + "', type: '" + type + "'");
|
||||||
|
}
|
||||||
self.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify([tiddlerFields])});
|
self.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify([tiddlerFields])});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1102,7 +1102,7 @@ exports.readFile = function(file,callback) {
|
|||||||
var contentTypeInfo = $tw.config.contentTypeInfo[type],
|
var contentTypeInfo = $tw.config.contentTypeInfo[type],
|
||||||
isBinary = contentTypeInfo ? contentTypeInfo.encoding === "base64" : false;
|
isBinary = contentTypeInfo ? contentTypeInfo.encoding === "base64" : false;
|
||||||
// Log some debugging information
|
// Log some debugging information
|
||||||
if($tw.log.FILES) {
|
if($tw.log.IMPORT) {
|
||||||
console.log("Importing file '" + file.name + "', type: '" + type + "', isBinary: " + isBinary);
|
console.log("Importing file '" + file.name + "', type: '" + type + "', isBinary: " + isBinary);
|
||||||
}
|
}
|
||||||
// Create the FileReader
|
// Create the FileReader
|
||||||
|
14
editions/prerelease/tiddlers/ImportLogging.tid
Normal file
14
editions/prerelease/tiddlers/ImportLogging.tid
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
title: ImportLogging
|
||||||
|
created: 20141114100055595
|
||||||
|
modified: 20141114100055595
|
||||||
|
|
||||||
|
Browsers still have significant variations in their handling of drag and drop and clipboard operations.
|
||||||
|
|
||||||
|
You can switch on special logging to help debug issues:
|
||||||
|
|
||||||
|
# Open your browser JavaScript console
|
||||||
|
# Type:
|
||||||
|
#> ``$tw.log.IMPORT = true``
|
||||||
|
# Drag or paste a file to import it
|
||||||
|
# Look for debug information in the console. For example:
|
||||||
|
#> ``Importing file 'my-image.png', type: 'image/png', isBinary: true``
|
Loading…
x
Reference in New Issue
Block a user