Skip to content

Commit

Permalink
Merge pull request #134 from magento-vanilla/PR-Bugs-P2
Browse files Browse the repository at this point in the history
[Vanilla] Bugfixes
  • Loading branch information
MomotenkoNatalia authored Jul 8, 2016
2 parents f7febb4 + f59ac9c commit 471976c
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ define([
case 9: // DOCUMENT_NODE
var hostName = window.location.hostname,
iFrameHostName = $('<a>')
.prop('href', element.prop('src'))
.prop('href', $(element).prop('src'))
.prop('hostname');

if (hostName === iFrameHostName) {
Expand Down
33 changes: 32 additions & 1 deletion app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,18 @@ define([
defaults: {
elementSelector: 'textarea',
value: '',
$wysiwygEditorButton: '',
links: {
value: '${ $.provider }:${ $.dataScope }'
},
template: 'ui/form/field',
elementTmpl: 'ui/form/element/wysiwyg',
content: '',
showSpinner: false,
loading: false
loading: false,
listens: {
disabled: 'setDisabled'
}
},

/**
Expand All @@ -34,6 +38,13 @@ define([
this._super()
.initNodeListener();

$.async({
component: this,
selector: 'button'
}, function (element) {
this.$wysiwygEditorButton = $(element);
}.bind(this));

return this;
},

Expand Down Expand Up @@ -69,6 +80,26 @@ define([
$(node).bindings({
value: this.value
});
},

/**
* Set disabled property to wysiwyg component
*
* @param {Boolean} status
*/
setDisabled: function (status) {
this.$wysiwygEditorButton.attr('disabled', status);

/* eslint-disable no-undef */
if (tinyMCE) {
_.each(tinyMCE.activeEditor.controlManager.controls, function (property, index, controls) {
controls[property].setDisabled(status);
});

tinyMCE.activeEditor.getBody().setAttribute('contenteditable', !status);
}

/* eslint-enable no-undef*/
}
});
});
5 changes: 2 additions & 3 deletions app/code/Magento/Ui/view/base/web/js/grid/resize.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,10 @@ define([
*/
initResizableElement: function (column) {
var model = ko.dataFor(column),
ctx = ko.contextFor(column),
tempalteDragElement = '<div class="' + ctx.$parent.resizeConfig.classResize + '"></div>';
templateDragElement = '<div class="' + this.resizableElementClass + '"></div>';

if (_.isUndefined(model.resizeEnabled) || model.resizeEnabled) {
$(column).append(tempalteDragElement);
$(column).append(templateDragElement);

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/web/mage/apply/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ define([

/**
* Parses 'script' tags with a custom type attribute and moves it's data
* to a 'data-mage-init' attribute of an elemennt found by provided selector.
* to a 'data-mage-init' attribute of an element found by provided selector.
* Note: All found script nodes will be removed from DOM.
*
* @returns {Array} An array of components not assigned to the specific element.
Expand Down
11 changes: 6 additions & 5 deletions lib/web/mage/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ define([
//Add class for expanded option
isExpanded: function () {
var subMenus = this.element.find(this.options.menus),
expandedMenus = subMenus.find('ul');
expandedMenus = subMenus.find(this.options.menus);

expandedMenus.addClass('expanded');
},
Expand All @@ -105,7 +105,7 @@ define([
return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
}

if (this.active.closest('ul').attr('aria-expanded') != 'true') {
if (this.active.closest(this.options.menus).attr('aria-expanded') != 'true') {

switch (event.keyCode) {
case $.ui.keyCode.PAGE_UP:
Expand Down Expand Up @@ -334,15 +334,16 @@ define([
},
"mouseenter .ui-menu-item": function (event) {
var target = $(event.currentTarget),
submenu = this.options.menus,
ulElement,
ulElementWidth,
width,
targetPageX,
rightBound;

if (target.has('ul')) {
ulElement = target.find('ul');
ulElementWidth = target.find('ul').outerWidth(true);
if (target.has(submenu)) {
ulElement = target.find(submenu);
ulElementWidth = ulElement.outerWidth(true);
width = target.outerWidth() * 2;
targetPageX = target.offset().left;
rightBound = $(window).width();
Expand Down

0 comments on commit 471976c

Please sign in to comment.