Add suggest menu for user mentions in text editor
This commit is contained in:
@@ -10,6 +10,14 @@ KB.dom = function (tag) {
|
||||
return this;
|
||||
};
|
||||
|
||||
this.data = function (attribute, value) {
|
||||
if (arguments.length === 1) {
|
||||
return element.dataset[attribute];
|
||||
}
|
||||
element.dataset[attribute] = value;
|
||||
return this;
|
||||
};
|
||||
|
||||
this.hide = function () {
|
||||
element.style.display = 'none';
|
||||
return this;
|
||||
@@ -30,6 +38,11 @@ KB.dom = function (tag) {
|
||||
return this;
|
||||
};
|
||||
|
||||
this.style = function(attribute, value) {
|
||||
element.style[attribute] = value;
|
||||
return this;
|
||||
};
|
||||
|
||||
this.on = function (eventName, callback) {
|
||||
element.addEventListener(eventName, function (e) {
|
||||
e.preventDefault();
|
||||
@@ -43,6 +56,10 @@ KB.dom = function (tag) {
|
||||
return this.on('click', callback);
|
||||
};
|
||||
|
||||
this.mouseover = function (callback) {
|
||||
return this.on('mouseover', callback);
|
||||
};
|
||||
|
||||
this.change = function (callback) {
|
||||
return this.on('change', callback);
|
||||
};
|
||||
@@ -96,6 +113,11 @@ KB.dom = function (tag) {
|
||||
return this;
|
||||
};
|
||||
|
||||
this.remove = function () {
|
||||
element.parentNode.removeChild(element);
|
||||
return this;
|
||||
};
|
||||
|
||||
this.parent = function (selector) {
|
||||
for (; element && element !== document; element = element.parentNode) {
|
||||
if (element.matches(selector)) {
|
||||
|
||||
Reference in New Issue
Block a user