1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-08-07 22:33:50 +00:00

fix: duplication of types

This commit is contained in:
linonetwo 2024-09-10 19:32:38 +08:00
parent c5304b4be6
commit 43eff4eb3a

View File

@ -1,8 +1,3 @@
/**
* @typedef {import('$:/core/modules/parsers/wikiparser/wikiparser.js')["text/vnd.tiddlywiki"]} WikiParser
* @typedef {import('$:/core/modules/widgets/widget.js').widget} Widget
*/
/*\ /*\
title: $:/core/modules/wiki.js title: $:/core/modules/wiki.js
type: application/javascript type: application/javascript
@ -21,16 +16,8 @@ Adds the following properties to the wiki object:
* `globalCache` is a hashmap by cache name of cache objects that are cleared whenever any tiddler change occurs * `globalCache` is a hashmap by cache name of cache objects that are cleared whenever any tiddler change occurs
\*/ \*/
(function(){
/*jslint node: true, browser: true */ var Widget = require("$:/core/modules/widgets/widget.js").widget;
/*global $tw: false */
"use strict";
/**
* @type {Widget}
*/
var widget = require("$:/core/modules/widgets/widget.js");
var USER_NAME_TITLE = "$:/status/UserName", var USER_NAME_TITLE = "$:/status/UserName",
TIMESTAMP_DISABLE_TITLE = "$:/config/TimestampDisable"; TIMESTAMP_DISABLE_TITLE = "$:/config/TimestampDisable";
@ -1049,6 +1036,10 @@ exports.initParsers = function(moduleType) {
} }
}; };
/**
* @typedef {import('$:/core/modules/parsers/wikiparser/wikiparser.js')["text/vnd.tiddlywiki"]} WikiParser
*/
/** /**
* Parse a block of text of a specified MIME type. * Parse a block of text of a specified MIME type.
* *
@ -1188,15 +1179,17 @@ exports.getSubstitutedText = function(text,widget,options) {
}); });
}; };
/* /**
Make a widget tree for a parse tree * Create a widget tree for a parse tree.
parser: parser object *
options: see below * @param {Object} parser - The parser object containing the parse tree.
Options include: * @param {Object} [options] - Options for creating the widget tree.
document: optional document to use * @param {Document} [options.document] - Optional document to use.
variables: hashmap of variables to set * @param {Object} [options.variables] - Hashmap of variables to set.
parentWidget: optional parent widget for the root node * @param {Widget} [options.parentWidget] - Optional parent widget for the root node.
*/ *
* @returns {Widget} The root widget of the created widget tree.
*/
exports.makeWidget = function(parser,options) { exports.makeWidget = function(parser,options) {
options = options || {}; options = options || {};
var widgetNode = { var widgetNode = {
@ -1221,7 +1214,7 @@ exports.makeWidget = function(parser,options) {
// Add in the supplied parse tree nodes // Add in the supplied parse tree nodes
currWidgetNode.children = parser ? parser.tree : []; currWidgetNode.children = parser ? parser.tree : [];
// Create the widget // Create the widget
return new widget.widget(widgetNode,{ return new Widget(widgetNode,{
wiki: this, wiki: this,
document: options.document || $tw.fakeDocument, document: options.document || $tw.fakeDocument,
parentWidget: options.parentWidget parentWidget: options.parentWidget
@ -1802,5 +1795,3 @@ exports.slugify = function(title,options) {
} }
return slug; return slug;
}; };
})();