Skip to content

Commit

Permalink
bugs, bugs, bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
snowkeeper committed Oct 21, 2015
1 parent 77a53cf commit f0bd157
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ let tagOpts = {
nameFromTagAttr: 'name',
nameFromTagSaveChildren: ':not("em, code")',
useLocation: true,
skipHistory: false,
forceSearch: 2000,
noclasses: false,
nostyles: false,
Expand Down Expand Up @@ -87,11 +88,12 @@ emitter.once('tag-search:options', (options) => {
> **placeholder** - *{String}* - placeholder text
> **searchList** - *{String}* - ID of search list div
> **tagSelector** - *{String}* - selector of tags to use for search list
> **linkFromTagAttr** - *{String}* - the links will be taked from this attribute in each `tagSelector`
> **linkFromTagAttr** - *{String}* - the links will be taked from this attribute in each `tagSelector`
> **contextTextUntilTag** - *{String}* - use the text until this tag is reached for the context string
> **nameFromTagAttr** - *{String}* - the attribute to grab the name from
> **nameFromNextTag** - *{Boolean}* - get the display name from the next tag
> **useLocation** - *{Boolean}* - Use `window.location` instead of scroll
> **useLocation** - *{Boolean}* - Use `window.location` in place of `$(document).scrollTop`. Defaults to `true` except for mobile.
> **skipHistory** - *{Boolean}* - if you provided a history object already and need to skip using for any reason
> **noclasses** - *{Boolean}* - do **not** include **any** classes
> **nostyles** - *{Boolean}* - do **not** include **any** styles
> **classes** - *{Object}* - object of classes
Expand Down
17 changes: 9 additions & 8 deletions lib/tag-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ class Tagged extends React.Component {
nostyles: opts.nostyles ? true : false,
forceSearch: opts.forceSearch || 2000,
wrapperLeftText: opts.wrapperLeftText || 'menu',
wrapperRightText: opts.wrapperRightText || 'search'
wrapperRightText: opts.wrapperRightText || 'search',
skipHistory: opts.skipHistory || false
}
// classes
this.state.Anchored.classes = this.state.Anchored.noclasses ? defaultClasses : _.defaults(opts.classes || {}, defaultClasses)
Expand Down Expand Up @@ -234,7 +235,7 @@ class Tagged extends React.Component {
typed: entry,
}
// open the list
//console.log('entry search')
//debug('entry search')
return thisComponent.searchTags(entry)
}
let useMe = thisComponent._limiters;
Expand All @@ -248,7 +249,7 @@ class Tagged extends React.Component {

// force search after specified time
if(useMe.force < now) {
//console.log('force search')
//debug('force search')
useMe.force = new Date().getTime() + this.state.Anchored.forceSearch
thisComponent.searchTags(entry)
return false
Expand All @@ -259,7 +260,7 @@ class Tagged extends React.Component {

// set the interval to run the search
useMe.interval = setTimeout(function() {
//console.log('interval search')
//debug('interval search')
thisComponent.searchTags(useMe.typed)
clearTimeout(thisComponent._limiters.interval)
}, 250)
Expand Down Expand Up @@ -385,14 +386,14 @@ class Tagged extends React.Component {
let replaceHistory
let _history = false

if('object' === $.type(thisComponent.props.history)) {
if('function' === $.type(thisComponent.props.history.pushState)) {
if(!config.skipHistory && 'object' === $.type(thisComponent.props.history)) {
if($.isFunction(thisComponent.props.history.pushState)) {
pushHistory = function() {
console.log('push history')
debug('push history')
thisComponent.props.history.pushState(null, goTo)
}
replaceHistory = function() {
console.log('replace history')
debug('replace history')
thisComponent.props.history.replaceState(null, goTo)
}
_history = true
Expand Down

0 comments on commit f0bd157

Please sign in to comment.