我正在使用GrapesJS模板编辑器处理一个项目,我正在try 使用两个按钮实现撤销/重复功能.当然,我创建的按钮目前没有撤销和重复操作.
请帮助我!
<div class="action">
<a class="btn" id="undo-btn"><i class="fa fa-undo"></i></a>
<a class="btn" id="redo-btn"><i class="fa fa-redo"></i></a>
</div>
const editor = grapesjs.init({
// Indicate where to init the editor. You can also pass an HTMLElement
container: '#gjs',
// Get the content for the canvas directly from the element
// As an alternative we could use: `components: '<h1>Hello World Component!</h1>'`,
fromElement: true,
// Size of the editor
height: '300px',
width: 'auto',
// Disable the storage manager for the moment
storageManager: false,
// Avoid any default panel
panels: { defaults: [...] },
// ...
});
$('#undo-btn').click(function() {
// undo action here
})
$('#redo-btn').click(function() {
// redo action here
})