Skip to content

Commit d213da9

Browse files
committed
npm: update react types and cheerio – ported over from #7768
1 parent 0ec2a12 commit d213da9

File tree

11 files changed

+244
-137
lines changed

11 files changed

+244
-137
lines changed

src/packages/frontend/editors/slate/elements/details/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
*/
55

66
import { CSSProperties } from "react";
7+
import { load } from "cheerio";
8+
79
import { register, SlateElement } from "../register";
810
import { dict } from "@cocalc/util/misc";
9-
import $ from "cheerio";
1011

1112
export const STYLE = {
1213
cursor: "pointer",
@@ -42,6 +43,7 @@ register({
4243

4344
toSlate: ({ children, state, token }) => {
4445
const attrs = dict(state.attrs as any);
46+
const $ = load("");
4547
const x = $(token.content);
4648
const summary = x.find("summary").text().trim();
4749
return {

src/packages/frontend/editors/slate/elements/image/index.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
* License: MS-RSL – see LICENSE.md for details
44
*/
55

6-
import { register, SlateElement } from "../register";
7-
import { dict } from "@cocalc/util/misc";
8-
import $ from "cheerio";
6+
import { load } from "cheerio";
7+
98
import { useFileContext } from "@cocalc/frontend/lib/file-context";
9+
import { dict } from "@cocalc/util/misc";
10+
import { register, SlateElement } from "../register";
1011

1112
export interface Image extends SlateElement {
1213
type: "image";
@@ -28,6 +29,7 @@ export function toSlate({ type, children, token }) {
2829
// token.content will be a string like this:
2930
// <img src='https://wstein.org/bella-and-william.jpg' width=200px title='my pup' />
3031
// easiest way to parse this is with jquery style api but via cheerio (not by hand).
32+
const $ = load("");
3133
const elt = $(token.content);
3234
const node = {
3335
type: "image",

src/packages/frontend/editors/slate/markdown-to-slate/util.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import $ from "cheerio";
1+
import { load } from "cheerio";
22

33
export function getAttrs(content: string, attrs: string[]): [string, string][] {
4+
const $ = load("");
45
const x = $(content);
56
const v: [string, string][] = [];
67
for (const attr of attrs) {

src/packages/frontend/misc/process-links/string.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ share server.
1414
TODO: this is NOT used anywhere yet.
1515
*/
1616

17-
import $ from "cheerio";
17+
import { load } from "cheerio";
18+
1819
import processLinks from "./generic";
1920

2021
interface Options {
@@ -25,8 +26,9 @@ interface Options {
2526

2627
export default function processLinksString(
2728
html: string,
28-
opts: Options
29+
opts: Options,
2930
): string {
31+
const $ = load("");
3032
const elt = $(`<div>${html}</div>`);
3133
processLinks(elt, { ...opts, $ });
3234
return elt.html() ?? "";

src/packages/frontend/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"bootstrap": "=3.4.1",
7474
"bootstrap-colorpicker": "^2.5.3",
7575
"cat-names": "^3.1.0",
76-
"cheerio": "^1.0.0-rc.10",
76+
"cheerio": "1.0.0-rc.10",
7777
"codemirror": "^5.65.16",
7878
"color-map": "^2.0.6",
7979
"copy-to-clipboard": "^3.0.8",
@@ -185,9 +185,9 @@
185185
"@types/md5": "^2.2.0",
186186
"@types/mocha": "^10.0.0",
187187
"@types/pica": "^5.1.3",
188-
"@types/react": "^18.0.26",
188+
"@types/react": "^18.0.28",
189189
"@types/react-bootstrap": "^0.32.21",
190-
"@types/react-dom": "^18.0.10",
190+
"@types/react-dom": "^18.0.11",
191191
"@types/react-image-crop": "^8.1.3",
192192
"@types/react-redux": "^7.1.25",
193193
"coffeescript": "^2.5.1",

src/packages/hub/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"@types/express": "^4.17.13",
2424
"@types/formidable": "^3.4.5",
2525
"@types/primus": "^7.3.6",
26-
"@types/react": "^18.0.26",
26+
"@types/react": "^18.0.28",
2727
"@types/uuid": "^8.3.1",
2828
"async": "^1.5.2",
2929
"awaiting": "^3.0.0",
@@ -77,7 +77,7 @@
7777
"@types/http-proxy": "^1.17.9",
7878
"@types/node": "^18.16.14",
7979
"@types/passport": "^1.0.9",
80-
"@types/react-dom": "^18.0.10",
80+
"@types/react-dom": "^18.0.11",
8181
"coffee-coverage": "^3.0.1",
8282
"coffeescript": "^2.5.1",
8383
"expect": "^26.6.2",

src/packages/next/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@
6363
"@cocalc/util": "workspace:*",
6464
"@openapitools/openapi-generator-cli": "^2.13.4",
6565
"@types/express": "^4.17.13",
66-
"@types/react": "^18.0.26",
67-
"@types/react-dom": "^18.0.10",
66+
"@types/react": "^18.0.28",
67+
"@types/react-dom": "^18.0.11",
6868
"@vscode/vscode-languagedetection": "^1.0.22",
6969
"antd": "^5.18.3",
7070
"antd-img-crop": "^4.21.0",

0 commit comments

Comments
 (0)