From 3110d67bb9817a52f69dbef53018b0629c8d4bdd Mon Sep 17 00:00:00 2001 From: rhenck <richard.henck@iqb.hu-berlin.de> Date: Fri, 2 Dec 2022 18:59:51 +0100 Subject: [PATCH] Add package for History (undo/redo) in TextEditor --- package-lock.json | 54 +++++++++++++++++++ package.json | 1 + .../text-editor/rich-text-editor.component.ts | 3 +- 3 files changed, 57 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index ee9afd386..876fc6a20 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,6 +31,7 @@ "@tiptap/extension-font-family": "^2.0.0-beta.202", "@tiptap/extension-heading": "^2.0.0-beta.202", "@tiptap/extension-highlight": "^2.0.0-beta.202", + "@tiptap/extension-history": "^2.0.0-beta.204", "@tiptap/extension-image": "^2.0.0-beta.202", "@tiptap/extension-italic": "^2.0.0-beta.202", "@tiptap/extension-list-item": "^2.0.0-beta.202", @@ -3021,6 +3022,21 @@ "@tiptap/core": "^2.0.0-beta.193" } }, + "node_modules/@tiptap/extension-history": { + "version": "2.0.0-beta.204", + "resolved": "https://registry.npmjs.org/@tiptap/extension-history/-/extension-history-2.0.0-beta.204.tgz", + "integrity": "sha512-Dk64Nu2bnPutLV0Fd2H1c5ffGE+bQ2eVyWUrAGodAhZJINouN8EF7T0pZLSo0YaIlLMWsl23fImGtBEyVYQUKw==", + "dependencies": { + "prosemirror-history": "^1.3.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "^2.0.0-beta.193" + } + }, "node_modules/@tiptap/extension-image": { "version": "2.0.0-beta.202", "resolved": "https://registry.npmjs.org/@tiptap/extension-image/-/extension-image-2.0.0-beta.202.tgz", @@ -12561,6 +12577,16 @@ "prosemirror-transform": "^1.0.0" } }, + "node_modules/prosemirror-history": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/prosemirror-history/-/prosemirror-history-1.3.0.tgz", + "integrity": "sha512-qo/9Wn4B/Bq89/YD+eNWFbAytu6dmIM85EhID+fz9Jcl9+DfGEo8TTSrRhP15+fFEoaPqpHSxlvSzSEbmlxlUA==", + "dependencies": { + "prosemirror-state": "^1.2.2", + "prosemirror-transform": "^1.0.0", + "rope-sequence": "^1.3.0" + } + }, "node_modules/prosemirror-keymap": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/prosemirror-keymap/-/prosemirror-keymap-1.2.0.tgz", @@ -13106,6 +13132,11 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/rope-sequence": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/rope-sequence/-/rope-sequence-1.3.3.tgz", + "integrity": "sha512-85aZYCxweiD5J8yTEbw+E6A27zSnLPNDL0WfPdw3YYodq7WjnTKo0q4dtyQ2gz23iPT8Q9CUyJtAaUNcTxRf5Q==" + }, "node_modules/run-async": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", @@ -17839,6 +17870,14 @@ "integrity": "sha512-lRsXseZxOz/gATpqMZKIJk61+KeV35cr7UPoRrX4eoImSS0EJEYjjlfnBKeFxju9b1qUv3ui4oq4nvrZ/MDwnw==", "requires": {} }, + "@tiptap/extension-history": { + "version": "2.0.0-beta.204", + "resolved": "https://registry.npmjs.org/@tiptap/extension-history/-/extension-history-2.0.0-beta.204.tgz", + "integrity": "sha512-Dk64Nu2bnPutLV0Fd2H1c5ffGE+bQ2eVyWUrAGodAhZJINouN8EF7T0pZLSo0YaIlLMWsl23fImGtBEyVYQUKw==", + "requires": { + "prosemirror-history": "^1.3.0" + } + }, "@tiptap/extension-image": { "version": "2.0.0-beta.202", "resolved": "https://registry.npmjs.org/@tiptap/extension-image/-/extension-image-2.0.0-beta.202.tgz", @@ -24894,6 +24933,16 @@ "prosemirror-transform": "^1.0.0" } }, + "prosemirror-history": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/prosemirror-history/-/prosemirror-history-1.3.0.tgz", + "integrity": "sha512-qo/9Wn4B/Bq89/YD+eNWFbAytu6dmIM85EhID+fz9Jcl9+DfGEo8TTSrRhP15+fFEoaPqpHSxlvSzSEbmlxlUA==", + "requires": { + "prosemirror-state": "^1.2.2", + "prosemirror-transform": "^1.0.0", + "rope-sequence": "^1.3.0" + } + }, "prosemirror-keymap": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/prosemirror-keymap/-/prosemirror-keymap-1.2.0.tgz", @@ -25320,6 +25369,11 @@ "glob": "^7.1.3" } }, + "rope-sequence": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/rope-sequence/-/rope-sequence-1.3.3.tgz", + "integrity": "sha512-85aZYCxweiD5J8yTEbw+E6A27zSnLPNDL0WfPdw3YYodq7WjnTKo0q4dtyQ2gz23iPT8Q9CUyJtAaUNcTxRf5Q==" + }, "run-async": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", diff --git a/package.json b/package.json index 23fb5964a..3e1586364 100644 --- a/package.json +++ b/package.json @@ -81,6 +81,7 @@ "@tiptap/extension-font-family": "^2.0.0-beta.202", "@tiptap/extension-heading": "^2.0.0-beta.202", "@tiptap/extension-highlight": "^2.0.0-beta.202", + "@tiptap/extension-history": "^2.0.0-beta.204", "@tiptap/extension-image": "^2.0.0-beta.202", "@tiptap/extension-italic": "^2.0.0-beta.202", "@tiptap/extension-list-item": "^2.0.0-beta.202", diff --git a/projects/editor/src/app/text-editor/rich-text-editor.component.ts b/projects/editor/src/app/text-editor/rich-text-editor.component.ts index 384b9d652..7061960c3 100644 --- a/projects/editor/src/app/text-editor/rich-text-editor.component.ts +++ b/projects/editor/src/app/text-editor/rich-text-editor.component.ts @@ -13,6 +13,7 @@ import { TextAlign } from '@tiptap/extension-text-align'; import { Heading } from '@tiptap/extension-heading'; import { Blockquote } from '@tiptap/extension-blockquote'; import { Document } from '@tiptap/extension-document'; +import { History } from '@tiptap/extension-history'; import { Text } from '@tiptap/extension-text'; import { ListItem } from '@tiptap/extension-list-item'; import { Bold } from '@tiptap/extension-bold'; @@ -55,7 +56,7 @@ export class RichTextEditorComponent implements OnInit, AfterViewInit { Document, Text, ListItem, Underline, Superscript, Subscript, TextStyle, Color, - Bold, Italic, Strike, + Bold, Italic, Strike, History, Highlight.configure({ multicolor: true }), -- GitLab