Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Bump tiptap #2274

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions editor.planx.uk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@
"@mui/utils": "^5.14.5",
"@opensystemslab/map": "^0.7.5",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#44420b9",
"@tiptap/core": "^2.0.3",
"@tiptap/extension-bold": "^2.0.3",
"@tiptap/extension-bubble-menu": "^2.1.6",
"@tiptap/extension-bullet-list": "^2.0.3",
"@tiptap/extension-document": "^2.0.3",
"@tiptap/extension-hard-break": "^2.1.6",
"@tiptap/extension-heading": "^2.0.3",
"@tiptap/extension-history": "^2.0.3",
"@tiptap/extension-image": "^2.0.3",
"@tiptap/extension-italic": "^2.0.3",
"@tiptap/extension-link": "^2.0.3",
"@tiptap/extension-list-item": "^2.0.3",
"@tiptap/extension-mention": "^2.1.8",
"@tiptap/extension-ordered-list": "^2.1.8",
"@tiptap/extension-paragraph": "^2.0.3",
"@tiptap/extension-placeholder": "^2.0.3",
"@tiptap/core": "^2.1.11",
"@tiptap/extension-bold": "^2.1.11",
"@tiptap/extension-bubble-menu": "^2.1.11",
"@tiptap/extension-bullet-list": "^2.1.11",
"@tiptap/extension-document": "^2.1.11",
"@tiptap/extension-hard-break": "^2.1.11",
"@tiptap/extension-heading": "^2.1.11",
"@tiptap/extension-history": "^2.1.11",
"@tiptap/extension-image": "^2.1.11",
"@tiptap/extension-italic": "^2.1.11",
"@tiptap/extension-link": "^2.1.11",
"@tiptap/extension-list-item": "^2.1.11",
"@tiptap/extension-mention": "^2.1.11",
"@tiptap/extension-ordered-list": "^2.1.11",
"@tiptap/extension-paragraph": "^2.1.11",
"@tiptap/extension-placeholder": "^2.1.11",
"@tiptap/extension-text": "^2.1.11",
"@tiptap/html": "^2.0.3",
"@tiptap/pm": "^2.0.3",
"@tiptap/react": "^2.0.3",
"@tiptap/suggestion": "^2.0.3",
"@tiptap/html": "^2.1.11",
"@tiptap/pm": "^2.1.11",
"@tiptap/react": "^2.1.11",
"@tiptap/suggestion": "^2.1.11",
"@turf/buffer": "^6.5.0",
"@turf/helpers": "^6.5.0",
"array-move": "^4.0.0",
Expand Down
242 changes: 120 additions & 122 deletions editor.planx.uk/pnpm-lock.yaml

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions editor.planx.uk/src/components/Header.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ const mockTeam2: Team = {
slug: "closedsystemslab",
};

jest.spyOn(ReactNavi, "useNavigation").mockReturnValue(({
navigate: jest.fn()
}) as any);
jest.spyOn(ReactNavi, "useNavigation").mockReturnValue({
navigate: jest.fn(),
} as any);

describe("Header Component - Editor Route", () => {
beforeAll(() => {
Expand Down
6 changes: 4 additions & 2 deletions editor.planx.uk/src/lib/dataMergedHotfix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ const getFlowData = async (id: string) => {
// in order to load frontend /preview routes for flows that are not published
export const dataMerged = async (id: string, ob: Record<string, any> = {}) => {
// get the primary flow data
const { slug, data }: { slug: string; data: Record<string, any> } = await getFlowData(id);
const { slug, data }: { slug: string; data: Record<string, any> } =
await getFlowData(id);

// recursively get and flatten internal portals & external portals
for (const [nodeId, node] of Object.entries(data)) {
const isExternalPortalRoot = nodeId === "_root" && Object.keys(ob).length > 0;
const isExternalPortalRoot =
nodeId === "_root" && Object.keys(ob).length > 0;
const isExternalPortal = node.type === TYPES.ExternalPortal;
const isMerged = ob[node.data?.flowId];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ describe("A flow with repeated external portals can be navigated as expected", (
record("withinExternalPortal", { answers: [] });
expect(upcomingCardIds()[0]).toEqual("finalNode");
});
});
});
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
{
"_root": {
"edges": [
"firstNode",
"finalNode"
]
"edges": ["firstNode", "finalNode"]
},
"externalPortal1": {
"type": 300,
"edges": [
"externalFlowId"
]
"edges": ["externalFlowId"]
},
"option3": {
"data": {
Expand All @@ -19,29 +14,21 @@
},
"externalPortal2": {
"type": 300,
"edges": [
"externalFlowId"
]
"edges": ["externalFlowId"]
},
"firstNode": {
"data": {
"text": "This is a question"
},
"type": 100,
"edges": [
"option1",
"option2",
"option3"
]
"edges": ["option1", "option2", "option3"]
},
"option2": {
"data": {
"text": "Option 2"
},
"type": 200,
"edges": [
"externalPortal2"
]
"edges": ["externalPortal2"]
},
"finalNode": {
"data": {
Expand All @@ -65,17 +52,13 @@
"text": "Option 1"
},
"type": 200,
"edges": [
"externalPortal1"
]
"edges": ["externalPortal1"]
},
"externalFlowId": {
"data": {
"text": "daf-external-portal-test"
},
"type": 300,
"edges": [
"withinExternalPortal"
]
"edges": ["withinExternalPortal"]
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"_root": {
"edges": [
"firstNode",
"finalNode"
]
"edges": ["firstNode", "finalNode"]
},
"option2": {
"data": {
Expand All @@ -21,28 +18,21 @@
},
"externalPortal": {
"type": 300,
"edges": [
"externalFlowId"
]
"edges": ["externalFlowId"]
},
"firstNode": {
"data": {
"text": "This is a question with many options"
},
"type": 100,
"edges": [
"option1",
"option2"
]
"edges": ["option1", "option2"]
},
"option1": {
"data": {
"text": "Option 1"
},
"type": 200,
"edges": [
"externalPortal"
]
"edges": ["externalPortal"]
},
"withinExternalPortal": {
"data": {
Expand All @@ -58,8 +48,6 @@
"text": "test-external-portal"
},
"type": 300,
"edges": [
"withinExternalPortal"
]
"edges": ["withinExternalPortal"]
}
}
}
4 changes: 2 additions & 2 deletions editor.planx.uk/src/pages/FlowEditor/lib/store/team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Team } from "types";
import type { StateCreator } from "zustand";

export interface TeamStore {
teamId: number,
teamId: number;
teamTheme?: TeamTheme;
teamName: string;
teamSettings?: TeamSettings;
Expand Down Expand Up @@ -88,7 +88,7 @@ export const teamStore: StateCreator<TeamStore, [], [], TeamStore> = (
get().setTeam(team);
},

clearTeamStore: () =>
clearTeamStore: () =>
set({
teamId: 0,
teamTheme: undefined,
Expand Down
4 changes: 2 additions & 2 deletions editor.planx.uk/src/pages/FlowEditor/lib/store/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export const userStore: StateCreator<UserStore, [], [], UserStore> = (
},

async initUserStore(jwt: string) {
const { getUser, setUser } = get();
const { getUser, setUser } = get();

if (getUser()) return;

const id = (jwtDecode(jwt) as any)["sub"];
Expand Down
2 changes: 1 addition & 1 deletion editor.planx.uk/src/routes/authenticated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const editorRoutes = compose(
});

useStore.getState().clearTeamStore();

return {
title: makeTitle("Teams"),
view: <Teams teams={data.teams} />,
Expand Down
2 changes: 1 addition & 1 deletion editor.planx.uk/src/routes/team.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const routes = compose(
mount({
"/": route(() => ({
title: makeTitle(useStore.getState().teamName),
view: <Team/>,
view: <Team />,
})),

"/:flow": lazy(async (req) => {
Expand Down
13 changes: 7 additions & 6 deletions editor.planx.uk/src/routes/views/team.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NaviRequest, NotFoundError } from "navi"
import { NaviRequest, NotFoundError } from "navi";
import { useStore } from "pages/FlowEditor/lib/store";
import React from "react";
import { View } from "react-navi"
import { View } from "react-navi";
import { getTeamFromDomain } from "routes/utils";

/**
Expand All @@ -10,7 +10,8 @@ import { getTeamFromDomain } from "routes/utils";
*/
export const teamView = async (req: NaviRequest) => {
const { initTeamStore, teamSlug: currentSlug } = useStore.getState();
const routeSlug = req.params.team || await getTeamFromDomain(window.location.hostname)
const routeSlug =
req.params.team || (await getTeamFromDomain(window.location.hostname));

if (currentSlug !== routeSlug) {
try {
Expand All @@ -19,6 +20,6 @@ export const teamView = async (req: NaviRequest) => {
throw new NotFoundError(`Team not found: ${error}`);
}
}
return <View/>
}

return <View />;
};
Loading