diff --git a/.vscode/launch.json b/.vscode/launch.json index 2f3ef800b6..23848a26ba 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -90,6 +90,7 @@ "SECRET": "secret", "METRICS_CONSOLE": "true", "TRANSACTOR_URL": "ws://localhost:3333", + "UPLOAD_URL": "/files", "MONGO_URL": "mongodb://localhost:27017", "MINIO_ACCESS_KEY": "minioadmin", "MINIO_SECRET_KEY": "minioadmin", diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index ecc29a0e98..c61eb973f0 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -707,6 +707,9 @@ dependencies: '@tiptap/extension-highlight': specifier: ^2.1.12 version: 2.1.12(@tiptap/core@2.1.12) + '@tiptap/extension-history': + specifier: ^2.1.12 + version: 2.1.12(@tiptap/core@2.1.12)(@tiptap/pm@2.1.12) '@tiptap/extension-link': specifier: ^2.1.12 version: 2.1.12(@tiptap/core@2.1.12)(@tiptap/pm@2.1.12) @@ -23650,7 +23653,7 @@ packages: dev: false file:projects/text-editor.tgz(@types/node@16.11.68)(bufferutil@4.0.7)(esbuild@0.16.17)(postcss-load-config@4.0.1)(postcss@8.4.31)(prosemirror-model@1.19.3)(ts-node@10.9.1): - resolution: {integrity: sha512-OTmONKS1vIIvQHrDVFHNsaVZopEiXGbimLMlkHpMj1sznAdusJITPsPbj9Q3YLvIc8VXNSlQeRzN2QlkwW2IYg==, tarball: file:projects/text-editor.tgz} + resolution: {integrity: sha512-QgUDUW3v5zIVHETcfC/UsoZ8EPeauNcSyGO+I/J6rXLG2ndtNKIWRdl7Herj480/Q6JjPjWmm5RTIRAnz8lZXQ==, tarball: file:projects/text-editor.tgz} id: file:projects/text-editor.tgz name: '@rush-temp/text-editor' version: 0.0.0 @@ -23665,6 +23668,7 @@ packages: '@tiptap/extension-gapcursor': 2.1.12(@tiptap/core@2.1.12)(@tiptap/pm@2.1.12) '@tiptap/extension-heading': 2.1.12(@tiptap/core@2.1.12) '@tiptap/extension-highlight': 2.1.12(@tiptap/core@2.1.12) + '@tiptap/extension-history': 2.1.12(@tiptap/core@2.1.12)(@tiptap/pm@2.1.12) '@tiptap/extension-link': 2.1.12(@tiptap/core@2.1.12)(@tiptap/pm@2.1.12) '@tiptap/extension-list-keymap': 2.1.12(@tiptap/core@2.1.12) '@tiptap/extension-mention': 2.1.12(@tiptap/core@2.1.12)(@tiptap/pm@2.1.12)(@tiptap/suggestion@2.1.12) @@ -23735,7 +23739,7 @@ packages: dev: false file:projects/text.tgz(@types/node@16.11.68)(esbuild@0.16.17)(svelte@4.2.5)(ts-node@10.9.1): - resolution: {integrity: sha512-mAnt4uQfrjjGcqAXJI8y+sOq5joLxJAU4l8shfLkgdv0FJY+JcR7/lnT0cg79pAEySJ3WWb3RnXlyH+TtGejJQ==, tarball: file:projects/text.tgz} + resolution: {integrity: sha512-yBBmdVZ6t7OiE7WauaYvqDsgVsOUzS8W4sKslQ6EXa/gvDvnV3F/cjAMIvbH6B4w1bFOWoqgC25sqxO8HUaEOQ==, tarball: file:projects/text.tgz} id: file:projects/text.tgz name: '@rush-temp/text' version: 0.0.0 @@ -23744,6 +23748,7 @@ packages: '@tiptap/extension-gapcursor': 2.1.12(@tiptap/core@2.1.12)(@tiptap/pm@2.1.12) '@tiptap/extension-heading': 2.1.12(@tiptap/core@2.1.12) '@tiptap/extension-highlight': 2.1.12(@tiptap/core@2.1.12) + '@tiptap/extension-history': 2.1.12(@tiptap/core@2.1.12)(@tiptap/pm@2.1.12) '@tiptap/extension-link': 2.1.12(@tiptap/core@2.1.12)(@tiptap/pm@2.1.12) '@tiptap/extension-mention': 2.1.12(@tiptap/core@2.1.12)(@tiptap/pm@2.1.12)(@tiptap/suggestion@2.1.12) '@tiptap/extension-table': 2.1.12(@tiptap/core@2.1.12)(@tiptap/pm@2.1.12) diff --git a/dev/docker-compose.yaml b/dev/docker-compose.yaml index 1e147ee4a4..ee902e1810 100644 --- a/dev/docker-compose.yaml +++ b/dev/docker-compose.yaml @@ -103,6 +103,7 @@ services: - COLLABORATOR_PORT=3078 - SECRET=secret - TRANSACTOR_URL=ws://localhost:3333 + - UPLOAD_URL=/files - MONGO_URL=mongodb://mongodb:27017 - MINIO_ENDPOINT=minio - MINIO_ACCESS_KEY=minioadmin diff --git a/packages/text-editor/package.json b/packages/text-editor/package.json index b14f914eb4..4d7c641252 100644 --- a/packages/text-editor/package.json +++ b/packages/text-editor/package.json @@ -60,6 +60,7 @@ "@tiptap/extension-code-block": "^2.1.12", "@tiptap/extension-gapcursor": "^2.1.12", "@tiptap/extension-heading": "^2.1.12", + "@tiptap/extension-history": "^2.1.12", "@tiptap/extension-table": "^2.1.12", "@tiptap/extension-table-cell": "^2.1.12", "@tiptap/extension-table-header": "^2.1.12", diff --git a/packages/text-editor/src/components/CollaborationDiffViewer.svelte b/packages/text-editor/src/components/CollaborationDiffViewer.svelte index b953db4274..9f26c1d01b 100644 --- a/packages/text-editor/src/components/CollaborationDiffViewer.svelte +++ b/packages/text-editor/src/components/CollaborationDiffViewer.svelte @@ -25,7 +25,7 @@ import { calculateDecorations, createYdocDocument } from './diff/decorations' import { defaultEditorAttributes } from './editor/editorProps' - import { defaultExtensions } from './extensions' + import { EditorKit } from '../kits/editor-kit' export let ydoc: Ydoc export let field: string | undefined = undefined @@ -79,7 +79,7 @@ editorProps: { attributes: mergeAttributes(defaultEditorAttributes, { class: 'flex-grow' }) }, element, editable: false, - extensions: [...defaultExtensions, DecorationExtension, Collaboration.configure({ document: ydoc, field })] + extensions: [EditorKit, DecorationExtension, Collaboration.configure({ document: ydoc, field })] }) }) diff --git a/packages/text-editor/src/components/CollaborativeAttributeBox.svelte b/packages/text-editor/src/components/CollaborativeAttributeBox.svelte index 8c01bb4eca..1fd0e13dcb 100644 --- a/packages/text-editor/src/components/CollaborativeAttributeBox.svelte +++ b/packages/text-editor/src/components/CollaborativeAttributeBox.svelte @@ -100,4 +100,5 @@ on:focus on:blur on:update + on:open-document /> diff --git a/packages/text-editor/src/components/CollaborativeTextEditor.svelte b/packages/text-editor/src/components/CollaborativeTextEditor.svelte index 9b40e1847e..04cf5f37f0 100644 --- a/packages/text-editor/src/components/CollaborativeTextEditor.svelte +++ b/packages/text-editor/src/components/CollaborativeTextEditor.svelte @@ -27,6 +27,7 @@ import { Completion } from '../Completion' import { textEditorCommandHandler } from '../commands' + import { EditorKit } from '../kits/editor-kit' import textEditorPlugin from '../plugin' import { DocumentId, TiptapCollabProvider } from '../provider' import { @@ -47,7 +48,7 @@ import { FileAttachFunction, ImageExtension } from './extension/imageExt' import { InlinePopupExtension } from './extension/inlinePopup' import { InlineStyleToolbarExtension } from './extension/inlineStyleToolbar' - import { completionConfig, defaultExtensions } from './extensions' + import { completionConfig } from './extensions' export let documentId: DocumentId export let field: string | undefined = undefined @@ -207,7 +208,8 @@ optionalExtensions.push( ImageExtension.configure({ inline: true, - attachFile + attachFile, + uploadUrl: getMetadata(presentation.metadata.UploadURL) }) ) } @@ -220,7 +222,7 @@ element, editorProps: { attributes: mergeAttributes(defaultEditorAttributes, editorAttributes, { class: 'flex-grow' }) }, extensions: [ - ...defaultExtensions, + EditorKit.configure({ history: false }), ...optionalExtensions, Placeholder.configure({ placeholder: placeHolderStr }), InlineStyleToolbarExtension.configure({ @@ -259,7 +261,7 @@ dispatch('open-document', { event, _id, _class }) } }), - EmojiExtension.configure(), + EmojiExtension, ...extensions ], parseOptions: { diff --git a/packages/text-editor/src/components/MarkupDiffViewer.svelte b/packages/text-editor/src/components/MarkupDiffViewer.svelte index c75efb0f11..92a6474e34 100644 --- a/packages/text-editor/src/components/MarkupDiffViewer.svelte +++ b/packages/text-editor/src/components/MarkupDiffViewer.svelte @@ -20,10 +20,13 @@ import { DecorationSet } from '@tiptap/pm/view' import { onDestroy, onMount } from 'svelte' import { Markup } from '@hcengineering/core' + import { getMetadata } from '@hcengineering/platform' + import presentation from '@hcengineering/presentation' import { calculateDecorations, createMarkupDocument } from './diff/decorations' import { defaultEditorAttributes } from './editor/editorProps' - import { defaultExtensions } from './extensions' + import { ImageExtension } from './extension/imageExt' + import { EditorKit } from '../kits/editor-kit' export let content: Markup export let comparedVersion: Markup | undefined = undefined @@ -78,7 +81,13 @@ element, content, editable: false, - extensions: [...defaultExtensions, DecorationExtension], + extensions: [ + EditorKit, + ImageExtension.configure({ + uploadUrl: getMetadata(presentation.metadata.UploadURL) + }), + DecorationExtension + ], onTransaction: () => { // force re-render so `editor.isActive` works as expected editor = editor diff --git a/packages/text-editor/src/components/StyledTextBox.svelte b/packages/text-editor/src/components/StyledTextBox.svelte index d75c4d9fc4..7c692a7c4f 100644 --- a/packages/text-editor/src/components/StyledTextBox.svelte +++ b/packages/text-editor/src/components/StyledTextBox.svelte @@ -1,5 +1,5 @@