From e506be871621da9bfaea79f121e0a5d7644760f1 Mon Sep 17 00:00:00 2001 From: bob Date: Mon, 6 Jan 2020 11:20:33 -0500 Subject: compile fixes and playing with Cors --- src/client/views/nodes/FormattedTextBox.tsx | 4 ++-- src/client/views/nodes/PDFBox.tsx | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/client/views') 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 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)) { -- cgit v1.2.3-70-g09d2