From 111a4775788a52b218d5dbb49ef8c2d83d90ff3e Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Tue, 1 Oct 2024 04:17:34 -0400 Subject: added dompurify --- package-lock.json | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'package-lock.json') diff --git a/package-lock.json b/package-lock.json index a47585c74..0bf5df2d5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -94,6 +94,7 @@ "D": "^1.0.0", "d3": "^7.8.5", "depcheck": "^1.4.7", + "dompurify": "^3.1.7", "dotenv": "^16.4.5", "eslint-webpack-plugin": "^4.1.0", "exif": "^0.6.0", @@ -265,6 +266,7 @@ "@types/cookie-session": "^2.0.48", "@types/d3": "^7.4.3", "@types/dom-mediacapture-record": "^1.0.19", + "@types/dompurify": "^3.0.5", "@types/exif": "^0.6.5", "@types/express": "^5.0.0", "@types/express-session": "^1.17.10", @@ -9253,6 +9255,15 @@ "resolved": "https://registry.npmjs.org/@types/dom-speech-recognition/-/dom-speech-recognition-0.0.4.tgz", "integrity": "sha512-zf2GwV/G6TdaLwpLDcGTIkHnXf8JEf/viMux+khqKQKDa8/8BAUtXXZS563GnvJ4Fg0PBLGAaFf2GekEVSZ6GQ==" }, + "node_modules/@types/dompurify": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/dompurify/-/dompurify-3.0.5.tgz", + "integrity": "sha512-1Wg0g3BtQF7sSb27fJQAKck1HECM6zV1EB66j8JH9i3LCjYabJa0FSdiSgsD5K/RbrsR0SiraKacLB+T8ZVYAg==", + "dev": true, + "dependencies": { + "@types/trusted-types": "*" + } + }, "node_modules/@types/eslint": { "version": "8.56.12", "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.12.tgz", @@ -9925,6 +9936,12 @@ "integrity": "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==", "dev": true }, + "node_modules/@types/trusted-types": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", + "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==", + "dev": true + }, "node_modules/@types/unist": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", -- cgit v1.2.3-70-g09d2 From 6ae5bd63d5355a03dba099a149532e7c6b1fd74a Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Wed, 9 Oct 2024 16:58:33 -0400 Subject: small changes for pull request; removed schema type reference in editableview; a couple lint changes --- package-lock.json | 6 +++--- src/client/views/EditableView.tsx | 7 ++++--- .../collectionFreeForm/CollectionFreeFormView.tsx | 2 +- .../collections/collectionSchema/SchemaCellField.tsx | 4 ++-- .../collectionSchema/SchemaColumnHeader.tsx | 3 ++- src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx | 2 +- src/client/views/nodes/ImageBox.tsx | 18 +++++++++--------- 7 files changed, 22 insertions(+), 20 deletions(-) (limited to 'package-lock.json') diff --git a/package-lock.json b/package-lock.json index 3b1ea2017..c49821f9d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17447,9 +17447,9 @@ } }, "node_modules/dompurify": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.1.6.tgz", - "integrity": "sha512-cTOAhc36AalkjtBpfG6O8JimdTMWNXjiePT2xQH/ppBGi/4uIpmj8eKyIkMJErXWARyINV/sB38yf8JCLF5pbQ==" + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.1.7.tgz", + "integrity": "sha512-VaTstWtsneJY8xzy7DekmYWEOZcmzIe3Qb3zPd4STve1OBTa+e+WmS1ITQec1fZYXI3HCsOZZiSMpG6oxoWMWQ==" }, "node_modules/domutils": { "version": "3.1.0", diff --git a/src/client/views/EditableView.tsx b/src/client/views/EditableView.tsx index 9722b2d4b..9974fc63b 100644 --- a/src/client/views/EditableView.tsx +++ b/src/client/views/EditableView.tsx @@ -54,7 +54,8 @@ export interface EditableProps { placeholder?: string; wrap?: string; // nowrap, pre-wrap, etc - schemaFieldType?: SchemaFieldType; + inputString?: boolean; + inputStringPlaceholder?: string; prohibitedText?: Array; onClick?: () => void; updateAlt?: (newAlt: string) => void; @@ -290,10 +291,10 @@ export class EditableView extends ObservableReactComponent { staticDisplay = () => { let toDisplay; const gval = this._props.GetValue()?.replace(/\n/g, '\\r\\n'); - if (this._props.schemaFieldType === SchemaFieldType.Header){ + if (this._props.inputString){ toDisplay = { + createDrawingDoc = (strokeData: [InkData, string, string][], opts: DrawingOptions) => { this._drawing = []; const xf = this.screenToFreeformContentsXf; strokeData.forEach((stroke: [InkData, string, string]) => { diff --git a/src/client/views/collections/collectionSchema/SchemaCellField.tsx b/src/client/views/collections/collectionSchema/SchemaCellField.tsx index 84e7b62bf..dab494c0e 100644 --- a/src/client/views/collections/collectionSchema/SchemaCellField.tsx +++ b/src/client/views/collections/collectionSchema/SchemaCellField.tsx @@ -5,7 +5,7 @@ import { OverlayView } from '../../OverlayView'; import { DocumentIconContainer } from '../../nodes/DocumentIcon'; import React, { FormEvent } from 'react'; import { FieldView, FieldViewProps } from '../../nodes/FieldView'; -import { ObjectField } from '../../../../fields/ObjectField'; +import { FieldType, ObjectField } from '../../../../fields/ObjectField'; import { Doc } from '../../../../fields/Doc'; import { DocumentView } from '../../nodes/DocumentView'; import DOMPurify from 'dompurify'; @@ -21,7 +21,7 @@ import DOMPurify from 'dompurify'; */ export interface SchemaCellFieldProps { - contents: any; + contents: FieldType; fieldContents?: FieldViewProps; editing?: boolean; oneLine?: boolean; diff --git a/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx b/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx index c5cdac8af..207e1deac 100644 --- a/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx +++ b/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx @@ -135,7 +135,8 @@ export class SchemaColumnHeader extends ObservableReactComponent { if (SchemaColumnHeader.isDefaultField(this.fieldKey)) return ''; else if (this._altTitle) return this._altTitle; diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx b/src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx index 44f743a97..ad47b7848 100644 --- a/src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx +++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx @@ -943,7 +943,7 @@ export class DocCreatorMenu extends ObservableReactComponent { removeDocument={returnFalse} PanelWidth={() => this._menuDimensions.width - 10} PanelHeight={() => this._menuDimensions.height - 60} - ScreenToLocalTransform={Transform.Identity} + ScreenToLocalTransform={() => new Transform(-this._pageX,-this._pageY, 1)} renderDepth={5} whenChildContentsActiveChanged={emptyFunction} focus={emptyFunction} diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx index 226fad977..c156c80e4 100644 --- a/src/client/views/nodes/ImageBox.tsx +++ b/src/client/views/nodes/ImageBox.tsx @@ -124,15 +124,15 @@ export class ImageBox extends ViewBoxAnnotatableComponent() { { fireImmediately: true, delay: 1000 } ); const { layoutDoc } = this; - // this._disposers.path = reaction( - // () => ({ nativeSize: this.nativeSize, width: NumCast(this.layoutDoc._width) }), - // ({ nativeSize, width }) => { - // if (layoutDoc === this.layoutDoc || !this.layoutDoc._height) { - // this.layoutDoc._height = (width * nativeSize.nativeHeight) / nativeSize.nativeWidth; - // } - // }, - // { fireImmediately: true } - // ); + this._disposers.path = reaction( + () => ({ nativeSize: this.nativeSize, width: NumCast(this.layoutDoc._width) }), + ({ nativeSize, width }) => { + if (layoutDoc === this.layoutDoc || !this.layoutDoc._height) { + this.layoutDoc._height = (width * nativeSize.nativeHeight) / nativeSize.nativeWidth; + } + }, + { fireImmediately: true } + ); this._disposers.scroll = reaction( () => this.layoutDoc.layout_scrollTop, sTop => { -- cgit v1.2.3-70-g09d2