diff options
author | bobzel <zzzman@gmail.com> | 2021-09-24 01:21:38 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2021-09-24 01:21:38 -0400 |
commit | 643df77e6366b7164307ffe195ed9de83b68e5ae (patch) | |
tree | edf5ce846fbbdb84ccd015b18b07314cb24c76b8 /src/fields/Doc.ts | |
parent | 815899626d82972ae56918487ee3ece11446d5a6 (diff) |
wrapped Color() calls in DashColor() to catch exceptions for color strings no found
Diffstat (limited to 'src/fields/Doc.ts')
-rw-r--r-- | src/fields/Doc.ts | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index 57bd0f46f..d8690831f 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -1,15 +1,17 @@ +import { IconProp } from "@fortawesome/fontawesome-svg-core"; import { saveAs } from "file-saver"; import { action, computed, observable, ObservableMap, runInAction } from "mobx"; import { computedFn } from "mobx-utils"; import { alias, map, serializable } from "serializr"; import { DocServer } from "../client/DocServer"; import { DocumentType } from "../client/documents/DocumentTypes"; +import { CurrentUserUtils } from "../client/util/CurrentUserUtils"; import { LinkManager } from "../client/util/LinkManager"; import { Scripting, scriptingGlobal } from "../client/util/Scripting"; import { SelectionManager } from "../client/util/SelectionManager"; import { afterDocDeserialize, autoObject, Deserializable, SerializationHelper } from "../client/util/SerializationHelper"; import { UndoManager } from "../client/util/UndoManager"; -import { intersectRect, Utils } from "../Utils"; +import { DashColor, intersectRect, Utils } from "../Utils"; import { DateField } from "./DateField"; import { Copy, HandleUpdate, Id, OnUpdate, Parent, Self, SelfProxy, ToScriptString, ToString, Update } from "./FieldSymbols"; import { List } from "./List"; @@ -23,9 +25,6 @@ import { Cast, FieldValue, NumCast, StrCast, ToConstructor } from "./Types"; import { AudioField, ImageField, PdfField, VideoField, WebField } from "./URLField"; import { deleteProperty, GetEffectiveAcl, getField, getter, inheritParentAcls, makeEditable, makeReadOnly, normalizeEmail, setter, SharingPermissions, updateFunction } from "./util"; import JSZip = require("jszip"); -import { CurrentUserUtils } from "../client/util/CurrentUserUtils"; -import { IconProp } from "@fortawesome/fontawesome-svg-core"; -import Color = require("color"); export namespace Field { export function toKeyValueString(doc: Doc, key: string): string { @@ -1089,7 +1088,7 @@ export namespace Doc { export function matchFieldValue(doc: Doc, key: string, value: any): boolean { if (Utils.HasTransparencyFilter(value)) { - const isTransparent = (color: string) => color !== "" && (Color(color).alpha() !== 1); + const isTransparent = (color: string) => color !== "" && (DashColor(color).alpha() !== 1); return isTransparent(StrCast(doc[key])); } if (typeof value === "string") { |