Works whit 2.4.5? I will test! Thank you friend!
define([
'jquery',
'angular',
], function ($, angular) {
var magezonBuilderUrl = function($rootScope, elementManager) {
this.getTemplateUrl = function(elem, defaultTemplate) {
let localName = 'magezon-builder';
if (typeof elem[0] !== 'undefined' && typeof elem[0]['localName'] !== 'undefined') {
localName = elem[0]['localName'];
}
var templateUrl;
var matches = localName.match("mgz-element-navigator-(.*)-mgz");
if (matches) {
var name = matches[1];
templateUrl = elementManager.getElement(name).navigatorTemplateUrl;
} else {
var matches2 = localName.match("mgz-element-(.*)-mgz");
if (matches2) {
var name = matches2[1];
templateUrl = elementManager.getElement(name).templateUrl;
} else {
templateUrl = elem.attr('templateUrl');
if (!templateUrl) templateUrl = elem.attr('template-url');
if (!templateUrl) templateUrl = elem.parent().attr('template-url');
if (!templateUrl) templateUrl = elem.parent().attr('templateUrl');
}
}
if (!templateUrl && defaultTemplate) templateUrl = defaultTemplate;
return this.getViewFileUrl(templateUrl);
}
this.getViewFileUrl = function(file) {
if (file.indexOf('http') === -1) {
return $rootScope.builderConfig.viewFileUrl + file;
} else {
return file;
}
}
this.getImageUrl = function(file) {
if (file && (file.indexOf('http:://') === -1 || file.indexOf('https://') === -1)) {
return $rootScope.builderConfig.mediaUrl + file;
} else {
return file;
}
}
this.getUrl = function(url, params) {
if (url.indexOf('http') === -1) {
url = $rootScope.builderConfig.baseUrl + url;
}
if (params) {
url += '?' + $.param(params);
}
return url;
}
this.getFrontendUrl = function(url, params) {
if (url.indexOf('http') === -1) {
url = $rootScope.builderConfig.frontend_url + url;
}
if (params) {
url += '?' + $.param(params);
}
return url;
}
}
return magezonBuilderUrl;
});
<textarea class="admin__control-textarea mgz-hidden" data-bind="
value: value,
valueUpdate: valueUpdate,
hasFocus: focused,
attr: {
name: inputName,
'aria-describedby': noticeId,
placeholder: placeholder,
id: htmlId,
disabled: disabled
}"></textarea>
<div data-bind="html: $data.content"></div>
Hello thank you for this update. Really helped meWorks whit 2.4.5? I will test! Thank you friend!
Post automatically merged:
I have some problem to install in 2.4.5 version.
So, I did any updates and works!
app/code/Magezon/Builder/view/base/web/js/services/url.js
Code:define([ 'jquery', 'angular', ], function ($, angular) { var magezonBuilderUrl = function($rootScope, elementManager) { this.getTemplateUrl = function(elem, defaultTemplate) { let localName = 'magezon-builder'; if (typeof elem[0] !== 'undefined' && typeof elem[0]['localName'] !== 'undefined') { localName = elem[0]['localName']; } var templateUrl; var matches = localName.match("mgz-element-navigator-(.*)-mgz"); if (matches) { var name = matches[1]; templateUrl = elementManager.getElement(name).navigatorTemplateUrl; } else { var matches2 = localName.match("mgz-element-(.*)-mgz"); if (matches2) { var name = matches2[1]; templateUrl = elementManager.getElement(name).templateUrl; } else { templateUrl = elem.attr('templateUrl'); if (!templateUrl) templateUrl = elem.attr('template-url'); if (!templateUrl) templateUrl = elem.parent().attr('template-url'); if (!templateUrl) templateUrl = elem.parent().attr('templateUrl'); } } if (!templateUrl && defaultTemplate) templateUrl = defaultTemplate; return this.getViewFileUrl(templateUrl); } this.getViewFileUrl = function(file) { if (file.indexOf('http') === -1) { return $rootScope.builderConfig.viewFileUrl + file; } else { return file; } } this.getImageUrl = function(file) { if (file && (file.indexOf('http:://') === -1 || file.indexOf('https://') === -1)) { return $rootScope.builderConfig.mediaUrl + file; } else { return file; } } this.getUrl = function(url, params) { if (url.indexOf('http') === -1) { url = $rootScope.builderConfig.baseUrl + url; } if (params) { url += '?' + $.param(params); } return url; } this.getFrontendUrl = function(url, params) { if (url.indexOf('http') === -1) { url = $rootScope.builderConfig.frontend_url + url; } if (params) { url += '?' + $.param(params); } return url; } } return magezonBuilderUrl; });
app/code/Magezon/Builder/view/base/web/template/ui/form/element/builder.html
Code:<textarea class="admin__control-textarea mgz-hidden" data-bind=" value: value, valueUpdate: valueUpdate, hasFocus: focused, attr: { name: inputName, 'aria-describedby': noticeId, placeholder: placeholder, id: htmlId, disabled: disabled }"></textarea> <div data-bind="html: $data.content"></div>
=))