|
@@ -59,19 +59,11 @@ const TEMPLATE = `
|
|
|
<div class="global-search-category-header" data-bind="text: label"></div>
|
|
<div class="global-search-category-header" data-bind="text: label"></div>
|
|
|
<ul>
|
|
<ul>
|
|
|
<!-- ko foreach: expanded() ? result : topMatches -->
|
|
<!-- ko foreach: expanded() ? result : topMatches -->
|
|
|
- <!-- ko if: typeof draggable !== 'undefined' -->
|
|
|
|
|
- <li class="result" data-bind="multiClick: {
|
|
|
|
|
- click: function () { $parents[1].resultSelected($parentContext.$index(), $index()) },
|
|
|
|
|
- dblClick: function () { $parents[1].resultSelected($parentContext.$index(), $index()); $parents[1].openResult(); }
|
|
|
|
|
- }, html: label, css: { 'selected': $parents[1].selectedResult() === $data }, draggableText: { text: draggable, meta: draggableMeta }"></li>
|
|
|
|
|
- <!-- /ko -->
|
|
|
|
|
- <!-- ko if: typeof draggable === 'undefined' -->
|
|
|
|
|
<li class="result" data-bind="multiClick: {
|
|
<li class="result" data-bind="multiClick: {
|
|
|
click: function () { $parents[1].resultSelected($parentContext.$index(), $index()) },
|
|
click: function () { $parents[1].resultSelected($parentContext.$index(), $index()) },
|
|
|
dblClick: function () { $parents[1].resultSelected($parentContext.$index(), $index()); $parents[1].openResult(); }
|
|
dblClick: function () { $parents[1].resultSelected($parentContext.$index(), $index()); $parents[1].openResult(); }
|
|
|
}, html: label, css: { 'selected': $parents[1].selectedResult() === $data }"></li>
|
|
}, html: label, css: { 'selected': $parents[1].selectedResult() === $data }"></li>
|
|
|
<!-- /ko -->
|
|
<!-- /ko -->
|
|
|
- <!-- /ko -->
|
|
|
|
|
<!-- ko if: topMatches.length < result.length && !expanded() -->
|
|
<!-- ko if: topMatches.length < result.length && !expanded() -->
|
|
|
<li class="blue" data-bind="toggle: expanded">${I18n('Show more...')}</li>
|
|
<li class="blue" data-bind="toggle: expanded">${I18n('Show more...')}</li>
|
|
|
<!-- /ko -->
|
|
<!-- /ko -->
|
|
@@ -189,18 +181,6 @@ class GlobalSearch {
|
|
|
huePubSub.subscribe('context.popover.show.in.assist', deferredCloseIfVisible);
|
|
huePubSub.subscribe('context.popover.show.in.assist', deferredCloseIfVisible);
|
|
|
huePubSub.subscribe('sample.error.insert.click', deferredCloseIfVisible);
|
|
huePubSub.subscribe('sample.error.insert.click', deferredCloseIfVisible);
|
|
|
|
|
|
|
|
- huePubSub.subscribe('draggable.text.started', meta => {
|
|
|
|
|
- // We have to set the height to 0 when dragging a text, just closing the results will break the
|
|
|
|
|
- // jQuery draggable plugin
|
|
|
|
|
- if (meta.source === 'globalSearch') {
|
|
|
|
|
- huePubSub.subscribeOnce('draggable.text.stopped', () => {
|
|
|
|
|
- self.heightWhenDragging(null);
|
|
|
|
|
- self.close();
|
|
|
|
|
- });
|
|
|
|
|
- self.heightWhenDragging(0);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
self.querySpec.subscribe(newValue => {
|
|
self.querySpec.subscribe(newValue => {
|
|
|
window.clearTimeout(self.fetchThrottle);
|
|
window.clearTimeout(self.fetchThrottle);
|
|
|
if (newValue && newValue.query !== '') {
|
|
if (newValue && newValue.query !== '') {
|
|
@@ -511,10 +491,6 @@ class GlobalSearch {
|
|
|
if (doc.hue_name.indexOf('.') !== 0) {
|
|
if (doc.hue_name.indexOf('.') !== 0) {
|
|
|
docCategory.result.push({
|
|
docCategory.result.push({
|
|
|
label: doc.hue_name,
|
|
label: doc.hue_name,
|
|
|
- draggable: doc.originalName,
|
|
|
|
|
- draggableMeta: {
|
|
|
|
|
- source: 'globalSearch'
|
|
|
|
|
- },
|
|
|
|
|
type: 'document',
|
|
type: 'document',
|
|
|
data: doc
|
|
data: doc
|
|
|
});
|
|
});
|
|
@@ -597,8 +573,6 @@ class GlobalSearch {
|
|
|
}
|
|
}
|
|
|
category.result.push({
|
|
category.result.push({
|
|
|
label: result.hue_name || result.originalName,
|
|
label: result.hue_name || result.originalName,
|
|
|
- draggable: result.originalName,
|
|
|
|
|
- draggableMeta: meta,
|
|
|
|
|
type: typeLower,
|
|
type: typeLower,
|
|
|
data: result
|
|
data: result
|
|
|
});
|
|
});
|