@convertkit/selection-toolbar
Advanced tools
Comparing version 0.1.9 to 0.1.10
@@ -128,14 +128,2 @@ import React, { useEffect, useRef, useCallback, useState, Component } from 'react'; | ||
function _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
} | ||
function _arrayWithHoles(arr) { | ||
@@ -145,6 +133,2 @@ if (Array.isArray(arr)) return arr; | ||
function _iterableToArray(iter) { | ||
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); | ||
} | ||
function _iterableToArrayLimit(arr, i) { | ||
@@ -176,6 +160,2 @@ var _arr = []; | ||
function _nonIterableSpread() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance"); | ||
} | ||
function _nonIterableRest() { | ||
@@ -252,3 +232,3 @@ throw new TypeError("Invalid attempt to destructure non-iterable instance"); | ||
var useDebounce = function useDebounce(callback, debounce, deps) { | ||
var useDebounce = function useDebounce(callback, debounce) { | ||
var timeout = useRef(); | ||
@@ -274,3 +254,3 @@ var cb = useRef(); | ||
}, debounce); | ||
}, [debounce].concat(_toConsumableArray(deps))); | ||
}, [debounce]); | ||
return [debounced]; | ||
@@ -419,3 +399,3 @@ }; | ||
if (debounce > -1) setRect(getSelectionRect()); | ||
}, debounce, [debounce, setRect]), | ||
}, debounce), | ||
_useDebounce2 = _slicedToArray(_useDebounce, 1), | ||
@@ -980,3 +960,3 @@ update = _useDebounce2[0]; | ||
if (shouldHide) return hide(); | ||
}, 200, [textSelected, visible, menu]), | ||
}, 200), | ||
_useDebounce2 = _slicedToArray(_useDebounce, 1), | ||
@@ -983,0 +963,0 @@ handleSelectionChange = _useDebounce2[0]; |
@@ -133,14 +133,2 @@ 'use strict'; | ||
function _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
} | ||
function _arrayWithHoles(arr) { | ||
@@ -150,6 +138,2 @@ if (Array.isArray(arr)) return arr; | ||
function _iterableToArray(iter) { | ||
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); | ||
} | ||
function _iterableToArrayLimit(arr, i) { | ||
@@ -181,6 +165,2 @@ var _arr = []; | ||
function _nonIterableSpread() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance"); | ||
} | ||
function _nonIterableRest() { | ||
@@ -257,3 +237,3 @@ throw new TypeError("Invalid attempt to destructure non-iterable instance"); | ||
var useDebounce = function useDebounce(callback, debounce, deps) { | ||
var useDebounce = function useDebounce(callback, debounce) { | ||
var timeout = React.useRef(); | ||
@@ -279,3 +259,3 @@ var cb = React.useRef(); | ||
}, debounce); | ||
}, [debounce].concat(_toConsumableArray(deps))); | ||
}, [debounce]); | ||
return [debounced]; | ||
@@ -424,3 +404,3 @@ }; | ||
if (debounce > -1) setRect(getSelectionRect()); | ||
}, debounce, [debounce, setRect]), | ||
}, debounce), | ||
_useDebounce2 = _slicedToArray(_useDebounce, 1), | ||
@@ -985,3 +965,3 @@ update = _useDebounce2[0]; | ||
if (shouldHide) return hide(); | ||
}, 200, [textSelected, visible, menu]), | ||
}, 200), | ||
_useDebounce2 = _slicedToArray(_useDebounce, 1), | ||
@@ -988,0 +968,0 @@ handleSelectionChange = _useDebounce2[0]; |
{ | ||
"name": "@convertkit/selection-toolbar", | ||
"version": "0.1.9", | ||
"version": "0.1.10", | ||
"description": "A toolbar for the ConvertKit Editor that hovers over the selection.", | ||
@@ -35,3 +35,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "8db86681a3d9ac14d4a3954a492acb3e63bbf6f5" | ||
"gitHead": "cba9b08714d4a24d74d4015556ea8c50b8e618a2" | ||
} |
@@ -53,13 +53,9 @@ import React, { useRef, useState, useCallback } from "react"; | ||
const [handleSelectionChange] = useDebounce( | ||
() => { | ||
const shouldShow = textSelected && !visible; | ||
const shouldHide = !textSelected && !menu; | ||
const [handleSelectionChange] = useDebounce(() => { | ||
const shouldShow = textSelected && !visible; | ||
const shouldHide = !textSelected && !menu; | ||
if (shouldShow) return show(); | ||
if (shouldHide) return hide(); | ||
}, | ||
200, | ||
[textSelected, visible, menu] | ||
); | ||
if (shouldShow) return show(); | ||
if (shouldHide) return hide(); | ||
}, 200); | ||
@@ -66,0 +62,0 @@ const handleKeyDown = event => { |
@@ -49,9 +49,5 @@ import { useEffect, useState } from "react"; | ||
const [update] = useDebounce( | ||
() => { | ||
if (debounce > -1) setRect(getSelectionRect()); | ||
}, | ||
debounce, | ||
[debounce, setRect] | ||
); | ||
const [update] = useDebounce(() => { | ||
if (debounce > -1) setRect(getSelectionRect()); | ||
}, debounce); | ||
@@ -58,0 +54,0 @@ useEventListener(document, "selectionchange", update); |
@@ -12,3 +12,3 @@ import { useCallback, useEffect, useRef, useState } from "react"; | ||
*/ | ||
export const useDebounce = (callback, debounce, deps) => { | ||
export const useDebounce = (callback, debounce) => { | ||
const timeout = useRef(); | ||
@@ -37,3 +37,3 @@ const cb = useRef(); | ||
}, | ||
[debounce, ...deps] | ||
[debounce] | ||
); | ||
@@ -40,0 +40,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68860
2392