This commit is contained in:
@@ -38,7 +38,9 @@ function ayRegisterHelpers() {
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("ayWiki", function (astring) {
|
||||
return new Handlebars.SafeString(DOMPurify.sanitize(marked(astring, { breaks: true })));
|
||||
return new Handlebars.SafeString(
|
||||
DOMPurify.sanitize(marked(astring, { breaks: true }))
|
||||
);
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("ayJSON", function (obj) {
|
||||
@@ -89,6 +91,38 @@ function ayRegisterHelpers() {
|
||||
}
|
||||
return ayTranslationKeyCache[translationKey];
|
||||
});
|
||||
|
||||
/*
|
||||
let canvas = document.createElement('canvas');
|
||||
try {
|
||||
bwipjs.toCanvas(canvas, options);
|
||||
document.getElementById(myimg).src = canvas.toDataURL('image/png');
|
||||
} catch (e) {
|
||||
// `e` may be a string or Error object
|
||||
}
|
||||
*/
|
||||
Handlebars.registerHelper("ayBC", function (text, options) {
|
||||
// options.text=text;
|
||||
let canvas = document.getElementById("aybarcode");
|
||||
if (canvas == null) {
|
||||
canvas = document.createElement("canvas");
|
||||
canvas.id = "aybarcode";
|
||||
}
|
||||
//let canvas = document.createElement("canvas");
|
||||
|
||||
let opt = {
|
||||
bcid: "code128", // Barcode type
|
||||
text: "0123456789", // Text to encode
|
||||
scale: 3, // 3x scaling factor
|
||||
height: 10, // Bar height, in millimeters
|
||||
includetext: true, // Show human-readable text
|
||||
textxalign: "center" // Always good to set this
|
||||
};
|
||||
|
||||
bwipjs.toCanvas(canvas, opt);
|
||||
var url = canvas.toDataURL("image/png");
|
||||
return new Handlebars.SafeString("<img src='" + url + "'/>");
|
||||
});
|
||||
} //eof
|
||||
|
||||
///////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user