From 82979c8a35bf960b9e8b36e5f7cdc36be3ea29c9 Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Fri, 1 Jun 2018 12:11:02 -1000 Subject: [PATCH] Allows specifying reverter on text.reel Adding the reverter makes the text.reel consistent with the FRB spec. --- ui/text.reel/text.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ui/text.reel/text.js b/ui/text.reel/text.js index 998926a36d..1208a3fa3e 100644 --- a/ui/text.reel/text.js +++ b/ui/text.reel/text.js @@ -55,6 +55,17 @@ var MontageText = exports.Text = Component.specialize( /** @lends module:montag value: null }, + /** + * An optional reverter for transforming the `value` into the + * corresponding rendered text. + * Converters are called at time of draw. + * @type {?Converter} + * @default null + */ + reverter: { + value: null + }, + /** * The default string value assigned to the Text instance. * @type {string} @@ -91,7 +102,9 @@ var MontageText = exports.Text = Component.specialize( /** @lends module:montag var displayValue = (typeof this._value !== "undefined" && this._value !== null) ? this._value : this.defaultValue; //push to DOM - this._valueNode.data = this.converter ? this.converter.convert(displayValue) : displayValue; + this._valueNode.data = this.converter ? this.converter.convert(displayValue) : + this.reverter ? this.reverter.revert(displayValue) : + displayValue; } }