mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-07 22:05:59 +01:00
Fixed memory leak with icon picker + optimizations
This commit is contained in:
@@ -229,6 +229,18 @@ class QL_Icon_Picker {
|
|||||||
.addClass(preview);
|
.addClass(preview);
|
||||||
$preview.find('a').show();
|
$preview.find('a').show();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Grav */
|
||||||
|
// extend $ with 3rd party QL Icon Picker
|
||||||
|
$.fn.qlIconPicker = function(options) {
|
||||||
|
this.each(function() {
|
||||||
|
if (!$.data(this, 'plugin_qlIconPicker')) {
|
||||||
|
$.data(this, 'plugin_qlIconPicker', new QL_Icon_Picker(this, options));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default class IconpickerField {
|
export default class IconpickerField {
|
||||||
@@ -256,17 +268,7 @@ export default class IconpickerField {
|
|||||||
addItem(element) {
|
addItem(element) {
|
||||||
element = $(element);
|
element = $(element);
|
||||||
this.items = this.items.add(element);
|
this.items = this.items.add(element);
|
||||||
|
element.find('.icon-picker').qlIconPicker({
|
||||||
$.fn.qlIconPicker = function(options) {
|
|
||||||
this.each(function() {
|
|
||||||
if (!$.data(this, 'plugin_qlIconPicker')) {
|
|
||||||
$.data(this, 'plugin_qlIconPicker', new QL_Icon_Picker(this, options));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return this;
|
|
||||||
};
|
|
||||||
|
|
||||||
$('.icon-picker').qlIconPicker({
|
|
||||||
'save': 'class'
|
'save': 'class'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user