1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-30 18:39:51 +02:00

Add options with normalize to unwrapBlockByKey and unwrapInlineByKey

This commit is contained in:
Samy Pesse
2016-10-25 21:58:34 +02:00
parent 4c9e138d04
commit e873de519f
2 changed files with 8 additions and 7 deletions

View File

@@ -330,16 +330,18 @@ export function splitNodeByKey(transform, key, offset, options = {}) {
* @param {Transform} transform * @param {Transform} transform
* @param {String} key * @param {String} key
* @param {Object or String} properties * @param {Object or String} properties
* @param {Object} options
* @param {Boolean} normalize
* @return {Transform} * @return {Transform}
*/ */
export function unwrapInlineByKey(transform, key, properties) { export function unwrapInlineByKey(transform, key, properties, options) {
const { state } = transform const { state } = transform
const { document, selection } = state const { document, selection } = state
const node = document.assertDescendant(key) const node = document.assertDescendant(key)
const texts = node.getTexts() const texts = node.getTexts()
const range = selection.moveToRangeOf(texts.first(), texts.last()) const range = selection.moveToRangeOf(texts.first(), texts.last())
return transform.unwrapInlineAtRange(range, properties) return transform.unwrapInlineAtRange(range, properties, options)
} }
/** /**
@@ -348,14 +350,16 @@ export function unwrapInlineByKey(transform, key, properties) {
* @param {Transform} transform * @param {Transform} transform
* @param {String} key * @param {String} key
* @param {Object or String} properties * @param {Object or String} properties
* @param {Object} options
* @param {Boolean} normalize
* @return {Transform} * @return {Transform}
*/ */
export function unwrapBlockByKey(transform, key, properties) { export function unwrapBlockByKey(transform, key, properties, options) {
const { state } = transform const { state } = transform
const { document, selection } = state const { document, selection } = state
const node = document.assertDescendant(key) const node = document.assertDescendant(key)
const texts = node.getTexts() const texts = node.getTexts()
const range = selection.moveToRangeOf(texts.first(), texts.last()) const range = selection.moveToRangeOf(texts.first(), texts.last())
return transform.unwrapBlockAtRange(range, properties) return transform.unwrapBlockAtRange(range, properties, options)
} }

View File

@@ -251,10 +251,7 @@ export default {
setNodeByKey, setNodeByKey,
splitNodeByKey, splitNodeByKey,
unwrapInlineByKey, unwrapInlineByKey,
<<<<<<< HEAD
=======
unwrapBlockByKey, unwrapBlockByKey,
>>>>>>> slate/master
/** /**
* On selection. * On selection.