Algolia InstantSearch.js' searchFunction parameter not working - algolia

Algolia's InstantSearch.js is working really great. However, its searchFunction parameter doesn't seem to be working according to their docs. Here's my search object:
const search = instantsearch({
indexName: 'decks',
searchClient,
routing: true,
searchParameters: { hitsPerPage: 10 },
searchFunction(helper) {
console.log('hi')
}
})
Nothing ever gets written to the console and search functionality remains the same. So, it seems searchFunction is never called. I'm using InstantSearch.js v3.0.0, has searchFunction maybe been renamed to something else?

searchFunction does in fact work as an argument to instantsearch. Even though I had previously reset my browser to avoid caching issues and did a view source to make sure updated JavaScript code was being loaded, I apparently had an older version of the code running.
Hopefully this helps someone else. Though I suppose this is now a Chrome caching issue rather than an InstantSearch.js issue.

Related

No JSONFormatter works in Safari 8.0 on Yosemite

I tried several JSONFormatter plugins to prettify the var_dump data from the framework laravel.
None of the plugins worked, though. I have no idea why. I tried everything, but it always gives me raw text instead of formatted text
Any ideas?
PS: For example, I tried this one: https://github.com/rfletcher/safari-json-formatter
I got that problem too. Although my json format is valid, the browser still does not show it in a pretty way.
Well, I translate my result using Jsend (https://github.com/shkm/JSend) and the returned result works fine in all browsers. I am not sure why but this is a viable option if you do not want to spend time investigating.
Found the solution! The problem was hiding in my 'homestead.yaml' file. I had to turn this:
sites:
- map: website.app
to: /home/vagrant/Projects/Website/public
hhvm: true
to this:
sites:
- map: website.app
to: /home/vagrant/Projects/Website/public
h hhvm: true was causing the problem. I removed it, backed up my database (gets deleted) and ran vagrant provision {your vagrant-id}
I don't know why, but now it works :)

RESTFUL API : new Iron Router version this.request.body not working anymore

I had my API fully functional and everything was working like a charm but with the last updates of Iron Router (Meteor update could impact?) my command
this.request.body
doesn't render nothing when I have a POST call on my API (all calls work good and I have no problem with GET this.params), I took a look at the docs and I don't see nothing talking about this, does anyone have an idea?
Thanks for your help =)
PS : I tried to replace it (without success obviously) by :
this.params.query.body
this.request.query.body
When I try to do a JSON.stringify on this.request it is empty so I guess it has been moved somewhere...
As asked here https://github.com/EventedMind/iron-router/issues/1003, just add:
Router.onBeforeAction(Iron.Router.bodyParser.urlencoded({extended: false}))
in your Meteor.startup

Bug at loading URLs to images

I think that I've found a bug in the add-on SDK. When I try to load a tab doing something like this:
var t = tabs.open({
url: linkURL,
inBackground: true,
onReady: closeTab(this)
});
And the URL is an image. The onReady event is never fired.
Is that the expected behaviour?
Thanks
I'm not sure whether this counts as a bug but you should probably file a bug report to see what the developers think about it. The problem is that the SDK waits for the DOMContentLoaded event to recognize that the tab is ready - but Gecko doesn't fire this event for image documents. The SDK could use a web progress listener instead, these work regardless of the document type.

TinyMCE: Copy-Paste from Google Docs

Folks,
My company needs to support the following workflow:
- There's rich content getting created in Google Docs (with simple formatting - bold/italic, as well as hyperlinks)
- That content is then pasted into an internal CMS that uses TinyMCE.
Problem: all formatting gets lost when pasting stuff in.
Already tried the "paste from Word" plugin - it doesn't work.
Please advise. Thank you!
UPDATE:
I narrowed the problem down to Google Chrome. Firefox works just fine. I also used the paste_pre_processing() callbacks - the data gets corrupted before getting in there.
I ended up giving up on the Paste plugin into TinyMCE. Instead, I used the undocumented valid_styles property of TinyMCE. This solved the problem fine for my scenario. Here's the config snippet we ended up using:
valid_elements: "a[href|title|target],del,b,strong,del,i,blockquote,p,br,em,ul,li,ol,span[style]",
valid_styles : { '*' : 'font-weight,font-style,text-decoration' },
I know this question was asked a long time ago however I am making an application that requires a copy and paste from google drive into tiny mce. This is actually fairly simple with the free paste plugin. Simply remove the filters so that it can copy in all of the data.
tinymce.init({
selector: 'textarea',
plugins: "paste",
paste_data_images: true,
paste_enable_default_filters: false,
paste_remove_styles_if_webkit: false
});
Your problem is a somewhat complex issue.
First you need to make sure that tinymce does not remove tags and tag-attributes that it recognises as invalid (have a closer look at the tinymce configuration options valid_elements and valid_children).
Second you will have to implement an own handling of the paste process.
There are three way to do this. The most time consuming option is to write an own custom paste plugin and replace the given one. The other options are ways to configure the paste plugins and define own functions to interact with and change the pasted content.
The seetings paste_pre_processing and paste_post_processing are the way to go here.

How do you automatically set focus on a form field using yui

I currently have an issue where I want text field to be automatically selected when the user visits my webpage, I currently do this by Javascript but would, ideally, like to use YUI. After searching the web, i found this command,
YAHOO.util.Dom.get("first_element").focus();
and
YAHOO.util.Dom.get("text1t").focus();
but have had very little luck getting it to work, one suggestion was to use a setTimeout fnction, but this seems a rather ugly way of doing it.
If anyone has any suggstions I would be very grateful.
Thanks,
Try using onAvailable
YAHOO.util.Event.onAvailable("elementId", function(me) { me.focus(); }, YAHOO.util.Dom.get("elementId"));
You may need to use a later event, like onContentReady or even onDOMReady if that doesn't work.