aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-08-19 22:39:51 -0400
committerbobzel <zzzman@gmail.com>2020-08-19 22:39:51 -0400
commitda8901bef2d4a0362354c69fe486076a67f8efc4 (patch)
tree35825255e04ba892b570a614a6d4449d8d87d659 /src
parent5b7d51d47a967e679d17560771efe71522ada13a (diff)
cleaning lint errors
Diffstat (limited to 'src')
-rw-r--r--src/client/views/PropertiesButtons.tsx2
-rw-r--r--src/client/views/collections/CollectionMenu.tsx12
-rw-r--r--src/client/views/collections/CollectionSchemaCells.tsx11
-rw-r--r--src/client/views/collections/CollectionSchemaHeaders.tsx2
-rw-r--r--src/client/views/collections/SchemaTable.tsx2
-rw-r--r--src/client/views/nodes/DocumentView.tsx2
-rw-r--r--src/client/views/nodes/PresBox.tsx2
-rw-r--r--src/client/views/nodes/formattedText/FormattedTextBox.tsx10
-rw-r--r--src/fields/Doc.ts10
9 files changed, 24 insertions, 29 deletions
diff --git a/src/client/views/PropertiesButtons.tsx b/src/client/views/PropertiesButtons.tsx
index e352db562..9e776c652 100644
--- a/src/client/views/PropertiesButtons.tsx
+++ b/src/client/views/PropertiesButtons.tsx
@@ -301,7 +301,7 @@ export class PropertiesButtons extends React.Component<{}, {}> {
const dragData = new DragManager.DocumentDragData([this.selectedDoc]);
const [left, top] = [e.clientX, e.clientY];
dragData.dropAction = "alias";
- DragManager.StartDocumentDrag([this._dragRef.current!], dragData, left, top, {
+ DragManager.StartDocumentDrag([this._dragRef.current], dragData, left, top, {
offsetX: dragData.offset[0],
offsetY: dragData.offset[1],
hideSource: false
diff --git a/src/client/views/collections/CollectionMenu.tsx b/src/client/views/collections/CollectionMenu.tsx
index cf053e1ca..388eda2b3 100644
--- a/src/client/views/collections/CollectionMenu.tsx
+++ b/src/client/views/collections/CollectionMenu.tsx
@@ -624,10 +624,10 @@ export class CollectionFreeFormViewChrome extends React.Component<CollectionMenu
}
@computed get _url() {
- return this.selectedDoc ? Cast(this.selectedDoc["data"], WebField, null)?.url.toString() : "hello";
+ return this.selectedDoc ? Cast(this.selectedDoc.data, WebField, null)?.url.toString() : "hello";
}
- set _url(value) { this.selectedDoc && (this.selectedDoc["data"] = value); }
+ set _url(value) { this.selectedDoc && (this.selectedDoc.data = value); }
@action
submitURL = () => {
@@ -637,7 +637,7 @@ export class CollectionFreeFormViewChrome extends React.Component<CollectionMenu
const future = this.selectedDoc ? Cast(this.selectedDoc["data-future"], listSpec("string"), null) : null;
const history = this.selectedDoc ? Cast(this.selectedDoc["data-history"], listSpec("string"), null) : [];
const annos = this.selectedDoc ? DocListCast(this.selectedDoc["data-annotations"]) : undefined;
- const url = this.selectedDoc ? Cast(this.selectedDoc["data"], WebField, null)?.url.toString() : null;
+ const url = this.selectedDoc ? Cast(this.selectedDoc.data, WebField, null)?.url.toString() : null;
if (url) {
if (history === undefined) {
this.selectedDoc && (this.selectedDoc["data-history"] = new List<string>([url]));
@@ -648,7 +648,7 @@ export class CollectionFreeFormViewChrome extends React.Component<CollectionMenu
future && (future.length = 0);
this.selectedDoc && (this.selectedDoc["data-" + this.urlHash(url)] = new List<Doc>(annos));
}
- this.selectedDoc && (this.selectedDoc["data"] = new WebField(URLy));
+ this.selectedDoc && (this.selectedDoc.data = new WebField(URLy));
this.selectedDoc && (this.selectedDoc["data-annotations"] = new List<Doc>([]));
} catch (e) {
console.log("WebBox URL error:" + this._url);
@@ -682,7 +682,7 @@ export class CollectionFreeFormViewChrome extends React.Component<CollectionMenu
if (future?.length) {
history?.push(this._url);
this.selectedDoc && (this.selectedDoc["data-annotations-" + this.urlHash(this._url)] = new List<Doc>(DocListCast(this.selectedDoc["data-annotations"])));
- this.selectedDoc && (this.selectedDoc["data"] = new WebField(new URL(this._url = future.pop()!)));
+ this.selectedDoc && (this.selectedDoc.data = new WebField(new URL(this._url = future.pop()!)));
this.selectedDoc && (this.selectedDoc["data-annotations"] = new List<Doc>(DocListCast(this.selectedDoc["data-annotations" + "-" + this.urlHash(this._url)])));
}
}
@@ -695,7 +695,7 @@ export class CollectionFreeFormViewChrome extends React.Component<CollectionMenu
if (future === undefined) this.selectedDoc && (this.selectedDoc["data-future"] = new List<string>([this._url]));
else future.push(this._url);
this.selectedDoc && (this.selectedDoc["data-annotations" + "-" + this.urlHash(this._url)] = new List<Doc>(DocListCast(this.selectedDoc["data-annotations"])));
- this.selectedDoc && (this.selectedDoc["data"] = new WebField(new URL(this._url = history.pop()!)));
+ this.selectedDoc && (this.selectedDoc.data = new WebField(new URL(this._url = history.pop()!)));
this.selectedDoc && (this.selectedDoc["data-annotations"] = new List<Doc>(DocListCast(this.selectedDoc["data-annotations" + "-" + this.urlHash(this._url)])));
}
}
diff --git a/src/client/views/collections/CollectionSchemaCells.tsx b/src/client/views/collections/CollectionSchemaCells.tsx
index 626ddf288..ea786800c 100644
--- a/src/client/views/collections/CollectionSchemaCells.tsx
+++ b/src/client/views/collections/CollectionSchemaCells.tsx
@@ -779,16 +779,9 @@ export class CollectionSchemaListCell extends CollectionSchemaCell {
@observable private _selectedNum = 0;
@action
- toggleOpened(open: boolean) {
- this._opened = open;
- }
-
- @action
onSetValue = (value: string) => {
- this._text = value;
-
// change if its a document
- this._optionsList[this._selectedNum] = this._text;
+ this._optionsList[this._selectedNum] = this._text = value;
(this.prop.Document[this.prop.fieldKey] as List<any>).splice(this._selectedNum, 1, value);
}
@@ -854,7 +847,7 @@ export class CollectionSchemaListCell extends CollectionSchemaCell {
<div className="collectionSchemaView-cellContents" key={this._document[Id]} ref={reference}>
<div className="collectionSchemaView-dropDownWrapper">
<button type="button" className="collectionSchemaView-dropdownButton" style={{ right: "length", position: "relative" }}
- onClick={e => this.toggleOpened(!this._opened)} >
+ onClick={action(e => this._opened = !this._opened)} >
<FontAwesomeIcon icon={this._opened ? "caret-up" : "caret-down"} size="lg" />
</button>
<div className="collectionSchemaView-dropdownText"> {link ? plainText : textarea} </div>
diff --git a/src/client/views/collections/CollectionSchemaHeaders.tsx b/src/client/views/collections/CollectionSchemaHeaders.tsx
index 73f319e9b..34a8bfa24 100644
--- a/src/client/views/collections/CollectionSchemaHeaders.tsx
+++ b/src/client/views/collections/CollectionSchemaHeaders.tsx
@@ -275,7 +275,7 @@ export class KeysDropdown extends React.Component<KeysDropdownProps> {
document.removeEventListener("pointerdown", this.detectClick);
const filters = Cast(this.props.Document._docFilters, listSpec("string"));
if (filters?.includes(this._key)) {
- runInAction(() => { this.closeResultsVisibility = "contents" });
+ runInAction(() => this.closeResultsVisibility = "contents");
}
}
diff --git a/src/client/views/collections/SchemaTable.tsx b/src/client/views/collections/SchemaTable.tsx
index 489c5e540..6ec9783e2 100644
--- a/src/client/views/collections/SchemaTable.tsx
+++ b/src/client/views/collections/SchemaTable.tsx
@@ -415,7 +415,7 @@ export class SchemaTable extends React.Component<SchemaTableProps> {
createRow = action(() => {
this.props.addDocument(Docs.Create.TextDocument("", { title: "", _width: 100, _height: 30 }));
this._focusedCell = { row: this.childDocs.length, col: this._focusedCell.col };
- })
+ });
@undoBatch
@action
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 7cf6b0f39..590befd86 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -713,7 +713,7 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
}
const cm = ContextMenu.Instance;
- if (!cm || ((e as any)?.nativeEvent as any)?.SchemaHandled) return;
+ if (!cm || (e?.nativeEvent as any)?.SchemaHandled) return;
const customScripts = Cast(this.props.Document.contextMenuScripts, listSpec(ScriptField), []);
Cast(this.props.Document.contextMenuLabels, listSpec("string"), []).forEach((label, i) =>
diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx
index f39413e9f..d30ea03b1 100644
--- a/src/client/views/nodes/PresBox.tsx
+++ b/src/client/views/nodes/PresBox.tsx
@@ -1061,7 +1061,7 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps, PresBoxSchema>
DockedFrameRenderer.PinDoc(doc, false);
this.gotoDocument(this.childDocs.length, this.itemIndex);
} else {
- this.props.addDocTab(doc as Doc, "onRight");
+ this.props.addDocTab(doc, "onRight");
}
}
}
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
index d58d75226..6b4115e53 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -510,10 +510,12 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<(FieldViewProp
let index = 0, foundAt;
const ep = this.getNodeEndpoints(pm.state.doc, node);
const regexp = find.replace("*", "");
- if (regexp) while (ep && (foundAt = node.textContent.slice(index).search(regexp, "i")) > -1) {
- const sel = new TextSelection(pm.state.doc.resolve(ep.from + index + foundAt + 1), pm.state.doc.resolve(ep.from + index + foundAt + find.length + 1));
- ret.push(sel);
- index = index + foundAt + find.length;
+ if (regexp) {
+ while (ep && (foundAt = node.textContent.slice(index).search(regexp)) > -1) {
+ const sel = new TextSelection(pm.state.doc.resolve(ep.from + index + foundAt + 1), pm.state.doc.resolve(ep.from + index + foundAt + find.length + 1));
+ ret.push(sel);
+ index = index + foundAt + find.length;
+ }
}
} else {
node.content.forEach((child, i) => ret = ret.concat(this.findInNode(pm, child, find)));
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts
index 4797fb4cb..3fdeb8e71 100644
--- a/src/fields/Doc.ts
+++ b/src/fields/Doc.ts
@@ -206,11 +206,11 @@ export class Doc extends RefField {
private [Self] = this;
private [SelfProxy]: any;
- public [FieldsSym] = (clear?: boolean) => { return clear ? this.___fields = this.___fieldKeys = {} : this.___fields; }
- public [WidthSym] = () => { return NumCast(this[SelfProxy]._width); }
- public [HeightSym] = () => { return NumCast(this[SelfProxy]._height); }
- public [ToScriptString] = () => { return `DOC-"${this[Self][Id]}"-`; }
- public [ToString] = () => { return `Doc(${GetEffectiveAcl(this) === AclPrivate ? "-inaccessible-" : this.title})`; }
+ public [FieldsSym] = (clear?: boolean) => clear ? this.___fields = this.___fieldKeys = {} : this.___fields;
+ public [WidthSym] = () => NumCast(this[SelfProxy]._width);
+ public [HeightSym] = () => NumCast(this[SelfProxy]._height);
+ public [ToScriptString] = () => `DOC-"${this[Self][Id]}"-`;
+ public [ToString] = () => `Doc(${GetEffectiveAcl(this) === AclPrivate ? "-inaccessible-" : this.title})`;
public get [LayoutSym]() { return this[SelfProxy].__LAYOUT__; }
public get [DataSym]() {
const self = this[SelfProxy];