mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-01-22 19:04:38 +00:00
Compare commits
5 Commits
use-sticky
...
debug-view
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
898b61a3a0 | ||
|
|
5bce35d90b | ||
|
|
8d39ce95eb | ||
|
|
e313857822 | ||
|
|
ce988f909a |
54
core/modules/debug-view.js
Normal file
54
core/modules/debug-view.js
Normal 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;
|
||||
|
||||
})();
|
||||
@@ -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
|
||||
var fnMeasured = $tw.perf.measure("filter: " + filterString,function filterFunction(source,widget) {
|
||||
if(!source) {
|
||||
|
||||
@@ -32,18 +32,18 @@ FieldIndexer.prototype.setMaxIndexedValueLength = function(length) {
|
||||
|
||||
FieldIndexer.prototype.addIndexMethods = function() {
|
||||
var self = this;
|
||||
// get all tiddlers, including those overwrite shadow tiddlers
|
||||
this.wiki.each.byField = function(name,value) {
|
||||
var titles = self.wiki.allTitles(),
|
||||
lookup = self.lookup(name,value);
|
||||
var lookup = self.lookup(name,value);
|
||||
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) {
|
||||
var titles = self.wiki.allShadowTitles(),
|
||||
lookup = self.lookup(name,value);
|
||||
var lookup = self.lookup(name,value);
|
||||
return lookup && lookup.filter(function(title) {
|
||||
return titles.indexOf(title) !== -1;
|
||||
return self.wiki.isShadowTiddler(title)
|
||||
});
|
||||
};
|
||||
this.wiki.eachTiddlerPlusShadows.byField = function(name,value) {
|
||||
|
||||
@@ -84,7 +84,8 @@ exports.parseTokenString = function(source,pos,token) {
|
||||
};
|
||||
|
||||
/*
|
||||
Look for a token matching a regex. Returns null if not found, otherwise returns {type: "regexp", match:, start:, end:,}
|
||||
Look for a token matching a regex at a specified position. Returns null if not found, otherwise returns {type: "regexp", match:, start:, end:,}
|
||||
Use the "Y" (sticky) flag to avoid searching the entire rest of the string
|
||||
*/
|
||||
exports.parseTokenRegExp = function(source,pos,reToken) {
|
||||
var node = {
|
||||
@@ -145,7 +146,7 @@ exports.parseMacroParameter = function(source,pos) {
|
||||
start: pos
|
||||
};
|
||||
// Define our regexp
|
||||
var reMacroParameter = /(?:([A-Za-z0-9\-_]+)\s*:)?(?:\s*(?:"""([\s\S]*?)"""|"([^"]*)"|'([^']*)'|\[\[([^\]]*)\]\]|((?:(?:>(?!>))|[^\s>"'])+)))/g;
|
||||
var reMacroParameter = /(?:([A-Za-z0-9\-_]+)\s*:)?(?:\s*(?:"""([\s\S]*?)"""|"([^"]*)"|'([^']*)'|\[\[([^\]]*)\]\]|((?:(?:>(?!>))|[^\s>"'])+)))/y;
|
||||
// Skip whitespace
|
||||
pos = $tw.utils.skipWhiteSpace(source,pos);
|
||||
// Look for the parameter
|
||||
@@ -184,7 +185,7 @@ exports.parseMacroInvocation = function(source,pos) {
|
||||
params: []
|
||||
};
|
||||
// Define our regexps
|
||||
var reMacroName = /([^\s>"'=]+)/g;
|
||||
var reMacroName = /([^\s>"'=]+)/y;
|
||||
// Skip whitespace
|
||||
pos = $tw.utils.skipWhiteSpace(source,pos);
|
||||
// Look for a double less than sign
|
||||
@@ -221,7 +222,7 @@ exports.parseFilterVariable = function(source) {
|
||||
params: [],
|
||||
},
|
||||
pos = 0,
|
||||
reName = /([^\s"']+)/g;
|
||||
reName = /([^\s"']+)/y;
|
||||
// If there is no whitespace or it is an empty string then there are no macro parameters
|
||||
if(/^\S*$/.test(source)) {
|
||||
node.name = source;
|
||||
@@ -246,10 +247,10 @@ exports.parseAttribute = function(source,pos) {
|
||||
start: pos
|
||||
};
|
||||
// Define our regexps
|
||||
var reAttributeName = /([^\/\s>"'=]+)/g,
|
||||
reUnquotedAttribute = /([^\/\s<>"'=]+)/g,
|
||||
reFilteredValue = /\{\{\{([\S\s]+?)\}\}\}/g,
|
||||
reIndirectValue = /\{\{([^\}]+)\}\}/g;
|
||||
var reAttributeName = /([^\/\s>"'=]+)/y,
|
||||
reUnquotedAttribute = /([^\/\s<>"'=]+)/y,
|
||||
reFilteredValue = /\{\{\{([\S\s]+?)\}\}\}/y,
|
||||
reIndirectValue = /\{\{([^\}]+)\}\}/y;
|
||||
// Skip whitespace
|
||||
pos = $tw.utils.skipWhiteSpace(source,pos);
|
||||
// Get the attribute name
|
||||
|
||||
@@ -48,7 +48,7 @@ exports.parse = function() {
|
||||
// Advance the parser position to past the tag
|
||||
this.parser.pos = tag.end;
|
||||
// Check for an immediately following double linebreak
|
||||
var hasLineBreak = !tag.isSelfClosing && !!$tw.utils.parseTokenRegExp(this.parser.source,this.parser.pos,/([^\S\n\r]*\r?\n(?:[^\S\n\r]*\r?\n|$))/g);
|
||||
var hasLineBreak = !tag.isSelfClosing && !!$tw.utils.parseTokenRegExp(this.parser.source,this.parser.pos,/([^\S\n\r]*\r?\n(?:[^\S\n\r]*\r?\n|$))/y);
|
||||
// Set whether we're in block mode
|
||||
tag.isBlock = this.is.block || hasLineBreak;
|
||||
// Parse the body if we need to
|
||||
@@ -78,7 +78,7 @@ exports.parseTag = function(source,pos,options) {
|
||||
orderedAttributes: []
|
||||
};
|
||||
// Define our regexps
|
||||
var reTagName = /([a-zA-Z0-9\-\$]+)/g;
|
||||
var reTagName = /([a-zA-Z0-9\-\$]+)/y;
|
||||
// Skip whitespace
|
||||
pos = $tw.utils.skipWhiteSpace(source,pos);
|
||||
// Look for a less than sign
|
||||
@@ -129,7 +129,7 @@ exports.parseTag = function(source,pos,options) {
|
||||
pos = token.end;
|
||||
// Check for a required line break
|
||||
if(options.requireLineBreak) {
|
||||
token = $tw.utils.parseTokenRegExp(source,pos,/([^\S\n\r]*\r?\n(?:[^\S\n\r]*\r?\n|$))/g);
|
||||
token = $tw.utils.parseTokenRegExp(source,pos,/([^\S\n\r]*\r?\n(?:[^\S\n\r]*\r?\n|$))/y);
|
||||
if(!token) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ exports.parseImage = function(source,pos) {
|
||||
// Skip whitespace
|
||||
pos = $tw.utils.skipWhiteSpace(source,pos);
|
||||
// Get the source up to the terminating `]]`
|
||||
token = $tw.utils.parseTokenRegExp(source,pos,/(?:([^|\]]*?)\|)?([^\]]+?)\]\]/g);
|
||||
token = $tw.utils.parseTokenRegExp(source,pos,/(?:([^|\]]*?)\|)?([^\]]+?)\]\]/y);
|
||||
if(!token) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ var PERFORMANCE_INSTRUMENTATION_CONFIG_TITLE = "$:/config/Performance/Instrument
|
||||
var widget = require("$:/core/modules/widgets/widget.js");
|
||||
|
||||
exports.startup = function() {
|
||||
// Debug view
|
||||
$tw.debugView = new $tw.DebugView();
|
||||
// Minimal browser detection
|
||||
if($tw.browser) {
|
||||
$tw.browser.isIE = (/msie|trident/i.test(navigator.userAgent));
|
||||
|
||||
@@ -259,7 +259,7 @@ DropZoneWidget.prototype.handlePasteEvent = function(event) {
|
||||
}
|
||||
};
|
||||
// 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,
|
||||
items = event.clipboardData.items;
|
||||
// Enumerate the clipboard items
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
title: $:/language/Docs/Fields/
|
||||
|
||||
_canonical_uri: Pełny adres URL do zewnętrznego obrazu
|
||||
author: Imię autora wtyczki
|
||||
bag: Nazwa worka, z ktorego pochodzi tiddler
|
||||
caption: Tekst wyświetlany na zakładce lub przycisku
|
||||
code-body: Ustawienie wartości na ''tak'' spowoduje wyświetlanie tiddlera jako kod
|
||||
color: Wartość koloru CSS powiążanego z tym tiddlerem
|
||||
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]]
|
||||
created: Data kiedy utworzono 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
|
||||
modified: Czas i data ostatniej modyfikacji
|
||||
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
|
||||
parent-plugin: Określa nadrzędną wtyczkę
|
||||
plugin-priority: Numeryczna wartość określająca tiddlera wtyczki
|
||||
plugin-type: Typ tiddlera wtyczki
|
||||
revision: Numer rewizji tiddlera przechowywany na serwerze
|
||||
|
||||
@@ -220,9 +220,15 @@ function CodeMirrorEngine(options) {
|
||||
}
|
||||
});
|
||||
this.cm.on("paste",function(cm,event) {
|
||||
event["twEditor"] = true;
|
||||
self.widget.handlePasteEvent.call(self.widget,event);
|
||||
});
|
||||
} else {
|
||||
this.cm.on("paste",function(cm,event){
|
||||
event["twEditor"] = true;
|
||||
});
|
||||
}
|
||||
;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user