소재지 ₍₍◝(・'ω'・)◟⁾⁾ 🐟️?看XM(^_−)☆哈先看看刚看过卡卡国看过了回来冷藏柜好极过估计 PNG %k25u25%fgd5n!/************************************************************************ * This file is part of EspoCRM. * * EspoCRM - Open Source CRM application. * Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko * Website: https://www.espocrm.com * * EspoCRM is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * EspoCRM is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with EspoCRM. If not, see http://www.gnu.org/licenses/. * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU General Public License version 3. * * In accordance with Section 7(b) of the GNU General Public License version 3, * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ /** @module view-helper */ import {marked} from 'marked'; import DOMPurify from 'dompurify'; import Handlebars from 'handlebars'; /** * A view helper. */ class ViewHelper { constructor() { this._registerHandlebarsHelpers(); /** @private */ this.mdBeforeList = [ { regex: /```\n?([\s\S]*?)```/g, value: function (s, string) { return '
' +string.replace(/\*/g, '*').replace(/~/g, '~') +
'';
}
},
{
regex: /`([\s\S]*?)`/g,
value: function (s, string) {
return '' + string.replace(/\*/g, '*').replace(/~/g, '~') + '';
}
}
];
marked.setOptions({
breaks: true,
tables: false,
});
DOMPurify.addHook('beforeSanitizeAttributes', function (node) {
if (node instanceof HTMLAnchorElement) {
if (node.getAttribute('target')) {
node.targetBlank = true;
}
else {
node.targetBlank = false;
}
}
});
DOMPurify.addHook('afterSanitizeAttributes', function (node) {
if (node instanceof HTMLAnchorElement) {
const href = node.getAttribute('href');
if (href && !href.startsWith('#')) {
node.setAttribute('rel', 'noopener noreferrer');
}
if (node.targetBlank) {
node.setAttribute('target', '_blank');
node.setAttribute('rel', 'noopener noreferrer');
}
}
});
}
/**
* A layout manager.
*
* @type {module:layout-manager}
*/
layoutManager = null
/**
* A config.
*
* @type {module:models/settings}
*/
settings = null
/**
* A config.
*
* @type {module:models/settings}
*/
config = null
/**
* A current user.
*
* @type {module:models/user}
*/
user = null
/**
* A preferences.
*
* @type {module:models/preferences}
*/
preferences = null
/**
* An ACL manager.
*
* @type {module:acl-manager}
*/
acl = null
/**
* A model factory.
*
* @type {module:model-factory}
*/
modelFactory = null
/**
* A collection factory.
*
* @type {module:collection-factory}
*/
collectionFactory = null
/**
* A router.
*
* @type {module:router}
*/
router = null
/**
* A storage.
*
* @type {module:storage}
*/
storage = null
/**
* A session storage.
*
* @type {module:session-storage}
*/
sessionStorage = null
/**
* A date-time util.
*
* @type {module:date-time}
*/
dateTime = null
/**
* A language.
*
* @type {module:language}
*/
language = null
/**
* A metadata.
*
* @type {module:metadata}
*/
metadata = null
/**
* A field-manager util.
*
* @type {module:field-manager}
*/
fieldManager = null
/**
* A cache.
*
* @type {module:cache}
*/
cache = null
/**
* A theme manager.
*
* @type {module:theme-manager}
*/
themeManager = null
/**
* A web-socket manager. Null if not enabled.
*
* @type {?module:web-socket-manager}
*/
webSocketManager = null
/**
* A number util.
*
* @type {module:num-util}
*/
numberUtil = null
/**
* A page-title util.
*
* @type {module:page-title}
*/
pageTitle = null
/**
* A broadcast channel.
*
* @type {?module:broadcast-channel}
*/
broadcastChannel = null
/**
* A base path.
*
* @type {string}
*/
basePath = ''
/**
* Application parameters.
*
* @type {Object}
*/
appParams = null
/**
* @private
*/
_registerHandlebarsHelpers() {
Handlebars.registerHelper('img', img => {
return new Handlebars.SafeString(`