Compare commits

..
7 changed files with 81 additions and 7 deletions
+54
View File
@@ -0,0 +1,54 @@
/*\
title: $:/core/modules/debug-view.js
type: application/javascript
module-type: global
debug-view module supports the optional external debug window
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
var dm = $tw.utils.domMaker;
/*
Instantiate the debug view
*/
function DebugView(options) {
if($tw.browser) {
this.outputFilters = dm("div",{
text: "Yes"
})
this.container = dm("div",{
"class": "tc-debug-view",
children: [
dm("div",{
children: [
dm("h1",{
text: "TiddlyWiki Debug View"
}),
dm("h2",{
text: "Filter Execution"
}),
this.outputFilters
]
})
]
});
document.body.appendChild(this.container);
}
}
/*
Show a generic network error alert
*/
DebugView.prototype.displayError = function(msg,err) {
};
exports.DebugView = DebugView;
})();
+8
View File
@@ -330,6 +330,14 @@ exports.compileFilter = function(filterString) {
} }
})()); })());
}); });
// If we're debugging then wrap each operation function with debug code
if(true) {
$tw.utils.each(operationFunctions,function(operationFunction,index) {
operationFunctions[index] = function(results,source,widget) {
return operationFunction(results,source,widget);
};
});
}
// Return a function that applies the operations to a source iterator of tiddler titles // Return a function that applies the operations to a source iterator of tiddler titles
var fnMeasured = $tw.perf.measure("filter: " + filterString,function filterFunction(source,widget) { var fnMeasured = $tw.perf.measure("filter: " + filterString,function filterFunction(source,widget) {
if(!source) { if(!source) {
+6 -6
View File
@@ -32,18 +32,18 @@ FieldIndexer.prototype.setMaxIndexedValueLength = function(length) {
FieldIndexer.prototype.addIndexMethods = function() { FieldIndexer.prototype.addIndexMethods = function() {
var self = this; var self = this;
// get all tiddlers, including those overwrite shadow tiddlers
this.wiki.each.byField = function(name,value) { this.wiki.each.byField = function(name,value) {
var titles = self.wiki.allTitles(), var lookup = self.lookup(name,value);
lookup = self.lookup(name,value);
return lookup && lookup.filter(function(title) { return lookup && lookup.filter(function(title) {
return titles.indexOf(title) !== -1; return self.wiki.tiddlerExists(title)
}); });
}; };
// get shadow tiddlers, including shadow tiddlers that is overwritten
this.wiki.eachShadow.byField = function(name,value) { this.wiki.eachShadow.byField = function(name,value) {
var titles = self.wiki.allShadowTitles(), var lookup = self.lookup(name,value);
lookup = self.lookup(name,value);
return lookup && lookup.filter(function(title) { return lookup && lookup.filter(function(title) {
return titles.indexOf(title) !== -1; return self.wiki.isShadowTiddler(title)
}); });
}; };
this.wiki.eachTiddlerPlusShadows.byField = function(name,value) { this.wiki.eachTiddlerPlusShadows.byField = function(name,value) {
+2
View File
@@ -23,6 +23,8 @@ var PERFORMANCE_INSTRUMENTATION_CONFIG_TITLE = "$:/config/Performance/Instrument
var widget = require("$:/core/modules/widgets/widget.js"); var widget = require("$:/core/modules/widgets/widget.js");
exports.startup = function() { exports.startup = function() {
// Debug view
$tw.debugView = new $tw.DebugView();
// Minimal browser detection // Minimal browser detection
if($tw.browser) { if($tw.browser) {
$tw.browser.isIE = (/msie|trident/i.test(navigator.userAgent)); $tw.browser.isIE = (/msie|trident/i.test(navigator.userAgent));
+1 -1
View File
@@ -259,7 +259,7 @@ DropZoneWidget.prototype.handlePasteEvent = function(event) {
} }
}; };
// Let the browser handle it if we're in a textarea or input box // Let the browser handle it if we're in a textarea or input box
if(["TEXTAREA","INPUT"].indexOf(event.target.tagName) == -1 && !event.target.isContentEditable) { if(["TEXTAREA","INPUT"].indexOf(event.target.tagName) == -1 && !event.target.isContentEditable && !event.twEditor) {
var self = this, var self = this,
items = event.clipboardData.items; items = event.clipboardData.items;
// Enumerate the clipboard items // Enumerate the clipboard items
+4
View File
@@ -1,11 +1,13 @@
title: $:/language/Docs/Fields/ title: $:/language/Docs/Fields/
_canonical_uri: Pełny adres URL do zewnętrznego obrazu _canonical_uri: Pełny adres URL do zewnętrznego obrazu
author: Imię autora wtyczki
bag: Nazwa worka, z ktorego pochodzi tiddler bag: Nazwa worka, z ktorego pochodzi tiddler
caption: Tekst wyświetlany na zakładce lub przycisku caption: Tekst wyświetlany na zakładce lub przycisku
code-body: Ustawienie wartości na ''tak'' spowoduje wyświetlanie tiddlera jako kod code-body: Ustawienie wartości na ''tak'' spowoduje wyświetlanie tiddlera jako kod
color: Wartość koloru CSS powiążanego z tym tiddlerem color: Wartość koloru CSS powiążanego z tym tiddlerem
component: Nazwa komponentu odpowiedzialnego za [[alert|AlertMechanism]] component: Nazwa komponentu odpowiedzialnego za [[alert|AlertMechanism]]
core-version: Wersja TiddlyWiki która jest wspierana przez wtyczkę
current-tiddler: Używane by zapamiętać ostatniego tiddlera w [[liście historii|HistoryMechanism]] current-tiddler: Używane by zapamiętać ostatniego tiddlera w [[liście historii|HistoryMechanism]]
created: Data kiedy utworzono tiddlera created: Data kiedy utworzono tiddlera
creator: Imię twórcy tiddlera creator: Imię twórcy tiddlera
@@ -22,7 +24,9 @@ list-before: Jeżeli ustawione, nazwa tiddlera przed którym ten tiddler będzie
list-after: Jeżeli ustawione, nazwa tiddlera po którym ten tiddler będzie dodany w sortowanej liście nazw tiddlerów; lub na końcu listy jeżeli pole jest obecne ale puste list-after: Jeżeli ustawione, nazwa tiddlera po którym ten tiddler będzie dodany w sortowanej liście nazw tiddlerów; lub na końcu listy jeżeli pole jest obecne ale puste
modified: Czas i data ostatniej modyfikacji modified: Czas i data ostatniej modyfikacji
modifier: Tytuł tiddlera powiązanego z osobą, która ostatnio modyfikowała tego tiddlera modifier: Tytuł tiddlera powiązanego z osobą, która ostatnio modyfikowała tego tiddlera
module-type: Rodzaj modułu używany przez wtyczki napisane w javascripcie
name: Czytelna nazwa powiązana z tiddlerem wtyczki name: Czytelna nazwa powiązana z tiddlerem wtyczki
parent-plugin: Określa nadrzędną wtyczkę
plugin-priority: Numeryczna wartość określająca tiddlera wtyczki plugin-priority: Numeryczna wartość określająca tiddlera wtyczki
plugin-type: Typ tiddlera wtyczki plugin-type: Typ tiddlera wtyczki
revision: Numer rewizji tiddlera przechowywany na serwerze revision: Numer rewizji tiddlera przechowywany na serwerze
+6
View File
@@ -220,9 +220,15 @@ function CodeMirrorEngine(options) {
} }
}); });
this.cm.on("paste",function(cm,event) { this.cm.on("paste",function(cm,event) {
event["twEditor"] = true;
self.widget.handlePasteEvent.call(self.widget,event); self.widget.handlePasteEvent.call(self.widget,event);
}); });
} else {
this.cm.on("paste",function(cm,event){
event["twEditor"] = true;
});
} }
;
} }
/* /*