1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-24 02:27:19 +00:00
TiddlyWiki5/core/modules/widgets/error.js
Jeremy Ruston 6d24cedbcc Refactored widget renderers to be hosted within HTML element renderers
This arrangement takes better advantage of the similarities between the
now deleted widget renderer and the element renderer. It also obviates
the need for wrapper elements around every widget.
2013-01-03 16:27:55 +00:00

38 lines
737 B
JavaScript

/*\
title: $:/core/modules/widgets/error.js
type: application/javascript
module-type: widget
The error widget displays an error message.
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
var ErrorWidget = function(renderer,errorMessage) {
// Save state
this.renderer = renderer;
this.errorMessage = errorMessage;
// Generate child nodes
this.generate();
};
ErrorWidget.prototype.generate = function() {
// Set the element details
this.tag = "span";
this.attributes = {
"class": "tw-error-widget"
};
this.children = this.renderer.renderTree.createRenderers(this.renderer.renderContext,[{
type: "text",
text: this.errorMessage
}]);
};
exports.error = ErrorWidget;
})();