aboutsummaryrefslogtreecommitdiff
path: root/src/client/util
diff options
context:
space:
mode:
authorab <abdullah_ahmed@brown.edu>2019-07-05 13:45:21 -0400
committerab <abdullah_ahmed@brown.edu>2019-07-05 13:45:21 -0400
commit27a2711343135f8d5b784bf446941a377a533488 (patch)
treedbb661df0c5c6af0323b64ad90ba3297b56c2946 /src/client/util
parenta223d6a4283c976ad3c5a2fd97df5a6bb0542722 (diff)
unhigh
Diffstat (limited to 'src/client/util')
-rw-r--r--src/client/util/TooltipTextMenu.scss8
-rw-r--r--src/client/util/TooltipTextMenu.tsx37
2 files changed, 7 insertions, 38 deletions
diff --git a/src/client/util/TooltipTextMenu.scss b/src/client/util/TooltipTextMenu.scss
index 6e6818636..38870a1ce 100644
--- a/src/client/util/TooltipTextMenu.scss
+++ b/src/client/util/TooltipTextMenu.scss
@@ -18,7 +18,8 @@
.ProseMirror-menuitem {
margin-right: 3px;
display: inline-block;
- z-index: 100000;
+ z-index: 50000;
+ position: relative;
}
.ProseMirror-menuseparator {
@@ -67,7 +68,7 @@
}
.ProseMirror-menu-dropdown-menu {
- z-index: 100000;
+ z-index: 50000;
min-width: 6em;
background: white;
position: absolute;
@@ -236,7 +237,7 @@
.tooltipMenu {
position: absolute;
- z-index: 2000;
+ z-index: 20000;
background: #121721;
border: 1px solid silver;
border-radius: 15px;
@@ -298,6 +299,7 @@
cursor: pointer;
text-align: center;
min-width: 10px;
+
}
.strong, .heading { font-weight: bold; }
.em { font-style: italic; }
diff --git a/src/client/util/TooltipTextMenu.tsx b/src/client/util/TooltipTextMenu.tsx
index 36be0398c..42d72e441 100644
--- a/src/client/util/TooltipTextMenu.tsx
+++ b/src/client/util/TooltipTextMenu.tsx
@@ -18,7 +18,7 @@ import { DocServer } from "../DocServer";
import { CollectionDockingView } from "../views/collections/CollectionDockingView";
import { DocumentManager } from "./DocumentManager";
import { Id } from "../../new_fields/FieldSymbols";
-import { FormattedTextBoxProps } from "../views/nodes/FormattedTextBox";
+import { FormattedTextBoxProps, FormattedTextBox } from "../views/nodes/FormattedTextBox";
//appears above a selection of text in a RichTextBox to give user options such as Bold, Italics, etc.
export class TooltipTextMenu {
@@ -197,7 +197,6 @@ export class TooltipTextMenu {
// set the element's new position:
elmnt.style.top = (elmnt.offsetTop - pos2) + "px";
elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
- self.highlightSearchTerms(["hello", "there"]);
}
function closeDragElement() {
@@ -205,7 +204,7 @@ export class TooltipTextMenu {
document.onmouseup = null;
document.onmousemove = null;
//self.highlightSearchTerms(self.state, ["hello"]);
- self.unhighlightSearchTerms();
+ FormattedTextBox.Instance.unhighlightSearchTerms();
}
}
@@ -596,38 +595,6 @@ export class TooltipTextMenu {
return found;
}
- public highlightSearchTerms = (terms: String[]) => {
- const doc = this.view.state.doc;
- const mark = this.view.state.schema.mark(this.view.state.schema.marks.search_highlight);
- doc.nodesBetween(0, doc.content.size, (node: ProsNode, pos: number, parent: ProsNode, index: number) => {
- if (node.isLeaf && node.isText && node.text) {
- let nodeText: String = node.text;
- let tokens = nodeText.split(" ");
- let start = pos;
- tokens.forEach((word) => {
- if (terms.includes(word)) {
- this.view.dispatch(this.view.state.tr.addMark(start, start + word.length, mark).removeStoredMark(mark));
- }
- else {
- start += word.length + 1;
- }
- });
- }
- });
- }
-
- public unhighlightSearchTerms = () => {
- const doc = this.view.state.doc;
- const mark = this.view.state.schema.mark(this.view.state.schema.marks.search_highlight);
- doc.nodesBetween(0, doc.content.size, (node: ProsNode, pos: number, parent: ProsNode, index: number) => {
- if (node.isLeaf && node.isText && node.text) {
- if (node.marks.includes(mark)) {
- this.view.dispatch(this.view.state.tr.removeMark(pos, pos + node.nodeSize, mark));
- }
- }
- });
- }
-
//updates the tooltip menu when the selection changes
update(view: EditorView, lastState: EditorState | undefined) {
let state = view.state;