feat!: add ability to copy and paste workspace comments (#8024)

* chore: add support for copying and pasting workspace comments

* chore: fix build

* fix: PR comments
This commit is contained in:
Beka Westberg
2024-04-15 21:43:58 +00:00
committed by GitHub
parent b6753a250e
commit dabb11f4cb
6 changed files with 145 additions and 39 deletions

View File

@@ -6,10 +6,8 @@
import {ISerializer} from '../interfaces/i_serializer.js';
import {Workspace} from '../workspace.js';
import {WorkspaceSvg} from '../workspace_svg.js';
import * as priorities from './priorities.js';
import {WorkspaceComment} from '../comments/workspace_comment.js';
import {RenderedWorkspaceComment} from '../comments/rendered_workspace_comment.js';
import type {WorkspaceComment} from '../comments/workspace_comment.js';
import * as eventUtils from '../events/utils.js';
import {Coordinate} from '../utils/coordinate.js';
import * as serializationRegistry from './registry.js';
@@ -70,10 +68,7 @@ export function append(
const prevRecordUndo = eventUtils.getRecordUndo();
eventUtils.setRecordUndo(recordUndo);
const comment =
workspace instanceof WorkspaceSvg
? new RenderedWorkspaceComment(workspace, state.id)
: new WorkspaceComment(workspace, state.id);
const comment = workspace.newComment(state.id);
if (state.text !== undefined) comment.setText(state.text);
if (state.x !== undefined || state.y !== undefined) {