Update development dependencies
This commit is contained in:
Родитель
8a1cafcb9d
Коммит
48599c9d51
2
LICENSE
2
LICENSE
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2018 GitHub, Inc.
|
||||
Copyright (c) 2018-2020 GitHub, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
|
|
@ -162,7 +162,7 @@ for (let level = 2; level <= 6; ++level) {
|
|||
}
|
||||
|
||||
export function insertMarkdownSyntax(root: DocumentFragment): void {
|
||||
const nodeIterator = document.createNodeIterator(root, NodeFilter.SHOW_ELEMENT, function(node) {
|
||||
const nodeIterator = document.createNodeIterator(root, NodeFilter.SHOW_ELEMENT, function (node) {
|
||||
if (node.nodeName in filters && !skipNode(node) && (hasContent(node) || isCheckbox(node))) {
|
||||
return NodeFilter.FILTER_ACCEPT
|
||||
}
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
22
package.json
22
package.json
|
@ -21,23 +21,25 @@
|
|||
"prepublishOnly": "npm run build",
|
||||
"postpublish": "npm publish --ignore-scripts --@github:registry='https://npm.pkg.github.com'"
|
||||
},
|
||||
"prettier": "@github/prettier-config",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.7.0",
|
||||
"@babel/preset-env": "^7.7.1",
|
||||
"@babel/preset-flow": "^7.0.0",
|
||||
"@babel/core": "^7.9.0",
|
||||
"@babel/preset-env": "^7.9.5",
|
||||
"@babel/preset-flow": "^7.9.0",
|
||||
"@github/prettier-config": "0.0.4",
|
||||
"chai": "^4.2.0",
|
||||
"eslint": "^6.6.0",
|
||||
"eslint-plugin-github": "^3.2.1",
|
||||
"flow-bin": "^0.111.1",
|
||||
"karma": "^4.4.1",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-plugin-github": "^3.4.1",
|
||||
"flow-bin": "^0.122.0",
|
||||
"karma": "^5.0.1",
|
||||
"karma-chai": "^0.1.0",
|
||||
"karma-chrome-launcher": "^3.1.0",
|
||||
"karma-mocha": "^1.3.0",
|
||||
"karma-mocha-reporter": "^2.2.5",
|
||||
"mocha": "^6.2.2",
|
||||
"rollup": "^1.26.3",
|
||||
"rollup-plugin-babel": "^4.3.3"
|
||||
"mocha": "^7.1.1",
|
||||
"rollup": "^2.4.0",
|
||||
"rollup-plugin-babel": "^4.4.0"
|
||||
},
|
||||
"eslintIgnore": [
|
||||
"dist/",
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
module.exports = require('eslint-plugin-github/prettier.config')
|
|
@ -96,7 +96,11 @@ function onCopy(event: ClipboardEvent) {
|
|||
function eventIsNotRelevant(event: KeyboardEvent): boolean {
|
||||
return (
|
||||
event.defaultPrevented ||
|
||||
(event.key !== 'r' || event.metaKey || event.altKey || event.shiftKey || event.ctrlKey) ||
|
||||
event.key !== 'r' ||
|
||||
event.metaKey ||
|
||||
event.altKey ||
|
||||
event.shiftKey ||
|
||||
event.ctrlKey ||
|
||||
(event.target instanceof HTMLElement && isFormField(event.target))
|
||||
)
|
||||
}
|
||||
|
@ -188,9 +192,7 @@ function extractQuote(text: string, range: Range, unwrap: boolean): ?Quote {
|
|||
})
|
||||
)
|
||||
insertMarkdownSyntax(fragment)
|
||||
selectionText = selectFragment(fragment)
|
||||
.replace(/^\n+/, '')
|
||||
.replace(/\s+$/, '')
|
||||
selectionText = selectFragment(fragment).replace(/^\n+/, '').replace(/\s+$/, '')
|
||||
} catch (error) {
|
||||
setTimeout(() => {
|
||||
throw error
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = function(config) {
|
||||
module.exports = function (config) {
|
||||
config.set({
|
||||
frameworks: ['mocha', 'chai'],
|
||||
files: ['../dist/quote-selection.umd.js', 'test.js'],
|
||||
|
|
32
test/test.js
32
test/test.js
|
@ -14,10 +14,10 @@ function quote() {
|
|||
)
|
||||
}
|
||||
|
||||
describe('quote-selection', function() {
|
||||
describe('with quotable selection', function() {
|
||||
describe('quote-selection', function () {
|
||||
describe('with quotable selection', function () {
|
||||
let subscription
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
document.body.innerHTML = `
|
||||
<p id="not-quotable">Not quotable text</p>
|
||||
<div data-quote>
|
||||
|
@ -33,13 +33,13 @@ describe('quote-selection', function() {
|
|||
subscription = quoteSelection.subscribe(document.querySelector('[data-nested-quote]'))
|
||||
})
|
||||
|
||||
afterEach(function() {
|
||||
afterEach(function () {
|
||||
quoteSelection.uninstall(document.querySelector('[data-quote]'))
|
||||
subscription.unsubscribe()
|
||||
document.body.innerHTML = ''
|
||||
})
|
||||
|
||||
it('textarea is updated', function() {
|
||||
it('textarea is updated', function () {
|
||||
const el = document.querySelector('#quotable')
|
||||
const selection = window.getSelection()
|
||||
window.getSelection = () => createSelection(selection, el)
|
||||
|
@ -49,11 +49,11 @@ describe('quote-selection', function() {
|
|||
let eventCount = 0
|
||||
let changeCount = 0
|
||||
|
||||
container.addEventListener('quote-selection', function() {
|
||||
container.addEventListener('quote-selection', function () {
|
||||
eventCount++
|
||||
})
|
||||
|
||||
textarea.addEventListener('change', function() {
|
||||
textarea.addEventListener('change', function () {
|
||||
changeCount++
|
||||
})
|
||||
|
||||
|
@ -63,7 +63,7 @@ describe('quote-selection', function() {
|
|||
assert.equal(changeCount, 1)
|
||||
})
|
||||
|
||||
it('nested textarea is updated when event is captured', function() {
|
||||
it('nested textarea is updated when event is captured', function () {
|
||||
const el = document.querySelector('#nested-quotable')
|
||||
const selection = window.getSelection()
|
||||
window.getSelection = () => createSelection(selection, el)
|
||||
|
@ -71,7 +71,7 @@ describe('quote-selection', function() {
|
|||
const textarea = document.querySelector('#nested-textarea')
|
||||
const outerTextarea = document.querySelector('#not-hidden-textarea')
|
||||
|
||||
container.addEventListener('quote-selection', function() {
|
||||
container.addEventListener('quote-selection', function () {
|
||||
textarea.hidden = false
|
||||
})
|
||||
|
||||
|
@ -80,7 +80,7 @@ describe('quote-selection', function() {
|
|||
assert.equal(textarea.value, 'Has text\n\n> Nested text.\n\n')
|
||||
})
|
||||
|
||||
it('textarea is not updated when selecting text outside of quote region', function() {
|
||||
it('textarea is not updated when selecting text outside of quote region', function () {
|
||||
const el = document.querySelector('#not-quotable')
|
||||
const selection = window.getSelection()
|
||||
window.getSelection = () => createSelection(selection, el)
|
||||
|
@ -91,9 +91,9 @@ describe('quote-selection', function() {
|
|||
})
|
||||
})
|
||||
|
||||
describe('with markdown enabled', function() {
|
||||
describe('with markdown enabled', function () {
|
||||
let subscription
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
document.body.innerHTML = `
|
||||
<div data-quote>
|
||||
<div>
|
||||
|
@ -114,12 +114,12 @@ describe('quote-selection', function() {
|
|||
})
|
||||
})
|
||||
|
||||
afterEach(function() {
|
||||
afterEach(function () {
|
||||
subscription.unsubscribe()
|
||||
document.body.innerHTML = ''
|
||||
})
|
||||
|
||||
it('preserves formatting', function() {
|
||||
it('preserves formatting', function () {
|
||||
const range = document.createRange()
|
||||
range.selectNodeContents(document.querySelector('.comment-body').parentNode)
|
||||
assert.ok(quoteSelection.quote('whatever', range))
|
||||
|
@ -141,8 +141,8 @@ describe('quote-selection', function() {
|
|||
)
|
||||
})
|
||||
|
||||
it('allows quote-selection-markdown event to prepare content', function() {
|
||||
document.querySelector('[data-quote]').addEventListener('quote-selection-markdown', function(event) {
|
||||
it('allows quote-selection-markdown event to prepare content', function () {
|
||||
document.querySelector('[data-quote]').addEventListener('quote-selection-markdown', function (event) {
|
||||
const {fragment} = event.detail
|
||||
fragment.querySelector('a[href]').replaceWith('@links')
|
||||
fragment.querySelector('img[alt]').replaceWith(':emoji:')
|
||||
|
|
Загрузка…
Ссылка в новой задаче