diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/collections/CollectionSchemaCells.tsx | 4 | ||||
-rw-r--r-- | src/client/views/collections/CollectionSchemaView.scss | 10 | ||||
-rw-r--r-- | src/client/views/collections/SchemaTable.tsx | 6 | ||||
-rw-r--r-- | src/client/views/nodes/formattedText/FormattedTextBox.tsx | 36 | ||||
-rw-r--r-- | src/client/views/pdf/PDFViewer.tsx | 3 | ||||
-rw-r--r-- | src/server/websocket.ts | 10 |
6 files changed, 27 insertions, 42 deletions
diff --git a/src/client/views/collections/CollectionSchemaCells.tsx b/src/client/views/collections/CollectionSchemaCells.tsx index f627faa63..d11d6a5ba 100644 --- a/src/client/views/collections/CollectionSchemaCells.tsx +++ b/src/client/views/collections/CollectionSchemaCells.tsx @@ -902,8 +902,8 @@ export class CollectionSchemaButtons extends CollectionSchemaCell { </button> <button onClick={() => { { - doc.searchMatch2 = false; - setTimeout(() => doc.searchMatch2 = true, 0); + doc.searchMatchAlt = false; + setTimeout(() => doc.searchMatchAlt = true, 0); doc.searchIndex = NumCast(doc.searchIndex); } }} style={{ padding: 2 }}> diff --git a/src/client/views/collections/CollectionSchemaView.scss b/src/client/views/collections/CollectionSchemaView.scss index 897c11dc7..6bf24fe63 100644 --- a/src/client/views/collections/CollectionSchemaView.scss +++ b/src/client/views/collections/CollectionSchemaView.scss @@ -161,16 +161,6 @@ .collectionSchema-col { height: 100%; - - .collectionSchema-apper { - &.col-before { - border-left: 2px solid red; - } - - &.col-after { - border-right: 2px solid red; - } - } } diff --git a/src/client/views/collections/SchemaTable.tsx b/src/client/views/collections/SchemaTable.tsx index 8b7717ad1..83830e111 100644 --- a/src/client/views/collections/SchemaTable.tsx +++ b/src/client/views/collections/SchemaTable.tsx @@ -160,7 +160,7 @@ export class SchemaTable extends React.Component<SchemaTableProps> { const focusedCol = this._focusedCell.col; const isEditable = !this.props.headerIsEditing; - if (this.childDocs.reduce((found, doc) => found || doc.type === "nnnnn", false)) { + if (this.childDocs.reduce((found, doc) => found || doc.type === "x", false)) { columns.push( { expander: true, @@ -334,8 +334,8 @@ export class SchemaTable extends React.Component<SchemaTableProps> { @action nextHighlight2 = (doc: Doc) => { - doc.searchMatch2 = false; - setTimeout(() => doc.searchMatch2 = true, 0); + doc.searchMatchAlt = false; + setTimeout(() => doc.searchMatchAlt = true, 0); doc.searchIndex = NumCast(doc.searchIndex); } diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx index c06e59fe5..c2f9f2030 100644 --- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx +++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx @@ -293,7 +293,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<(FieldViewProp this._editorView.dispatch(tr.addMark(flattened[lastSel].from, flattened[lastSel].to, link)); } } - public highlightSearchTerms = (terms: string[]) => { + public highlightSearchTerms = (terms: string[], alt: boolean) => { 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); @@ -309,24 +309,28 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<(FieldViewProp flattened.forEach((h: TextSelection, ind: number) => tr = tr.addMark(h.from, h.to, ind === lastSel ? activeMark : mark)); this._searchIndex = ++this._searchIndex > flattened.length - 1 ? 0 : this._searchIndex; this._editorView.dispatch(tr.setSelection(new TextSelection(tr.doc.resolve(flattened[lastSel].from), tr.doc.resolve(flattened[lastSel].to))).scrollIntoView()); + if (alt === true) { + if (this._searchIndex > 1) { + this._searchIndex += -2; + } + else if (this._searchIndex === 1) { + this._searchIndex = length - 1; + } + else if (this._searchIndex === 0 && length !== 1) { + this._searchIndex = length - 2; + } - if (this._searchIndex > 1) { - this._searchIndex += -2; - } - else if (this._searchIndex === 1) { - this._searchIndex = length - 1; } - else if (this._searchIndex === 0 && length !== 1) { - this._searchIndex = length - 2; + else { + } const index = this._searchIndex; Doc.GetProto(this.dataDoc).searchIndex = index; - Doc.GetProto(this.dataDoc).length = length; } } - public highlightSearchTerms2 = (terms: string[]) => { + public highlightSearchTermsAlt = (terms: string[]) => { 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); @@ -336,14 +340,16 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<(FieldViewProp let tr = this._editorView.state.tr; const flattened: TextSelection[] = []; res.map(r => r.map(h => flattened.push(h))); + const lastSel = Math.min(flattened.length - 1, this._searchIndex); flattened.forEach((h: TextSelection, ind: number) => tr = tr.addMark(h.from, h.to, ind === lastSel ? activeMark : mark)); this._searchIndex = ++this._searchIndex > flattened.length - 1 ? 0 : this._searchIndex; this._editorView.dispatch(tr.setSelection(new TextSelection(tr.doc.resolve(flattened[lastSel].from), tr.doc.resolve(flattened[lastSel].to))).scrollIntoView()); + + const index = this._searchIndex; Doc.GetProto(this.dataDoc).searchIndex = index; - Doc.GetProto(this.dataDoc).length = length; } } @@ -780,11 +786,11 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<(FieldViewProp this.setupEditor(this.config, this.props.fieldKey); - this._disposers.search = reaction(() => this.rootDoc.searchMatch2, - search => search ? this.highlightSearchTerms2([Doc.SearchQuery()]) : this.unhighlightSearchTerms(), + this._disposers.searchAlt = reaction(() => this.rootDoc.searchMatchAlt, + search => search ? this.highlightSearchTerms([Doc.SearchQuery()], false) : this.unhighlightSearchTerms(), { fireImmediately: true }); - this._disposers.search2 = reaction(() => this.rootDoc.searchMatch, - search => search ? this.highlightSearchTerms([Doc.SearchQuery()]) : this.unhighlightSearchTerms(), + this._disposers.search = reaction(() => this.rootDoc.searchMatch, + search => search ? this.highlightSearchTerms([Doc.SearchQuery()], true) : this.unhighlightSearchTerms(), { fireImmediately: this.rootDoc.searchMatch ? true : false }); this._disposers.record = reaction(() => this._recording, diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx index 7f31931a9..264d3e6c6 100644 --- a/src/client/views/pdf/PDFViewer.tsx +++ b/src/client/views/pdf/PDFViewer.tsx @@ -338,7 +338,6 @@ export class PDFViewer extends ViewBoxAnnotatableComponent<IViewerProps, PdfDocu this.Index = Math.min(this.Index + 1, this.allAnnotations.length - 1); this.scrollToAnnotation(this.allAnnotations.sort((a, b) => NumCast(a.y) - NumCast(b.y))[this.Index]); this.Document.searchIndex = this.Index; - this.Document.length = this.allAnnotations.length; } @@ -408,7 +407,6 @@ export class PDFViewer extends ViewBoxAnnotatableComponent<IViewerProps, PdfDocu query: searchString }); this.Document.searchIndex = this.Index; - this.Document.length = this.allAnnotations.length; } else if (this._mainCont.current) { const executeFind = () => { @@ -423,7 +421,6 @@ export class PDFViewer extends ViewBoxAnnotatableComponent<IViewerProps, PdfDocu this._mainCont.current.addEventListener("pagesloaded", executeFind); this._mainCont.current.addEventListener("pagerendered", executeFind); this.Document.searchIndex = this.Index; - this.Document.length = this.allAnnotations.length; } } diff --git a/src/server/websocket.ts b/src/server/websocket.ts index 24371a997..63cfa41f0 100644 --- a/src/server/websocket.ts +++ b/src/server/websocket.ts @@ -287,18 +287,10 @@ export namespace WebSocket { dynfield = true; const val = docfield[key]; key = key.substring(7); - if (key === "_height") { - Object.values(suffixMap).forEach(suf => { update[key] = { set: null }; }); - } - else { - Object.values(suffixMap).forEach(suf => { update[key + getSuffix(suf)] = { set: null }; }); - } + Object.values(suffixMap).forEach(suf => { update[key + getSuffix(suf)] = { set: null }; }); const term = ToSearchTerm(val); if (term !== undefined) { const { suffix, value } = term; - if (key === "_height") { - update[key] = { set: value }; - } update[key + suffix] = { set: value }; } } |