aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/util/DocumentManager.ts2
-rw-r--r--src/client/views/nodes/FormattedTextBox.tsx4
-rw-r--r--src/client/views/nodes/PDFBox.tsx3
-rw-r--r--src/server/server_Initialization.ts8
4 files changed, 12 insertions, 5 deletions
diff --git a/src/client/util/DocumentManager.ts b/src/client/util/DocumentManager.ts
index a318dede8..76c5ee1f5 100644
--- a/src/client/util/DocumentManager.ts
+++ b/src/client/util/DocumentManager.ts
@@ -136,7 +136,7 @@ export class DocumentManager {
const docView = DocumentManager.Instance.getFirstDocumentView(targetDoc);
let annotatedDoc = await Cast(docView?.props.Document.annotationOn, Doc);
if (annotatedDoc) {
- let first = DocumentManager.Instance.getFirstDocumentView(annotatedDoc);
+ const first = DocumentManager.Instance.getFirstDocumentView(annotatedDoc);
if (first) annotatedDoc = first.props.Document;
}
if (docView) { // we have a docView already and aren't forced to create a new one ... just focus on the document. TODO move into view if necessary otherwise just highlight?
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)) {
diff --git a/src/server/server_Initialization.ts b/src/server/server_Initialization.ts
index 4cb1fca47..943988fdf 100644
--- a/src/server/server_Initialization.ts
+++ b/src/server/server_Initialization.ts
@@ -22,6 +22,7 @@ import { publicDirectory } from '.';
import { logPort, } from './ActionUtilities';
import { timeMap } from './ApiManagers/UserManager';
import { blue, yellow } from 'colors';
+var cors = require('cors');
/* RouteSetter is a wrapper around the server that prevents the server
from being exposed. */
@@ -33,7 +34,12 @@ export default async function InitializeServer(routeSetter: RouteSetter) {
app.use(express.static(publicDirectory));
app.use("/images", express.static(publicDirectory));
-
+ const corsOptions = {
+ origin: function (origin: any, callback: any) {
+ callback(null, true);
+ }
+ };
+ app.use(cors(corsOptions));
app.use("*", ({ user, originalUrl }, res, next) => {
if (user && !originalUrl.includes("Heartbeat")) {
const userEmail = (user as any).email;