Skip to content

Commit

Permalink
Merge b07aaa6 into ad2a0a9
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Zhelyazkov committed Jun 28, 2016
2 parents ad2a0a9 + b07aaa6 commit 08e3560
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 46 deletions.
5 changes: 4 additions & 1 deletion bower.json
@@ -1,7 +1,7 @@
{
"name": "ment.io",
"main": "dist/mentio.js",
"version": "0.9.24",
"version": "0.9.25",
"homepage": "https://github.com/jeff-collins/ment.io",
"authors": [
"jeff-collins <i.am.jeff.collins@gmail.com>",
Expand All @@ -25,5 +25,8 @@
"angular": "~1.2.18",
"angular-mocks": "~1.2.18",
"angular-ui-tinymce": "latest"
},
"resolutions": {
"angular": "~1.2.18"
}
}
29 changes: 17 additions & 12 deletions dist/mentio.js
Expand Up @@ -16,7 +16,8 @@ angular.module('mentio', [])
requireLeadingSpace: '=mentioRequireLeadingSpace',
selectNotFound: '=mentioSelectNotFound',
trimTerm: '=mentioTrimTerm',
ngModel: '='
ngModel: '=',
zIndex: '@mentioZIndex'
},
controller: ["$scope", "$timeout", "$attrs", function($scope, $timeout, $attrs) {

Expand Down Expand Up @@ -266,6 +267,7 @@ angular.module('mentio', [])
}
html = html + ' mentio-trigger-char="\'' + scope.defaultTriggerChar + '\'"' +
' mentio-parent-scope="parentScope"' +
' mentio-z-index="' + (scope.zIndex || 10000) + '"' +
'/>';
var linkFn = $compile(html);
var el = linkFn(scope);
Expand Down Expand Up @@ -463,7 +465,8 @@ angular.module('mentio', [])
items: '=mentioItems',
triggerChar: '=mentioTriggerChar',
forElem: '=mentioFor',
parentScope: '=mentioParentScope'
parentScope: '=mentioParentScope',
zIndex: '@mentioZIndex'
},
templateUrl: function(tElement, tAttrs) {
return tAttrs.mentioTemplateUrl !== undefined ? tAttrs.mentioTemplateUrl : 'mentio-menu.tpl.html';
Expand Down Expand Up @@ -541,6 +544,8 @@ angular.module('mentio', [])
$document[0].body.appendChild(element[0]);
scope.menuElement = element; // for testing

var zIndex = scope.zIndex || 10000;

if (scope.parentScope) {
scope.parentScope.addMenu(scope);
} else {
Expand All @@ -567,7 +572,7 @@ angular.module('mentio', [])
var triggerCharSet = [];
triggerCharSet.push(scope.triggerChar);
mentioUtil.popUnderMention(scope.parentMentio.context(),
triggerCharSet, element, scope.requireLeadingSpace);
triggerCharSet, element, zIndex, scope.requireLeadingSpace);
}
}
);
Expand All @@ -590,7 +595,7 @@ angular.module('mentio', [])
var triggerCharSet = [];
triggerCharSet.push(scope.triggerChar);
mentioUtil.popUnderMention(scope.parentMentio.context(),
triggerCharSet, element, scope.requireLeadingSpace);
triggerCharSet, element, zIndex, scope.requireLeadingSpace);
}
});

Expand All @@ -606,7 +611,7 @@ angular.module('mentio', [])
scope.adjustScroll = function (direction) {
var menuEl = element[0];
var menuItemsList = menuEl.querySelector('ul');
var menuItem = (menuEl.querySelector('[mentio-menu-item].active') ||
var menuItem = (menuEl.querySelector('[mentio-menu-item].active') ||
menuEl.querySelector('[data-mentio-menu-item].active'));

if (scope.isFirstItemActive()) {
Expand Down Expand Up @@ -686,7 +691,7 @@ angular.module('mentio')
.factory('mentioUtil', ["$window", "$location", "$anchorScroll", "$timeout", function ($window, $location, $anchorScroll, $timeout) {

// public
function popUnderMention (ctx, triggerCharSet, selectionEl, requireLeadingSpace) {
function popUnderMention (ctx, triggerCharSet, selectionEl, zIndex, requireLeadingSpace) {
var coordinates;
var mentionInfo = getTriggerInfo(ctx, triggerCharSet, requireLeadingSpace, false);

Expand All @@ -703,8 +708,8 @@ angular.module('mentio')
selectionEl.css({
top: coordinates.top + 'px',
left: coordinates.left + 'px',
position: 'absolute',
zIndex: 10000,
position: 'fixed',
zIndex: zIndex,
display: 'block'
});

Expand Down Expand Up @@ -856,7 +861,7 @@ angular.module('mentio')
}

// public
function replaceTriggerText (ctx, targetElement, path, offset, triggerCharSet,
function replaceTriggerText (ctx, targetElement, path, offset, triggerCharSet,
text, requireLeadingSpace, hasTrailingSpace) {
resetSelection(ctx, targetElement, path, offset);

Expand Down Expand Up @@ -979,7 +984,7 @@ angular.module('mentio')
// public
function getTriggerInfo (ctx, triggerCharSet, requireLeadingSpace, menuAlreadyActive, hasTrailingSpace) {
/*jshint maxcomplexity:11 */
// yes this function needs refactoring
// yes this function needs refactoring
var selected, path, offset;
if (selectedElementIsTextAreaOrInput(ctx)) {
selected = getDocument(ctx).activeElement;
Expand Down Expand Up @@ -1124,7 +1129,7 @@ angular.module('mentio')
obj = iframe;
iframe = null;
}
}
}
obj = element;
iframe = ctx ? ctx.iframe : null;
while(obj !== getDocument().body) {
Expand All @@ -1139,7 +1144,7 @@ angular.module('mentio')
obj = iframe;
iframe = null;
}
}
}
}

function getTextAreaOrInputUnderlinePosition (ctx, element, position) {
Expand Down

0 comments on commit 08e3560

Please sign in to comment.