Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9448cca81d | ||
|
|
217c59a13a |
@@ -1,7 +1,8 @@
|
|||||||
import { arrayToMap, ROUNDNESS } from "@excalidraw/common";
|
import { arrayToMap } from "@excalidraw/common";
|
||||||
import { type GlobalPoint, type LocalPoint, pointFrom } from "@excalidraw/math";
|
import { type GlobalPoint, type LocalPoint, pointFrom } from "@excalidraw/math";
|
||||||
import { Excalidraw } from "@excalidraw/excalidraw";
|
import { Excalidraw } from "@excalidraw/excalidraw";
|
||||||
import { API } from "@excalidraw/excalidraw/tests/helpers/api";
|
import { API } from "@excalidraw/excalidraw/tests/helpers/api";
|
||||||
|
import { UI } from "@excalidraw/excalidraw/tests/helpers/ui";
|
||||||
import "@excalidraw/utils/test-utils";
|
import "@excalidraw/utils/test-utils";
|
||||||
import { render } from "@excalidraw/excalidraw/tests/test-utils";
|
import { render } from "@excalidraw/excalidraw/tests/test-utils";
|
||||||
|
|
||||||
@@ -9,29 +10,29 @@ import * as distance from "../src/distance";
|
|||||||
import { hitElementItself } from "../src/collision";
|
import { hitElementItself } from "../src/collision";
|
||||||
|
|
||||||
describe("check rotated elements can be hit:", () => {
|
describe("check rotated elements can be hit:", () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
localStorage.clear();
|
||||||
|
await render(<Excalidraw handleKeyboardGlobally={true} />);
|
||||||
|
});
|
||||||
|
|
||||||
it("arrow", () => {
|
it("arrow", () => {
|
||||||
const element = API.createElement({
|
UI.createElement("arrow", {
|
||||||
type: "arrow",
|
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0,
|
y: 0,
|
||||||
width: 124,
|
width: 124,
|
||||||
height: 302,
|
height: 302,
|
||||||
angle: 1.8700426423973724,
|
angle: 1.8700426423973724,
|
||||||
roundness: { type: ROUNDNESS.PROPORTIONAL_RADIUS },
|
|
||||||
endArrowhead: "arrow",
|
|
||||||
points: [
|
points: [
|
||||||
[0, 0],
|
[0, 0],
|
||||||
[120, -198],
|
[120, -198],
|
||||||
[-4, -302],
|
[-4, -302],
|
||||||
] as LocalPoint[],
|
] as LocalPoint[],
|
||||||
});
|
});
|
||||||
const elementsMap = arrayToMap([element]);
|
|
||||||
|
|
||||||
const hit = hitElementItself({
|
const hit = hitElementItself({
|
||||||
point: pointFrom<GlobalPoint>(88, -68),
|
point: pointFrom<GlobalPoint>(88, -68),
|
||||||
element,
|
element: window.h.elements[0],
|
||||||
threshold: 10,
|
threshold: 10,
|
||||||
elementsMap,
|
elementsMap: window.h.scene.getNonDeletedElementsMap(),
|
||||||
});
|
});
|
||||||
expect(hit).toBe(true);
|
expect(hit).toBe(true);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,145 +0,0 @@
|
|||||||
import {
|
|
||||||
getElementsInGroup,
|
|
||||||
isSomeElementSelected,
|
|
||||||
makeNextSelectedElementIds,
|
|
||||||
selectGroupsForSelectedElements,
|
|
||||||
} from "@excalidraw/element";
|
|
||||||
import { CaptureUpdateAction } from "@excalidraw/element";
|
|
||||||
import { KEYS, isWritableElement, updateActiveTool } from "@excalidraw/common";
|
|
||||||
|
|
||||||
import type { GroupId } from "@excalidraw/element/types";
|
|
||||||
|
|
||||||
import { register } from "./register";
|
|
||||||
|
|
||||||
import type { AppClassProperties, AppState } from "../types";
|
|
||||||
|
|
||||||
const getNextActiveTool = (
|
|
||||||
appState: Readonly<AppState>,
|
|
||||||
app: AppClassProperties,
|
|
||||||
) => {
|
|
||||||
if (appState.activeTool.type === "eraser") {
|
|
||||||
return updateActiveTool(appState, {
|
|
||||||
...(appState.activeTool.lastActiveTool || {
|
|
||||||
type: app.state.preferredSelectionTool.type,
|
|
||||||
}),
|
|
||||||
lastActiveToolBeforeEraser: null,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return updateActiveTool(appState, {
|
|
||||||
type: app.state.preferredSelectionTool.type,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const getParentEditingGroupId = (
|
|
||||||
appState: Readonly<AppState>,
|
|
||||||
app: AppClassProperties,
|
|
||||||
selectedElementIds: AppState["selectedElementIds"],
|
|
||||||
): GroupId | null => {
|
|
||||||
if (!appState.editingGroupId) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const nonDeletedElements = app.scene.getNonDeletedElements();
|
|
||||||
const selectedElements = app.scene.getSelectedElements({
|
|
||||||
selectedElementIds,
|
|
||||||
elements: nonDeletedElements,
|
|
||||||
});
|
|
||||||
const candidateElements = selectedElements.length
|
|
||||||
? selectedElements
|
|
||||||
: getElementsInGroup(nonDeletedElements, appState.editingGroupId);
|
|
||||||
|
|
||||||
for (const element of candidateElements) {
|
|
||||||
const editingGroupIndex = element.groupIds.indexOf(appState.editingGroupId);
|
|
||||||
if (editingGroupIndex !== -1 && element.groupIds[editingGroupIndex + 1]) {
|
|
||||||
return element.groupIds[editingGroupIndex + 1] as GroupId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const actionDeselect = register({
|
|
||||||
name: "deselect",
|
|
||||||
label: "",
|
|
||||||
trackEvent: false,
|
|
||||||
perform: (_elements, appState, _, app) => {
|
|
||||||
const activeTool = getNextActiveTool(appState, app);
|
|
||||||
|
|
||||||
if (appState.editingGroupId) {
|
|
||||||
const nonDeletedElements = app.scene.getNonDeletedElements();
|
|
||||||
const selectedElementIds =
|
|
||||||
Object.keys(appState.selectedElementIds).length > 0
|
|
||||||
? appState.selectedElementIds
|
|
||||||
: getElementsInGroup(
|
|
||||||
nonDeletedElements,
|
|
||||||
appState.editingGroupId,
|
|
||||||
).reduce((acc, element) => {
|
|
||||||
acc[element.id] = true;
|
|
||||||
return acc;
|
|
||||||
}, {} as Record<string, true>);
|
|
||||||
|
|
||||||
return {
|
|
||||||
appState: {
|
|
||||||
...appState,
|
|
||||||
...selectGroupsForSelectedElements(
|
|
||||||
{
|
|
||||||
editingGroupId: getParentEditingGroupId(
|
|
||||||
appState,
|
|
||||||
app,
|
|
||||||
selectedElementIds,
|
|
||||||
),
|
|
||||||
selectedElementIds,
|
|
||||||
},
|
|
||||||
nonDeletedElements,
|
|
||||||
appState,
|
|
||||||
app,
|
|
||||||
),
|
|
||||||
activeEmbeddable: null,
|
|
||||||
activeTool,
|
|
||||||
selectedLinearElement: null,
|
|
||||||
selectionElement: null,
|
|
||||||
showHyperlinkPopup: false,
|
|
||||||
suggestedBinding: null,
|
|
||||||
},
|
|
||||||
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
appState: {
|
|
||||||
...appState,
|
|
||||||
activeEmbeddable: null,
|
|
||||||
activeTool,
|
|
||||||
editingGroupId: null,
|
|
||||||
selectedElementIds: makeNextSelectedElementIds({}, appState),
|
|
||||||
selectedGroupIds: {},
|
|
||||||
selectedLinearElement: null,
|
|
||||||
selectionElement: null,
|
|
||||||
showHyperlinkPopup: false,
|
|
||||||
suggestedBinding: null,
|
|
||||||
},
|
|
||||||
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
keyTest: (event, appState, _, app) => {
|
|
||||||
if (event.key !== KEYS.ESCAPE) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isWritableElement(event.target)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
!appState.newElement &&
|
|
||||||
appState.multiElement === null &&
|
|
||||||
!appState.selectedLinearElement?.isEditing &&
|
|
||||||
(appState.activeEmbeddable !== null ||
|
|
||||||
appState.activeTool.type !== app.state.preferredSelectionTool.type ||
|
|
||||||
!!appState.editingGroupId ||
|
|
||||||
!!appState.selectedLinearElement ||
|
|
||||||
isSomeElementSelected(app.scene.getNonDeletedElements(), appState))
|
|
||||||
);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
@@ -348,7 +348,9 @@ export const actionFinalize = register<FormData>({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
keyTest: (event, appState) =>
|
keyTest: (event, appState) =>
|
||||||
(event.key === KEYS.ESCAPE && appState.selectedLinearElement?.isEditing) ||
|
(event.key === KEYS.ESCAPE &&
|
||||||
|
(appState.selectedLinearElement?.isEditing ||
|
||||||
|
(!appState.newElement && appState.multiElement === null))) ||
|
||||||
((event.key === KEYS.ESCAPE || event.key === KEYS.ENTER) &&
|
((event.key === KEYS.ESCAPE || event.key === KEYS.ENTER) &&
|
||||||
appState.multiElement !== null),
|
appState.multiElement !== null),
|
||||||
PanelComponent: ({ appState, updateData, data }) => (
|
PanelComponent: ({ appState, updateData, data }) => (
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ export {
|
|||||||
export { actionSetEmbeddableAsActiveTool } from "./actionEmbeddable";
|
export { actionSetEmbeddableAsActiveTool } from "./actionEmbeddable";
|
||||||
|
|
||||||
export { actionFinalize } from "./actionFinalize";
|
export { actionFinalize } from "./actionFinalize";
|
||||||
export { actionDeselect } from "./actionDeselect";
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
actionChangeProjectName,
|
actionChangeProjectName,
|
||||||
|
|||||||
@@ -114,7 +114,6 @@ export type ActionName =
|
|||||||
| "distributeVertically"
|
| "distributeVertically"
|
||||||
| "flipHorizontal"
|
| "flipHorizontal"
|
||||||
| "flipVertical"
|
| "flipVertical"
|
||||||
| "deselect"
|
|
||||||
| "viewMode"
|
| "viewMode"
|
||||||
| "exportWithDarkMode"
|
| "exportWithDarkMode"
|
||||||
| "toggleTheme"
|
| "toggleTheme"
|
||||||
|
|||||||
@@ -5725,13 +5725,13 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
const isDeleted = !nextOriginalText.trim();
|
const isDeleted = !nextOriginalText.trim();
|
||||||
updateElement(nextOriginalText, isDeleted);
|
updateElement(nextOriginalText, isDeleted);
|
||||||
|
|
||||||
// keyboard-submit keeps focus on the edited object. For bound text, keep
|
// select the created text element only if submitting via keyboard
|
||||||
// the container selected even if the text becomes empty and is deleted.
|
// (when submitting via click it should act as signal to deselect)
|
||||||
const elementIdToSelect = viaKeyboard
|
if (!isDeleted && viaKeyboard) {
|
||||||
? element.containerId || (!isDeleted ? element.id : null)
|
const elementIdToSelect = element.containerId
|
||||||
: null;
|
? element.containerId
|
||||||
|
: element.id;
|
||||||
|
|
||||||
if (elementIdToSelect) {
|
|
||||||
// needed to ensure state is updated before "finalize" action
|
// needed to ensure state is updated before "finalize" action
|
||||||
// that's invoked on keyboard-submit as well
|
// that's invoked on keyboard-submit as well
|
||||||
// TODO either move this into finalize as well, or handle all state
|
// TODO either move this into finalize as well, or handle all state
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ import {
|
|||||||
import { fontPickerKeyHandler } from "./keyboardNavHandlers";
|
import { fontPickerKeyHandler } from "./keyboardNavHandlers";
|
||||||
|
|
||||||
import type { JSX } from "react";
|
import type { JSX } from "react";
|
||||||
import type { ExcalidrawFontFace } from "../../fonts/ExcalidrawFontFace";
|
|
||||||
|
|
||||||
export interface FontDescriptor {
|
export interface FontDescriptor {
|
||||||
value: number;
|
value: number;
|
||||||
@@ -87,15 +86,6 @@ const getFontFamilyIcon = (fontFamily: FontFamilyValues): JSX.Element => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getFontFamilyLabel = (
|
|
||||||
fontFamily: FontFamilyValues,
|
|
||||||
fontFaces: ExcalidrawFontFace[],
|
|
||||||
) =>
|
|
||||||
// prefer our config as the browser resolved names may be wrapped in quotes and such
|
|
||||||
Object.entries(FONT_FAMILY).find(([, id]) => id === fontFamily)?.[0] ??
|
|
||||||
fontFaces[0]?.fontFace?.family ??
|
|
||||||
"Unknown";
|
|
||||||
|
|
||||||
export const FontPickerList = React.memo(
|
export const FontPickerList = React.memo(
|
||||||
({
|
({
|
||||||
selectedFontFamily,
|
selectedFontFamily,
|
||||||
@@ -124,7 +114,7 @@ export const FontPickerList = React.memo(
|
|||||||
const fontDescriptor = {
|
const fontDescriptor = {
|
||||||
value: familyId,
|
value: familyId,
|
||||||
icon: getFontFamilyIcon(familyId),
|
icon: getFontFamilyIcon(familyId),
|
||||||
text: getFontFamilyLabel(familyId, fontFaces),
|
text: fontFaces[0]?.fontFace?.family ?? "Unknown",
|
||||||
};
|
};
|
||||||
|
|
||||||
if (metadata.deprecated) {
|
if (metadata.deprecated) {
|
||||||
|
|||||||
@@ -3,7 +3,25 @@
|
|||||||
$verticalBreakpoint: 861px;
|
$verticalBreakpoint: 861px;
|
||||||
|
|
||||||
.excalidraw {
|
.excalidraw {
|
||||||
|
--ttd-mermaid-token-keyword: #0000ff;
|
||||||
|
--ttd-mermaid-token-string: #a31515;
|
||||||
|
--ttd-mermaid-token-comment: #008000;
|
||||||
|
--ttd-mermaid-token-number: #098658;
|
||||||
|
--ttd-mermaid-token-operator: #1e1e1e;
|
||||||
|
--ttd-mermaid-token-punctuation: #1e1e1e;
|
||||||
|
--ttd-mermaid-token-variable-name: #001080;
|
||||||
|
--ttd-mermaid-token-bracket: #af00db;
|
||||||
|
|
||||||
&.theme--dark {
|
&.theme--dark {
|
||||||
|
--ttd-mermaid-token-keyword: #569cd6;
|
||||||
|
--ttd-mermaid-token-string: #ce9178;
|
||||||
|
--ttd-mermaid-token-comment: #6a9955;
|
||||||
|
--ttd-mermaid-token-number: #b5cea8;
|
||||||
|
--ttd-mermaid-token-operator: #d4d4d4;
|
||||||
|
--ttd-mermaid-token-punctuation: #d4d4d4;
|
||||||
|
--ttd-mermaid-token-variable-name: #9cdcfe;
|
||||||
|
--ttd-mermaid-token-bracket: #ffd700;
|
||||||
|
|
||||||
.chat-message {
|
.chat-message {
|
||||||
&--assistant {
|
&--assistant {
|
||||||
.chat-message__content {
|
.chat-message__content {
|
||||||
@@ -194,7 +212,7 @@ $verticalBreakpoint: 861px;
|
|||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
|
|
||||||
.chat-message__content {
|
.chat-message__content {
|
||||||
background: var(--color-surface-low);
|
background: #f7f7f7;
|
||||||
color: var(--color-on-surface);
|
color: var(--color-on-surface);
|
||||||
border-radius: var(--border-radius-md);
|
border-radius: var(--border-radius-md);
|
||||||
min-width: 6rem;
|
min-width: 6rem;
|
||||||
@@ -292,6 +310,51 @@ $verticalBreakpoint: 861px;
|
|||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__text--error {
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__text--mermaid {
|
||||||
|
overflow-x: auto;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__token {
|
||||||
|
white-space: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__token--keyword {
|
||||||
|
color: var(--ttd-mermaid-token-keyword);
|
||||||
|
}
|
||||||
|
|
||||||
|
&__token--string {
|
||||||
|
color: var(--ttd-mermaid-token-string);
|
||||||
|
}
|
||||||
|
|
||||||
|
&__token--comment {
|
||||||
|
color: var(--ttd-mermaid-token-comment);
|
||||||
|
}
|
||||||
|
|
||||||
|
&__token--number {
|
||||||
|
color: var(--ttd-mermaid-token-number);
|
||||||
|
}
|
||||||
|
|
||||||
|
&__token--operator {
|
||||||
|
color: var(--ttd-mermaid-token-operator);
|
||||||
|
}
|
||||||
|
|
||||||
|
&__token--punctuation {
|
||||||
|
color: var(--ttd-mermaid-token-punctuation);
|
||||||
|
}
|
||||||
|
|
||||||
|
&__token--variableName {
|
||||||
|
color: var(--ttd-mermaid-token-variable-name);
|
||||||
|
}
|
||||||
|
|
||||||
|
&__token--bracket {
|
||||||
|
color: var(--ttd-mermaid-token-bracket);
|
||||||
|
}
|
||||||
|
|
||||||
&__cursor {
|
&__cursor {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-left: 2px;
|
margin-left: 2px;
|
||||||
@@ -332,11 +395,13 @@ $verticalBreakpoint: 861px;
|
|||||||
&__error {
|
&__error {
|
||||||
color: var(--color-danger);
|
color: var(--color-danger);
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
white-space: pre-wrap;
|
|
||||||
word-wrap: break-word;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
|
|
||||||
|
.chat-message__text--mermaid {
|
||||||
|
color: var(--color-on-surface);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__error_message {
|
&__error_message {
|
||||||
|
|||||||
@@ -5,8 +5,49 @@ import { t } from "../../../i18n";
|
|||||||
import { FilledButton } from "../../FilledButton";
|
import { FilledButton } from "../../FilledButton";
|
||||||
import { TrashIcon, codeIcon, stackPushIcon, RetryIcon } from "../../icons";
|
import { TrashIcon, codeIcon, stackPushIcon, RetryIcon } from "../../icons";
|
||||||
|
|
||||||
|
import { tokenizeMermaid } from "../mermaid-highlighting";
|
||||||
|
|
||||||
import type { TChat, TTTDDialog } from "../types";
|
import type { TChat, TTTDDialog } from "../types";
|
||||||
|
|
||||||
|
const isMermaidMessage = (message: TChat.ChatMessage) =>
|
||||||
|
message.contentFormat === "mermaid";
|
||||||
|
|
||||||
|
const renderMessageContent = (
|
||||||
|
message: TChat.ChatMessage,
|
||||||
|
className: string,
|
||||||
|
) => {
|
||||||
|
const content = message.content ?? "";
|
||||||
|
|
||||||
|
console.log("@", message);
|
||||||
|
|
||||||
|
if (!isMermaidMessage(message)) {
|
||||||
|
return (
|
||||||
|
<div className={className}>
|
||||||
|
{content}
|
||||||
|
{message.isGenerating && (
|
||||||
|
<span className="chat-message__cursor">▋</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={clsx(className, "chat-message__text--mermaid")}>
|
||||||
|
{tokenizeMermaid(content).map((token, index) => (
|
||||||
|
<span
|
||||||
|
key={`${index}-${token.type ?? "text"}-${token.value}`}
|
||||||
|
className={clsx("chat-message__token", {
|
||||||
|
[`chat-message__token--${token.type}`]: token.type,
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
{token.value}
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
{message.isGenerating && <span className="chat-message__cursor">▋</span>}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
export const ChatMessage: React.FC<{
|
export const ChatMessage: React.FC<{
|
||||||
message: TChat.ChatMessage;
|
message: TChat.ChatMessage;
|
||||||
onMermaidTabClick?: (message: TChat.ChatMessage) => void;
|
onMermaidTabClick?: (message: TChat.ChatMessage) => void;
|
||||||
@@ -122,7 +163,14 @@ export const ChatMessage: React.FC<{
|
|||||||
<div className="chat-message__body">
|
<div className="chat-message__body">
|
||||||
{message.error ? (
|
{message.error ? (
|
||||||
<>
|
<>
|
||||||
<div className="chat-message__error">{message.content}</div>
|
<div className="chat-message__error">
|
||||||
|
{renderMessageContent(
|
||||||
|
message,
|
||||||
|
clsx("chat-message__text", {
|
||||||
|
"chat-message__text--error": !isMermaidMessage(message),
|
||||||
|
}),
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
{message.errorType !== "parse" && (
|
{message.errorType !== "parse" && (
|
||||||
<div className="chat-message__error_message">
|
<div className="chat-message__error_message">
|
||||||
Error: {message.error || t("chat.errors.generationFailed")}
|
Error: {message.error || t("chat.errors.generationFailed")}
|
||||||
@@ -132,7 +180,7 @@ export const ChatMessage: React.FC<{
|
|||||||
<div className="chat-message__error_message">
|
<div className="chat-message__error_message">
|
||||||
<p>{t("chat.errors.invalidDiagram")}</p>
|
<p>{t("chat.errors.invalidDiagram")}</p>
|
||||||
<div className="chat-message__error-actions">
|
<div className="chat-message__error-actions">
|
||||||
{onMermaidTabClick && (
|
{onMermaidTabClick && isMermaidMessage(message) && (
|
||||||
<button
|
<button
|
||||||
className="chat-message__error-link"
|
className="chat-message__error-link"
|
||||||
onClick={() => onMermaidTabClick(message)}
|
onClick={() => onMermaidTabClick(message)}
|
||||||
@@ -156,18 +204,13 @@ export const ChatMessage: React.FC<{
|
|||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<div className="chat-message__text">
|
renderMessageContent(message, "chat-message__text")
|
||||||
{message.content}
|
|
||||||
{message.isGenerating && (
|
|
||||||
<span className="chat-message__cursor">▋</span>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{message.type === "assistant" && !message.isGenerating && (
|
{message.type === "assistant" && !message.isGenerating && (
|
||||||
<div className="chat-message__actions">
|
<div className="chat-message__actions">
|
||||||
{!message.error && onInsertMessage && (
|
{!message.error && onInsertMessage && isMermaidMessage(message) && (
|
||||||
<button
|
<button
|
||||||
className="chat-message__action"
|
className="chat-message__action"
|
||||||
onClick={() => onInsertMessage(message)}
|
onClick={() => onInsertMessage(message)}
|
||||||
@@ -178,7 +221,7 @@ export const ChatMessage: React.FC<{
|
|||||||
{stackPushIcon}
|
{stackPushIcon}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
{onMermaidTabClick && message.content && (
|
{onMermaidTabClick && isMermaidMessage(message) && message.content && (
|
||||||
<button
|
<button
|
||||||
className="chat-message__action"
|
className="chat-message__action"
|
||||||
onClick={() => onMermaidTabClick(message)}
|
onClick={() => onMermaidTabClick(message)}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ export const TTDChatPanel = ({
|
|||||||
onGenerate,
|
onGenerate,
|
||||||
isGenerating,
|
isGenerating,
|
||||||
generatedResponse,
|
generatedResponse,
|
||||||
|
generatedResponseFormat,
|
||||||
isMenuOpen,
|
isMenuOpen,
|
||||||
onMenuToggle,
|
onMenuToggle,
|
||||||
onMenuClose,
|
onMenuClose,
|
||||||
@@ -50,6 +51,7 @@ export const TTDChatPanel = ({
|
|||||||
onGenerate: TTTDDialog.OnGenerate;
|
onGenerate: TTTDDialog.OnGenerate;
|
||||||
isGenerating: boolean;
|
isGenerating: boolean;
|
||||||
generatedResponse: string | null | undefined;
|
generatedResponse: string | null | undefined;
|
||||||
|
generatedResponseFormat?: TChat.ChatMessage["contentFormat"];
|
||||||
|
|
||||||
isMenuOpen: boolean;
|
isMenuOpen: boolean;
|
||||||
onMenuToggle: () => void;
|
onMenuToggle: () => void;
|
||||||
@@ -89,7 +91,7 @@ export const TTDChatPanel = ({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (generatedResponse) {
|
if (generatedResponse && generatedResponseFormat === "mermaid") {
|
||||||
actions.push({
|
actions.push({
|
||||||
action: onViewAsMermaid,
|
action: onViewAsMermaid,
|
||||||
label: t("chat.viewAsMermaid"),
|
label: t("chat.viewAsMermaid"),
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ export const useChatAgent = () => {
|
|||||||
{
|
{
|
||||||
type: "assistant",
|
type: "assistant",
|
||||||
content: "",
|
content: "",
|
||||||
|
contentFormat: "mermaid",
|
||||||
isGenerating: true,
|
isGenerating: true,
|
||||||
},
|
},
|
||||||
]),
|
]),
|
||||||
|
|||||||
@@ -1,13 +1,21 @@
|
|||||||
import { useEffect, useRef } from "react";
|
import { useEffect, useRef } from "react";
|
||||||
import {
|
import {
|
||||||
Decoration,
|
Decoration,
|
||||||
|
type DecorationSet,
|
||||||
EditorView,
|
EditorView,
|
||||||
|
ViewPlugin,
|
||||||
|
type ViewUpdate,
|
||||||
keymap,
|
keymap,
|
||||||
lineNumbers,
|
lineNumbers,
|
||||||
placeholder as cmPlaceholder,
|
placeholder as cmPlaceholder,
|
||||||
drawSelection,
|
drawSelection,
|
||||||
} from "@codemirror/view";
|
} from "@codemirror/view";
|
||||||
import { Compartment, EditorState, type Extension } from "@codemirror/state";
|
import {
|
||||||
|
Compartment,
|
||||||
|
EditorState,
|
||||||
|
type Extension,
|
||||||
|
type Range,
|
||||||
|
} from "@codemirror/state";
|
||||||
import {
|
import {
|
||||||
defaultKeymap,
|
defaultKeymap,
|
||||||
history,
|
history,
|
||||||
@@ -40,6 +48,13 @@ const darkTheme = EditorView.theme(
|
|||||||
},
|
},
|
||||||
".cm-content": { caretColor: "#fff" },
|
".cm-content": { caretColor: "#fff" },
|
||||||
".cm-cursor": { borderLeftColor: "#fff" },
|
".cm-cursor": { borderLeftColor: "#fff" },
|
||||||
|
".cm-selectionBackground": {
|
||||||
|
backgroundColor: "rgba(86, 156, 214, 0.3)",
|
||||||
|
},
|
||||||
|
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":
|
||||||
|
{
|
||||||
|
backgroundColor: "rgba(86, 156, 214, 0.42)",
|
||||||
|
},
|
||||||
".cm-gutters": {
|
".cm-gutters": {
|
||||||
backgroundColor: "#1e1e1e",
|
backgroundColor: "#1e1e1e",
|
||||||
color: "#858585",
|
color: "#858585",
|
||||||
@@ -48,6 +63,10 @@ const darkTheme = EditorView.theme(
|
|||||||
".cm-activeLineGutter": { backgroundColor: "#2a2a2a" },
|
".cm-activeLineGutter": { backgroundColor: "#2a2a2a" },
|
||||||
".cm-activeLine": { backgroundColor: "#2a2a2a" },
|
".cm-activeLine": { backgroundColor: "#2a2a2a" },
|
||||||
".cm-errorLine": { backgroundColor: "rgba(255, 0, 0, 0.15)" },
|
".cm-errorLine": { backgroundColor: "rgba(255, 0, 0, 0.15)" },
|
||||||
|
".cm-selectedWordMatch": {
|
||||||
|
backgroundColor: "rgba(255, 209, 102, 0.22)",
|
||||||
|
borderRadius: "2px",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{ dark: true },
|
{ dark: true },
|
||||||
);
|
);
|
||||||
@@ -80,6 +99,10 @@ const lightTheme = EditorView.theme({
|
|||||||
".cm-activeLineGutter": { backgroundColor: "#e8e8e8" },
|
".cm-activeLineGutter": { backgroundColor: "#e8e8e8" },
|
||||||
".cm-activeLine": { backgroundColor: "#e8e8e8" },
|
".cm-activeLine": { backgroundColor: "#e8e8e8" },
|
||||||
".cm-errorLine": { backgroundColor: "rgba(255, 0, 0, 0.1)" },
|
".cm-errorLine": { backgroundColor: "rgba(255, 0, 0, 0.1)" },
|
||||||
|
".cm-selectedWordMatch": {
|
||||||
|
backgroundColor: "rgba(255, 209, 102, 0.35)",
|
||||||
|
borderRadius: "2px",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const lightHighlight = HighlightStyle.define([
|
const lightHighlight = HighlightStyle.define([
|
||||||
@@ -96,6 +119,79 @@ const lightHighlight = HighlightStyle.define([
|
|||||||
// ---- Error line decoration ----
|
// ---- Error line decoration ----
|
||||||
|
|
||||||
const errorLineDeco = Decoration.line({ class: "cm-errorLine" });
|
const errorLineDeco = Decoration.line({ class: "cm-errorLine" });
|
||||||
|
const selectedWordMatchDeco = Decoration.mark({
|
||||||
|
class: "cm-selectedWordMatch",
|
||||||
|
});
|
||||||
|
|
||||||
|
const getSelectedWordMatchText = (state: EditorState) => {
|
||||||
|
const mainSelection = state.selection.main;
|
||||||
|
if (state.selection.ranges.length !== 1 || mainSelection.empty) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const selectedWord = state.wordAt(mainSelection.from);
|
||||||
|
if (
|
||||||
|
!selectedWord ||
|
||||||
|
selectedWord.from !== mainSelection.from ||
|
||||||
|
selectedWord.to !== mainSelection.to
|
||||||
|
) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return state.sliceDoc(mainSelection.from, mainSelection.to);
|
||||||
|
};
|
||||||
|
|
||||||
|
const getSelectedWordMatchDecorations = (view: EditorView): DecorationSet => {
|
||||||
|
const selectedWord = getSelectedWordMatchText(view.state);
|
||||||
|
if (!selectedWord) {
|
||||||
|
return Decoration.none;
|
||||||
|
}
|
||||||
|
|
||||||
|
const selection = view.state.selection.main;
|
||||||
|
const ranges: Range<Decoration>[] = [];
|
||||||
|
const doc = view.state.doc.toString();
|
||||||
|
let searchFrom = 0;
|
||||||
|
|
||||||
|
while (searchFrom <= doc.length - selectedWord.length) {
|
||||||
|
const matchFrom = doc.indexOf(selectedWord, searchFrom);
|
||||||
|
if (matchFrom === -1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
const matchTo = matchFrom + selectedWord.length;
|
||||||
|
const matchWord = view.state.wordAt(matchFrom);
|
||||||
|
if (
|
||||||
|
matchWord?.from === matchFrom &&
|
||||||
|
matchWord.to === matchTo &&
|
||||||
|
(matchFrom !== selection.from || matchTo !== selection.to)
|
||||||
|
) {
|
||||||
|
ranges.push(selectedWordMatchDeco.range(matchFrom, matchTo));
|
||||||
|
}
|
||||||
|
|
||||||
|
searchFrom = matchTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ranges.length ? Decoration.set(ranges) : Decoration.none;
|
||||||
|
};
|
||||||
|
|
||||||
|
const selectedWordMatchExtension = ViewPlugin.fromClass(
|
||||||
|
class {
|
||||||
|
decorations: DecorationSet;
|
||||||
|
|
||||||
|
constructor(view: EditorView) {
|
||||||
|
this.decorations = getSelectedWordMatchDecorations(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
update(update: ViewUpdate) {
|
||||||
|
if (update.docChanged || update.selectionSet) {
|
||||||
|
this.decorations = getSelectedWordMatchDecorations(update.view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
decorations: (value) => value.decorations,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
const getErrorLineExtension = (
|
const getErrorLineExtension = (
|
||||||
errorLine: number | null | undefined,
|
errorLine: number | null | undefined,
|
||||||
@@ -172,6 +268,7 @@ const CodeMirrorEditor = ({
|
|||||||
errorLineCompartmentRef.current.of([]),
|
errorLineCompartmentRef.current.of([]),
|
||||||
mermaidLite(),
|
mermaidLite(),
|
||||||
drawSelection({ drawRangeCursor: true }),
|
drawSelection({ drawRangeCursor: true }),
|
||||||
|
selectedWordMatchExtension,
|
||||||
...(placeholder ? [cmPlaceholder(placeholder)] : []),
|
...(placeholder ? [cmPlaceholder(placeholder)] : []),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -80,7 +80,10 @@ const TextToDiagramContent = ({
|
|||||||
} = useChatManagement({ persistenceAdapter });
|
} = useChatManagement({ persistenceAdapter });
|
||||||
|
|
||||||
const onViewAsMermaid = () => {
|
const onViewAsMermaid = () => {
|
||||||
if (typeof lastAssistantMessage?.content === "string") {
|
if (
|
||||||
|
lastAssistantMessage?.contentFormat === "mermaid" &&
|
||||||
|
typeof lastAssistantMessage.content === "string"
|
||||||
|
) {
|
||||||
saveMermaidDataToStorage(lastAssistantMessage.content);
|
saveMermaidDataToStorage(lastAssistantMessage.content);
|
||||||
setAppState({
|
setAppState({
|
||||||
openDialog: { name: "ttd", tab: "mermaid" },
|
openDialog: { name: "ttd", tab: "mermaid" },
|
||||||
@@ -206,6 +209,7 @@ const TextToDiagramContent = ({
|
|||||||
onGenerate={onGenerate}
|
onGenerate={onGenerate}
|
||||||
isGenerating={lastAssistantMessage?.isGenerating ?? false}
|
isGenerating={lastAssistantMessage?.isGenerating ?? false}
|
||||||
generatedResponse={lastAssistantMessage?.content}
|
generatedResponse={lastAssistantMessage?.content}
|
||||||
|
generatedResponseFormat={lastAssistantMessage?.contentFormat}
|
||||||
isMenuOpen={isMenuOpen}
|
isMenuOpen={isMenuOpen}
|
||||||
onMenuToggle={handleMenuToggle}
|
onMenuToggle={handleMenuToggle}
|
||||||
onMenuClose={handleMenuClose}
|
onMenuClose={handleMenuClose}
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ export const useTextGeneration = ({
|
|||||||
updateAssistantContent(prev, {
|
updateAssistantContent(prev, {
|
||||||
isGenerating: true,
|
isGenerating: true,
|
||||||
content: "",
|
content: "",
|
||||||
|
contentFormat: "mermaid",
|
||||||
error: undefined,
|
error: undefined,
|
||||||
errorType: undefined,
|
errorType: undefined,
|
||||||
errorDetails: undefined,
|
errorDetails: undefined,
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import {
|
||||||
|
getMermaidHighlightToken,
|
||||||
|
tokenizeMermaid,
|
||||||
|
} from "./mermaid-highlighting";
|
||||||
|
|
||||||
|
describe("mermaid highlighting", () => {
|
||||||
|
it("tokenizes mermaid syntax with shared token types", () => {
|
||||||
|
const tokens = tokenizeMermaid('flowchart LR\nA["Hello"] --> B');
|
||||||
|
|
||||||
|
expect(tokens).toEqual([
|
||||||
|
{ type: "keyword", value: "flowchart" },
|
||||||
|
{ type: null, value: " " },
|
||||||
|
{ type: "keyword", value: "LR" },
|
||||||
|
{ type: null, value: "\n" },
|
||||||
|
{ type: "variableName", value: "A" },
|
||||||
|
{ type: "bracket", value: "[" },
|
||||||
|
{ type: "string", value: '"Hello"' },
|
||||||
|
{ type: "bracket", value: "]" },
|
||||||
|
{ type: null, value: " " },
|
||||||
|
{ type: "operator", value: "-->" },
|
||||||
|
{ type: null, value: " " },
|
||||||
|
{ type: "variableName", value: "B" },
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("limits comment tokens to a single line", () => {
|
||||||
|
const tokens = tokenizeMermaid("%% comment\nflowchart TD");
|
||||||
|
|
||||||
|
expect(tokens[0]).toEqual({ type: "comment", value: "%% comment" });
|
||||||
|
expect(tokens[1]).toEqual({ type: null, value: "\n" });
|
||||||
|
expect(tokens[2]).toEqual({ type: "keyword", value: "flowchart" });
|
||||||
|
});
|
||||||
|
|
||||||
|
it("falls back to plain text for unsupported characters", () => {
|
||||||
|
expect(getMermaidHighlightToken("@node")).toEqual({
|
||||||
|
type: null,
|
||||||
|
value: "@",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
export type MermaidHighlightTokenType =
|
||||||
|
| "bracket"
|
||||||
|
| "comment"
|
||||||
|
| "keyword"
|
||||||
|
| "number"
|
||||||
|
| "operator"
|
||||||
|
| "punctuation"
|
||||||
|
| "string"
|
||||||
|
| "variableName";
|
||||||
|
|
||||||
|
export type MermaidHighlightToken = {
|
||||||
|
type: MermaidHighlightTokenType | null;
|
||||||
|
value: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
const DIAGRAM_TYPE_PATTERN =
|
||||||
|
/^(flowchart|graph|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt|pie|mindmap|journey|gitGraph|timeline|quadrantChart|sankey|xychart)\b/i;
|
||||||
|
const DIRECTION_PATTERN = /^(TB|TD|BT|RL|LR)\b/;
|
||||||
|
const KEYWORD_PATTERN =
|
||||||
|
/^(subgraph|end|participant|actor|loop|alt|else|opt|par|critical|break|rect|note|over|activate|deactivate|title|section|class|style|linkStyle|classDef|click)\b/i;
|
||||||
|
|
||||||
|
const MERMAID_TOKEN_RULES: ReadonlyArray<{
|
||||||
|
pattern: RegExp;
|
||||||
|
type: MermaidHighlightTokenType | null;
|
||||||
|
}> = [
|
||||||
|
{ pattern: /^%%[^\n]*/, type: "comment" },
|
||||||
|
{ pattern: /^"(?:[^"\\]|\\.)*"/, type: "string" },
|
||||||
|
{ pattern: DIAGRAM_TYPE_PATTERN, type: "keyword" },
|
||||||
|
{ pattern: DIRECTION_PATTERN, type: "keyword" },
|
||||||
|
{ pattern: KEYWORD_PATTERN, type: "keyword" },
|
||||||
|
{ pattern: /^[-.=<>|ox]+>/, type: "operator" },
|
||||||
|
{ pattern: /^<[-.=<>|ox]+/, type: "operator" },
|
||||||
|
{ pattern: /^(--+|\.\.+|==+)/, type: "operator" },
|
||||||
|
{ pattern: /^[[\](){}|<>]/, type: "bracket" },
|
||||||
|
{ pattern: /^[A-Za-z_][A-Za-z0-9_]*/, type: "variableName" },
|
||||||
|
{ pattern: /^\d+(\.\d+)?/, type: "number" },
|
||||||
|
{ pattern: /^[,:;]/, type: "punctuation" },
|
||||||
|
{ pattern: /^\s+/, type: null },
|
||||||
|
];
|
||||||
|
|
||||||
|
export const getMermaidHighlightToken = (
|
||||||
|
input: string,
|
||||||
|
): MermaidHighlightToken | null => {
|
||||||
|
if (!input) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const rule of MERMAID_TOKEN_RULES) {
|
||||||
|
const match = input.match(rule.pattern);
|
||||||
|
if (match) {
|
||||||
|
return {
|
||||||
|
type: rule.type,
|
||||||
|
value: match[0],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
type: null,
|
||||||
|
value: input[0],
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const tokenizeMermaid = (input: string): MermaidHighlightToken[] => {
|
||||||
|
const tokens: MermaidHighlightToken[] = [];
|
||||||
|
let remaining = input;
|
||||||
|
|
||||||
|
while (remaining) {
|
||||||
|
const token = getMermaidHighlightToken(remaining);
|
||||||
|
if (!token) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
tokens.push(token);
|
||||||
|
remaining = remaining.slice(token.value.length);
|
||||||
|
}
|
||||||
|
|
||||||
|
return tokens;
|
||||||
|
};
|
||||||
@@ -1,79 +1,17 @@
|
|||||||
import { StreamLanguage } from "@codemirror/language";
|
import { StreamLanguage } from "@codemirror/language";
|
||||||
|
|
||||||
|
import { getMermaidHighlightToken } from "./mermaid-highlighting";
|
||||||
|
|
||||||
const mermaidStreamParser = StreamLanguage.define({
|
const mermaidStreamParser = StreamLanguage.define({
|
||||||
token(stream) {
|
token(stream) {
|
||||||
// Comments: %%...
|
const token = getMermaidHighlightToken(stream.string.slice(stream.pos));
|
||||||
if (stream.match(/^%%.*$/)) {
|
if (!token) {
|
||||||
return "comment";
|
stream.skipToEnd();
|
||||||
}
|
|
||||||
|
|
||||||
// Strings
|
|
||||||
if (stream.match(/^"(?:[^"\\]|\\.)*"/)) {
|
|
||||||
return "string";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Diagram type keywords (at start of line or after whitespace)
|
|
||||||
if (
|
|
||||||
stream.match(
|
|
||||||
/^(flowchart|graph|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt|pie|mindmap|journey|gitGraph|timeline|quadrantChart|sankey|xychart)\b/i,
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
return "keyword";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Direction keywords
|
|
||||||
if (stream.match(/^(TB|TD|BT|RL|LR)\b/)) {
|
|
||||||
return "keyword";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Keywords
|
|
||||||
if (
|
|
||||||
stream.match(
|
|
||||||
/^(subgraph|end|participant|actor|loop|alt|else|opt|par|critical|break|rect|note|over|activate|deactivate|title|section|class|style|linkStyle|classDef|click)\b/i,
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
return "keyword";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Arrows: -->, ---, -.->, ===>, etc.
|
|
||||||
if (stream.match(/^[-.=<>|ox]+>/)) {
|
|
||||||
return "operator";
|
|
||||||
}
|
|
||||||
if (stream.match(/^<[-.=<>|ox]+/)) {
|
|
||||||
return "operator";
|
|
||||||
}
|
|
||||||
if (stream.match(/^--+|\.\.+|==+/)) {
|
|
||||||
return "operator";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Labels in brackets/parens: [text], (text), {text}, ((text)), etc.
|
|
||||||
if (stream.match(/^[[\](){}|<>]/)) {
|
|
||||||
return "bracket";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Node IDs (alphanumeric)
|
|
||||||
if (stream.match(/^[A-Za-z_][A-Za-z0-9_]*/)) {
|
|
||||||
return "variableName";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Numbers
|
|
||||||
if (stream.match(/^\d+(\.\d+)?/)) {
|
|
||||||
return "number";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Punctuation
|
|
||||||
if (stream.match(/^[,:;]/)) {
|
|
||||||
return "punctuation";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skip whitespace
|
|
||||||
if (stream.eatSpace()) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip any other character
|
stream.pos += token.value.length;
|
||||||
stream.next();
|
return token.type;
|
||||||
return null;
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ export type MermaidData = {
|
|||||||
files: BinaryFiles | null;
|
files: BinaryFiles | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type ChatMessageContentFormat = "text" | "mermaid";
|
||||||
|
|
||||||
export interface RateLimits {
|
export interface RateLimits {
|
||||||
rateLimit: number;
|
rateLimit: number;
|
||||||
rateLimitRemaining: number;
|
rateLimitRemaining: number;
|
||||||
@@ -33,6 +35,7 @@ export namespace TChat {
|
|||||||
errorType?: "parse" | "network" | "other";
|
errorType?: "parse" | "network" | "other";
|
||||||
lastAttemptAt?: number;
|
lastAttemptAt?: number;
|
||||||
type: "user" | "assistant" | "warning";
|
type: "user" | "assistant" | "warning";
|
||||||
|
contentFormat?: ChatMessageContentFormat;
|
||||||
warningType?: /* daily rate limit */
|
warningType?: /* daily rate limit */
|
||||||
"messageLimitExceeded" | /* general 429 */ "rateLimitExceeded";
|
"messageLimitExceeded" | /* general 429 */ "rateLimitExceeded";
|
||||||
content?: string;
|
content?: string;
|
||||||
|
|||||||
@@ -7,6 +7,17 @@ import { chatHistoryAtom } from "./TTDContext";
|
|||||||
|
|
||||||
import type { SavedChat, SavedChats, TTDPersistenceAdapter } from "./types";
|
import type { SavedChat, SavedChats, TTDPersistenceAdapter } from "./types";
|
||||||
|
|
||||||
|
const normalizePersistedChat = (chat: SavedChat): SavedChat => ({
|
||||||
|
...chat,
|
||||||
|
messages: chat.messages.map((message) => ({
|
||||||
|
...message,
|
||||||
|
// Legacy TTD chats predate explicit content format metadata.
|
||||||
|
contentFormat:
|
||||||
|
message.contentFormat ??
|
||||||
|
(message.type === "assistant" ? "mermaid" : undefined),
|
||||||
|
})),
|
||||||
|
});
|
||||||
|
|
||||||
interface UseTTDChatStorageProps {
|
interface UseTTDChatStorageProps {
|
||||||
persistenceAdapter: TTDPersistenceAdapter;
|
persistenceAdapter: TTDPersistenceAdapter;
|
||||||
}
|
}
|
||||||
@@ -56,7 +67,7 @@ export const useTTDChatStorage = ({
|
|||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
try {
|
try {
|
||||||
const chats = await persistenceAdapter.loadChats();
|
const chats = await persistenceAdapter.loadChats();
|
||||||
setSavedChats(chats);
|
setSavedChats(chats.map(normalizePersistedChat));
|
||||||
setChatsLoaded(true);
|
setChatsLoaded(true);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn("Failed to load chats:", error);
|
console.warn("Failed to load chats:", error);
|
||||||
|
|||||||
@@ -117,6 +117,28 @@ describe("chat utils", () => {
|
|||||||
expect(result.messages[0].errorType).toBe("network");
|
expect(result.messages[0].errorType).toBe("network");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should update content format when provided", () => {
|
||||||
|
const chatHistory: TChat.ChatHistory = {
|
||||||
|
id: "chat-1",
|
||||||
|
currentPrompt: "",
|
||||||
|
messages: [
|
||||||
|
{
|
||||||
|
id: "1",
|
||||||
|
type: "assistant",
|
||||||
|
content: "graph TD",
|
||||||
|
timestamp: new Date("2024-01-01"),
|
||||||
|
contentFormat: "text",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
const result = updateAssistantContent(chatHistory, {
|
||||||
|
contentFormat: "mermaid",
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(result.messages[0].contentFormat).toBe("mermaid");
|
||||||
|
});
|
||||||
|
|
||||||
it("should return unchanged chatHistory if no assistant message exists", () => {
|
it("should return unchanged chatHistory if no assistant message exists", () => {
|
||||||
const chatHistory: TChat.ChatHistory = {
|
const chatHistory: TChat.ChatHistory = {
|
||||||
id: "chat-1",
|
id: "chat-1",
|
||||||
@@ -357,6 +379,7 @@ describe("chat utils", () => {
|
|||||||
{
|
{
|
||||||
type: "assistant",
|
type: "assistant",
|
||||||
content: "Message",
|
content: "Message",
|
||||||
|
contentFormat: "mermaid",
|
||||||
isGenerating: true,
|
isGenerating: true,
|
||||||
error: "Error text",
|
error: "Error text",
|
||||||
errorType: "parse",
|
errorType: "parse",
|
||||||
@@ -364,6 +387,7 @@ describe("chat utils", () => {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
expect(result.messages[0].isGenerating).toBe(true);
|
expect(result.messages[0].isGenerating).toBe(true);
|
||||||
|
expect(result.messages[0].contentFormat).toBe("mermaid");
|
||||||
expect(result.messages[0].error).toBe("Error text");
|
expect(result.messages[0].error).toBe("Error text");
|
||||||
expect(result.messages[0].errorType).toBe("parse");
|
expect(result.messages[0].errorType).toBe("parse");
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -661,7 +661,7 @@
|
|||||||
"placeholder": {
|
"placeholder": {
|
||||||
"title": "Let's design your diagram",
|
"title": "Let's design your diagram",
|
||||||
"description": "Describe the diagram you want to create, and we'll generate it for you.",
|
"description": "Describe the diagram you want to create, and we'll generate it for you.",
|
||||||
"hint": "At the moment we know Flowchart, Sequence, Class, State, and Entity Relationship diagrams."
|
"hint": "At the moment we know Flowchart, Sequence, Class, and Entity Relationship diagrams."
|
||||||
},
|
},
|
||||||
"preview": "Preview",
|
"preview": "Preview",
|
||||||
"insert": "Insert",
|
"insert": "Insert",
|
||||||
|
|||||||
@@ -88,7 +88,7 @@
|
|||||||
"@excalidraw/element": "0.18.0",
|
"@excalidraw/element": "0.18.0",
|
||||||
"@excalidraw/laser-pointer": "1.3.1",
|
"@excalidraw/laser-pointer": "1.3.1",
|
||||||
"@excalidraw/math": "0.18.0",
|
"@excalidraw/math": "0.18.0",
|
||||||
"@excalidraw/mermaid-to-excalidraw": "2.2.2",
|
"@excalidraw/mermaid-to-excalidraw": "2.1.1",
|
||||||
"@excalidraw/random-username": "1.1.0",
|
"@excalidraw/random-username": "1.1.0",
|
||||||
"browser-fs-access": "0.38.0",
|
"browser-fs-access": "0.38.0",
|
||||||
"canvas-roundrect-polyfill": "0.0.1",
|
"canvas-roundrect-polyfill": "0.0.1",
|
||||||
|
|||||||
@@ -11222,489 +11222,6 @@ exports[`history > multiplayer undo/redo > should redraw arrows on undo > [end o
|
|||||||
|
|
||||||
exports[`history > multiplayer undo/redo > should redraw arrows on undo > [end of test] undo stack 1`] = `[]`;
|
exports[`history > multiplayer undo/redo > should redraw arrows on undo > [end of test] undo stack 1`] = `[]`;
|
||||||
|
|
||||||
exports[`history > multiplayer undo/redo > should support undo and redo when escape unwinds nested group editing > [end of test] appState 1`] = `
|
|
||||||
{
|
|
||||||
"activeEmbeddable": null,
|
|
||||||
"activeLockedId": null,
|
|
||||||
"activeTool": {
|
|
||||||
"customType": null,
|
|
||||||
"fromSelection": false,
|
|
||||||
"lastActiveTool": null,
|
|
||||||
"locked": false,
|
|
||||||
"type": "selection",
|
|
||||||
},
|
|
||||||
"bindMode": "orbit",
|
|
||||||
"bindingPreference": "enabled",
|
|
||||||
"collaborators": Map {},
|
|
||||||
"contextMenu": null,
|
|
||||||
"croppingElementId": null,
|
|
||||||
"currentHoveredFontFamily": null,
|
|
||||||
"currentItemArrowType": "round",
|
|
||||||
"currentItemBackgroundColor": "transparent",
|
|
||||||
"currentItemEndArrowhead": "arrow",
|
|
||||||
"currentItemFillStyle": "solid",
|
|
||||||
"currentItemFontFamily": 5,
|
|
||||||
"currentItemFontSize": 20,
|
|
||||||
"currentItemOpacity": 100,
|
|
||||||
"currentItemRoughness": 1,
|
|
||||||
"currentItemRoundness": "sharp",
|
|
||||||
"currentItemStartArrowhead": null,
|
|
||||||
"currentItemStrokeColor": "#1e1e1e",
|
|
||||||
"currentItemStrokeStyle": "solid",
|
|
||||||
"currentItemStrokeWidth": 2,
|
|
||||||
"currentItemTextAlign": "left",
|
|
||||||
"cursorButton": "up",
|
|
||||||
"defaultSidebarDockedPreference": false,
|
|
||||||
"editingFrame": null,
|
|
||||||
"editingGroupId": null,
|
|
||||||
"editingTextElement": null,
|
|
||||||
"elementsToHighlight": null,
|
|
||||||
"errorMessage": null,
|
|
||||||
"exportBackground": true,
|
|
||||||
"exportEmbedScene": false,
|
|
||||||
"exportScale": 1,
|
|
||||||
"exportWithDarkMode": false,
|
|
||||||
"fileHandle": null,
|
|
||||||
"followedBy": Set {},
|
|
||||||
"frameRendering": {
|
|
||||||
"clip": true,
|
|
||||||
"enabled": true,
|
|
||||||
"name": true,
|
|
||||||
"outline": true,
|
|
||||||
},
|
|
||||||
"frameToHighlight": null,
|
|
||||||
"gridModeEnabled": false,
|
|
||||||
"gridSize": 20,
|
|
||||||
"gridStep": 5,
|
|
||||||
"height": 0,
|
|
||||||
"hoveredElementIds": {},
|
|
||||||
"isBindingEnabled": true,
|
|
||||||
"isCropping": false,
|
|
||||||
"isLoading": false,
|
|
||||||
"isMidpointSnappingEnabled": true,
|
|
||||||
"isResizing": false,
|
|
||||||
"isRotating": false,
|
|
||||||
"lastPointerDownWith": "mouse",
|
|
||||||
"lockedMultiSelections": {},
|
|
||||||
"multiElement": null,
|
|
||||||
"newElement": null,
|
|
||||||
"objectsSnapModeEnabled": false,
|
|
||||||
"offsetLeft": 0,
|
|
||||||
"offsetTop": 0,
|
|
||||||
"openDialog": null,
|
|
||||||
"openMenu": null,
|
|
||||||
"openPopup": null,
|
|
||||||
"openSidebar": null,
|
|
||||||
"originSnapOffset": null,
|
|
||||||
"penDetected": false,
|
|
||||||
"penMode": false,
|
|
||||||
"preferredSelectionTool": {
|
|
||||||
"initialized": true,
|
|
||||||
"type": "selection",
|
|
||||||
},
|
|
||||||
"previousSelectedElementIds": {},
|
|
||||||
"resizingElement": null,
|
|
||||||
"scrollX": 0,
|
|
||||||
"scrollY": 0,
|
|
||||||
"searchMatches": null,
|
|
||||||
"selectedElementIds": {},
|
|
||||||
"selectedElementsAreBeingDragged": false,
|
|
||||||
"selectedGroupIds": {},
|
|
||||||
"selectionElement": null,
|
|
||||||
"shouldCacheIgnoreZoom": false,
|
|
||||||
"showHyperlinkPopup": false,
|
|
||||||
"showWelcomeScreen": true,
|
|
||||||
"snapLines": [],
|
|
||||||
"startBoundElement": null,
|
|
||||||
"stats": {
|
|
||||||
"open": false,
|
|
||||||
"panels": 3,
|
|
||||||
},
|
|
||||||
"suggestedBinding": null,
|
|
||||||
"theme": "light",
|
|
||||||
"toast": null,
|
|
||||||
"userToFollow": null,
|
|
||||||
"viewBackgroundColor": "#ffffff",
|
|
||||||
"viewModeEnabled": false,
|
|
||||||
"width": 0,
|
|
||||||
"zenModeEnabled": false,
|
|
||||||
"zoom": {
|
|
||||||
"value": 1,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`history > multiplayer undo/redo > should support undo and redo when escape unwinds nested group editing > [end of test] element 0 1`] = `
|
|
||||||
{
|
|
||||||
"angle": 0,
|
|
||||||
"backgroundColor": "transparent",
|
|
||||||
"boundElements": null,
|
|
||||||
"customData": undefined,
|
|
||||||
"fillStyle": "solid",
|
|
||||||
"frameId": null,
|
|
||||||
"groupIds": [
|
|
||||||
"inner",
|
|
||||||
"outer",
|
|
||||||
],
|
|
||||||
"height": 100,
|
|
||||||
"id": "id0",
|
|
||||||
"index": "a0",
|
|
||||||
"isDeleted": false,
|
|
||||||
"link": null,
|
|
||||||
"locked": false,
|
|
||||||
"opacity": 100,
|
|
||||||
"roughness": 1,
|
|
||||||
"roundness": null,
|
|
||||||
"strokeColor": "#1e1e1e",
|
|
||||||
"strokeStyle": "solid",
|
|
||||||
"strokeWidth": 2,
|
|
||||||
"type": "rectangle",
|
|
||||||
"updated": 1,
|
|
||||||
"version": 2,
|
|
||||||
"width": 100,
|
|
||||||
"x": 0,
|
|
||||||
"y": 0,
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`history > multiplayer undo/redo > should support undo and redo when escape unwinds nested group editing > [end of test] element 1 1`] = `
|
|
||||||
{
|
|
||||||
"angle": 0,
|
|
||||||
"backgroundColor": "transparent",
|
|
||||||
"boundElements": null,
|
|
||||||
"customData": undefined,
|
|
||||||
"fillStyle": "solid",
|
|
||||||
"frameId": null,
|
|
||||||
"groupIds": [
|
|
||||||
"outer",
|
|
||||||
],
|
|
||||||
"height": 100,
|
|
||||||
"id": "id1",
|
|
||||||
"index": "a1",
|
|
||||||
"isDeleted": false,
|
|
||||||
"link": null,
|
|
||||||
"locked": false,
|
|
||||||
"opacity": 100,
|
|
||||||
"roughness": 1,
|
|
||||||
"roundness": null,
|
|
||||||
"strokeColor": "#1e1e1e",
|
|
||||||
"strokeStyle": "solid",
|
|
||||||
"strokeWidth": 2,
|
|
||||||
"type": "rectangle",
|
|
||||||
"updated": 1,
|
|
||||||
"version": 2,
|
|
||||||
"width": 100,
|
|
||||||
"x": 100,
|
|
||||||
"y": 100,
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`history > multiplayer undo/redo > should support undo and redo when escape unwinds nested group editing > [end of test] element 2 1`] = `
|
|
||||||
{
|
|
||||||
"angle": 0,
|
|
||||||
"backgroundColor": "transparent",
|
|
||||||
"boundElements": null,
|
|
||||||
"customData": undefined,
|
|
||||||
"fillStyle": "solid",
|
|
||||||
"frameId": null,
|
|
||||||
"groupIds": [
|
|
||||||
"inner",
|
|
||||||
"outer",
|
|
||||||
],
|
|
||||||
"height": 100,
|
|
||||||
"id": "id2",
|
|
||||||
"index": "a2",
|
|
||||||
"isDeleted": false,
|
|
||||||
"link": null,
|
|
||||||
"locked": false,
|
|
||||||
"opacity": 100,
|
|
||||||
"roughness": 1,
|
|
||||||
"roundness": null,
|
|
||||||
"strokeColor": "#1e1e1e",
|
|
||||||
"strokeStyle": "solid",
|
|
||||||
"strokeWidth": 2,
|
|
||||||
"type": "rectangle",
|
|
||||||
"updated": 1,
|
|
||||||
"version": 2,
|
|
||||||
"width": 100,
|
|
||||||
"x": 200,
|
|
||||||
"y": 200,
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`history > multiplayer undo/redo > should support undo and redo when escape unwinds nested group editing > [end of test] number of elements 1`] = `3`;
|
|
||||||
|
|
||||||
exports[`history > multiplayer undo/redo > should support undo and redo when escape unwinds nested group editing > [end of test] number of renders 1`] = `16`;
|
|
||||||
|
|
||||||
exports[`history > multiplayer undo/redo > should support undo and redo when escape unwinds nested group editing > [end of test] redo stack 1`] = `[]`;
|
|
||||||
|
|
||||||
exports[`history > multiplayer undo/redo > should support undo and redo when escape unwinds nested group editing > [end of test] undo stack 1`] = `
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"appState": AppStateDelta {
|
|
||||||
"delta": Delta {
|
|
||||||
"deleted": {
|
|
||||||
"selectedElementIds": {
|
|
||||||
"id0": true,
|
|
||||||
"id1": true,
|
|
||||||
"id2": true,
|
|
||||||
},
|
|
||||||
"selectedGroupIds": {
|
|
||||||
"outer": true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"inserted": {
|
|
||||||
"selectedElementIds": {},
|
|
||||||
"selectedGroupIds": {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"elements": {
|
|
||||||
"added": {},
|
|
||||||
"removed": {
|
|
||||||
"id0": {
|
|
||||||
"deleted": {
|
|
||||||
"angle": 0,
|
|
||||||
"backgroundColor": "transparent",
|
|
||||||
"boundElements": null,
|
|
||||||
"customData": undefined,
|
|
||||||
"fillStyle": "solid",
|
|
||||||
"frameId": null,
|
|
||||||
"groupIds": [
|
|
||||||
"inner",
|
|
||||||
"outer",
|
|
||||||
],
|
|
||||||
"height": 100,
|
|
||||||
"index": "a0",
|
|
||||||
"isDeleted": false,
|
|
||||||
"link": null,
|
|
||||||
"locked": false,
|
|
||||||
"opacity": 100,
|
|
||||||
"roughness": 1,
|
|
||||||
"roundness": null,
|
|
||||||
"strokeColor": "#1e1e1e",
|
|
||||||
"strokeStyle": "solid",
|
|
||||||
"strokeWidth": 2,
|
|
||||||
"type": "rectangle",
|
|
||||||
"version": 2,
|
|
||||||
"width": 100,
|
|
||||||
"x": 0,
|
|
||||||
"y": 0,
|
|
||||||
},
|
|
||||||
"inserted": {
|
|
||||||
"isDeleted": true,
|
|
||||||
"version": 1,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"id1": {
|
|
||||||
"deleted": {
|
|
||||||
"angle": 0,
|
|
||||||
"backgroundColor": "transparent",
|
|
||||||
"boundElements": null,
|
|
||||||
"customData": undefined,
|
|
||||||
"fillStyle": "solid",
|
|
||||||
"frameId": null,
|
|
||||||
"groupIds": [
|
|
||||||
"outer",
|
|
||||||
],
|
|
||||||
"height": 100,
|
|
||||||
"index": "a1",
|
|
||||||
"isDeleted": false,
|
|
||||||
"link": null,
|
|
||||||
"locked": false,
|
|
||||||
"opacity": 100,
|
|
||||||
"roughness": 1,
|
|
||||||
"roundness": null,
|
|
||||||
"strokeColor": "#1e1e1e",
|
|
||||||
"strokeStyle": "solid",
|
|
||||||
"strokeWidth": 2,
|
|
||||||
"type": "rectangle",
|
|
||||||
"version": 2,
|
|
||||||
"width": 100,
|
|
||||||
"x": 100,
|
|
||||||
"y": 100,
|
|
||||||
},
|
|
||||||
"inserted": {
|
|
||||||
"isDeleted": true,
|
|
||||||
"version": 1,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"id2": {
|
|
||||||
"deleted": {
|
|
||||||
"angle": 0,
|
|
||||||
"backgroundColor": "transparent",
|
|
||||||
"boundElements": null,
|
|
||||||
"customData": undefined,
|
|
||||||
"fillStyle": "solid",
|
|
||||||
"frameId": null,
|
|
||||||
"groupIds": [
|
|
||||||
"inner",
|
|
||||||
"outer",
|
|
||||||
],
|
|
||||||
"height": 100,
|
|
||||||
"index": "a2",
|
|
||||||
"isDeleted": false,
|
|
||||||
"link": null,
|
|
||||||
"locked": false,
|
|
||||||
"opacity": 100,
|
|
||||||
"roughness": 1,
|
|
||||||
"roundness": null,
|
|
||||||
"strokeColor": "#1e1e1e",
|
|
||||||
"strokeStyle": "solid",
|
|
||||||
"strokeWidth": 2,
|
|
||||||
"type": "rectangle",
|
|
||||||
"version": 2,
|
|
||||||
"width": 100,
|
|
||||||
"x": 200,
|
|
||||||
"y": 200,
|
|
||||||
},
|
|
||||||
"inserted": {
|
|
||||||
"isDeleted": true,
|
|
||||||
"version": 1,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"updated": {},
|
|
||||||
},
|
|
||||||
"id": "id5",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"appState": AppStateDelta {
|
|
||||||
"delta": Delta {
|
|
||||||
"deleted": {
|
|
||||||
"editingGroupId": "outer",
|
|
||||||
"selectedElementIds": {},
|
|
||||||
"selectedGroupIds": {
|
|
||||||
"inner": true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"inserted": {
|
|
||||||
"editingGroupId": null,
|
|
||||||
"selectedElementIds": {
|
|
||||||
"id1": true,
|
|
||||||
},
|
|
||||||
"selectedGroupIds": {
|
|
||||||
"outer": true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"elements": {
|
|
||||||
"added": {},
|
|
||||||
"removed": {},
|
|
||||||
"updated": {},
|
|
||||||
},
|
|
||||||
"id": "id7",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"appState": AppStateDelta {
|
|
||||||
"delta": Delta {
|
|
||||||
"deleted": {
|
|
||||||
"editingGroupId": "inner",
|
|
||||||
"selectedElementIds": {},
|
|
||||||
"selectedGroupIds": {},
|
|
||||||
},
|
|
||||||
"inserted": {
|
|
||||||
"editingGroupId": "outer",
|
|
||||||
"selectedElementIds": {
|
|
||||||
"id2": true,
|
|
||||||
},
|
|
||||||
"selectedGroupIds": {
|
|
||||||
"inner": true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"elements": {
|
|
||||||
"added": {},
|
|
||||||
"removed": {},
|
|
||||||
"updated": {},
|
|
||||||
},
|
|
||||||
"id": "id9",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"appState": AppStateDelta {
|
|
||||||
"delta": Delta {
|
|
||||||
"deleted": {
|
|
||||||
"editingGroupId": "outer",
|
|
||||||
"selectedElementIds": {
|
|
||||||
"id2": true,
|
|
||||||
},
|
|
||||||
"selectedGroupIds": {
|
|
||||||
"inner": true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"inserted": {
|
|
||||||
"editingGroupId": "inner",
|
|
||||||
"selectedElementIds": {},
|
|
||||||
"selectedGroupIds": {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"elements": {
|
|
||||||
"added": {},
|
|
||||||
"removed": {},
|
|
||||||
"updated": {},
|
|
||||||
},
|
|
||||||
"id": "id19",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"appState": AppStateDelta {
|
|
||||||
"delta": Delta {
|
|
||||||
"deleted": {
|
|
||||||
"editingGroupId": null,
|
|
||||||
"selectedElementIds": {
|
|
||||||
"id1": true,
|
|
||||||
},
|
|
||||||
"selectedGroupIds": {
|
|
||||||
"outer": true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"inserted": {
|
|
||||||
"editingGroupId": "outer",
|
|
||||||
"selectedElementIds": {},
|
|
||||||
"selectedGroupIds": {
|
|
||||||
"inner": true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"elements": {
|
|
||||||
"added": {},
|
|
||||||
"removed": {},
|
|
||||||
"updated": {},
|
|
||||||
},
|
|
||||||
"id": "id20",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"appState": AppStateDelta {
|
|
||||||
"delta": Delta {
|
|
||||||
"deleted": {
|
|
||||||
"selectedElementIds": {},
|
|
||||||
"selectedGroupIds": {},
|
|
||||||
},
|
|
||||||
"inserted": {
|
|
||||||
"selectedElementIds": {
|
|
||||||
"id0": true,
|
|
||||||
"id1": true,
|
|
||||||
"id2": true,
|
|
||||||
},
|
|
||||||
"selectedGroupIds": {
|
|
||||||
"outer": true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"elements": {
|
|
||||||
"added": {},
|
|
||||||
"removed": {},
|
|
||||||
"updated": {},
|
|
||||||
},
|
|
||||||
"id": "id21",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`history > multiplayer undo/redo > should update history entries after remote changes on the same properties > [end of test] appState 1`] = `
|
exports[`history > multiplayer undo/redo > should update history entries after remote changes on the same properties > [end of test] appState 1`] = `
|
||||||
{
|
{
|
||||||
"activeEmbeddable": null,
|
"activeEmbeddable": null,
|
||||||
|
|||||||
@@ -2971,82 +2971,6 @@ describe("history", () => {
|
|||||||
expect(h.state.editingGroupId).toBeNull();
|
expect(h.state.editingGroupId).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO mark with "noncritical" tag once we migrate to vitest 4
|
|
||||||
it.skip("should support undo and redo when escape unwinds nested group editing", async () => {
|
|
||||||
const rectA = API.createElement({
|
|
||||||
type: "rectangle",
|
|
||||||
groupIds: ["inner", "outer"],
|
|
||||||
x: 0,
|
|
||||||
});
|
|
||||||
const rectB = API.createElement({
|
|
||||||
type: "rectangle",
|
|
||||||
groupIds: ["outer"],
|
|
||||||
x: 100,
|
|
||||||
});
|
|
||||||
const rectC = API.createElement({
|
|
||||||
type: "rectangle",
|
|
||||||
groupIds: ["inner", "outer"],
|
|
||||||
x: 200,
|
|
||||||
});
|
|
||||||
|
|
||||||
API.setElements([rectA, rectB, rectC]);
|
|
||||||
mouse.select(rectA);
|
|
||||||
mouse.doubleClickOn(rectA);
|
|
||||||
mouse.doubleClickOn(rectA);
|
|
||||||
|
|
||||||
assertSelectedElements([rectA]);
|
|
||||||
expect(h.state.editingGroupId).toBe("inner");
|
|
||||||
expect(API.getUndoStack().length).toBe(3);
|
|
||||||
expect(API.getRedoStack().length).toBe(0);
|
|
||||||
|
|
||||||
Keyboard.keyPress(KEYS.ESCAPE);
|
|
||||||
assertSelectedElements([rectA, rectC]);
|
|
||||||
expect(h.state.editingGroupId).toBe("outer");
|
|
||||||
expect(API.getUndoStack().length).toBe(4);
|
|
||||||
expect(API.getRedoStack().length).toBe(0);
|
|
||||||
|
|
||||||
Keyboard.keyPress(KEYS.ESCAPE);
|
|
||||||
assertSelectedElements([rectA, rectB, rectC]);
|
|
||||||
expect(h.state.editingGroupId).toBeNull();
|
|
||||||
expect(h.state.selectedGroupIds).toEqual({ outer: true });
|
|
||||||
expect(API.getUndoStack().length).toBe(5);
|
|
||||||
expect(API.getRedoStack().length).toBe(0);
|
|
||||||
|
|
||||||
Keyboard.keyPress(KEYS.ESCAPE);
|
|
||||||
expect(API.getSelectedElements()).toEqual([]);
|
|
||||||
expect(h.state.editingGroupId).toBeNull();
|
|
||||||
expect(h.state.selectedGroupIds).toEqual({});
|
|
||||||
expect(API.getUndoStack().length).toBe(6);
|
|
||||||
expect(API.getRedoStack().length).toBe(0);
|
|
||||||
|
|
||||||
Keyboard.undo();
|
|
||||||
assertSelectedElements([rectA, rectB, rectC]);
|
|
||||||
expect(h.state.editingGroupId).toBeNull();
|
|
||||||
expect(h.state.selectedGroupIds).toEqual({ outer: true });
|
|
||||||
|
|
||||||
Keyboard.undo();
|
|
||||||
assertSelectedElements([rectA, rectC]);
|
|
||||||
expect(h.state.editingGroupId).toBe("outer");
|
|
||||||
|
|
||||||
Keyboard.undo();
|
|
||||||
assertSelectedElements([rectA]);
|
|
||||||
expect(h.state.editingGroupId).toBe("inner");
|
|
||||||
|
|
||||||
Keyboard.redo();
|
|
||||||
assertSelectedElements([rectA, rectC]);
|
|
||||||
expect(h.state.editingGroupId).toBe("outer");
|
|
||||||
|
|
||||||
Keyboard.redo();
|
|
||||||
assertSelectedElements([rectA, rectB, rectC]);
|
|
||||||
expect(h.state.editingGroupId).toBeNull();
|
|
||||||
expect(h.state.selectedGroupIds).toEqual({ outer: true });
|
|
||||||
|
|
||||||
Keyboard.redo();
|
|
||||||
expect(API.getSelectedElements()).toEqual([]);
|
|
||||||
expect(h.state.editingGroupId).toBeNull();
|
|
||||||
expect(h.state.selectedGroupIds).toEqual({});
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should iterate through the history when selected or editing linear element was remotely deleted", async () => {
|
it("should iterate through the history when selected or editing linear element was remotely deleted", async () => {
|
||||||
// create three point arrow
|
// create three point arrow
|
||||||
UI.clickTool("arrow");
|
UI.clickTool("arrow");
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ describe("select single element on the scene", () => {
|
|||||||
fireEvent.pointerUp(canvas);
|
fireEvent.pointerUp(canvas);
|
||||||
|
|
||||||
expect(renderInteractiveScene).toHaveBeenCalledTimes(8);
|
expect(renderInteractiveScene).toHaveBeenCalledTimes(8);
|
||||||
expect(renderStaticScene).toHaveBeenCalledTimes(7);
|
expect(renderStaticScene).toHaveBeenCalledTimes(6);
|
||||||
expect(h.state.selectionElement).toBeNull();
|
expect(h.state.selectionElement).toBeNull();
|
||||||
expect(h.elements.length).toEqual(1);
|
expect(h.elements.length).toEqual(1);
|
||||||
expect(h.state.selectedElementIds[h.elements[0].id]).toBeTruthy();
|
expect(h.state.selectedElementIds[h.elements[0].id]).toBeTruthy();
|
||||||
@@ -359,7 +359,7 @@ describe("select single element on the scene", () => {
|
|||||||
fireEvent.pointerUp(canvas);
|
fireEvent.pointerUp(canvas);
|
||||||
|
|
||||||
expect(renderInteractiveScene).toHaveBeenCalledTimes(8);
|
expect(renderInteractiveScene).toHaveBeenCalledTimes(8);
|
||||||
expect(renderStaticScene).toHaveBeenCalledTimes(7);
|
expect(renderStaticScene).toHaveBeenCalledTimes(6);
|
||||||
expect(h.state.selectionElement).toBeNull();
|
expect(h.state.selectionElement).toBeNull();
|
||||||
expect(h.elements.length).toEqual(1);
|
expect(h.elements.length).toEqual(1);
|
||||||
expect(h.state.selectedElementIds[h.elements[0].id]).toBeTruthy();
|
expect(h.state.selectedElementIds[h.elements[0].id]).toBeTruthy();
|
||||||
@@ -392,7 +392,7 @@ describe("select single element on the scene", () => {
|
|||||||
fireEvent.pointerUp(canvas);
|
fireEvent.pointerUp(canvas);
|
||||||
|
|
||||||
expect(renderInteractiveScene).toHaveBeenCalledTimes(8);
|
expect(renderInteractiveScene).toHaveBeenCalledTimes(8);
|
||||||
expect(renderStaticScene).toHaveBeenCalledTimes(7);
|
expect(renderStaticScene).toHaveBeenCalledTimes(6);
|
||||||
expect(h.state.selectionElement).toBeNull();
|
expect(h.state.selectionElement).toBeNull();
|
||||||
expect(h.elements.length).toEqual(1);
|
expect(h.elements.length).toEqual(1);
|
||||||
expect(h.state.selectedElementIds[h.elements[0].id]).toBeTruthy();
|
expect(h.state.selectedElementIds[h.elements[0].id]).toBeTruthy();
|
||||||
@@ -438,7 +438,7 @@ describe("select single element on the scene", () => {
|
|||||||
fireEvent.pointerUp(canvas);
|
fireEvent.pointerUp(canvas);
|
||||||
|
|
||||||
expect(renderInteractiveScene).toHaveBeenCalledTimes(10);
|
expect(renderInteractiveScene).toHaveBeenCalledTimes(10);
|
||||||
expect(renderStaticScene).toHaveBeenCalledTimes(9);
|
expect(renderStaticScene).toHaveBeenCalledTimes(8);
|
||||||
expect(h.state.selectionElement).toBeNull();
|
expect(h.state.selectionElement).toBeNull();
|
||||||
expect(h.elements.length).toEqual(1);
|
expect(h.elements.length).toEqual(1);
|
||||||
expect(h.state.selectedElementIds[h.elements[0].id]).toBeTruthy();
|
expect(h.state.selectedElementIds[h.elements[0].id]).toBeTruthy();
|
||||||
@@ -483,7 +483,7 @@ describe("select single element on the scene", () => {
|
|||||||
fireEvent.pointerUp(canvas);
|
fireEvent.pointerUp(canvas);
|
||||||
|
|
||||||
expect(renderInteractiveScene).toHaveBeenCalledTimes(10);
|
expect(renderInteractiveScene).toHaveBeenCalledTimes(10);
|
||||||
expect(renderStaticScene).toHaveBeenCalledTimes(9);
|
expect(renderStaticScene).toHaveBeenCalledTimes(8);
|
||||||
expect(h.state.selectionElement).toBeNull();
|
expect(h.state.selectionElement).toBeNull();
|
||||||
expect(h.elements.length).toEqual(1);
|
expect(h.elements.length).toEqual(1);
|
||||||
expect(h.state.selectedElementIds[h.elements[0].id]).toBeTruthy();
|
expect(h.state.selectedElementIds[h.elements[0].id]).toBeTruthy();
|
||||||
@@ -558,58 +558,3 @@ describe("selectedElementIds stability", () => {
|
|||||||
expect(h.state.selectedElementIds).toBe(selectedElementIds_2);
|
expect(h.state.selectedElementIds).toBe(selectedElementIds_2);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("deselecting", () => {
|
|
||||||
beforeEach(async () => {
|
|
||||||
await render(<Excalidraw handleKeyboardGlobally={true} />);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("esc unwinds nested group editing before deselecting", () => {
|
|
||||||
const rectA = API.createElement({
|
|
||||||
type: "rectangle",
|
|
||||||
x: 0,
|
|
||||||
y: 0,
|
|
||||||
groupIds: ["inner", "outer"],
|
|
||||||
});
|
|
||||||
const rectB = API.createElement({
|
|
||||||
type: "rectangle",
|
|
||||||
x: 100,
|
|
||||||
y: 0,
|
|
||||||
groupIds: ["outer"],
|
|
||||||
});
|
|
||||||
const rectC = API.createElement({
|
|
||||||
type: "rectangle",
|
|
||||||
x: 200,
|
|
||||||
y: 0,
|
|
||||||
groupIds: ["inner", "outer"],
|
|
||||||
});
|
|
||||||
|
|
||||||
API.setElements([rectA, rectB, rectC]);
|
|
||||||
|
|
||||||
mouse.select(rectA);
|
|
||||||
assertSelectedElements(rectA, rectB, rectC);
|
|
||||||
expect(h.state.editingGroupId).toBeNull();
|
|
||||||
|
|
||||||
mouse.doubleClickOn(rectA);
|
|
||||||
assertSelectedElements(rectA, rectC);
|
|
||||||
expect(h.state.editingGroupId).toBe("outer");
|
|
||||||
|
|
||||||
mouse.doubleClickOn(rectA);
|
|
||||||
assertSelectedElements(rectA);
|
|
||||||
expect(h.state.editingGroupId).toBe("inner");
|
|
||||||
|
|
||||||
Keyboard.keyPress(KEYS.ESCAPE);
|
|
||||||
assertSelectedElements(rectA, rectC);
|
|
||||||
expect(h.state.editingGroupId).toBe("outer");
|
|
||||||
|
|
||||||
Keyboard.keyPress(KEYS.ESCAPE);
|
|
||||||
assertSelectedElements(rectA, rectB, rectC);
|
|
||||||
expect(h.state.editingGroupId).toBeNull();
|
|
||||||
expect(h.state.selectedGroupIds).toEqual({ outer: true });
|
|
||||||
|
|
||||||
Keyboard.keyPress(KEYS.ESCAPE);
|
|
||||||
expect(API.getSelectedElements()).toEqual([]);
|
|
||||||
expect(h.state.editingGroupId).toBeNull();
|
|
||||||
expect(h.state.selectedGroupIds).toEqual({});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -45,28 +45,6 @@ unmountComponent();
|
|||||||
const tab = " ";
|
const tab = " ";
|
||||||
const mouse = new Pointer("mouse");
|
const mouse = new Pointer("mouse");
|
||||||
|
|
||||||
const exitTextEditorAndAssertSelection = async ({
|
|
||||||
editor,
|
|
||||||
selectedIds,
|
|
||||||
nextText,
|
|
||||||
}: {
|
|
||||||
editor: HTMLTextAreaElement;
|
|
||||||
selectedIds: string[];
|
|
||||||
nextText?: string;
|
|
||||||
}) => {
|
|
||||||
if (nextText !== undefined) {
|
|
||||||
updateTextEditor(editor, nextText);
|
|
||||||
}
|
|
||||||
|
|
||||||
Keyboard.exitTextEditor(editor);
|
|
||||||
|
|
||||||
expect(await getTextEditor({ waitForEditor: false })).toBe(null);
|
|
||||||
expect(window.h.state.editingTextElement).toBeNull();
|
|
||||||
expect(API.getSelectedElements().map((element) => element.id)).toEqual(
|
|
||||||
selectedIds,
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
describe("textWysiwyg", () => {
|
describe("textWysiwyg", () => {
|
||||||
describe("start text editing", () => {
|
describe("start text editing", () => {
|
||||||
const { h } = window;
|
const { h } = window;
|
||||||
@@ -293,33 +271,6 @@ describe("textWysiwyg", () => {
|
|||||||
expect(h.elements.length).toBe(1);
|
expect(h.elements.length).toBe(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should reselect text after exiting wysiwyg with escape", async () => {
|
|
||||||
const text = API.createElement({
|
|
||||||
type: "text",
|
|
||||||
text: "ola",
|
|
||||||
x: 60,
|
|
||||||
y: 0,
|
|
||||||
width: 100,
|
|
||||||
height: 100,
|
|
||||||
});
|
|
||||||
|
|
||||||
API.setElements([text]);
|
|
||||||
API.setSelectedElements([text]);
|
|
||||||
UI.clickTool("selection");
|
|
||||||
|
|
||||||
Keyboard.keyPress(KEYS.ENTER);
|
|
||||||
|
|
||||||
const editor = await getTextEditor();
|
|
||||||
|
|
||||||
expect(editor).not.toBe(null);
|
|
||||||
expect(h.state.editingTextElement?.id).toBe(text.id);
|
|
||||||
|
|
||||||
await exitTextEditorAndAssertSelection({
|
|
||||||
editor,
|
|
||||||
selectedIds: [text.id],
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should edit selected bound text on single click", async () => {
|
it("should edit selected bound text on single click", async () => {
|
||||||
const container = API.createElement({
|
const container = API.createElement({
|
||||||
type: "rectangle",
|
type: "rectangle",
|
||||||
@@ -1354,40 +1305,6 @@ describe("textWysiwyg", () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each([
|
|
||||||
{
|
|
||||||
label: "container",
|
|
||||||
createElements: () => API.createTextContainer(),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "arrow",
|
|
||||||
createElements: () => API.createLabeledArrow(),
|
|
||||||
},
|
|
||||||
])(
|
|
||||||
"should reselect $label after deleting bound text with escape",
|
|
||||||
async ({ createElements }) => {
|
|
||||||
const [selectedElement, text] = createElements();
|
|
||||||
API.setElements([selectedElement, text]);
|
|
||||||
API.setSelectedElements([selectedElement]);
|
|
||||||
|
|
||||||
Keyboard.keyPress(KEYS.ENTER);
|
|
||||||
const editor = await getTextEditor();
|
|
||||||
|
|
||||||
await exitTextEditorAndAssertSelection({
|
|
||||||
editor,
|
|
||||||
nextText: "",
|
|
||||||
selectedIds: [selectedElement.id],
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(selectedElement.boundElements).toStrictEqual([]);
|
|
||||||
expect(h.elements[1]).toEqual(
|
|
||||||
expect.objectContaining({
|
|
||||||
isDeleted: true,
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
it("should restore original container height and clear cache once text is unbind", async () => {
|
it("should restore original container height and clear cache once text is unbind", async () => {
|
||||||
const container = API.createElement({
|
const container = API.createElement({
|
||||||
type: "rectangle",
|
type: "rectangle",
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export const isLineSegment = <Point extends GlobalPoint | LocalPoint>(
|
|||||||
Array.isArray(segment) &&
|
Array.isArray(segment) &&
|
||||||
segment.length === 2 &&
|
segment.length === 2 &&
|
||||||
isPoint(segment[0]) &&
|
isPoint(segment[0]) &&
|
||||||
isPoint(segment[1]);
|
isPoint(segment[0]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the coordinates resulting from rotating the given line about an origin by an angle in radians
|
* Return the coordinates resulting from rotating the given line about an origin by an angle in radians
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
import { pointFrom } from "../src/point";
|
import { pointFrom } from "../src/point";
|
||||||
import {
|
import { lineSegment, lineSegmentIntersectionPoints } from "../src/segment";
|
||||||
lineSegment,
|
|
||||||
lineSegmentIntersectionPoints,
|
|
||||||
isLineSegment,
|
|
||||||
} from "../src/segment";
|
|
||||||
|
|
||||||
describe("line-segment intersections", () => {
|
describe("line-segment intersections", () => {
|
||||||
it("should correctly detect intersection", () => {
|
it("should correctly detect intersection", () => {
|
||||||
@@ -23,23 +19,3 @@ describe("line-segment intersections", () => {
|
|||||||
).toEqual(null);
|
).toEqual(null);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe("isLineSegment validation", () => {
|
|
||||||
it("should return true for a valid segment", () => {
|
|
||||||
expect(
|
|
||||||
isLineSegment([
|
|
||||||
[0, 0],
|
|
||||||
[1, 1],
|
|
||||||
]),
|
|
||||||
).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should return false if second element is not a point", () => {
|
|
||||||
const invalidSegment = [[0, 0], "not-a-point"] as any;
|
|
||||||
|
|
||||||
expect(isLineSegment(invalidSegment)).toBe(false);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should return false for wrong length", () => {
|
|
||||||
expect(isLineSegment([[0, 0]])).toBe(false);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -1531,10 +1531,10 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@excalidraw/markdown-to-text/-/markdown-to-text-0.1.2.tgz#1703705e7da608cf478f17bfe96fb295f55a23eb"
|
resolved "https://registry.yarnpkg.com/@excalidraw/markdown-to-text/-/markdown-to-text-0.1.2.tgz#1703705e7da608cf478f17bfe96fb295f55a23eb"
|
||||||
integrity sha512-1nDXBNAojfi3oSFwJswKREkFm5wrSjqay81QlyRv2pkITG/XYB5v+oChENVBQLcxQwX4IUATWvXM5BcaNhPiIg==
|
integrity sha512-1nDXBNAojfi3oSFwJswKREkFm5wrSjqay81QlyRv2pkITG/XYB5v+oChENVBQLcxQwX4IUATWvXM5BcaNhPiIg==
|
||||||
|
|
||||||
"@excalidraw/mermaid-to-excalidraw@2.2.2":
|
"@excalidraw/mermaid-to-excalidraw@2.1.1":
|
||||||
version "2.2.2"
|
version "2.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/@excalidraw/mermaid-to-excalidraw/-/mermaid-to-excalidraw-2.2.2.tgz#ee6b597a0d95b9a76f7ae41ce0e3733a9b96e4a0"
|
resolved "https://registry.yarnpkg.com/@excalidraw/mermaid-to-excalidraw/-/mermaid-to-excalidraw-2.1.1.tgz#659c934a607dd2cf57f2a69282588ee2b0722959"
|
||||||
integrity sha512-5VKQq5CdRocC82vOIUpQ5ufJOVV9FpBTdHGA+ULqazeIVV+cr299877omQCibsdS3Bpitz2fsnTwnIXEmLVDSg==
|
integrity sha512-jU+frqcxazsY+t5yOBf2mgrQy+WUrbrzA36if3SQB/Vwaf2qOJjnWxucNafgZZk/3+9xGmRotUeOviSOJG+wYA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@excalidraw/markdown-to-text" "0.1.2"
|
"@excalidraw/markdown-to-text" "0.1.2"
|
||||||
"@mermaid-js/parser" "^0.6.3"
|
"@mermaid-js/parser" "^0.6.3"
|
||||||
|
|||||||
Reference in New Issue
Block a user