-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
755a752
commit bfb3014
Showing
8 changed files
with
126 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* @description undo redo | ||
* @author wangfupeng | ||
*/ | ||
|
||
import { IModuleConf } from '@wangeditor/core' | ||
import { redoMenuConf, undoMenuConf } from './menu/index' | ||
|
||
const undoRedo: IModuleConf = { | ||
menus: [redoMenuConf, undoMenuConf], | ||
} | ||
|
||
export default undoRedo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* @description redo menu | ||
* @author wangfupeng | ||
*/ | ||
|
||
import { IButtonMenu, IDomEditor } from '@wangeditor/core' | ||
import { REDO_SVG } from '../../_helpers/icon-svg' | ||
|
||
class RedoMenu implements IButtonMenu { | ||
title = '重做' | ||
iconSvg = REDO_SVG | ||
tag = 'button' | ||
|
||
getValue(editor: IDomEditor): string | boolean { | ||
return '' | ||
} | ||
|
||
isActive(editor: IDomEditor): boolean { | ||
return false | ||
} | ||
|
||
isDisabled(editor: IDomEditor): boolean { | ||
if (editor.selection == null) return true | ||
return false | ||
} | ||
|
||
exec(editor: IDomEditor, value: string | boolean) { | ||
// @ts-ignore | ||
if (typeof editor.redo === 'function') { | ||
// @ts-ignore | ||
editor.redo() | ||
} | ||
} | ||
} | ||
|
||
export default RedoMenu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* @description undo menu | ||
* @author wangfupeng | ||
*/ | ||
|
||
import { IButtonMenu, IDomEditor } from '@wangeditor/core' | ||
import { UNDO_SVG } from '../../_helpers/icon-svg' | ||
|
||
class UndoMenu implements IButtonMenu { | ||
title = '撤销' | ||
iconSvg = UNDO_SVG | ||
tag = 'button' | ||
|
||
getValue(editor: IDomEditor): string | boolean { | ||
return '' | ||
} | ||
|
||
isActive(editor: IDomEditor): boolean { | ||
return false | ||
} | ||
|
||
isDisabled(editor: IDomEditor): boolean { | ||
if (editor.selection == null) return true | ||
return false | ||
} | ||
|
||
exec(editor: IDomEditor, value: string | boolean) { | ||
// @ts-ignore | ||
if (typeof editor.undo === 'function') { | ||
// @ts-ignore | ||
editor.undo() | ||
} | ||
} | ||
} | ||
|
||
export default UndoMenu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* @description menu entry | ||
* @author wangfupeng | ||
*/ | ||
|
||
import RedoMenu from './RedoMenu' | ||
import UndoMenu from './UndoMenu' | ||
|
||
export const undoMenuConf = { | ||
key: 'undo', | ||
factory() { | ||
return new UndoMenu() | ||
}, | ||
} | ||
|
||
export const redoMenuConf = { | ||
key: 'redo', | ||
factory() { | ||
return new RedoMenu() | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters