lib usage

This commit is contained in:
Yuri Kuznetsov
2021-06-21 14:14:06 +03:00
parent 9e6385c00a
commit 16db12231a
11 changed files with 54 additions and 15 deletions
@@ -18,6 +18,7 @@
"node_modules/bootstrap/dist/js/bootstrap.js",
"node_modules/bootstrap-datepicker/dist/js/bootstrap-datepicker.js",
"node_modules/marked/lib/marked.js",
"node_modules/dompurify/dist/purify.js",
"node_modules/gridstack/dist/gridstack.js",
"node_modules/gridstack/dist/gridstack.jQueryUI.js",
@@ -45,6 +45,14 @@
"exportsTo": "window",
"exportsAs": "GridStack"
},
"marked": {
"exportsTo": "window",
"exportsAs": "marked"
},
"dompurify": {
"exportsTo": "window",
"exportsAs": "DOMPurify"
},
"Colorpicker": {
"path": "client/lib/bootstrap-colorpicker.js",
"devPath": "node_modules/bootstrap-colorpicker/dist/js/bootstrap-colorpicker.js",
@@ -58,8 +66,15 @@
"exportsAs": "EXIF"
},
"JsBarcode": {
"path": "client/lib/JsBarcode.all.min.js",
"path": "client/lib/JsBarcode.all.js",
"devPath": "node_modules/jsbarcode/dist/JsBarcode.all.js",
"exportsTo": "window",
"exportsAs": "JsBarcode"
},
"qrcode": {
"path": "client/lib/qrcode.js",
"devPath": "node_modules/qrcodejs/qrcode.js",
"exportsTo": "window",
"exportsAs": "QRCode"
}
}
File diff suppressed because one or more lines are too long
-2
View File
File diff suppressed because one or more lines are too long
-1
View File
File diff suppressed because one or more lines are too long
+4 -4
View File
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('view-helper', ['lib!client/lib/purify.min.js'], function () {
define('view-helper', [/*'lib!marked', 'lib!dompurify'*/], function (/*marked, DOMPurify*/) {
let ViewHelper = function () {
this._registerHandlebarsHelpers();
@@ -54,17 +54,17 @@ define('view-helper', ['lib!client/lib/purify.min.js'], function () {
DOMPurify.addHook('beforeSanitizeAttributes', function (node) {
if (node instanceof HTMLAnchorElement) {
if (node.getAttribute('target')) {
node.targetBlack = true;
node.targetBlank = true;
}
else {
node.targetBlack = false;
node.targetBlank = false;
}
}
});
DOMPurify.addHook('afterSanitizeAttributes', function (node) {
if (node instanceof HTMLAnchorElement) {
if (node.targetBlack) {
if (node.targetBlank) {
node.setAttribute('target', '_blank');
node.setAttribute('rel', 'noopener noreferrer');
}
+4 -3
View File
@@ -26,8 +26,9 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/fields/barcode', [
'views/fields/varchar', 'lib!JsBarcode', 'lib!client/lib/qrcode.min.js'], function (Dep, JsBarcode, Qrcode) {
define('views/fields/barcode',
['views/fields/varchar', 'lib!JsBarcode', 'lib!qrcode'],
function (Dep, JsBarcode, QRCode) {
return Dep.extend({
@@ -102,7 +103,7 @@ define('views/fields/barcode', [
size = containerWidth;
}
var qrCode = new QRCode(this.$el.find('.barcode').get(0), {
new QRCode(this.$el.find('.barcode').get(0), {
text: value,
width: size,
height: size,
@@ -26,7 +26,9 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/user-security/modals/totp', ['views/modal', 'model', 'lib!client/lib/qrcode.min.js'], function (Dep, Model) {
define('views/user-security/modals/totp',
['views/modal', 'model', 'lib!qrcode'],
function (Dep, Model, QRCode) {
return Dep.extend({
@@ -108,7 +110,7 @@ define('views/user-security/modals/totp', ['views/modal', 'model', 'lib!client/l
},
afterRender: function () {
var qrcode = new QRCode(this.$el.find('.qrcode').get(0), {
new QRCode(this.$el.find('.qrcode').get(0), {
text: 'otpauth://totp/'+this.label+'?secret=' + this.secret,
width: 256,
height: 256,
+7
View File
@@ -14,6 +14,7 @@
"bootstrap/dist/js/bootstrap.js",
"bootstrap-datepicker/dist/js/bootstrap-datepicker.js",
"marked/lib/marked.js",
"dompurify/dist/purify.js",
"gridstack/dist/gridstack.js",
"gridstack/dist/gridstack.jQueryUI.js",
{
@@ -30,5 +31,11 @@
},
{
"path": "exif-js/exif.js"
},
{
"path": "jsbarcode/dist/JsBarcode.all.js"
},
{
"path": "qrcodejs/qrcode.js"
}
]
+15
View File
@@ -773,6 +773,11 @@
"jquery": ">=1.7"
}
},
"dompurify": {
"version": "2.2.9",
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-2.2.9.tgz",
"integrity": "sha512-+9MqacuigMIZ+1+EwoEltogyWGFTJZWU3258Rupxs+2CGs4H914G9er6pZbsme/bvb5L67o2rade9n21e4RW/w=="
},
"duplexer": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz",
@@ -2050,6 +2055,11 @@
"esprima": "^4.0.0"
}
},
"jsbarcode": {
"version": "3.11.4",
"resolved": "https://registry.npmjs.org/jsbarcode/-/jsbarcode-3.11.4.tgz",
"integrity": "sha512-PHtad17lOl6LOLGK20k5I6P7MabiyHaJY5u5N5TlzC6ZunOR+yFnFnRUoqqOefrYPqO2nuJ1weHzG8B7YYEnHg=="
},
"kind-of": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
@@ -2745,6 +2755,11 @@
"dev": true,
"optional": true
},
"qrcodejs": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/qrcodejs/-/qrcodejs-1.0.0.tgz",
"integrity": "sha1-r6tenoWFIfhZrjNtLtD5/S52zKc="
},
"read-pkg": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz",
+3
View File
@@ -44,15 +44,18 @@
"cronstrue": "^1.114.0",
"cropper": "^0.7.9",
"devbridge-autocomplete": "^1.4.9",
"dompurify": "^2.2.9",
"es6-promise": "^3.0.2",
"exif-js": "^2.3.0",
"gridstack": "^1.2.1",
"handlebars": "^4.7.7",
"jquery": "^3.6.0",
"jquery-textcomplete": "^1.8.5",
"jsbarcode": "^3.11.4",
"marked": "^0.8.2",
"moment": "^2.24.0",
"moment-timezone": "^0.5.33",
"qrcodejs": "^1.0.0",
"selectize": "git://github.com/selectize/selectize.js.git#v0.13.3",
"timepicker": "^1.11.15",
"underscore": "^1.13.1"