Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ReactTooltip/react-tooltip
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: cb16d97d107454a304f1bf09102907374a5baffb
Choose a base ref
...
head repository: ReactTooltip/react-tooltip
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 541718732c6c1ce7c7903615823d78d3c85d1bdb
Choose a head ref
  • 8 commits
  • 3 files changed
  • 4 contributors

Commits on Aug 20, 2018

  1. fix(index.js): Use correct orientation when mouse enters

    getPosition has to be called before first setting the state (and thus rendering the tooltip) when
    mouse enters, to take into account cases when the position is close to the client window edge
    
    #388
    an4ger committed Aug 20, 2018
    Copy the full SHA
    4a0da8b View commit details
  2. fix travis issues

    an4ger committed Aug 20, 2018
    Copy the full SHA
    ab9c109 View commit details

Commits on Sep 3, 2018

  1. Merge remote-tracking branch 'upstream/master'

    # Conflicts:
    #	src/index.js
    an4ger committed Sep 3, 2018
    Copy the full SHA
    6add4b6 View commit details

Commits on Sep 11, 2018

  1. Merge pull request #413 from an4ger/master

    fix(index.js): Use correct orientation when mouse enters
    aronhelser authored Sep 11, 2018
    Copy the full SHA
    be89b82 View commit details

Commits on Sep 12, 2018

  1. Copy the full SHA
    69dea07 View commit details
  2. perf(Use sanitize-html-react instead of sanitize-html to avoid useles…

    …s server side dependencies): Us
    
    Use sanitize-html-react instead of sanitize-html to avoid useless server side dependencies
    
    fix #424
    Julien Gerlier committed Sep 12, 2018
    Copy the full SHA
    4b84caa View commit details
  3. Merge pull request #425 from MtBlue81/fix_state_initialization

    fix(index.js): fix state initialization
    aronhelser authored Sep 12, 2018
    Copy the full SHA
    3ba4d7a View commit details
  4. Merge pull request #426 from jgerlier/use_sanitize-html-react

    perf(Use sanitize-html-react instead of sanitize-html)
    aronhelser authored Sep 12, 2018
    Copy the full SHA
    5417187 View commit details
Showing with 26 additions and 62 deletions.
  1. +1 −1 package.json
  2. +14 −6 src/index.js
  3. +11 −55 yarn.lock
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@
"dependencies": {
"classnames": "^2.2.5",
"prop-types": "^15.6.0",
"sanitize-html": "^1.18.5"
"sanitize-html-react": "^1.13.0"
},
"engines": {
"node": ">=4.2.1"
20 changes: 14 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ import React from 'react'
import PropTypes from 'prop-types'
import ReactDOM from 'react-dom'
import classname from 'classnames'
import sanitizeHtml from 'sanitize-html'
import sanitizeHtml from 'sanitize-html-react'

/* Decoraters */
import staticMethods from './decorators/staticMethods'
@@ -74,7 +74,8 @@ class ReactTooltip extends React.Component {
constructor (props) {
super(props)
this.state = {
place: 'top', // Direction of tooltip
place: props.place || 'top', // Direction of tooltip
desiredPlace: props.place || 'top',
type: 'dark', // Color theme of tooltip
effect: 'float', // float or fixed
show: false,
@@ -297,6 +298,13 @@ class ReactTooltip extends React.Component {
scrollHide = this.props.scrollHide
}

// Make sure the correct place is set
let desiredPlace = e.currentTarget.getAttribute('data-place') || this.props.place || 'top'
let effect = switchToSolid && 'solid' || this.getEffect(e.currentTarget)
let offset = e.currentTarget.getAttribute('data-offset') || this.props.offset || {}
let result = getPosition(e, e.currentTarget, ReactDOM.findDOMNode(this), desiredPlace, desiredPlace, effect, offset)
let place = result.isNewState ? result.newState.place : desiredPlace

// To prevent previously created timers from triggering
this.clearTimer()

@@ -310,11 +318,11 @@ class ReactTooltip extends React.Component {
self.setState({
originTooltip: originTooltip,
isMultiline: isMultiline,
desiredPlace: target.getAttribute('data-place') || self.props.place || 'top',
place: target.getAttribute('data-place') || self.props.place || 'top',
desiredPlace: desiredPlace,
place: place,
type: target.getAttribute('data-type') || self.props.type || 'dark',
effect: switchToSolid && 'solid' || self.getEffect(target),
offset: target.getAttribute('data-offset') || self.props.offset || {},
effect: effect,
offset: offset,
html: target.getAttribute('data-html') ? target.getAttribute('data-html') === 'true' : self.props.html || false,
delayShow: target.getAttribute('data-delay-show') || self.props.delayShow || 0,
delayHide: target.getAttribute('data-delay-hide') || self.props.delayHide || 0,
66 changes: 11 additions & 55 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -318,7 +318,7 @@ array-union@^1.0.1:
dependencies:
array-uniq "^1.0.1"

array-uniq@^1.0.1, array-uniq@^1.0.2:
array-uniq@^1.0.1:
version "1.0.3"
resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6"

@@ -1797,7 +1797,7 @@ chalk@1.1.3, chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3:
strip-ansi "^3.0.0"
supports-color "^2.0.0"

chalk@^2.3.0, chalk@^2.4.1:
chalk@^2.3.0:
version "2.4.1"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e"
dependencies:
@@ -4987,18 +4987,14 @@ lodash.clonedeep@^3.0.1:
lodash._baseclone "^3.0.0"
lodash._bindcallback "^3.0.0"

lodash.clonedeep@^4.3.2, lodash.clonedeep@^4.5.0:
lodash.clonedeep@^4.3.2:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef"

lodash.defaults@^4.0.1:
version "4.2.0"
resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c"

lodash.escaperegexp@^4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz#64762c48618082518ac3df4ccf5d5886dae20347"

lodash.filter@^4.4.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash.filter/-/lodash.filter-4.6.0.tgz#668b1d4981603ae1cc5a6fa760143e480b4c4ace"
@@ -5027,14 +5023,6 @@ lodash.isplainobject@^3.0.0:
lodash.isarguments "^3.0.0"
lodash.keysin "^3.0.0"

lodash.isplainobject@^4.0.6:
version "4.0.6"
resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb"

lodash.isstring@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451"

lodash.istypedarray@^3.0.0:
version "3.0.6"
resolved "https://registry.yarnpkg.com/lodash.istypedarray/-/lodash.istypedarray-3.0.6.tgz#c9a477498607501d8e8494d283b87c39281cef62"
@@ -5082,10 +5070,6 @@ lodash.merge@^4.4.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.0.tgz#69884ba144ac33fe699737a6086deffadd0f89c5"

lodash.mergewith@^4.6.0:
version "4.6.1"
resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.1.tgz#639057e726c3afbdb3e7d42741caa8d6e4335927"

lodash.omit@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/lodash.omit/-/lodash.omit-3.1.0.tgz#897fe382e6413d9ac97c61f78ed1e057a00af9f3"
@@ -6162,14 +6146,6 @@ posix-character-classes@^0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab"

postcss@^6.0.14:
version "6.0.23"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.23.tgz#61c82cc328ac60e677645f979054eb98bc0e3324"
dependencies:
chalk "^2.4.1"
source-map "^0.6.1"
supports-color "^5.4.0"

prelude-ls@~1.1.0, prelude-ls@~1.1.1, prelude-ls@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
@@ -6572,6 +6548,10 @@ regex-not@^1.0.0, regex-not@^1.0.2:
extend-shallow "^3.0.2"
safe-regex "^1.1.0"

regexp-quote@0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/regexp-quote/-/regexp-quote-0.0.0.tgz#1e0f4650c862dcbfed54fd42b148e9bb1721fcf2"

regexpu-core@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-2.0.0.tgz#49d038837b8dcf8bfa5b9a42139938e6ea2ae240"
@@ -6900,19 +6880,12 @@ samsam@~1.1:
version "1.1.3"
resolved "https://registry.yarnpkg.com/samsam/-/samsam-1.1.3.tgz#9f5087419b4d091f232571e7fa52e90b0f552621"

sanitize-html@^1.18.5:
version "1.18.5"
resolved "https://registry.yarnpkg.com/sanitize-html/-/sanitize-html-1.18.5.tgz#350013d95d17f851ef8b178dfd9ca155acf2d7a0"
sanitize-html-react@^1.13.0:
version "1.13.0"
resolved "https://registry.yarnpkg.com/sanitize-html-react/-/sanitize-html-react-1.13.0.tgz#e757b9adbaf2c8a762f3d2dff70138838e05420a"
dependencies:
chalk "^2.3.0"
htmlparser2 "^3.9.0"
lodash.clonedeep "^4.5.0"
lodash.escaperegexp "^4.1.2"
lodash.isplainobject "^4.0.6"
lodash.isstring "^4.0.1"
lodash.mergewith "^4.6.0"
postcss "^6.0.14"
srcset "^1.0.0"
regexp-quote "0.0.0"
xtend "^4.0.0"

sass-graph@^2.1.1:
@@ -7201,10 +7174,6 @@ source-map@^0.5.0, source-map@^0.5.6, source-map@~0.5.0, source-map@~0.5.1, sour
version "0.5.7"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"

source-map@^0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"

source-map@~0.1.30:
version "0.1.43"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.1.43.tgz#c24bc146ca517c1471f5dacbe2571b2b7f9e3346"
@@ -7264,13 +7233,6 @@ sprintf-js@~1.0.2:
version "1.0.3"
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"

srcset@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/srcset/-/srcset-1.0.0.tgz#a5669de12b42f3b1d5e83ed03c71046fc48f41ef"
dependencies:
array-uniq "^1.0.2"
number-is-nan "^1.0.0"

sshpk@^1.7.0:
version "1.13.1"
resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.13.1.tgz#512df6da6287144316dc4c18fe1cf1d940739be3"
@@ -7520,12 +7482,6 @@ supports-color@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"

supports-color@^5.4.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"
dependencies:
has-flag "^3.0.0"

symbol-tree@^3.2.1:
version "3.2.2"
resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6"