From 929d4e2febc1b1f12d5c38ec9229c1f4d68db9f8 Mon Sep 17 00:00:00 2001 From: Alexander Onnikov Date: Wed, 11 Oct 2023 01:31:04 +0700 Subject: [PATCH] UBERF-162 Hide collaborators text selection (#3822) Signed-off-by: Alexander Onnikov --- .../src/components/CollaboratorEditor.svelte | 4 +++- .../src/components/editor/collaboration.ts | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 packages/text-editor/src/components/editor/collaboration.ts diff --git a/packages/text-editor/src/components/CollaboratorEditor.svelte b/packages/text-editor/src/components/CollaboratorEditor.svelte index b748a8b5ee..a7eeba5459 100644 --- a/packages/text-editor/src/components/CollaboratorEditor.svelte +++ b/packages/text-editor/src/components/CollaboratorEditor.svelte @@ -33,6 +33,7 @@ import { CollaborationIds, TextFormatCategory, TextNodeAction } from '../types' import { calculateDecorations } from './diff/decorations' + import { noSelectionRender } from './editor/collaboration' import { defaultEditorAttributes } from './editor/editorProps' import { completionConfig, defaultExtensions } from './extensions' import { InlineStyleToolbarExtension } from './extension/inlineStyleToolbar' @@ -239,7 +240,8 @@ user: { name: currentUser.email, color: getPlatformColorForText(currentUser.email, $themeStore.dark) - } + }, + selectionRender: noSelectionRender }), DecorationExtension, Completion.configure({ diff --git a/packages/text-editor/src/components/editor/collaboration.ts b/packages/text-editor/src/components/editor/collaboration.ts new file mode 100644 index 0000000000..5b8f97af28 --- /dev/null +++ b/packages/text-editor/src/components/editor/collaboration.ts @@ -0,0 +1,18 @@ +// +// Copyright © 2023 Hardcore Engineering Inc. +// +// Licensed under the Eclipse Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. You may +// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import { DecorationAttrs } from 'prosemirror-view' + +export const noSelectionRender = (_user: Record): DecorationAttrs => ({})