mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
fix: Prevent selecting word-joiner characters around multiplayer cursor (#12660)
* Possible fix for word-joiner characters copied on Chrome+Windows * simplify
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
|||||||
import * as Y from "yjs";
|
import * as Y from "yjs";
|
||||||
import Extension from "@shared/editor/lib/Extension";
|
import Extension from "@shared/editor/lib/Extension";
|
||||||
import { isRemoteTransaction } from "@shared/editor/lib/multiplayer";
|
import { isRemoteTransaction } from "@shared/editor/lib/multiplayer";
|
||||||
|
import { EditorStyleHelper } from "@shared/editor/styles/EditorStyleHelper";
|
||||||
import { Second } from "@shared/utils/time";
|
import { Second } from "@shared/utils/time";
|
||||||
|
|
||||||
type UserAwareness = {
|
type UserAwareness = {
|
||||||
@@ -107,7 +108,7 @@ export default class Multiplayer extends Extension<MultiplayerOptions> {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
style: `background-color: ${u.color}${opacity}`,
|
style: `background-color: ${u.color}${opacity}`,
|
||||||
class: "ProseMirror-yjs-selection",
|
class: EditorStyleHelper.multiplayerSelection,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -596,7 +596,7 @@ width: 100%;
|
|||||||
padding: ${props.editorStyle?.padding ?? "initial"};
|
padding: ${props.editorStyle?.padding ?? "initial"};
|
||||||
margin: ${props.editorStyle?.margin ?? "initial"};
|
margin: ${props.editorStyle?.margin ?? "initial"};
|
||||||
|
|
||||||
& > .ProseMirror-yjs-cursor {
|
& > .${EditorStyleHelper.multiplayerCursor} {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -670,11 +670,11 @@ width: 100%;
|
|||||||
h5 { font-size: var(--font-size-h5); }
|
h5 { font-size: var(--font-size-h5); }
|
||||||
h6 { font-size: var(--font-size-h6); }
|
h6 { font-size: var(--font-size-h6); }
|
||||||
|
|
||||||
.ProseMirror-yjs-selection {
|
.${EditorStyleHelper.multiplayerSelection} {
|
||||||
transition: background-color 500ms ease-in-out;
|
transition: background-color 500ms ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ProseMirror-yjs-cursor {
|
.${EditorStyleHelper.multiplayerCursor} {
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-left: -1px;
|
margin-left: -1px;
|
||||||
margin-right: -1px;
|
margin-right: -1px;
|
||||||
@@ -682,6 +682,7 @@ width: 100%;
|
|||||||
border-right: 1px solid black;
|
border-right: 1px solid black;
|
||||||
height: 1em;
|
height: 1em;
|
||||||
word-break: normal;
|
word-break: normal;
|
||||||
|
user-select: none;
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
content: "";
|
content: "";
|
||||||
@@ -719,7 +720,7 @@ width: 100%;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.show-cursor-names .ProseMirror-yjs-cursor > div {
|
&.show-cursor-names .${EditorStyleHelper.multiplayerCursor} > div {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -998,7 +999,7 @@ img.ProseMirror-separator {
|
|||||||
|
|
||||||
.${EditorStyleHelper.headingPositionAnchor}:first-child,
|
.${EditorStyleHelper.headingPositionAnchor}:first-child,
|
||||||
// Edge case where multiplayer cursor is between start of cell and heading
|
// Edge case where multiplayer cursor is between start of cell and heading
|
||||||
.${EditorStyleHelper.headingPositionAnchor}:first-child + .ProseMirror-yjs-cursor,
|
.${EditorStyleHelper.headingPositionAnchor}:first-child + .${EditorStyleHelper.multiplayerCursor},
|
||||||
// Edge case where table grips are between start of cell and heading
|
// Edge case where table grips are between start of cell and heading
|
||||||
.${EditorStyleHelper.headingPositionAnchor}:first-child + [role=button] + [role=button] {
|
.${EditorStyleHelper.headingPositionAnchor}:first-child + [role=button] + [role=button] {
|
||||||
& + h1,
|
& + h1,
|
||||||
|
|||||||
@@ -22,6 +22,14 @@ export class EditorStyleHelper {
|
|||||||
|
|
||||||
static readonly comment = "comment-marker";
|
static readonly comment = "comment-marker";
|
||||||
|
|
||||||
|
// Multiplayer
|
||||||
|
|
||||||
|
/** Remote collaborator's cursor */
|
||||||
|
static readonly multiplayerCursor = "ProseMirror-yjs-cursor";
|
||||||
|
|
||||||
|
/** Remote collaborator's selection */
|
||||||
|
static readonly multiplayerSelection = "ProseMirror-yjs-selection";
|
||||||
|
|
||||||
// Code
|
// Code
|
||||||
|
|
||||||
static readonly codeBlock = "code-block";
|
static readonly codeBlock = "code-block";
|
||||||
|
|||||||
Reference in New Issue
Block a user