braft-utils
Advanced tools
Comparing version 0.0.21 to 0.0.22
@@ -11,4 +11,2 @@ 'use strict'; | ||
var _color = require('./color'); | ||
var _braftConvert = require('braft-convert'); | ||
@@ -68,8 +66,11 @@ | ||
if (override) { | ||
return (0, _draftjsUtils.setBlockData)(editorState, blockData); | ||
} else { | ||
var allBlockData = this.getSelectionBlockData(editorState).toJS(); | ||
return (0, _draftjsUtils.setBlockData)(editorState, Object.assign({}, allBlockData, blockData)); | ||
} | ||
var newBlockData = override ? blockData : Object.assign({}, this.getSelectionBlockData(editorState).toJS(), blockData); | ||
Object.keys(newBlockData).forEach(function (key) { | ||
if (newBlockData.hasOwnProperty(key) && newBlockData[key] === undefined) { | ||
delete newBlockData[key]; | ||
} | ||
}); | ||
return (0, _draftjsUtils.setBlockData)(editorState, newBlockData); | ||
}, | ||
@@ -164,7 +165,7 @@ getSelectionBlockData: function getSelectionBlockData(editorState, name) { | ||
var currentIndent = this.getSelectionBlockData(editorState, 'textIndent'); | ||
var currentIndent = this.getSelectionBlockData(editorState, 'textIndent') || 0; | ||
return this.toggleSelectionIndent(editorState, currentIndent + 1, maxIndent); | ||
}, | ||
decreaseSelectionIndent: function decreaseSelectionIndent(editorState) { | ||
var currentIndent = this.getSelectionBlockData(editorState, 'textIndent'); | ||
var currentIndent = this.getSelectionBlockData(editorState, 'textIndent') || 0; | ||
return this.toggleSelectionIndent(editorState, currentIndent - 1); | ||
@@ -171,0 +172,0 @@ }, |
{ | ||
"name": "braft-utils", | ||
"version": "0.0.21", | ||
"version": "0.0.22", | ||
"description": "Utils for Braft Editor", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
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
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
110181