mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 03:57:21 +00:00
Minor tweaks to #3052
This commit is contained in:
parent
661bff4f5b
commit
38fbc4f35a
@ -64,7 +64,7 @@ LinkWidget.prototype.renderLink = function(parent,nextSibling) {
|
||||
var domNode = this.document.createElement(tag);
|
||||
// Assign classes
|
||||
var classes = [];
|
||||
if(this.enforceClasses === undefined) {
|
||||
if(this.overrideClasses === undefined)
|
||||
classes.push("tc-tiddlylink");
|
||||
if(this.isShadow) {
|
||||
classes.push("tc-tiddlylink-shadow");
|
||||
@ -77,9 +77,8 @@ LinkWidget.prototype.renderLink = function(parent,nextSibling) {
|
||||
}
|
||||
}
|
||||
classes.push(this.linkClasses);
|
||||
}
|
||||
else if (this.enforceClasses !== "") {
|
||||
classes.push(this.enforceClasses);
|
||||
} else if(this.overrideClasses !== "")
|
||||
classes.push(this.overrideClasses)
|
||||
}
|
||||
if(classes.length > 0) {
|
||||
domNode.setAttribute("class",classes.join(" "));
|
||||
@ -174,7 +173,7 @@ LinkWidget.prototype.execute = function() {
|
||||
this.tooltip = this.getAttribute("tooltip");
|
||||
this["aria-label"] = this.getAttribute("aria-label");
|
||||
this.linkClasses = this.getAttribute("class");
|
||||
this.enforceClasses = this.getAttribute("setClass");;
|
||||
this.overrideClasses = this.getAttribute("overrideClass");
|
||||
this.tabIndex = this.getAttribute("tabindex");
|
||||
this.draggable = this.getAttribute("draggable","yes");
|
||||
this.linkTag = this.getAttribute("tag","a");
|
||||
|
@ -16,8 +16,8 @@ The `link` widget generates links to tiddlers. (Use the HTML `<a>` element to ge
|
||||
|tabindex |Optional numeric [[tabindex|https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/tabIndex]] |
|
||||
|draggable |"yes" to enable the link to be draggable (defaults to "yes") |
|
||||
|tag |Optional tag to override the default "a" element |
|
||||
|class|Optional css classes __in addition to__ the default classes (see below)|
|
||||
|setClass|Optional css classes __instead of__ the default classes <<.from-version "5.1.16">>|
|
||||
|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 `<a>` tag. The draggable functionality is equivalent to using the DraggableWidget with the ''tiddler'' attribute set to the link target.
|
||||
|
||||
@ -64,11 +64,11 @@ The link widget automatically determines and applies the following classes to li
|
||||
* `tc-tiddlylink-missing` - applied to tiddler links where the target tiddler doesn't exist
|
||||
* `tc-tiddlylink-resolves` - applied to tiddler links when the target tiddler does exist
|
||||
|
||||
Use the `class` attribute to specify additional css classes, or `setClass` to apply only that but not the above defaults, e.g. when used in a LinkCatcherWidget:
|
||||
Use the `class` attribute to specify additional css classes, or `overrideClass` to apply only that but not the above defaults, e.g. when used in a LinkCatcherWidget:
|
||||
|
||||
<<wikitext-example-without-html """*<$link class="example">Here</$link> the `example` class is added.
|
||||
*<$link setClass="example">Here</$link> only the `example` class applies.
|
||||
*<$link setClass="">Here</$link> no class is set.""">>
|
||||
*<$link overrideClass="example">Here</$link> only the `example` class applies.
|
||||
*<$link overrideClass="">Here</$link> no class is set.""">>
|
||||
|
||||
! `href` generation
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user