slate-edit-blockquote
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -6,2 +6,10 @@ # Change Log | ||
## [0.1.2] - 2016-09-30 | ||
### Fixed | ||
- Now publish compiled source with babel | ||
## [0.1.1] - 2016-09-19 | ||
### Fixed | ||
- Use of this plugin with other container plugins (such as `slate-edit-list`) | ||
## [0.1.0] - 2016-09-17 | ||
@@ -8,0 +16,0 @@ - First version |
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
@@ -11,4 +12,5 @@ /** | ||
function getCurrentBlockquote(opts, state, block) { | ||
const { document } = state; | ||
var document = state.document; | ||
if (!block) { | ||
@@ -19,3 +21,3 @@ if (!state.selection.startKey) return null; | ||
const parent = document.getParent(block.key); | ||
var parent = document.getParent(block.key); | ||
@@ -22,0 +24,0 @@ return parent && parent.type === opts.type ? parent : null; |
@@ -1,14 +0,18 @@ | ||
const onEnter = require('./onEnter'); | ||
const onTab = require('./onTab'); | ||
const onBackspace = require('./onBackspace'); | ||
const makeSchema = require('./makeSchema'); | ||
'use strict'; | ||
const getCurrentBlockquote = require('./getCurrentBlockquote'); | ||
const wrapInBlockquote = require('./transforms/wrapInBlockquote'); | ||
const unwrapBlockquote = require('./transforms/unwrapBlockquote'); | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
const KEY_ENTER = 'enter'; | ||
const KEY_TAB = 'tab'; | ||
const KEY_BACKSPACE = 'backspace'; | ||
var onEnter = require('./onEnter'); | ||
var onTab = require('./onTab'); | ||
var onBackspace = require('./onBackspace'); | ||
var makeSchema = require('./makeSchema'); | ||
var getCurrentBlockquote = require('./getCurrentBlockquote'); | ||
var wrapInBlockquote = require('./transforms/wrapInBlockquote'); | ||
var unwrapBlockquote = require('./transforms/unwrapBlockquote'); | ||
var KEY_ENTER = 'enter'; | ||
var KEY_TAB = 'tab'; | ||
var KEY_BACKSPACE = 'backspace'; | ||
/** | ||
@@ -40,5 +44,6 @@ * A Slate plugin to handle keyboard events in lists. | ||
function bindTransform(fn) { | ||
return function (transform, ...args) { | ||
const { state } = transform; | ||
return function (transform) { | ||
var state = transform.state; | ||
if (!isSelectionInBlockquote(state)) { | ||
@@ -48,3 +53,7 @@ return transform; | ||
return fn(...[opts, transform].concat(args)); | ||
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
args[_key - 1] = arguments[_key]; | ||
} | ||
return fn.apply(undefined, _toConsumableArray([opts, transform].concat(args))); | ||
}; | ||
@@ -58,22 +67,22 @@ } | ||
// Build arguments list | ||
const args = [e, data, state, opts]; | ||
var args = [e, data, state, opts]; | ||
switch (data.key) { | ||
case KEY_ENTER: | ||
return onEnter(...args); | ||
return onEnter.apply(undefined, args); | ||
case KEY_TAB: | ||
return onTab(...args); | ||
return onTab.apply(undefined, args); | ||
case KEY_BACKSPACE: | ||
return onBackspace(...args); | ||
return onBackspace.apply(undefined, args); | ||
} | ||
} | ||
const schema = makeSchema(opts); | ||
var schema = makeSchema(opts); | ||
return { | ||
onKeyDown, | ||
schema, | ||
onKeyDown: onKeyDown, | ||
schema: schema, | ||
utils: { | ||
isSelectionInBlockquote | ||
isSelectionInBlockquote: isSelectionInBlockquote | ||
}, | ||
@@ -80,0 +89,0 @@ |
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
@@ -2,0 +3,0 @@ /** |
@@ -1,4 +0,6 @@ | ||
const getCurrentBlockquote = require('./getCurrentBlockquote'); | ||
const unwrapBlockquote = require('./transforms/unwrapBlockquote'); | ||
'use strict'; | ||
var getCurrentBlockquote = require('./getCurrentBlockquote'); | ||
var unwrapBlockquote = require('./transforms/unwrapBlockquote'); | ||
/** | ||
@@ -9,4 +11,6 @@ * User pressed Delete in an editor: | ||
function onBackspace(event, data, state, opts) { | ||
const { startOffset, isCollapsed } = state; | ||
var startOffset = state.startOffset; | ||
var isCollapsed = state.isCollapsed; | ||
if (!getCurrentBlockquote(opts, state) || !isCollapsed) { | ||
@@ -13,0 +17,0 @@ return null; |
@@ -1,4 +0,6 @@ | ||
const getCurrentBlockquote = require('./getCurrentBlockquote'); | ||
const unwrapBlockquote = require('./transforms/unwrapBlockquote'); | ||
'use strict'; | ||
var getCurrentBlockquote = require('./getCurrentBlockquote'); | ||
var unwrapBlockquote = require('./transforms/unwrapBlockquote'); | ||
/** | ||
@@ -10,4 +12,5 @@ * User pressed Enter in an editor | ||
function onEnter(event, data, state, opts) { | ||
const { startBlock } = state; | ||
var startBlock = state.startBlock; | ||
if (!getCurrentBlockquote(opts, state)) { | ||
@@ -14,0 +17,0 @@ return null; |
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
@@ -2,0 +3,0 @@ /** |
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
@@ -2,0 +3,0 @@ /** |
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
@@ -2,0 +3,0 @@ /** |
{ | ||
"name": "slate-edit-blockquote", | ||
"description": "A Slate plugin to handle keyboard events in blockquotes.", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"license": "Apache-2.0", | ||
@@ -6,0 +6,0 @@ "repository": "git://github.com/GitbookIO/slate-edit-blockquote.git", |
Sorry, the diff of this file is too big to display
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
2209438
35
63488
1