diff --git a/core/modules/widgets/link.js b/core/modules/widgets/link.js index ad519ac62..6d3ffe093 100755 --- a/core/modules/widgets/link.js +++ b/core/modules/widgets/link.js @@ -183,7 +183,14 @@ LinkWidget.prototype.execute = function() { this.isShadow = this.wiki.isShadowTiddler(this.to); this.hideMissingLinks = (this.getVariable("tv-show-missing-links") || "yes") === "no"; // Make the child widgets - this.makeChildWidgets(); + var templateTree; + if(this.parseTreeNode.children && this.parseTreeNode.children.length > 0) { + templateTree = this.parseTreeNode.children; + } else { + // Default template is a link to the title + templateTree = [{type: "text", text: this.to}]; + } + this.makeChildWidgets(templateTree); }; /* diff --git a/editions/tw5.com/tiddlers/widgets/LinkWidget.tid b/editions/tw5.com/tiddlers/widgets/LinkWidget.tid index b704d77b1..bebebef6a 100644 --- a/editions/tw5.com/tiddlers/widgets/LinkWidget.tid +++ b/editions/tw5.com/tiddlers/widgets/LinkWidget.tid @@ -1,6 +1,6 @@ caption: link created: 20131024141900000 -modified: 20171212063130159 +modified: 20190610195105615 tags: Widgets title: LinkWidget type: text/vnd.tiddlywiki @@ -9,6 +9,10 @@ The `link` widget generates links to tiddlers. (Use the HTML `` element to ge ! Content and Attributes +The content of the link widget is rendered within the `` tag representing the link. If the content is empty then the title of the target tiddler is rendered as the default. + +For example, `<$link to="HelloThere"/>` is equivalent to `<$link to="HelloThere">HelloThere` and `<$link/>` is equivalent to `<$link to=<>><$view field="title"/>`. + |!Attribute |!Description | |to |The title of the target tiddler for the link (defaults to the [[current tiddler|Current Tiddler]]) | |aria-label |Optional accessibility label | @@ -19,7 +23,7 @@ The `link` widget generates links to tiddlers. (Use the HTML `` element to ge |class|Optional CSS classes //in addition to// the default classes (see below)| |overrideClass|<<.from-version "5.1.16">> Optional CSS classes //instead of// the default classes | -The content of the link widget is rendered within the `` tag. The draggable functionality is equivalent to using the DraggableWidget with the ''tiddler'' attribute set to the link target. +The draggable functionality is equivalent to using the DraggableWidget with the ''tiddler'' attribute set to the link target. The default value of the tooltip attribute is supplied by the <<.vlink tv-wikilink-tooltip>> variable.