Merge branch 'master' into edit-text-focus-select-attribute

This commit is contained in:
jeremy@jermolene.com 2023-02-25 18:24:53 +00:00
commit e9da58df16
4 changed files with 26 additions and 6 deletions

View File

@ -74,7 +74,9 @@ LetWidget.prototype.getVariableInfo = function(name,options) {
text: this.currentValueFor[name]
};
}
return Widget.prototype.getVariableInfo.call(this,name,options);
return Widget.prototype.getVariableInfo.call(this,name,$tw.utils.extend(Object.create(null),options,{
defaultValue: ""
}));
};
/*

View File

@ -14,6 +14,7 @@ extension: .html
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="generator" content="TiddlyWiki" />
<meta name="tiddlywiki-version" content="{{$:/core/templates/version}}" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="format-detection" content="telephone=no">
<link id="faviconLink" rel="shortcut icon" href="favicon.ico">
<title>{{$:/core/wiki/title}}</title>

View File

@ -7,5 +7,5 @@ markdown/breaks: false
markdown/linkify: false
markdown/quotes: “”‘’
markdown/renderWikiText: true
markdown/renderWikiTextPragma: \rules only html entity syslink prettylink wikilink commentblock commentinline macrocallblock macrocallinline transcludeblock transcludeinline filteredtranscludeblock filteredtranscludeinline
markdown/renderWikiTextPragma: \rules only html entity syslink prettylink image prettyextlink wikilink commentblock commentinline macrocallblock macrocallinline transcludeblock transcludeinline filteredtranscludeblock filteredtranscludeinline
markdown/typographer: false

View File

@ -103,8 +103,9 @@ function render_tw_expr(tokens,idx) {
return tokens[idx].content;
}
// Overwrite default: render attribute strings in e"..." format instead,
// so HTML entities can be decoded. See parseStringLiteralExt() below.
// Overwrite default: attribute values can be either a string or {type;, value:}.
// 1) string attr val: render in e"..." format so HTML entities can be decoded.
// 2) object attr val: render value as is.
function render_token_attrs(token) {
var i, l, result;
@ -113,7 +114,11 @@ function render_token_attrs(token) {
result = '';
for(i=0, l=token.attrs.length; i<l; i++) {
result += ' ' + md.utils.escapeHtml(token.attrs[i][0]) + '=e"' + md.utils.escapeHtml(token.attrs[i][1]) + '"';
if(typeof token.attrs[i][1] === "object" && token.attrs[i][1] !== null) {
result += ' ' + md.utils.escapeHtml(token.attrs[i][0]) + '=' + token.attrs[i][1].value;
} else {
result += ' ' + md.utils.escapeHtml(token.attrs[i][0]) + '=e"' + md.utils.escapeHtml(token.attrs[i][1]) + '"';
}
}
return result;
@ -264,7 +269,19 @@ function tw_image(state,silent) {
var twNode = ruleinfo.rule.parse()[0];
var token = state.push('$image','$image',0);
$tw.utils.each(twNode.attributes,function(attr,id) {
token.attrSet(id,attr.value);
switch(attr.type) {
case "filtered":
token.attrSet(id,{ type: "filtered", value: "{{{" + attr.filter + "}}}" });
break;
case "indirect":
token.attrSet(id,{ type: "indirect", value: "{{" + attr.textReference + "}}" });
break;
case "macro":
token.attrSet(id,{ type: "macro", value: ruleinfo.rule.parser.source.substring(attr.value.start,attr.value.end) });
break;
default:
token.attrSet(id,attr.value);
}
});
token.markup = 'tw_image';
}