craft.js icon indicating copy to clipboard operation
craft.js copied to clipboard

how to reset pointer of history

Open phungvansyhb opened this issue 2 years ago • 1 comments

when update data of Frame by call api from server , the pointer of history be changed and timeline not empty .

phungvansyhb avatar Apr 27 '22 09:04 phungvansyhb

Currently, we don't have a way to clear the history stack in the latest stable version of Craft. But if you're using the alpha yarn install @craftjs/core@next (which is version 0.3.x), there's a method that allows you to clear the history stack -> https://github.com/prevwong/craft.js/blob/next/packages/utils/src/History.ts#L109

Usage:

const { store } = useEditor();

store.history.clear();

Note: This above code is still experimental

prevwong avatar May 23 '22 12:05 prevwong