feat: initial rich-text-elements-ui library implementation
TipTap-powered rich text editing library with WYSIWYG editor, markdown editor, template editor, collaboration support (Yjs), mentions, track changes, comments, code blocks, and table insertion. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
25
src/services/history.service.ts
Normal file
25
src/services/history.service.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import type { Editor } from '@tiptap/core';
|
||||
|
||||
@Injectable()
|
||||
export class HistoryService {
|
||||
/** Undo the last action */
|
||||
undo(editor: Editor): void {
|
||||
editor.chain().focus().undo().run();
|
||||
}
|
||||
|
||||
/** Redo the last undone action */
|
||||
redo(editor: Editor): void {
|
||||
editor.chain().focus().redo().run();
|
||||
}
|
||||
|
||||
/** Check if undo is available */
|
||||
canUndo(editor: Editor): boolean {
|
||||
return editor.can().undo();
|
||||
}
|
||||
|
||||
/** Check if redo is available */
|
||||
canRedo(editor: Editor): boolean {
|
||||
return editor.can().redo();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user