diff options
| author | bob <bcz@cs.brown.edu> | 2020-01-06 11:20:33 -0500 |
|---|---|---|
| committer | bob <bcz@cs.brown.edu> | 2020-01-06 11:20:33 -0500 |
| commit | e506be871621da9bfaea79f121e0a5d7644760f1 (patch) | |
| tree | f925b411796da14026c2f57182218fda86a0dea8 /src/client/views | |
| parent | df12bd5432f24796de25f9aa85e278eae944edf7 (diff) | |
compile fixes and playing with Cors
Diffstat (limited to 'src/client/views')
| -rw-r--r-- | src/client/views/nodes/FormattedTextBox.tsx | 4 | ||||
| -rw-r--r-- | src/client/views/nodes/PDFBox.tsx | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/client/views/nodes/FormattedTextBox.tsx b/src/client/views/nodes/FormattedTextBox.tsx index a08c14436..3d1517d2a 100644 --- a/src/client/views/nodes/FormattedTextBox.tsx +++ b/src/client/views/nodes/FormattedTextBox.tsx @@ -217,7 +217,7 @@ export class FormattedTextBox extends DocAnnotatableComponent<(FieldViewProps & } public highlightSearchTerms = (terms: string[]) => { - if (this._editorView && (this._editorView as any).docView) { + if (this._editorView && (this._editorView as any).docView && terms.some(t => t)) { const mark = this._editorView.state.schema.mark(this._editorView.state.schema.marks.search_highlight); const activeMark = this._editorView.state.schema.mark(this._editorView.state.schema.marks.search_highlight, { selected: true }); const res = terms.filter(t => t).map(term => this.findInNode(this._editorView!, this._editorView!.state.doc, term)); @@ -1060,7 +1060,7 @@ export class FormattedTextBox extends DocAnnotatableComponent<(FieldViewProps & e.preventDefault(); return; } - let state = this._editorView!.state; + const state = this._editorView!.state; if (!state.selection.empty && e.key === "%") { state.schema.EnteringStyle = true; e.preventDefault(); diff --git a/src/client/views/nodes/PDFBox.tsx b/src/client/views/nodes/PDFBox.tsx index 2f1e1832e..8370df6ba 100644 --- a/src/client/views/nodes/PDFBox.tsx +++ b/src/client/views/nodes/PDFBox.tsx @@ -21,6 +21,7 @@ import { pageSchema } from "./ImageBox"; import "./PDFBox.scss"; import React = require("react"); import { documentSchema } from '../../../new_fields/documentSchemas'; +import { url } from 'inspector'; type PdfDocument = makeInterface<[typeof documentSchema, typeof panZoomSchema, typeof pageSchema]>; const PdfDocument = makeInterface(documentSchema, panZoomSchema, pageSchema); @@ -61,7 +62,7 @@ export class PDFBox extends DocAnnotatableComponent<FieldViewProps, PdfDocument> console.log("\nHere's the { url } being fed into the outer regex:"); console.log(href); console.log("And here's the 'properPath' build from the captured filename:\n"); - if (matches !== null) { + if (matches !== null && href.startsWith(window.location.origin)) { const properPath = Utils.prepend(`/files/pdfs/${matches[0]}`); console.log(properPath); if (!properPath.includes(href)) { |
