您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

change-page.ts 699B

1234567891011121314151617181920212223242526
  1. import Command from './command'
  2. import history from '../history'
  3. import { Data } from 'types'
  4. import storage from 'state/storage'
  5. export default function changePage(data: Data, toPageId: string) {
  6. const { currentPageId: fromPageId } = data
  7. history.execute(
  8. data,
  9. new Command({
  10. name: 'change_page',
  11. category: 'canvas',
  12. manualSelection: true,
  13. do(data) {
  14. storage.savePage(data, data.document.id, fromPageId)
  15. storage.loadPage(data, data.document.id, toPageId)
  16. data.currentPageId = toPageId
  17. },
  18. undo(data) {
  19. storage.loadPage(data, data.document.id, fromPageId)
  20. data.currentPageId = fromPageId
  21. },
  22. })
  23. )
  24. }