0
私は私が達成しようとしているどのような次の関数Draftjsはプログラム的
buttonToSelection(){
const editorState = this.state.editorState;
var selectionState = editorState.getSelection();
const newSelection = selectionState.merge({
anchorOffset: 1,
focusOffset: 10
})
const newEditorState = EditorState.forceSelection(editorState, newSelection);
this.editorChangeState(RichUtils.toggleInlineStyle(newEditorState,'STRIKEOUT'));
}
を持っているテキストにインラインスタイルを適用ボタンのスタイル1および取り消し線と10の間のテキストの範囲をクリックするとです。この機能は現時点では行いますが、テキストの選択も保持します。テキストのスタイリングを変更したいだけです。