From 6c61e2772d2b3d01febf097f9104a7580e1ef09a Mon Sep 17 00:00:00 2001 From: Ian Storm Taylor Date: Thu, 28 Jul 2016 16:27:07 -0700 Subject: [PATCH] update state wrap method arguments --- lib/models/state.js | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/lib/models/state.js b/lib/models/state.js index 325ab1f5b..787f683f1 100644 --- a/lib/models/state.js +++ b/lib/models/state.js @@ -1014,52 +1014,50 @@ class State extends new Record(DEFAULTS) { } /** - * Wrap the block nodes in the current selection in new nodes of `type`. + * Wrap the block nodes in the current selection with a new block node with + * `properties`. * - * @param {String} type - * @param {Data} data (optional) + * @param {Object or String} properties * @return {State} state */ - wrapBlock(type, data) { + wrapBlock(properties) { let state = this let { document, selection } = state - document = document.wrapBlockAtRange(selection, type, data) + document = document.wrapBlockAtRange(selection, properties) state = state.merge({ document }) return state } /** - * Unwrap the current selection from a block parent of `type`. + * Unwrap the current selection from a block parent with `properties`. * - * @param {String} type (optional) - * @param {Data} data (optional) + * @param {Object or String} properties * @return {State} state */ - unwrapBlock(type, data) { + unwrapBlock(properties) { let state = this let { document, selection } = state - document = document.unwrapBlockAtRange(selection, type, data) + document = document.unwrapBlockAtRange(selection, properties) state = state.merge({ document, selection }) return state } /** - * Wrap the current selection in new inline nodes of `type`. + * Wrap the current selection in new inline nodes with `properties`. * - * @param {String} type - * @param {Data} data (optional) + * @param {Object or String} properties * @return {State} state */ - wrapInline(type, data) { + wrapInline(properties) { let state = this let { document, selection } = state const { startKey } = selection const previous = document.getPreviousText(startKey) - document = document.wrapInlineAtRange(selection, type, data) + document = document.wrapInlineAtRange(selection, properties) // Determine what the selection should be after wrapping. if (selection.isCollapsed) { @@ -1083,17 +1081,16 @@ class State extends new Record(DEFAULTS) { } /** - * Unwrap the current selection from an inline parent of `type`. + * Unwrap the current selection from an inline parent with `properties`. * - * @param {String} type (optional) - * @param {Data} data (optional) + * @param {Object or String} properties * @return {State} state */ - unwrapInline(type, data) { + unwrapInline(properties) { let state = this let { document, selection } = state - document = document.unwrapInlineAtRange(selection, type, data) + document = document.unwrapInlineAtRange(selection, properties) state = state.merge({ document, selection }) return state }