remove lodash

This commit is contained in:
Philipp Kühn
2019-05-04 12:20:34 +02:00
parent 9a688409fb
commit fc42cba033
3 changed files with 14 additions and 8 deletions

View File

@@ -21,7 +21,6 @@
"url": "https://github.com/scrumpy/tiptap/issues" "url": "https://github.com/scrumpy/tiptap/issues"
}, },
"dependencies": { "dependencies": {
"lodash-es": "^4.17.11",
"lowlight": "^1.11.0", "lowlight": "^1.11.0",
"prosemirror-collab": "^1.1.1", "prosemirror-collab": "^1.1.1",
"prosemirror-history": "^1.0.4", "prosemirror-history": "^1.0.4",

View File

@@ -1,4 +1,3 @@
import { debounce } from 'lodash-es'
import { Extension } from 'tiptap' import { Extension } from 'tiptap'
import { Step } from 'prosemirror-transform' import { Step } from 'prosemirror-transform'
import { import {
@@ -51,7 +50,7 @@ export default class CollaborationExtension extends Extension {
] ]
} }
getSendableSteps = debounce(state => { getSendableSteps = this.debounce(state => {
const sendable = sendableSteps(state) const sendable = sendableSteps(state)
if (sendable) { if (sendable) {
@@ -59,4 +58,17 @@ export default class CollaborationExtension extends Extension {
} }
}, this.options.debounce) }, this.options.debounce)
debounce(fn, delay) {
let timeout
return function (...args) {
if (timeout) {
clearTimeout(timeout)
}
timeout = setTimeout(() => {
fn(...args)
timeout = null
}, delay)
}
}
} }

View File

@@ -7521,11 +7521,6 @@ locate-path@^3.0.0:
p-locate "^3.0.0" p-locate "^3.0.0"
path-exists "^3.0.0" path-exists "^3.0.0"
lodash-es@^4.17.11:
version "4.17.11"
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.11.tgz#145ab4a7ac5c5e52a3531fb4f310255a152b4be0"
integrity sha512-DHb1ub+rMjjrxqlB3H56/6MXtm1lSksDp2rA2cNWjG8mlDUYFhUj3Di2Zn5IwSU87xLv8tNIQ7sSwE/YOX/D/Q==
lodash._reinterpolate@~3.0.0: lodash._reinterpolate@~3.0.0:
version "3.0.0" version "3.0.0"
resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d"