ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
define([], function () {
|
||||
'use strict';
|
||||
|
||||
return {
|
||||
afterInitialization: 'afterInitialization',
|
||||
afterChangeContent: 'afterChangeContent',
|
||||
afterUndo: 'afterUndo',
|
||||
afterPaste: 'afterPaste',
|
||||
beforeSetContent: 'beforeSetContent',
|
||||
afterSetContent: 'afterSetContent',
|
||||
afterSave: 'afterSave',
|
||||
afterOpenFileBrowser: 'afterOpenFileBrowser',
|
||||
afterFormSubmit: 'afterFormSubmit',
|
||||
afterBlur: 'afterBlur',
|
||||
afterFocus: 'afterFocus'
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,212 @@
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
define([
|
||||
'underscore'
|
||||
], function (_) {
|
||||
'use strict';
|
||||
|
||||
/* eslint-disable max-len */
|
||||
|
||||
var schema = {
|
||||
blockContent: [
|
||||
'address', 'article', 'aside', 'blockquote', 'details', 'dialog', 'div', 'dl', 'fieldset',
|
||||
'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hgroup', 'hr',
|
||||
'menu', 'nav', 'ol', 'p', 'pre', 'section', 'table', 'ul'
|
||||
],
|
||||
phrasingContent: [
|
||||
'#comment', '#text', 'a', 'abbr', 'audio', 'b', 'bdi', 'bdo', 'br', 'button', 'canvas',
|
||||
'cite','code', 'command', 'datalist', 'del', 'dfn', 'em', 'embed', 'i', 'iframe', 'img',
|
||||
'input', 'ins', 'kbd', 'keygen', 'label', 'map', 'mark', 'meter', 'noscript', 'object',
|
||||
'output', 'picture', 'progress', 'q', 'ruby', 's', 'samp', 'script', 'select', 'small',
|
||||
'span', 'strong', 'sub', 'sup', 'textarea', 'time', 'u', 'var', 'video', 'wbr'
|
||||
],
|
||||
blockElements: [
|
||||
'address', 'article', 'aside', 'blockquote', 'caption', 'center', 'datalist', 'dd', 'dir', 'div',
|
||||
'dl', 'dt', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
|
||||
'header', 'hgroup', 'hr', 'isindex', 'li', 'menu', 'nav', 'noscript', 'ol', 'optgroup', 'option',
|
||||
'p', 'pre', 'section', 'select', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'ul'
|
||||
],
|
||||
boolAttrs: [
|
||||
'autoplay', 'checked', 'compact', 'controls', 'declare', 'defer', 'disabled', 'ismap', 'loop',
|
||||
'multiple', 'nohref', 'noresize', 'noshade', 'nowrap', 'readonly', 'selected'
|
||||
],
|
||||
shortEnded: [
|
||||
'area', 'base', 'basefont', 'br', 'col', 'embed', 'frame', 'hr', 'img', 'input', 'isindex',
|
||||
'link', 'meta', 'param', 'source', 'track', 'wbr'
|
||||
],
|
||||
whiteSpace: [
|
||||
'audio', 'iframe', 'noscript', 'object', 'pre', 'script', 'style', 'textarea', 'video'
|
||||
],
|
||||
selfClosing: [
|
||||
'colgroup', 'dd', 'dt', 'li', 'option', 'p', 'td', 'tfoot', 'th', 'thead', 'tr'
|
||||
]
|
||||
};
|
||||
|
||||
schema.flowContent = schema.blockContent.concat(schema.phrasingContent, ['style']);
|
||||
schema.nonEmpty = ['td', 'th', 'iframe', 'video', 'audio', 'object', 'script', 'i', 'em', 'span'].concat(schema.shortEnded);
|
||||
|
||||
_.extend(schema, (function (phrasingContent, flowContent) {
|
||||
var validElements = [],
|
||||
validChildren = [],
|
||||
compiled = {},
|
||||
globalAttrs,
|
||||
rawData;
|
||||
|
||||
globalAttrs = [
|
||||
'id', 'dir', 'lang', 'class', 'style', 'title', 'hidden', 'onclick', 'onkeyup',
|
||||
'tabindex', 'dropzone', 'accesskey', 'draggable', 'translate', 'onmouseup',
|
||||
'onkeydown', 'spellcheck', 'ondblclick', 'onmouseout', 'onkeypress', 'contextmenu',
|
||||
'onmousedown', 'onmouseover', 'onmousemove', 'contenteditable'
|
||||
];
|
||||
|
||||
rawData = [
|
||||
['html', 'manifest', 'head body'],
|
||||
['head', '', 'base command link meta noscript script style title'],
|
||||
['title hr noscript br'],
|
||||
['base', 'href target'],
|
||||
['link', 'href rel media hreflang type sizes hreflang'],
|
||||
['meta', 'name http-equiv content charset'],
|
||||
['style', 'media type scoped'],
|
||||
['script', 'src async defer type charset'],
|
||||
['body', 'onafterprint onbeforeprint onbeforeunload onblur onerror onfocus ' +
|
||||
'onhashchange onload onmessage onoffline ononline onpagehide onpageshow ' +
|
||||
'onpopstate onresize onscroll onstorage onunload background bgcolor text link vlink alink', flowContent
|
||||
],
|
||||
['caption', '', _.without(flowContent, 'table')],
|
||||
['address dt dd div', '', flowContent],
|
||||
['h1 h2 h3 h4 h5 h6 pre p abbr code var samp kbd sub sup i b u bdo span legend em strong small s cite dfn', '', phrasingContent],
|
||||
['blockquote', 'cite', flowContent],
|
||||
['ol', 'reversed start type', 'li'],
|
||||
['ul', 'type compact', 'li'],
|
||||
['li', 'value type', flowContent],
|
||||
['dl', '', 'dt dd'],
|
||||
['a', 'href target rel media hreflang type charset name rev shape coords download', phrasingContent],
|
||||
['q', 'cite', phrasingContent],
|
||||
['ins del', 'cite datetime', flowContent],
|
||||
['img', 'src sizes srcset alt usemap ismap width height name longdesc align border hspace vspace'],
|
||||
['iframe', 'src name width height longdesc frameborder marginwidth marginheight scrolling align sandbox seamless allowfullscreen', flowContent],
|
||||
['embed', 'src type width height'],
|
||||
['object', 'data type typemustmatch name usemap form width height declare classid code codebase codetype archive standby align border hspace vspace', flowContent.concat(['param'])],
|
||||
['param', 'name value valuetype type'],
|
||||
['map', 'name', flowContent.concat(['area'])],
|
||||
['area', 'alt coords shape href target rel media hreflang type nohref'],
|
||||
['table', 'border summary width frame rules cellspacing cellpadding align bgcolor', 'caption colgroup thead tfoot tbody tr col'],
|
||||
['colgroup', 'span width align char charoff valign', 'col'],
|
||||
['col', 'span'],
|
||||
['tbody thead tfoot', 'align char charoff valign', 'tr'],
|
||||
['tr', 'align char charoff valign bgcolor', 'td th'],
|
||||
['td', 'colspan rowspan headers abbr axis scope align char charoff valign nowrap bgcolor width height', flowContent],
|
||||
['th', 'colspan rowspan headers scope abbr axis align char charoff valign nowrap bgcolor width height accept', flowContent],
|
||||
['form', 'accept-charset action autocomplete enctype method name novalidate target onsubmit onreset', flowContent],
|
||||
['fieldset', 'disabled form name', flowContent.concat(['legend'])],
|
||||
['label', 'form for', phrasingContent],
|
||||
['input', 'accept alt autocomplete checked dirname disabled form formaction formenctype formmethod formnovalidate ' +
|
||||
'formtarget height list max maxlength min multiple name pattern readonly required size src step type value width usemap align'
|
||||
],
|
||||
['button', 'disabled form formaction formenctype formmethod formnovalidate formtarget name type value', phrasingContent],
|
||||
['select', 'disabled form multiple name required size onfocus onblur onchange', 'option optgroup'],
|
||||
['optgroup', 'disabled label', 'option'],
|
||||
['option', 'disabled label selected value'],
|
||||
['textarea', 'cols dirname disabled form maxlength name readonly required rows wrap'],
|
||||
['menu', 'type label', flowContent.concat(['li'])],
|
||||
['noscript', '', flowContent],
|
||||
['wbr'],
|
||||
['ruby', '', phrasingContent.concat(['rt', 'rp'])],
|
||||
['figcaption', '', flowContent],
|
||||
['mark rt rp summary bdi', '', phrasingContent],
|
||||
['canvas', 'width height', flowContent],
|
||||
['video', 'src crossorigin poster preload autoplay mediagroup loop muted controls width height buffered', flowContent.concat(['track', 'source'])],
|
||||
['audio', 'src crossorigin preload autoplay mediagroup loop muted controls buffered volume', flowContent.concat(['track', 'source'])],
|
||||
['picture', '', 'img source'],
|
||||
['source', 'src srcset type media sizes'],
|
||||
['track', 'kind src srclang label default'],
|
||||
['datalist', '', phrasingContent.concat(['option'])],
|
||||
['article section nav aside header footer', '', flowContent],
|
||||
['hgroup', '', 'h1 h2 h3 h4 h5 h6'],
|
||||
['figure', '', flowContent.concat(['figcaption'])],
|
||||
['time', 'datetime', phrasingContent],
|
||||
['dialog', 'open', flowContent],
|
||||
['command', 'type label icon disabled checked radiogroup command'],
|
||||
['output', 'for form name', phrasingContent],
|
||||
['progress', 'value max', phrasingContent],
|
||||
['meter', 'value min max low high optimum', phrasingContent],
|
||||
['details', 'open', flowContent.concat(['summary'])],
|
||||
['keygen', 'autofocus challenge disabled form keytype name'],
|
||||
['script', 'language xml:space'],
|
||||
['style', 'xml:space'],
|
||||
['embed', 'align name hspace vspace'],
|
||||
['br', 'clear'],
|
||||
['applet', 'codebase archive code object alt name width height align hspace vspace'],
|
||||
['font basefont', 'size color face'],
|
||||
['h1 h2 h3 h4 h5 h6 div p legend caption', 'align'],
|
||||
['ol dl menu dir', 'compact'],
|
||||
['pre', 'width xml:space'],
|
||||
['hr', 'align noshade size width'],
|
||||
['isindex', 'prompt'],
|
||||
['col', 'width align char charoff valign'],
|
||||
['input button select textarea', 'autofocus'],
|
||||
['input textarea', 'placeholder onselect onchange onfocus onblur'],
|
||||
['link script img', 'crossorigin']
|
||||
];
|
||||
|
||||
rawData.forEach(function (data) {
|
||||
var nodes = data[0].split(' '),
|
||||
attributes = data[1] || [],
|
||||
children = data[2] || [],
|
||||
ni = nodes.length,
|
||||
nodeName,
|
||||
schemaData;
|
||||
|
||||
if (typeof attributes === 'string') {
|
||||
attributes = attributes.split(' ');
|
||||
}
|
||||
|
||||
if (typeof children === 'string') {
|
||||
children = children.split(' ');
|
||||
}
|
||||
|
||||
while (ni--) {
|
||||
nodeName = nodes[ni];
|
||||
schemaData = compiled[nodeName] || {};
|
||||
|
||||
compiled[nodeName] = {
|
||||
attributes: _.union(schemaData.attributes, globalAttrs, attributes),
|
||||
children: _.union(schemaData.children, children)
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
['a', 'dfn', 'form', 'meter', 'progress'].forEach(function (nodeName) {
|
||||
var node = compiled[nodeName];
|
||||
|
||||
node.children = _.without(node.children, nodeName);
|
||||
});
|
||||
|
||||
_.each(compiled, function (node, nodeName) {
|
||||
var filteredAttributes = [];
|
||||
|
||||
_.each(node.attributes, function (attribute) { //eslint-disable-line max-nested-callbacks
|
||||
// Disallowing usage of 'on*' attributes.
|
||||
if (!/^on/.test(attribute)) {
|
||||
filteredAttributes.push(attribute);
|
||||
}
|
||||
});
|
||||
|
||||
node.attributes = filteredAttributes;
|
||||
|
||||
validElements.push(nodeName + '[' + node.attributes.join('|') + ']');
|
||||
validChildren.push(nodeName + '[' + node.children.join('|') + ']');
|
||||
});
|
||||
|
||||
return {
|
||||
nodes: compiled,
|
||||
validElements: validElements,
|
||||
validChildren: validChildren
|
||||
};
|
||||
})(schema.phrasingContent, schema.flowContent));
|
||||
|
||||
return schema;
|
||||
});
|
||||
+239
@@ -0,0 +1,239 @@
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
/* global tinymce, MagentovariablePlugin, varienGlobalEvents, Base64 */
|
||||
/* eslint-disable strict */
|
||||
define([
|
||||
'Magento_Variable/js/config-directive-generator',
|
||||
'Magento_Variable/js/custom-directive-generator',
|
||||
'wysiwygAdapter',
|
||||
'jquery',
|
||||
'mage/adminhtml/tools'
|
||||
], function (configDirectiveGenerator, customDirectiveGenerator, wysiwyg, jQuery) {
|
||||
return function (config) {
|
||||
tinymce.create('tinymce.plugins.magentovariable', {
|
||||
|
||||
/**
|
||||
* Initialize editor plugin.
|
||||
*
|
||||
* @param {tinymce.editor} editor - Editor instance that the plugin is initialized in.
|
||||
*/
|
||||
init: function (editor) {
|
||||
var self = this;
|
||||
|
||||
/**
|
||||
* Add new command to open variables selector slideout.
|
||||
*/
|
||||
editor.addCommand('openVariablesSlideout', function (commandConfig) {
|
||||
var selectedElement;
|
||||
|
||||
if (commandConfig) {
|
||||
selectedElement = commandConfig.selectedElement;
|
||||
} else {
|
||||
selectedElement = tinymce.activeEditor.selection.getNode();
|
||||
}
|
||||
MagentovariablePlugin.setEditor(editor);
|
||||
MagentovariablePlugin.loadChooser(
|
||||
config.url,
|
||||
wysiwyg.getId(),
|
||||
selectedElement
|
||||
);
|
||||
});
|
||||
|
||||
/**
|
||||
* Add button to the editor toolbar.
|
||||
*/
|
||||
editor.ui.registry.addIcon(
|
||||
'magentovariable',
|
||||
'<svg width="24" height="24" viewBox="0 0 32.000000 32.000000" ' +
|
||||
'preserveAspectRatio="xMidYMid meet"><g transform="translate(0.000000,32.000000) ' +
|
||||
'scale(0.100000,-0.100000)" fill="#000000" stroke="none"><path d="M68 250 c-56 -44 -75 -136 -37 ' +
|
||||
'-184 27 -34 42 -33 23 2 -26 50 -9 129 38 179 26 28 10 30 -24 3z"/><path d="M266 253 c5 -10 9 ' +
|
||||
'-41 9 -70 0 -42 -6 -60 -32 -97 -36 -51 -35 -56 7 -26 54 39 78 139 44 188 -18 26 -40 30 -28 5z"/>' +
|
||||
'<path d="M128 223 c-15 -4 -15 -6 0 -33 16 -28 16 -30 -11 -58 -30 -31 -34 -42 -13 -42 8 0 17 11 ' +
|
||||
'20 25 4 14 11 25 16 25 5 0 12 -11 16 -25 6 -25 37 -35 49 -15 3 5 2 10 -3 10 -23 0 -20 44 5 76 ' +
|
||||
'25 34 25 34 4 34 -12 0 -20 -4 -17 -8 2 -4 0 -14 -5 -22 -7 -10 -12 -11 -15 -4 -10 25 -30 40 ' +
|
||||
'-46 37z"/></g>' +
|
||||
'</svg>'
|
||||
);
|
||||
editor.ui.registry.addToggleButton('magentovariable', {
|
||||
icon: 'magentovariable',
|
||||
tooltip: jQuery.mage.__('Insert Variable'),
|
||||
|
||||
/**
|
||||
* execute openVariablesSlideout for onAction callback
|
||||
*/
|
||||
onAction: function () {
|
||||
editor.execCommand('openVariablesSlideout');
|
||||
},
|
||||
|
||||
/**
|
||||
* Highlight or dismiss Insert Variable button when variable is selected or deselected.
|
||||
*/
|
||||
onSetup: function (api) {
|
||||
/**
|
||||
* Toggle active state of Insert Variable button.
|
||||
*
|
||||
* @param {Object} e
|
||||
*/
|
||||
var toggleVariableButton = function (e) {
|
||||
api.setActive(false);
|
||||
|
||||
if (jQuery(e.target).hasClass('magento-variable')) {
|
||||
api.setActive(true);
|
||||
}
|
||||
};
|
||||
|
||||
editor.on('click', toggleVariableButton);
|
||||
editor.on('change', toggleVariableButton);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Double click handler on the editor to handle dbl click on variable placeholder.
|
||||
*/
|
||||
editor.on('dblclick', function (evt) {
|
||||
if (jQuery(evt.target).hasClass('magento-variable')) {
|
||||
editor.selection.collapse(false);
|
||||
editor.execCommand('openVariablesSlideout', {
|
||||
ui: true,
|
||||
selectedElement: evt.target
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Attach event handler for when wysiwyg editor is about to encode its content
|
||||
*/
|
||||
varienGlobalEvents.attachEventHandler('wysiwygEncodeContent', function (content) {
|
||||
content = self.encodeVariables(content);
|
||||
|
||||
return content;
|
||||
});
|
||||
|
||||
/**
|
||||
* Attach event handler for when wysiwyg editor is about to decode its content
|
||||
*/
|
||||
varienGlobalEvents.attachEventHandler('wysiwygDecodeContent', function (content) {
|
||||
content = self.decodeVariables(content);
|
||||
|
||||
return content;
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Encode variables in content
|
||||
*
|
||||
* @param {String} content
|
||||
* @returns {*}
|
||||
*/
|
||||
encodeVariables: function (content) {
|
||||
content = content.gsub(/\{\{config path=\"([^\"]+)\"\}\}/i, function (match) {
|
||||
var path = match[1],
|
||||
magentoVariables,
|
||||
imageHtml;
|
||||
|
||||
magentoVariables = JSON.parse(config.placeholders);
|
||||
|
||||
if (magentoVariables[match[1]] && magentoVariables[match[1]]['variable_type'] === 'default') {
|
||||
imageHtml = '<span id="%id" class="magento-variable magento-placeholder mceNonEditable">' +
|
||||
'%s</span>';
|
||||
imageHtml = imageHtml.replace('%s', magentoVariables[match[1]]['variable_name']);
|
||||
} else {
|
||||
imageHtml = '<span id="%id" class="' +
|
||||
'magento-variable magento-placeholder magento-placeholder-error ' +
|
||||
'mceNonEditable' +
|
||||
'">' +
|
||||
'Not found' +
|
||||
'</span>';
|
||||
}
|
||||
|
||||
return imageHtml.replace('%id', Base64.idEncode(path));
|
||||
});
|
||||
|
||||
content = content.gsub(/\{\{customVar code=([^\}\"]+)\}\}/i, function (match) {
|
||||
var path = match[1],
|
||||
magentoVariables,
|
||||
imageHtml;
|
||||
|
||||
magentoVariables = JSON.parse(config.placeholders);
|
||||
|
||||
if (magentoVariables[match[1]] && magentoVariables[match[1]]['variable_type'] === 'custom') {
|
||||
imageHtml = '<span id="%id" class="magento-variable magento-custom-var magento-placeholder ' +
|
||||
'mceNonEditable">%s</span>';
|
||||
imageHtml = imageHtml.replace('%s', magentoVariables[match[1]]['variable_name']);
|
||||
} else {
|
||||
imageHtml = '<span id="%id" class="' +
|
||||
'magento-variable magento-custom-var magento-placeholder ' +
|
||||
'magento-placeholder-error mceNonEditable' +
|
||||
'">' +
|
||||
match[1] +
|
||||
'</span>';
|
||||
}
|
||||
|
||||
return imageHtml.replace('%id', Base64.idEncode(path));
|
||||
});
|
||||
|
||||
return content;
|
||||
},
|
||||
|
||||
/**
|
||||
* Decode variables in content.
|
||||
*
|
||||
* @param {String} content
|
||||
* @returns {String}
|
||||
*/
|
||||
decodeVariables: function (content) {
|
||||
var doc = new DOMParser().parseFromString(content.replace(/"/g, '&quot;'), 'text/html'),
|
||||
returnval = '';
|
||||
|
||||
[].forEach.call(doc.querySelectorAll('span.magento-variable'), function (el) {
|
||||
var $el = jQuery(el);
|
||||
|
||||
if ($el.hasClass('magento-custom-var')) {
|
||||
$el.replaceWith(
|
||||
customDirectiveGenerator.processConfig(
|
||||
Base64.idDecode(
|
||||
$el.attr('id')
|
||||
)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$el.replaceWith(
|
||||
configDirectiveGenerator.processConfig(
|
||||
Base64.idDecode(
|
||||
$el.attr('id')
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
returnval += doc.head ? doc.head.innerHTML.replace(/&quot;/g, '"') : '';
|
||||
returnval += doc.body ? doc.body.innerHTML.replace(/&quot;/g, '"') : '';
|
||||
|
||||
return returnval ? returnval : content;
|
||||
},
|
||||
|
||||
/**
|
||||
* @return {Object}
|
||||
*/
|
||||
getInfo: function () {
|
||||
return {
|
||||
longname: 'Magento Variable Manager Plugin',
|
||||
author: 'Magento Core Team',
|
||||
authorurl: 'http://magentocommerce.com',
|
||||
infourl: 'http://magentocommerce.com',
|
||||
version: '1.0'
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Register plugin
|
||||
*/
|
||||
tinymce.PluginManager.add('magentovariable', tinymce.plugins.magentovariable);
|
||||
};
|
||||
});
|
||||
+262
@@ -0,0 +1,262 @@
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
/* global tinymce, widgetTools, Base64 */
|
||||
/* eslint-disable strict */
|
||||
define([
|
||||
'wysiwygAdapter',
|
||||
'mage/adminhtml/events',
|
||||
'mage/adminhtml/wysiwyg/widget'
|
||||
], function (wysiwyg, varienGlobalEvents) {
|
||||
return function (config) {
|
||||
tinymce.create('tinymce.plugins.magentowidget', {
|
||||
|
||||
/**
|
||||
* @param {tinymce.Editor} editor - Editor instance that the plugin is initialized in.
|
||||
*/
|
||||
init: function (editor) {
|
||||
var self = this;
|
||||
|
||||
this.activePlaceholder = null;
|
||||
|
||||
editor.addCommand('mceMagentowidget', function (img) {
|
||||
if (self.activePlaceholder) {
|
||||
img = self.activePlaceholder;
|
||||
}
|
||||
|
||||
widgetTools.setActiveSelectedNode(img);
|
||||
widgetTools.openDialog(
|
||||
config['window_url'] + 'widget_target_id/' + editor.getElement().id + '/'
|
||||
);
|
||||
});
|
||||
|
||||
// Register Widget plugin button
|
||||
editor.ui.registry.addIcon(
|
||||
'magentowidget',
|
||||
'<svg width="24" height="24" viewBox="0 0 32.000000 32.000000" ' +
|
||||
'preserveAspectRatio="xMidYMid meet"> <g transform="translate(0.000000,32.000000) ' +
|
||||
'scale(0.100000,-0.100000)" fill="#000000" stroke="none"> <path d="M130 290 c0 -5 13 -10 30 ' +
|
||||
'-10 22 0 28 -4 24 -15 -5 -11 2 -15 26 -15 21 0 30 -4 28 -12 -7 -20 -40 -22 -50 -4 -5 9 -14 16 ' +
|
||||
'-20 16 -6 0 -19 7 -28 15 -9 8 -25 12 -38 8 -33 -8 -27 -26 8 -21 34 5 40 -6 12 -21 -14 -7 -25 -6 ' +
|
||||
'-40 5 -12 8 -23 10 -27 5 -5 -8 88 -71 105 -71 3 0 29 14 58 31 l53 30 -23 18 c-13 10 -31 20 -40 ' +
|
||||
'24 -10 3 -18 11 -18 17 0 5 -13 10 -30 10 -16 0 -30 -4 -30 -10z m58 -82 c-3 -7 -15 -13 -28 -13 ' +
|
||||
'-13 0 -25 6 -27 13 -3 8 6 12 27 12 21 0 30 -4 28 -12z"/> <path d="M30 151 l0 -60 61 -36 c33 ' +
|
||||
'-19 64 -35 69 -35 5 0 36 16 69 35 l61 36 0 60 0 61 -65 -37 -65 -36 -65 36 -65 37 0 -61z"/> </g>' +
|
||||
'</svg>'
|
||||
);
|
||||
editor.ui.registry.addToggleButton('magentowidget', {
|
||||
icon: 'magentowidget',
|
||||
tooltip: jQuery.mage.__('Insert Widget'),
|
||||
|
||||
/**
|
||||
* execute openVariablesSlideout for onAction callback
|
||||
*/
|
||||
onAction: function () {
|
||||
editor.execCommand('mceMagentowidget');
|
||||
},
|
||||
|
||||
/**
|
||||
* Add a node change handler, selects the button in the UI when a image is selected
|
||||
* @param {ToolbarToggleButtonInstanceApi} api
|
||||
*/
|
||||
onSetup: function (api) {
|
||||
/**
|
||||
* NodeChange handler
|
||||
*/
|
||||
editor.on('NodeChange', function (e) {
|
||||
var placeholder = e.element;
|
||||
|
||||
if (self.isWidgetPlaceholderSelected(placeholder)) {
|
||||
widgetTools.setEditMode(true);
|
||||
api.setActive(true);
|
||||
} else {
|
||||
widgetTools.setEditMode(false);
|
||||
api.setActive(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Add a widget placeholder image double click callback
|
||||
editor.on('dblClick', function (e) {
|
||||
var placeholder = e.target;
|
||||
|
||||
if (self.isWidgetPlaceholderSelected(placeholder)) {
|
||||
widgetTools.setEditMode(true);
|
||||
this.execCommand('mceMagentowidget', null);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Attach event handler for when wysiwyg editor is about to encode its content
|
||||
*/
|
||||
varienGlobalEvents.attachEventHandler('wysiwygEncodeContent', function (content) {
|
||||
content = self.encodeWidgets(self.decodeWidgets(content));
|
||||
content = self.removeDuplicateAncestorWidgetSpanElement(content);
|
||||
|
||||
return content;
|
||||
});
|
||||
|
||||
/**
|
||||
* Attach event handler for when wysiwyg editor is about to decode its content
|
||||
*/
|
||||
varienGlobalEvents.attachEventHandler('wysiwygDecodeContent', function (content) {
|
||||
content = self.decodeWidgets(content);
|
||||
|
||||
return content;
|
||||
});
|
||||
|
||||
/**
|
||||
* Attach event handler for when popups associated with wysiwyg are about to be closed
|
||||
*/
|
||||
varienGlobalEvents.attachEventHandler('wysiwygClosePopups', function () {
|
||||
wysiwyg.closeEditorPopup('widget_window' + wysiwyg.getId());
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} placeholder - Contains the selected node
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
isWidgetPlaceholderSelected: function (placeholder) {
|
||||
var isSelected = false;
|
||||
|
||||
if (placeholder.nodeName &&
|
||||
(placeholder.nodeName === 'SPAN' || placeholder.nodeName === 'IMG') &&
|
||||
placeholder.className && placeholder.className.indexOf('magento-widget') !== -1
|
||||
) {
|
||||
this.activePlaceholder = placeholder;
|
||||
isSelected = true;
|
||||
} else {
|
||||
this.activePlaceholder = null;
|
||||
}
|
||||
|
||||
return isSelected;
|
||||
},
|
||||
|
||||
/**
|
||||
* Convert {{widget}} style syntax to image placeholder HTML
|
||||
* @param {String} content
|
||||
* @return {*}
|
||||
*/
|
||||
encodeWidgets: function (content) {
|
||||
return content.gsub(/\{\{widget([\S\s]*?)\}\}/i, function (match) {
|
||||
var attributes = wysiwyg.parseAttributesString(match[1]),
|
||||
imageSrc,
|
||||
imageHtml = '';
|
||||
|
||||
if (attributes.type) {
|
||||
attributes.type = attributes.type.replace(/\\\\/g, '\\');
|
||||
imageSrc = config.placeholders[attributes.type];
|
||||
|
||||
if (imageSrc) {
|
||||
imageHtml += '<span class="magento-placeholder magento-widget mceNonEditable" ' +
|
||||
'contenteditable="false">';
|
||||
} else {
|
||||
imageSrc = config['error_image_url'];
|
||||
imageHtml += '<span ' +
|
||||
'class="magento-placeholder magento-placeholder-error magento-widget mceNonEditable" ' +
|
||||
'contenteditable="false">';
|
||||
}
|
||||
|
||||
imageHtml += '<img';
|
||||
imageHtml += ' id="' + Base64.idEncode(match[0]) + '"';
|
||||
imageHtml += ' src="' + imageSrc + '"';
|
||||
imageHtml += ' />';
|
||||
|
||||
if (config.types[attributes.type]) {
|
||||
imageHtml += config.types[attributes.type];
|
||||
}
|
||||
|
||||
imageHtml += '</span>';
|
||||
|
||||
return imageHtml;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Convert image placeholder HTML to {{widget}} style syntax
|
||||
* @param {String} content
|
||||
* @return {*}
|
||||
*/
|
||||
decodeWidgets: function (content) {
|
||||
return content.gsub(
|
||||
/(<span class="[^"]*magento-widget[^"]*"[^>]*>)?<img([^>]+id="[^>]+)>(([^>]*)<\/span>)?/i,
|
||||
function (match) {
|
||||
var attributes = wysiwyg.parseAttributesString(match[2]),
|
||||
widgetCode,
|
||||
result = match[0];
|
||||
|
||||
if (attributes.id) {
|
||||
try {
|
||||
widgetCode = Base64.idDecode(attributes.id);
|
||||
} catch (e) {
|
||||
// Ignore and continue.
|
||||
}
|
||||
|
||||
if (widgetCode && widgetCode.indexOf('{{widget') !== -1) {
|
||||
result = widgetCode;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Tinymce has strange behavior with html and this removes one of its side-effects
|
||||
* @param {String} content
|
||||
* @return {String}
|
||||
*/
|
||||
removeDuplicateAncestorWidgetSpanElement: function (content) {
|
||||
var parser, doc, returnval = '';
|
||||
|
||||
if (!window.DOMParser) {
|
||||
return content;
|
||||
}
|
||||
|
||||
parser = new DOMParser();
|
||||
doc = parser.parseFromString(content.replace(/"/g, '&quot;'), 'text/html');
|
||||
|
||||
[].forEach.call(doc.querySelectorAll('.magento-widget'), function (widgetEl) {
|
||||
var widgetChildEl = widgetEl.querySelector('.magento-widget');
|
||||
|
||||
if (!widgetChildEl) {
|
||||
return;
|
||||
}
|
||||
|
||||
[].forEach.call(widgetEl.childNodes, function (el) {
|
||||
widgetEl.parentNode.insertBefore(el, widgetEl);
|
||||
});
|
||||
|
||||
widgetEl.parentNode.removeChild(widgetEl);
|
||||
});
|
||||
|
||||
returnval += doc.head ? doc.head.innerHTML.replace(/&quot;/g, '"') : '';
|
||||
returnval += doc.body ? doc.body.innerHTML.replace(/&quot;/g, '"') : '';
|
||||
|
||||
return returnval ? returnval : content;
|
||||
},
|
||||
|
||||
/**
|
||||
* @return {Object}
|
||||
*/
|
||||
getInfo: function () {
|
||||
return {
|
||||
longname: 'Magento Widget Manager Plugin',
|
||||
author: 'Magento Core Team',
|
||||
authorurl: 'http://magentocommerce.com',
|
||||
infourl: 'http://magentocommerce.com',
|
||||
version: '1.0'
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('magentowidget', tinymce.plugins.magentowidget);
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
/* eslint-disable strict */
|
||||
define([
|
||||
'jquery',
|
||||
'underscore',
|
||||
'wysiwygAdapter',
|
||||
'module',
|
||||
'mage/translate',
|
||||
'prototype',
|
||||
'mage/adminhtml/events',
|
||||
'mage/adminhtml/browser'
|
||||
], function (jQuery, _, wysiwygAdapter, module) {
|
||||
var baseConfig = module.config().config || {},
|
||||
wysiwygSetup = Class.create({
|
||||
wysiwygInstance: null
|
||||
});
|
||||
|
||||
wysiwygSetup.prototype = {
|
||||
|
||||
/**
|
||||
* @param {*} htmlId
|
||||
* @param {Object} config
|
||||
*/
|
||||
initialize: function (htmlId, config) {
|
||||
var WysiwygInstancePrototype = new wysiwygAdapter.getAdapterPrototype();
|
||||
|
||||
_.bindAll(this, 'openFileBrowser');
|
||||
|
||||
config = _.extend({}, baseConfig, config || {});
|
||||
this.wysiwygInstance = new WysiwygInstancePrototype(htmlId, config);
|
||||
this.wysiwygInstance.eventBus = this.eventBus = new window.varienEvents();
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {*} mode
|
||||
*/
|
||||
setup: function (mode) {
|
||||
this.wysiwygInstance.setup(mode);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} o
|
||||
*/
|
||||
openFileBrowser: function (o) {
|
||||
this.wysiwygInstance.openFileBrowser(o);
|
||||
},
|
||||
|
||||
/**
|
||||
* @return {Boolean}
|
||||
*/
|
||||
toggle: function () {
|
||||
return this.wysiwygInstance.toggle();
|
||||
},
|
||||
|
||||
/**
|
||||
* On form validation.
|
||||
*/
|
||||
onFormValidation: function () {
|
||||
this.wysiwygInstance.onFormValidation();
|
||||
},
|
||||
|
||||
/**
|
||||
* Encodes the content so it can be inserted into the wysiwyg
|
||||
* @param {String} content - The content to be encoded
|
||||
*
|
||||
* @returns {*} - The encoded content
|
||||
*/
|
||||
updateContent: function (content) {
|
||||
return this.wysiwygInstance.encodeContent(content);
|
||||
}
|
||||
|
||||
};
|
||||
window.wysiwygSetup = wysiwygSetup;
|
||||
|
||||
return wysiwygSetup;
|
||||
});
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
html {height: 100%;}
|
||||
body, td, pre { color:#2f2f2f; font-family:Arial, Helvetica, sans-serif; font-size:12px; margin:8px; }
|
||||
body {background:#fff; min-height: calc(100% - 20px);}
|
||||
body.mceForceColors { background:#fff; color:#2f2f2f; }
|
||||
h1 {font-size: 2em}
|
||||
h2 {font-size: 1.5em}
|
||||
h3 {font-size: 1.17em}
|
||||
h4 {font-size: 1em}
|
||||
h5 {font-size: .83em}
|
||||
h6 {font-size: .75em}
|
||||
.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;}
|
||||
img {border:0; vertical-align:middle; }
|
||||
table {cursor:default}
|
||||
table td, table th {cursor:text}
|
||||
ins {border-bottom:1px solid green; text-decoration: none; color:green}
|
||||
del {color:red; text-decoration:line-through}
|
||||
cite {border-bottom:1px dashed blue}
|
||||
acronym {border-bottom:1px dotted #CCC; cursor:help}
|
||||
abbr, html\:abbr {border-bottom:1px dashed #CCC; cursor:help}
|
||||
|
||||
/* IE */
|
||||
* html body {
|
||||
scrollbar-3dlight-color:#F0F0EE;
|
||||
scrollbar-arrow-color:#676662;
|
||||
scrollbar-base-color:#F0F0EE;
|
||||
scrollbar-darkshadow-color:#DDD;
|
||||
scrollbar-face-color:#E0E0DD;
|
||||
scrollbar-highlight-color:#F0F0EE;
|
||||
scrollbar-shadow-color:#F0F0EE;
|
||||
scrollbar-track-color:#F5F5F5;
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
/* Browse */
|
||||
a.pickcolor, a.browse {text-decoration:none}
|
||||
a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.png) -860px 0; border:1px solid #FFF; margin-left:1px;}
|
||||
.mceOldBoxModel a.browse span {width:22px; height:20px;}
|
||||
a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;}
|
||||
a.browse span.disabled {border:1px solid white; opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
|
||||
a.browse:hover span.disabled {border:1px solid white; background-color:transparent;}
|
||||
a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.png) -840px 0; margin-left:2px;}
|
||||
.mceOldBoxModel a.pickcolor span {width:21px; height:17px;}
|
||||
a.pickcolor:hover span {background-color:#B2BBD0;}
|
||||
a.pickcolor:hover span.disabled {}
|
||||
|
||||
/* Charmap */
|
||||
table.charmap {border:1px solid #AAA; text-align:center}
|
||||
td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #AAA; text-align:center; font-size:12px; vertical-align:middle; line-height: 18px;}
|
||||
#charmap a {display:block; color:#000; text-decoration:none; border:0}
|
||||
#charmap a:hover {background:#CCC;color:#2B6FB6}
|
||||
#charmap #codeN {font-size:10px; font-family:Arial,Helvetica,sans-serif; text-align:center}
|
||||
#charmap #codeV {font-size:40px; height:80px; border:1px solid #AAA; text-align:center}
|
||||
|
||||
/* Source */
|
||||
.wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;}
|
||||
.mceActionPanel {margin-top:5px;}
|
||||
|
||||
/* Tabs classes */
|
||||
.tabs {width:100%; height:18px; line-height:normal; background:url(img/tabs.gif) repeat-x 0 -72px;}
|
||||
.tabs ul {margin:0; padding:0; list-style:none;}
|
||||
.tabs li {float:left; background:url(img/tabs.gif) no-repeat 0 0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block;}
|
||||
.tabs li.current {background:url(img/tabs.gif) no-repeat 0 -18px; margin-right:2px;}
|
||||
.tabs span {float:left; display:block; background:url(img/tabs.gif) no-repeat right -36px; padding:0px 10px 0 0;}
|
||||
.tabs .current span {background:url(img/tabs.gif) no-repeat right -54px;}
|
||||
.tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;}
|
||||
.tabs a:link, .tabs a:visited, .tabs a:hover {color:black;}
|
||||
|
||||
/* Panels */
|
||||
.panel_wrapper div.panel {display:none;}
|
||||
.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;}
|
||||
.panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;}
|
||||
|
||||
/* Columns */
|
||||
.column {float:left;}
|
||||
.properties {width:100%;}
|
||||
.properties .column1 {}
|
||||
.properties .column2 {text-align:left;}
|
||||
|
||||
/* Dialog specific */
|
||||
#link .panel_wrapper, #link div.current {height:125px;}
|
||||
#image .panel_wrapper, #image div.current {height:200px;}
|
||||
#plugintable thead {font-weight:bold; background:#DDD;}
|
||||
#plugintable, #about #plugintable td {border:1px solid #919B9C;}
|
||||
#plugintable {width:96%; margin-top:10px;}
|
||||
#pluginscontainer {height:290px; overflow:auto;}
|
||||
#colorpicker #preview {float:right; width:50px; height:14px;line-height:1px; border:1px solid black; margin-left:5px;}
|
||||
#colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;}
|
||||
#colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;}
|
||||
#colorpicker #light div {overflow:hidden;}
|
||||
#colorpicker #previewblock {float:right; padding-left:10px; height:20px;}
|
||||
#colorpicker .panel_wrapper div.current {height:175px;}
|
||||
#colorpicker #namedcolors {width:150px;}
|
||||
#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;}
|
||||
#colorpicker #colornamecontainer {margin-top:5px;}
|
||||
#colorpicker #picker_panel fieldset {margin:auto;width:325px;}
|
||||
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
.magento-placeholder {
|
||||
display: inline-block;
|
||||
margin: 0 5px;
|
||||
background: #dff7ff;
|
||||
outline: 2px solid #c0dffa;
|
||||
padding: 2px 4px;
|
||||
vertical-align: bottom;
|
||||
height: 20px;
|
||||
cursor: pointer !important;
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-size: 14px;
|
||||
color: #000;
|
||||
box-sizing: initial;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.magento-placeholder-error {
|
||||
display: inline-block;
|
||||
margin: 0 5px;
|
||||
background: #ffc0cb;
|
||||
outline: 2px solid #F7AAAA !important;
|
||||
padding: 2px 4px;
|
||||
vertical-align: bottom;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.magento-placeholder-error:before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABWUlEQVR42qVTS07DMBD1pggqcQAQEofINbrNvh977Au04gJtxZYiVZwLJJasAhJJ3LBrI4Xwxm3SKErCz9Koqec9e/xmnhBYdjK5tlo/R8ZsI63XIdGFqK1QSg+5MNY6scbMXobDU5eIpbyKiaZIpLExOX4/cdg6IOoXZP6OlbpDPjtgUks0y4l6An8esbl1iUPghgyA5ZPvnzAo0XphC/IRkyZKKVEnl8GVEK04+LsRY8yb4HJbAVpnLprJmVVqIcLx+DIieqiX2Bl8ITQB93wv0mDQb3pnGxkXLqsiu8WCufd2H5KBfM/Yepv/d0Du+2c/fQJjIilvyyfwhLEgvxHR7itZORFjHs82clcbuRNazwXm/uOvg4RKAoFSbkofVMjJN6MMzG5DNBI5XAVDTeG0XaE0a9JpJviADejM5LrgeT1UMsJmAOC8nLCqnbG3QQ6Y13ciWbTyC+DUOUqNY1A2AAAAAElFTkSuQmCC);
|
||||
background-repeat: no-repeat;
|
||||
background-position-x: 1px;
|
||||
background-position-y: 1px;
|
||||
width: 20px;
|
||||
height: inherit;
|
||||
margin-right: 4px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.magento-placeholder-error img {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.magento-placeholder-error[data-mce-selected] {
|
||||
outline: 2px solid #E12525 !important;
|
||||
}
|
||||
|
||||
.magento-placeholder-error img,
|
||||
.magento-placeholder img {
|
||||
vertical-align: middle;
|
||||
max-height: 20px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
@@ -0,0 +1,771 @@
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
/* global popups, tinyMceEditors, MediabrowserUtility, Base64 */
|
||||
/* eslint-disable strict */
|
||||
define([
|
||||
'jquery',
|
||||
'underscore',
|
||||
'tinymce',
|
||||
'mage/adminhtml/events',
|
||||
'mage/adminhtml/wysiwyg/events',
|
||||
'mage/translate',
|
||||
'prototype',
|
||||
'jquery/ui'
|
||||
], function (jQuery, _, tinyMCE, varienGlobalEvents, wysiwygEvents) {
|
||||
'use strict';
|
||||
|
||||
var tinyMceWysiwyg = Class.create();
|
||||
|
||||
tinyMceWysiwyg.prototype = {
|
||||
mediaBrowserOpener: null,
|
||||
mediaBrowserTargetElementId: null,
|
||||
magentoVariablesPlugin: null,
|
||||
mode: 'exact',
|
||||
|
||||
/**
|
||||
* @param {*} htmlId
|
||||
* @param {Object} config
|
||||
*/
|
||||
initialize: function (htmlId, config) {
|
||||
this.id = htmlId;
|
||||
this.config = config;
|
||||
|
||||
_.bindAll(
|
||||
this,
|
||||
'beforeSetContent',
|
||||
'saveContent',
|
||||
'onChangeContent',
|
||||
'openFileBrowser',
|
||||
'updateTextArea',
|
||||
'onUndo',
|
||||
'removeEvents'
|
||||
);
|
||||
|
||||
varienGlobalEvents.attachEventHandler('tinymceChange', this.onChangeContent);
|
||||
varienGlobalEvents.attachEventHandler('tinymceBeforeSetContent', this.beforeSetContent);
|
||||
varienGlobalEvents.attachEventHandler('tinymceSetContent', this.updateTextArea);
|
||||
varienGlobalEvents.attachEventHandler('tinymceSaveContent', this.saveContent);
|
||||
varienGlobalEvents.attachEventHandler('tinymceUndo', this.onUndo);
|
||||
|
||||
if (typeof tinyMceEditors === 'undefined') {
|
||||
window.tinyMceEditors = $H({});
|
||||
}
|
||||
|
||||
tinyMceEditors.set(this.id, this);
|
||||
},
|
||||
|
||||
/**
|
||||
* Ensures the undo operation works properly
|
||||
*/
|
||||
onUndo: function () {
|
||||
this.addContentEditableAttributeBackToNonEditableNodes();
|
||||
},
|
||||
|
||||
/**
|
||||
* Setup TinyMCE editor
|
||||
*/
|
||||
setup: function (mode) {
|
||||
var deferreds = [],
|
||||
settings,
|
||||
self = this;
|
||||
|
||||
this.turnOff();
|
||||
|
||||
if (this.config.plugins) {
|
||||
this.config.plugins.forEach(function (plugin) {
|
||||
var deferred;
|
||||
|
||||
self.addPluginToToolbar(plugin.name, '|');
|
||||
|
||||
if (!plugin.src) {
|
||||
return;
|
||||
}
|
||||
|
||||
deferred = jQuery.Deferred();
|
||||
deferreds.push(deferred);
|
||||
|
||||
require([plugin.src], function (factoryFn) {
|
||||
if (typeof factoryFn === 'function') {
|
||||
factoryFn(plugin.options);
|
||||
}
|
||||
|
||||
tinyMCE.PluginManager.load(plugin.name, plugin.src);
|
||||
deferred.resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (jQuery.isReady) {
|
||||
tinyMCE.dom.Event.domLoaded = true;
|
||||
}
|
||||
|
||||
settings = this.getSettings();
|
||||
|
||||
if (mode === 'inline') {
|
||||
settings.inline = true;
|
||||
|
||||
if (!isNaN(settings.toolbarZIndex)) {
|
||||
tinyMCE.ui.FloatPanel.zIndex = settings.toolbarZIndex;
|
||||
}
|
||||
|
||||
this.removeEvents(self.id);
|
||||
}
|
||||
|
||||
jQuery.when.apply(jQuery, deferreds).done(function () {
|
||||
tinyMCE.init(settings);
|
||||
this.getPluginButtons().hide();
|
||||
varienGlobalEvents.clearEventHandlers('open_browser_callback');
|
||||
this.eventBus.clearEventHandlers('open_browser_callback');
|
||||
this.eventBus.attachEventHandler('open_browser_callback', tinyMceEditors.get(self.id).openFileBrowser);
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove events from instance.
|
||||
*
|
||||
* @param {String} wysiwygId
|
||||
*/
|
||||
removeEvents: function (wysiwygId) {
|
||||
var editor;
|
||||
|
||||
if (typeof tinyMceEditors !== 'undefined' && tinyMceEditors.get(wysiwygId)) {
|
||||
editor = tinyMceEditors.get(wysiwygId);
|
||||
varienGlobalEvents.removeEventHandler('tinymceChange', editor.onChangeContent);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Add plugin to the toolbar if not added.
|
||||
*
|
||||
* @param {String} plugin
|
||||
* @param {String} separator
|
||||
*/
|
||||
addPluginToToolbar: function (plugin, separator) {
|
||||
var plugins = this.config.tinymce.plugins.split(' '),
|
||||
toolbar = this.config.tinymce.toolbar.split(' ');
|
||||
|
||||
if (plugins.indexOf(plugin) === -1) {
|
||||
plugins.push(plugin);
|
||||
}
|
||||
|
||||
if (toolbar.indexOf(plugin) === -1) {
|
||||
toolbar.push(separator || '', plugin);
|
||||
}
|
||||
|
||||
this.config.tinymce.plugins = plugins.join(' ');
|
||||
this.config.tinymce.toolbar = toolbar.join(' ');
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the status of the toolbar to disabled or enabled (true for enabled, false for disabled)
|
||||
* @param {Boolean} enabled
|
||||
*/
|
||||
setToolbarStatus: function (enabled) {
|
||||
var controlIds = this.get(this.getId()).theme.panel.rootControl.controlIdLookup;
|
||||
|
||||
_.each(controlIds, function (controlId) {
|
||||
controlId.disabled(!enabled);
|
||||
controlId.canFocus = enabled;
|
||||
|
||||
if (controlId.tooltip) {
|
||||
controlId.tooltip().state.set('rendered', enabled);
|
||||
|
||||
if (enabled) {
|
||||
jQuery(controlId.getEl()).children('button').addBack().removeAttr('style');
|
||||
} else {
|
||||
jQuery(controlId.getEl()).children('button').addBack().attr('style', 'color: inherit;' +
|
||||
'background-color: inherit;' +
|
||||
'border-color: transparent;'
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* @return {Object}
|
||||
*/
|
||||
getSettings: function () {
|
||||
var settings,
|
||||
eventBus = this.eventBus;
|
||||
|
||||
settings = {
|
||||
selector: '#' + this.getId(),
|
||||
theme: 'silver',
|
||||
skin: 'oxide',
|
||||
'toolbar_mode': 'wrap',
|
||||
'entity_encoding': 'raw',
|
||||
'convert_urls': false,
|
||||
'content_css': this.config.tinymce['content_css'],
|
||||
'relative_urls': true,
|
||||
'valid_children': '+body[style]',
|
||||
menubar: false,
|
||||
plugins: this.config.tinymce.plugins,
|
||||
toolbar: this.config.tinymce.toolbar,
|
||||
adapter: this,
|
||||
'body_id': 'html-body',
|
||||
|
||||
/**
|
||||
* @param {Object} editor
|
||||
*/
|
||||
setup: function (editor) {
|
||||
var onChange;
|
||||
|
||||
editor.on('BeforeSetContent', function (evt) {
|
||||
varienGlobalEvents.fireEvent('tinymceBeforeSetContent', evt);
|
||||
eventBus.fireEvent(wysiwygEvents.beforeSetContent);
|
||||
});
|
||||
|
||||
editor.on('SaveContent', function (evt) {
|
||||
varienGlobalEvents.fireEvent('tinymceSaveContent', evt);
|
||||
eventBus.fireEvent(wysiwygEvents.afterSave);
|
||||
});
|
||||
|
||||
editor.on('paste', function (evt) {
|
||||
varienGlobalEvents.fireEvent('tinymcePaste', evt);
|
||||
eventBus.fireEvent(wysiwygEvents.afterPaste);
|
||||
});
|
||||
|
||||
editor.on('PostProcess', function (evt) {
|
||||
varienGlobalEvents.fireEvent('tinymceSaveContent', evt);
|
||||
eventBus.fireEvent(wysiwygEvents.afterSave);
|
||||
});
|
||||
|
||||
editor.on('undo', function (evt) {
|
||||
varienGlobalEvents.fireEvent('tinymceUndo', evt);
|
||||
eventBus.fireEvent(wysiwygEvents.afterUndo);
|
||||
});
|
||||
|
||||
editor.on('focus', function () {
|
||||
eventBus.fireEvent(wysiwygEvents.afterFocus);
|
||||
});
|
||||
|
||||
editor.on('blur', function () {
|
||||
eventBus.fireEvent(wysiwygEvents.afterBlur);
|
||||
});
|
||||
|
||||
/**
|
||||
* @param {*} evt
|
||||
*/
|
||||
onChange = function (evt) {
|
||||
varienGlobalEvents.fireEvent('tinymceChange', evt);
|
||||
eventBus.fireEvent(wysiwygEvents.afterChangeContent);
|
||||
};
|
||||
|
||||
editor.on('Change', onChange);
|
||||
editor.on('keyup', onChange);
|
||||
|
||||
editor.on('ExecCommand', function (cmd) {
|
||||
varienGlobalEvents.fireEvent('tinymceExecCommand', cmd);
|
||||
});
|
||||
|
||||
editor.on('init', function (args) {
|
||||
varienGlobalEvents.fireEvent('wysiwygEditorInitialized', args.target);
|
||||
eventBus.fireEvent(wysiwygEvents.afterInitialization);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// Set default initial height
|
||||
settings['min_height'] = this.config.tinymce['min_height'] ? this.config.tinymce['min_height'] : 250;
|
||||
|
||||
if (this.config.skin) {
|
||||
settings.skin = this.config.skin;
|
||||
}
|
||||
|
||||
if (this.config['toolbar_mode']) {
|
||||
settings['toolbar_mode'] = this.config['toolbar_mode'];
|
||||
}
|
||||
|
||||
if (this.config.baseStaticUrl && this.config.baseStaticDefaultUrl) {
|
||||
settings['document_base_url'] = this.config.baseStaticUrl;
|
||||
}
|
||||
// Set the document base URL
|
||||
if (this.config['document_base_url']) {
|
||||
settings['document_base_url'] = this.config['document_base_url'];
|
||||
}
|
||||
|
||||
if (this.config['files_browser_window_url']) {
|
||||
settings['file_picker_callback_types'] = 'file image media';
|
||||
|
||||
/**
|
||||
* @param {*} callback
|
||||
* @param {*} value
|
||||
* @param {*} meta
|
||||
*/
|
||||
settings['file_picker_callback'] = function (callback, value, meta) {
|
||||
var payload = {
|
||||
callback: callback,
|
||||
value: value,
|
||||
meta: meta
|
||||
};
|
||||
|
||||
varienGlobalEvents.fireEvent('open_browser_callback', payload);
|
||||
this.eventBus.fireEvent('open_browser_callback', payload);
|
||||
}.bind(this);
|
||||
}
|
||||
|
||||
if (this.config.width) {
|
||||
settings.width = this.config.width;
|
||||
}
|
||||
|
||||
if (this.config.height) {
|
||||
settings.height = this.config.height;
|
||||
}
|
||||
|
||||
if (this.config.plugins) {
|
||||
settings.magentoPluginsOptions = {};
|
||||
|
||||
_.each(this.config.plugins, function (plugin) {
|
||||
settings.magentoPluginsOptions[plugin.name] = plugin.options;
|
||||
});
|
||||
}
|
||||
|
||||
if (this.config.settings) {
|
||||
Object.extend(settings, this.config.settings);
|
||||
}
|
||||
|
||||
return settings;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {String} id
|
||||
*/
|
||||
get: function (id) {
|
||||
return tinyMCE.get(id);
|
||||
},
|
||||
|
||||
/**
|
||||
* @return {String|null}
|
||||
*/
|
||||
getId: function () {
|
||||
return this.id || (this.activeEditor() ? this.activeEditor().id : null) || tinyMceEditors.values()[0].id;
|
||||
},
|
||||
|
||||
/**
|
||||
* @return {Object}
|
||||
*/
|
||||
activeEditor: function () {
|
||||
return tinyMCE.activeEditor;
|
||||
},
|
||||
|
||||
/**
|
||||
* Insert content to active editor.
|
||||
*
|
||||
* @param {String} content
|
||||
* @param {Boolean} ui
|
||||
*/
|
||||
insertContent: function (content, ui) {
|
||||
this.activeEditor().execCommand('mceInsertContent', typeof ui !== 'undefined' ? ui : false, content);
|
||||
},
|
||||
|
||||
/**
|
||||
* Replace entire contents of wysiwyg with string content parameter
|
||||
*
|
||||
* @param {String} content
|
||||
*/
|
||||
setContent: function (content) {
|
||||
this.get(this.getId()).setContent(content);
|
||||
},
|
||||
|
||||
/**
|
||||
* Set caret location in WYSIWYG editor.
|
||||
*
|
||||
* @param {Object} targetElement
|
||||
*/
|
||||
setCaretOnElement: function (targetElement) {
|
||||
this.activeEditor().selection.select(targetElement);
|
||||
this.activeEditor().selection.collapse();
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} o
|
||||
*/
|
||||
openFileBrowser: function (o) {
|
||||
var typeTitle = this.translate('Select Images'),
|
||||
storeId = this.config['store_id'] ? this.config['store_id'] : 0,
|
||||
frameDialog = jQuery('div.mce-container[role="dialog"]'),
|
||||
self = this,
|
||||
wUrl = this.config['files_browser_window_url'] +
|
||||
'target_element_id/' + this.getId() + '/' +
|
||||
'store/' + storeId + '/';
|
||||
|
||||
this.mediaBrowserOpener = o.callback;
|
||||
|
||||
if (typeof o.meta.filetype !== 'undefined' && o.meta.filetype !== '') { //eslint-disable-line eqeqeq
|
||||
wUrl = wUrl + 'type/' + o.meta.filetype + '/';
|
||||
}
|
||||
|
||||
frameDialog.hide();
|
||||
jQuery('.tox-tinymce-aux').hide();
|
||||
|
||||
require(['mage/adminhtml/browser'], function () {
|
||||
MediabrowserUtility.openDialog(wUrl, false, false, typeTitle, {
|
||||
/**
|
||||
* Closed.
|
||||
*/
|
||||
closed: function () {
|
||||
frameDialog.show();
|
||||
jQuery('.tox-tinymce-aux').show();
|
||||
},
|
||||
|
||||
targetElementId: self.activeEditor() ? self.activeEditor().id : null
|
||||
}
|
||||
);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {String} string
|
||||
* @return {String}
|
||||
*/
|
||||
translate: function (string) {
|
||||
return jQuery.mage.__ ? jQuery.mage.__(string) : string;
|
||||
},
|
||||
|
||||
/**
|
||||
* @return {null}
|
||||
*/
|
||||
getMediaBrowserOpener: function () {
|
||||
return this.mediaBrowserOpener;
|
||||
},
|
||||
|
||||
/**
|
||||
* @return {null}
|
||||
*/
|
||||
getMediaBrowserTargetElementId: function () {
|
||||
return this.mediaBrowserTargetElementId;
|
||||
},
|
||||
|
||||
/**
|
||||
* @return {jQuery|*|HTMLElement}
|
||||
*/
|
||||
getToggleButton: function () {
|
||||
return $('toggle' + this.getId());
|
||||
},
|
||||
|
||||
/**
|
||||
* Get plugins button.
|
||||
*/
|
||||
getPluginButtons: function () {
|
||||
return jQuery('#buttons' + this.getId() + ' > button.plugin');
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {*} mode
|
||||
* @return {wysiwygSetup}
|
||||
*/
|
||||
turnOn: function (mode) {
|
||||
this.closePopups();
|
||||
|
||||
this.setup(mode);
|
||||
|
||||
this.getPluginButtons().hide();
|
||||
|
||||
tinyMCE.execCommand('mceAddControl', false, this.getId());
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {String} name
|
||||
*/
|
||||
closeEditorPopup: function (name) {
|
||||
if (typeof popups !== 'undefined' && popups[name] !== undefined && !popups[name].closed) {
|
||||
popups[name].close();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @return {wysiwygSetup}
|
||||
*/
|
||||
turnOff: function () {
|
||||
this.closePopups();
|
||||
|
||||
this.getPluginButtons().show();
|
||||
|
||||
tinyMCE.execCommand('mceRemoveEditor', false, this.getId());
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Close popups.
|
||||
*/
|
||||
closePopups: function () {
|
||||
// close all popups to avoid problems with updating parent content area
|
||||
varienGlobalEvents.fireEvent('wysiwygClosePopups');
|
||||
this.closeEditorPopup('browser_window' + this.getId());
|
||||
},
|
||||
|
||||
/**
|
||||
* @return {Boolean}
|
||||
*/
|
||||
toggle: function () {
|
||||
var content;
|
||||
|
||||
if (!tinyMCE.get(this.getId())) {
|
||||
this.turnOn();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
content = this.get(this.getId()) ? this.get(this.getId()).getContent() : this.getTextArea().val();
|
||||
|
||||
this.turnOff();
|
||||
|
||||
if (content.match(/{{.+?}}/g)) {
|
||||
this.getTextArea().val(content.replace(/"/g, '"'));
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* On form validation.
|
||||
*/
|
||||
onFormValidation: function () {
|
||||
if (tinyMCE.get(this.getId())) {
|
||||
$(this.getId()).value = tinyMCE.get(this.getId()).getContent();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* On change content.
|
||||
*/
|
||||
onChangeContent: function () {
|
||||
// Add "changed" to tab class if it exists
|
||||
var tab;
|
||||
|
||||
this.updateTextArea();
|
||||
|
||||
if (this.config['tab_id']) {
|
||||
tab = $$('a[id$=' + this.config['tab_id'] + ']')[0];
|
||||
|
||||
if ($(tab) != undefined && $(tab).hasClassName('tab-item-link')) { //eslint-disable-line eqeqeq
|
||||
$(tab).addClassName('changed');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} o
|
||||
*/
|
||||
beforeSetContent: function (o) {
|
||||
o.content = this.encodeContent(o.content);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} o
|
||||
*/
|
||||
saveContent: function (o) {
|
||||
o.content = this.decodeContent(o.content);
|
||||
},
|
||||
|
||||
/**
|
||||
* Return the content stored in the WYSIWYG field
|
||||
* @param {String} id
|
||||
* @return {String}
|
||||
*/
|
||||
getContent: function (id) {
|
||||
return id ? this.get(id).getContent() : this.get(this.getId()).getContent();
|
||||
},
|
||||
|
||||
/**
|
||||
* @returns {Object}
|
||||
*/
|
||||
getAdapterPrototype: function () {
|
||||
return tinyMceWysiwyg;
|
||||
},
|
||||
|
||||
/**
|
||||
* Fix range selection placement when typing. This fixes MAGETWO-84769
|
||||
* @param {Object} editor
|
||||
*/
|
||||
fixRangeSelection: function (editor) {
|
||||
var selection = editor.selection,
|
||||
dom = editor.dom,
|
||||
rng = dom.createRng(),
|
||||
doc = editor.getDoc(),
|
||||
markerHtml,
|
||||
marker;
|
||||
|
||||
// Validate the range we're trying to fix is contained within the current editors document
|
||||
if (!selection.getContent().length && jQuery.contains(doc, selection.getRng().startContainer)) {
|
||||
markerHtml = '<span id="mce_marker" data-mce-type="bookmark">\uFEFF</span>';
|
||||
selection.setContent(markerHtml);
|
||||
marker = dom.get('mce_marker');
|
||||
rng.setStartBefore(marker);
|
||||
rng.setEndBefore(marker);
|
||||
dom.remove(marker);
|
||||
selection.setRng(rng);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Update text area.
|
||||
*/
|
||||
updateTextArea: function () {
|
||||
var editor = this.get(this.getId()),
|
||||
content;
|
||||
|
||||
if (!editor || editor.id !== this.activeEditor().id) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.addContentEditableAttributeBackToNonEditableNodes();
|
||||
|
||||
content = editor.getContent();
|
||||
content = this.decodeContent(content);
|
||||
|
||||
this.getTextArea().val(content).trigger('change');
|
||||
},
|
||||
|
||||
/**
|
||||
* @return {Object} jQuery textarea element
|
||||
*/
|
||||
getTextArea: function () {
|
||||
return jQuery('#' + this.getId());
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the status of the editor and toolbar
|
||||
*
|
||||
* @param {Boolean} enabled
|
||||
*/
|
||||
setEnabledStatus: function (enabled) {
|
||||
if (this.activeEditor()) {
|
||||
this.activeEditor().getBody().setAttribute('contenteditable', enabled);
|
||||
this.activeEditor().readonly = !enabled;
|
||||
this.setToolbarStatus(enabled);
|
||||
}
|
||||
|
||||
if (enabled) {
|
||||
this.getTextArea().prop('disabled', false);
|
||||
} else {
|
||||
this.getTextArea().prop('disabled', 'disabled');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Retrieve directives URL with substituted directive value.
|
||||
*
|
||||
* @param {String} directive
|
||||
*/
|
||||
makeDirectiveUrl: function (directive) {
|
||||
return this.config['directives_url']
|
||||
.replace(/directive/, 'directive/___directive/' + directive)
|
||||
.replace(/\/$/, '');
|
||||
},
|
||||
|
||||
/**
|
||||
* Convert {{directive}} style attributes syntax to absolute URLs
|
||||
* @param {Object} content
|
||||
* @return {*}
|
||||
*/
|
||||
encodeDirectives: function (content) {
|
||||
// collect all HTML tags with attributes that contain directives
|
||||
return content.gsub(/<([a-z0-9\-\_]+[^>]+?)([a-z0-9\-\_]+="[^"]*?\{\{.+?\}\}.*?".*?)>/i, function (match) {
|
||||
var attributesString = match[2],
|
||||
decodedDirectiveString;
|
||||
|
||||
// process tag attributes string
|
||||
attributesString = attributesString.gsub(/([a-z0-9\-\_]+)="(.*?)(\{\{.+?\}\})(.*?)"/i, function (m) {
|
||||
decodedDirectiveString = encodeURIComponent(Base64.mageEncode(m[3].replace(/"/g, '"') + m[4]));
|
||||
|
||||
return m[1] + '="' + m[2] + this.makeDirectiveUrl(decodedDirectiveString) + '"';
|
||||
}.bind(this));
|
||||
|
||||
return '<' + match[1] + attributesString + '>';
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
/**
|
||||
* Convert absolute URLs to {{directive}} style attributes syntax
|
||||
* @param {Object} content
|
||||
* @return {*}
|
||||
*/
|
||||
decodeDirectives: function (content) {
|
||||
var directiveUrl = this.makeDirectiveUrl('%directive%').split('?')[0], // remove query string from directive
|
||||
// escape special chars in directives url to use in regular expression
|
||||
regexEscapedDirectiveUrl = directiveUrl.replace(/([$^.?*!+:=()\[\]{}|\\])/g, '\\$1'),
|
||||
regexDirectiveUrl = regexEscapedDirectiveUrl
|
||||
.replace(
|
||||
'%directive%',
|
||||
'([a-zA-Z0-9,_-]+(?:%2[A-Z]|)+\/?)(?:(?!").)*'
|
||||
) + '/?(\\\\?[^"]*)?', // allow optional query string
|
||||
reg = new RegExp(regexDirectiveUrl);
|
||||
|
||||
return content.gsub(reg, function (match) {
|
||||
return Base64.mageDecode(decodeURIComponent(match[1]).replace(/\/$/, '')).replace(/"/g, '"');
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} attributes
|
||||
* @return {Object}
|
||||
*/
|
||||
parseAttributesString: function (attributes) {
|
||||
var result = {};
|
||||
|
||||
// Decode " entity, as regex below does not support encoded quote
|
||||
attributes = attributes.replace(/"/g, '"');
|
||||
|
||||
attributes.gsub(
|
||||
/(\w+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/,
|
||||
function (match) {
|
||||
result[match[1]] = match[2];
|
||||
}
|
||||
);
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} content
|
||||
* @return {*}
|
||||
*/
|
||||
decodeContent: function (content) {
|
||||
if (this.config['add_directives']) {
|
||||
content = this.decodeDirectives(content);
|
||||
}
|
||||
|
||||
content = varienGlobalEvents.fireEventReducer('wysiwygDecodeContent', content);
|
||||
|
||||
return content;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} content
|
||||
* @return {*}
|
||||
*/
|
||||
encodeContent: function (content) {
|
||||
if (this.config['add_directives']) {
|
||||
content = this.encodeDirectives(content);
|
||||
}
|
||||
|
||||
content = varienGlobalEvents.fireEventReducer('wysiwygEncodeContent', content);
|
||||
|
||||
return content;
|
||||
},
|
||||
|
||||
/**
|
||||
* Reinstate contenteditable attributes on .mceNonEditable nodes
|
||||
*/
|
||||
addContentEditableAttributeBackToNonEditableNodes: function () {
|
||||
jQuery('.mceNonEditable', this.activeEditor().getDoc()).attr('contenteditable', false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Calls the save method on all editor instances in the collection.
|
||||
*/
|
||||
triggerSave: function () {
|
||||
tinyMCE.triggerSave();
|
||||
}
|
||||
};
|
||||
|
||||
return tinyMceWysiwyg.prototype;
|
||||
});
|
||||
@@ -0,0 +1,714 @@
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
/* global setLocation, Base64, updateElementAtCursor, varienGlobalEvents */
|
||||
/* eslint-disable strict */
|
||||
define([
|
||||
'jquery',
|
||||
'wysiwygAdapter',
|
||||
'Magento_Ui/js/modal/alert',
|
||||
'jquery/ui',
|
||||
'mage/translate',
|
||||
'mage/mage',
|
||||
'mage/validation',
|
||||
'mage/adminhtml/events',
|
||||
'prototype',
|
||||
'Magento_Ui/js/modal/modal'
|
||||
], function (jQuery, wysiwyg, alert) {
|
||||
var widgetTools = {
|
||||
|
||||
/**
|
||||
* Sets the widget to be active and is the scope of the slide out if the value is set
|
||||
*/
|
||||
activeSelectedNode: null,
|
||||
editMode: false,
|
||||
cursorLocation: 0,
|
||||
|
||||
/**
|
||||
* Set active selected node.
|
||||
*
|
||||
* @param {Object} activeSelectedNode
|
||||
*/
|
||||
setActiveSelectedNode: function (activeSelectedNode) {
|
||||
this.activeSelectedNode = activeSelectedNode;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get active selected node.
|
||||
*
|
||||
* @returns {null}
|
||||
*/
|
||||
getActiveSelectedNode: function () {
|
||||
return this.activeSelectedNode;
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Boolean} editMode
|
||||
*/
|
||||
setEditMode: function (editMode) {
|
||||
this.editMode = editMode;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {*} id
|
||||
* @param {*} html
|
||||
* @return {String}
|
||||
*/
|
||||
getDivHtml: function (id, html) {
|
||||
|
||||
if (!html) {
|
||||
html = '';
|
||||
}
|
||||
|
||||
return '<div id="' + id + '">' + html + '</div>';
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} transport
|
||||
*/
|
||||
onAjaxSuccess: function (transport) {
|
||||
var response;
|
||||
|
||||
if (transport.responseText.isJSON()) {
|
||||
response = transport.responseText.evalJSON();
|
||||
|
||||
if (response.error) {
|
||||
throw response;
|
||||
} else if (response.ajaxExpired && response.ajaxRedirect) {
|
||||
setLocation(response.ajaxRedirect);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
dialogOpened: false,
|
||||
|
||||
/**
|
||||
* @return {Number}
|
||||
*/
|
||||
getMaxZIndex: function () {
|
||||
var max = 0,
|
||||
cn = document.body.childNodes,
|
||||
i, el, zIndex;
|
||||
|
||||
for (i = 0; i < cn.length; i++) {
|
||||
el = cn[i];
|
||||
zIndex = el.nodeType == 1 ? parseInt(el.style.zIndex, 10) || 0 : 0; //eslint-disable-line eqeqeq
|
||||
|
||||
if (zIndex < 10000) {
|
||||
max = Math.max(max, zIndex);
|
||||
}
|
||||
}
|
||||
|
||||
return max + 10;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {String} widgetUrl
|
||||
*/
|
||||
openDialog: function (widgetUrl) {
|
||||
var oThis = this,
|
||||
title = 'Insert Widget',
|
||||
mode = 'new',
|
||||
dialog;
|
||||
|
||||
if (this.editMode) {
|
||||
title = 'Edit Widget';
|
||||
mode = 'edit';
|
||||
}
|
||||
|
||||
if (this.dialogOpened) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.dialogWindow = jQuery('<div/>').modal({
|
||||
|
||||
title: jQuery.mage.__(title),
|
||||
type: 'slide',
|
||||
buttons: [],
|
||||
|
||||
/**
|
||||
* Opened.
|
||||
*/
|
||||
opened: function () {
|
||||
dialog = jQuery(this).addClass('loading magento-message');
|
||||
|
||||
widgetUrl += 'mode/' + mode;
|
||||
|
||||
new Ajax.Updater($(this), widgetUrl, {
|
||||
evalScripts: true,
|
||||
|
||||
/**
|
||||
* On complete.
|
||||
*/
|
||||
onComplete: function () {
|
||||
dialog.removeClass('loading');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {jQuery.Event} e
|
||||
* @param {Object} modal
|
||||
*/
|
||||
closed: function (e, modal) {
|
||||
modal.modal.remove();
|
||||
oThis.dialogOpened = false;
|
||||
}
|
||||
});
|
||||
|
||||
this.dialogOpened = true;
|
||||
this.dialogWindow.modal('openModal');
|
||||
}
|
||||
},
|
||||
WysiwygWidget = {};
|
||||
|
||||
WysiwygWidget.Widget = Class.create();
|
||||
WysiwygWidget.Widget.prototype = {
|
||||
/**
|
||||
* @param {HTMLElement} formEl
|
||||
* @param {HTMLElement} widgetEl
|
||||
* @param {*} widgetOptionsEl
|
||||
* @param {*} optionsSourceUrl
|
||||
* @param {*} widgetTargetId
|
||||
*/
|
||||
initialize: function (formEl, widgetEl, widgetOptionsEl, optionsSourceUrl, widgetTargetId) {
|
||||
$(formEl).insert({
|
||||
bottom: widgetTools.getDivHtml(widgetOptionsEl)
|
||||
});
|
||||
|
||||
this.formEl = formEl;
|
||||
this.widgetEl = $(widgetEl);
|
||||
this.widgetOptionsEl = $(widgetOptionsEl);
|
||||
this.optionsUrl = optionsSourceUrl;
|
||||
this.optionValues = new Hash({});
|
||||
this.widgetTargetId = widgetTargetId;
|
||||
|
||||
if (typeof wysiwyg != 'undefined' && wysiwyg.activeEditor()) { //eslint-disable-line eqeqeq
|
||||
this.bMark = wysiwyg.activeEditor().selection.getBookmark();
|
||||
}
|
||||
|
||||
// disable -- Please Select -- option from being re-selected
|
||||
this.widgetEl.querySelector('option').setAttribute('disabled', 'disabled');
|
||||
|
||||
Event.observe(this.widgetEl, 'change', this.loadOptions.bind(this));
|
||||
|
||||
this.initOptionValues();
|
||||
},
|
||||
|
||||
/**
|
||||
* @return {String}
|
||||
*/
|
||||
getOptionsContainerId: function () {
|
||||
return this.widgetOptionsEl.id + '_' + this.widgetEl.value.gsub(/\//, '_');
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {*} containerId
|
||||
*/
|
||||
switchOptionsContainer: function (containerId) {
|
||||
$$('#' + this.widgetOptionsEl.id + ' div[id^=' + this.widgetOptionsEl.id + ']').each(function (e) {
|
||||
this.disableOptionsContainer(e.id);
|
||||
}.bind(this));
|
||||
|
||||
if (containerId != undefined) { //eslint-disable-line eqeqeq
|
||||
this.enableOptionsContainer(containerId);
|
||||
}
|
||||
this._showWidgetDescription();
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {*} containerId
|
||||
*/
|
||||
enableOptionsContainer: function (containerId) {
|
||||
var container = $(containerId);
|
||||
|
||||
container.select('.widget-option').each(function (e) {
|
||||
e.removeClassName('skip-submit');
|
||||
|
||||
if (e.hasClassName('obligatory')) {
|
||||
e.removeClassName('obligatory');
|
||||
e.addClassName('required-entry');
|
||||
}
|
||||
});
|
||||
container.removeClassName('no-display');
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {*} containerId
|
||||
*/
|
||||
disableOptionsContainer: function (containerId) {
|
||||
var container = $(containerId);
|
||||
|
||||
if (container.hasClassName('no-display')) {
|
||||
return;
|
||||
}
|
||||
container.select('.widget-option').each(function (e) {
|
||||
// Avoid submitting fields of unactive container
|
||||
if (!e.hasClassName('skip-submit')) {
|
||||
e.addClassName('skip-submit');
|
||||
}
|
||||
// Form validation workaround for unactive container
|
||||
if (e.hasClassName('required-entry')) {
|
||||
e.removeClassName('required-entry');
|
||||
e.addClassName('obligatory');
|
||||
}
|
||||
});
|
||||
container.addClassName('no-display');
|
||||
},
|
||||
|
||||
/**
|
||||
* Assign widget options values when existing widget selected in WYSIWYG.
|
||||
*
|
||||
* @return {Boolean}
|
||||
*/
|
||||
initOptionValues: function () {
|
||||
var e, widgetCode;
|
||||
|
||||
if (!this.wysiwygExists()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
e = this.getWysiwygNode();
|
||||
|
||||
if (e.localName === 'span') {
|
||||
e = e.firstElementChild;
|
||||
}
|
||||
|
||||
if (e != undefined && e.id) { //eslint-disable-line eqeqeq
|
||||
// attempt to Base64-decode id on selected node; exception is thrown if it is in fact not a widget node
|
||||
try {
|
||||
widgetCode = Base64.idDecode(e.id);
|
||||
} catch (ex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (widgetCode.indexOf('{{widget') !== -1) {
|
||||
this.optionValues = new Hash({});
|
||||
widgetCode.gsub(/([a-z0-9\_]+)\s*\=\s*[\"]{1}([^\"]+)[\"]{1}/i, function (match) {
|
||||
|
||||
if (match[1] == 'type') { //eslint-disable-line eqeqeq
|
||||
this.widgetEl.value = match[2];
|
||||
} else {
|
||||
this.optionValues.set(match[1], match[2]);
|
||||
}
|
||||
|
||||
}.bind(this));
|
||||
|
||||
this.loadOptions();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Load options.
|
||||
*/
|
||||
loadOptions: function () {
|
||||
var optionsContainerId,
|
||||
params,
|
||||
msg,
|
||||
msgTmpl,
|
||||
$wrapper,
|
||||
typeName = this.optionValues.get('type_name');
|
||||
|
||||
if (!this.widgetEl.value) {
|
||||
if (typeName) {
|
||||
msgTmpl = jQuery.mage.__('The widget %1 is no longer available. Select a different widget.');
|
||||
msg = jQuery.mage.__(msgTmpl).replace('%1', typeName);
|
||||
|
||||
jQuery('body').notification('clear').notification('add', {
|
||||
error: true,
|
||||
message: msg,
|
||||
|
||||
/**
|
||||
* @param {String} message
|
||||
*/
|
||||
insertMethod: function (message) {
|
||||
$wrapper = jQuery('<div/>').html(message);
|
||||
|
||||
$wrapper.insertAfter('.modal-slide .page-main-actions');
|
||||
}
|
||||
});
|
||||
}
|
||||
this.switchOptionsContainer();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
optionsContainerId = this.getOptionsContainerId();
|
||||
|
||||
if ($(optionsContainerId) != undefined) { //eslint-disable-line eqeqeq
|
||||
this.switchOptionsContainer(optionsContainerId);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this._showWidgetDescription();
|
||||
|
||||
params = {
|
||||
'widget_type': this.widgetEl.value,
|
||||
values: this.optionValues
|
||||
};
|
||||
new Ajax.Request(this.optionsUrl, {
|
||||
parameters: {
|
||||
widget: Object.toJSON(params)
|
||||
},
|
||||
|
||||
/**
|
||||
* On success.
|
||||
*/
|
||||
onSuccess: function (transport) {
|
||||
try {
|
||||
widgetTools.onAjaxSuccess(transport);
|
||||
this.switchOptionsContainer();
|
||||
|
||||
if ($(optionsContainerId) == undefined) { //eslint-disable-line eqeqeq
|
||||
this.widgetOptionsEl.insert({
|
||||
bottom: widgetTools.getDivHtml(optionsContainerId, transport.responseText)
|
||||
});
|
||||
} else {
|
||||
this.switchOptionsContainer(optionsContainerId);
|
||||
}
|
||||
} catch (e) {
|
||||
alert({
|
||||
content: e.message
|
||||
});
|
||||
}
|
||||
}.bind(this)
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_showWidgetDescription: function () {
|
||||
var noteCnt = this.widgetEl.next().down('small'),
|
||||
descrCnt = $('widget-description-' + this.widgetEl.selectedIndex),
|
||||
description;
|
||||
|
||||
if (noteCnt != undefined) { //eslint-disable-line eqeqeq
|
||||
description = descrCnt != undefined ? descrCnt.innerHTML : ''; //eslint-disable-line eqeqeq
|
||||
noteCnt.update(description);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Validate field.
|
||||
*/
|
||||
validateField: function () {
|
||||
jQuery(this.widgetEl).valid();
|
||||
jQuery('#insert_button').removeClass('disabled');
|
||||
},
|
||||
|
||||
/**
|
||||
* Closes the modal
|
||||
*/
|
||||
closeModal: function () {
|
||||
widgetTools.dialogWindow.modal('closeModal');
|
||||
},
|
||||
|
||||
/* eslint-disable max-depth*/
|
||||
/**
|
||||
* Insert widget.
|
||||
*/
|
||||
insertWidget: function () {
|
||||
var validationResult,
|
||||
$form = jQuery('#' + this.formEl),
|
||||
formElements,
|
||||
i,
|
||||
params,
|
||||
editor,
|
||||
activeNode;
|
||||
|
||||
// remove cached validator instance, which caches elements to validate
|
||||
jQuery.data($form[0], 'validator', null);
|
||||
|
||||
$form.validate({
|
||||
/**
|
||||
* Ignores elements with .skip-submit, .no-display ancestor elements
|
||||
*/
|
||||
ignore: function () {
|
||||
return jQuery(this).closest('.skip-submit, .no-display').length;
|
||||
},
|
||||
errorClass: 'mage-error'
|
||||
});
|
||||
|
||||
validationResult = $form.valid();
|
||||
|
||||
if (validationResult) {
|
||||
formElements = [];
|
||||
i = 0;
|
||||
Form.getElements($(this.formEl)).each(function (e) {
|
||||
|
||||
if (jQuery(e).closest('.skip-submit, .no-display').length === 0) {
|
||||
formElements[i] = e;
|
||||
i++;
|
||||
}
|
||||
});
|
||||
|
||||
// Add as_is flag to parameters if wysiwyg editor doesn't exist
|
||||
params = Form.serializeElements(formElements);
|
||||
|
||||
if (!this.wysiwygExists()) {
|
||||
params += '&as_is=1';
|
||||
}
|
||||
|
||||
new Ajax.Request($(this.formEl).action, {
|
||||
parameters: params,
|
||||
onComplete: function (transport) {
|
||||
try {
|
||||
editor = wysiwyg.get(this.widgetTargetId);
|
||||
|
||||
widgetTools.onAjaxSuccess(transport);
|
||||
widgetTools.dialogWindow.modal('closeModal');
|
||||
|
||||
if (editor) {
|
||||
editor.focus();
|
||||
activeNode = widgetTools.getActiveSelectedNode();
|
||||
|
||||
if (activeNode) {
|
||||
editor.selection.select(activeNode);
|
||||
editor.selection.setContent(transport.responseText);
|
||||
editor.fire('Change');
|
||||
} else if (this.bMark) {
|
||||
editor.selection.moveToBookmark(this.bMark);
|
||||
}
|
||||
}
|
||||
|
||||
if (!activeNode) {
|
||||
this.updateContent(transport.responseText);
|
||||
}
|
||||
} catch (e) {
|
||||
alert({
|
||||
content: e.message
|
||||
});
|
||||
}
|
||||
}.bind(this)
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} content
|
||||
*/
|
||||
updateContent: function (content) {
|
||||
var textarea;
|
||||
|
||||
if (this.wysiwygExists()) {
|
||||
wysiwyg.insertContent(content, false);
|
||||
} else {
|
||||
textarea = document.getElementById(this.widgetTargetId);
|
||||
updateElementAtCursor(textarea, content);
|
||||
varienGlobalEvents.fireEvent('tinymceChange');
|
||||
jQuery(textarea).trigger('change');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @return {Boolean}
|
||||
*/
|
||||
wysiwygExists: function () {
|
||||
return typeof wysiwyg != 'undefined' && wysiwyg.get(this.widgetTargetId);
|
||||
},
|
||||
|
||||
/**
|
||||
* @return {null|wysiwyg.Editor|*}
|
||||
*/
|
||||
getWysiwyg: function () {
|
||||
return wysiwyg.get(this.widgetTargetId);
|
||||
},
|
||||
|
||||
/**
|
||||
* @return {*|Element}
|
||||
*/
|
||||
getWysiwygNode: function () {
|
||||
return widgetTools.getActiveSelectedNode() || wysiwyg.activeEditor().selection.getNode();
|
||||
}
|
||||
};
|
||||
|
||||
WysiwygWidget.chooser = Class.create();
|
||||
WysiwygWidget.chooser.prototype = {
|
||||
|
||||
// HTML element A, on which click event fired when choose a selection
|
||||
chooserId: null,
|
||||
|
||||
// Source URL for Ajax requests
|
||||
chooserUrl: null,
|
||||
|
||||
// Chooser config
|
||||
config: null,
|
||||
|
||||
// Chooser dialog window
|
||||
dialogWindow: null,
|
||||
|
||||
// Chooser content for dialog window
|
||||
dialogContent: null,
|
||||
|
||||
overlayShowEffectOptions: null,
|
||||
overlayHideEffectOptions: null,
|
||||
|
||||
/**
|
||||
* @param {*} chooserId
|
||||
* @param {*} chooserUrl
|
||||
* @param {*} config
|
||||
*/
|
||||
initialize: function (chooserId, chooserUrl, config) {
|
||||
this.chooserId = chooserId;
|
||||
this.chooserUrl = chooserUrl;
|
||||
this.config = config;
|
||||
},
|
||||
|
||||
/**
|
||||
* @return {String}
|
||||
*/
|
||||
getResponseContainerId: function () {
|
||||
return 'responseCnt' + this.chooserId;
|
||||
},
|
||||
|
||||
/**
|
||||
* @return {jQuery|*|HTMLElement}
|
||||
*/
|
||||
getChooserControl: function () {
|
||||
return $(this.chooserId + 'control');
|
||||
},
|
||||
|
||||
/**
|
||||
* @return {jQuery|*|HTMLElement}
|
||||
*/
|
||||
getElement: function () {
|
||||
return $(this.chooserId + 'value');
|
||||
},
|
||||
|
||||
/**
|
||||
* @return {jQuery|*|HTMLElement}
|
||||
*/
|
||||
getElementLabel: function () {
|
||||
return $(this.chooserId + 'label');
|
||||
},
|
||||
|
||||
/**
|
||||
* Open.
|
||||
*/
|
||||
open: function () {
|
||||
$(this.getResponseContainerId()).show();
|
||||
},
|
||||
|
||||
/**
|
||||
* Close.
|
||||
*/
|
||||
close: function () {
|
||||
$(this.getResponseContainerId()).hide();
|
||||
this.closeDialogWindow();
|
||||
},
|
||||
|
||||
/**
|
||||
* Choose.
|
||||
*/
|
||||
choose: function () {
|
||||
// Open dialog window with previously loaded dialog content
|
||||
var responseContainerId;
|
||||
|
||||
if (this.dialogContent) {
|
||||
this.openDialogWindow(this.dialogContent);
|
||||
|
||||
return;
|
||||
}
|
||||
// Show or hide chooser content if it was already loaded
|
||||
responseContainerId = this.getResponseContainerId();
|
||||
|
||||
// Otherwise load content from server
|
||||
new Ajax.Request(this.chooserUrl, {
|
||||
parameters: {
|
||||
'element_value': this.getElementValue(),
|
||||
'element_label': this.getElementLabelText()
|
||||
},
|
||||
|
||||
/**
|
||||
* On success.
|
||||
*/
|
||||
onSuccess: function (transport) {
|
||||
try {
|
||||
widgetTools.onAjaxSuccess(transport);
|
||||
this.dialogContent = widgetTools.getDivHtml(responseContainerId, transport.responseText);
|
||||
this.openDialogWindow(this.dialogContent);
|
||||
} catch (e) {
|
||||
alert({
|
||||
content: e.message
|
||||
});
|
||||
}
|
||||
}.bind(this)
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Open dialog winodw.
|
||||
*
|
||||
* @param {*} content
|
||||
*/
|
||||
openDialogWindow: function (content) {
|
||||
this.dialogWindow = jQuery('<div/>').modal({
|
||||
title: this.config.buttons.open,
|
||||
type: 'slide',
|
||||
buttons: [],
|
||||
|
||||
/**
|
||||
* Opened.
|
||||
*/
|
||||
opened: function () {
|
||||
jQuery(this).addClass('magento-message');
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {jQuery.Event} e
|
||||
* @param {Object} modal
|
||||
*/
|
||||
closed: function (e, modal) {
|
||||
modal.modal.remove();
|
||||
this.dialogWindow = null;
|
||||
}
|
||||
});
|
||||
|
||||
this.dialogWindow.modal('openModal').append(content);
|
||||
},
|
||||
|
||||
/**
|
||||
* Close dialog window.
|
||||
*/
|
||||
closeDialogWindow: function () {
|
||||
this.dialogWindow.modal('closeModal').remove();
|
||||
},
|
||||
|
||||
/**
|
||||
* @return {*|Number}
|
||||
*/
|
||||
getElementValue: function () {
|
||||
return this.getElement().value;
|
||||
},
|
||||
|
||||
/**
|
||||
* @return {String}
|
||||
*/
|
||||
getElementLabelText: function () {
|
||||
return this.getElementLabel().innerHTML;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {*} value
|
||||
*/
|
||||
setElementValue: function (value) {
|
||||
this.getElement().value = value;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {*} value
|
||||
*/
|
||||
setElementLabel: function (value) {
|
||||
this.getElementLabel().innerHTML = value;
|
||||
}
|
||||
};
|
||||
|
||||
window.WysiwygWidget = WysiwygWidget;
|
||||
window.widgetTools = widgetTools;
|
||||
});
|
||||
Reference in New Issue
Block a user