-
Notifications
You must be signed in to change notification settings - Fork 0
/
tengwar-view.js
30 lines (25 loc) · 791 Bytes
/
tengwar-view.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"use strict";
module.exports = TengwarEditor;
var modes = require("tengwar/modes");
var fonts = require("tengwar/fonts");
function TengwarEditor() {
}
TengwarEditor.prototype.hookup = function (id, component, scope) {
if (id === "this") {
this.element = scope.components.text;
this.container = scope.components.container;
}
};
Object.defineProperty(TengwarEditor.prototype, "value", {
set: function (value) {
var mode = modes[value.mode];
var font = fonts[value.font];
var options = {
font: font,
language: value.language,
block: true
};
this.container.className = "tengwar " + value.font + " rendered";
this.element.value = mode.transcribe(value.value, options);
}
});