aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/util/RichTextSchema.tsx18
-rw-r--r--src/client/util/TooltipTextMenu.scss8
-rw-r--r--src/client/util/TooltipTextMenu.tsx6
3 files changed, 21 insertions, 11 deletions
diff --git a/src/client/util/RichTextSchema.tsx b/src/client/util/RichTextSchema.tsx
index c0225f1f9..789f3e0cf 100644
--- a/src/client/util/RichTextSchema.tsx
+++ b/src/client/util/RichTextSchema.tsx
@@ -5,6 +5,7 @@ import { redo, undo } from 'prosemirror-history';
import { orderedList, bulletList, listItem, } from 'prosemirror-schema-list';
import { EditorState, Transaction, NodeSelection, TextSelection, Selection, } from "prosemirror-state";
import { EditorView, } from "prosemirror-view";
+import { View } from '@react-pdf/renderer';
const pDOM: DOMOutputSpecArray = ["p", 0], blockquoteDOM: DOMOutputSpecArray = ["blockquote", 0], hrDOM: DOMOutputSpecArray = ["hr"],
preDOM: DOMOutputSpecArray = ["pre", ["code", 0]], brDOM: DOMOutputSpecArray = ["br"], ulDOM: DOMOutputSpecArray = ["ul", 0];
@@ -254,11 +255,11 @@ export const marks: { [index: string]: MarkSpec } = {
toDOM: () => ['sup']
},
- collapse: {
- parseDOM: [{ style: 'color: blue' }],
+ highlight: {
+ parseDOM: [{ style: 'background: #9aa8a4' }],
toDOM() {
return ['span', {
- style: 'color: blue'
+ style: 'background: #9aa8a4'
}];
}
},
@@ -453,6 +454,7 @@ export class ImageResizeView {
export class SummarizedView {
// TODO: highlight text that is summarized. to find end of region, walk along mark
_collapsed: HTMLElement;
+ _view: any;
constructor(node: any, view: any, getPos: any) {
this._collapsed = document.createElement("span");
this._collapsed.textContent = "㊉";
@@ -462,6 +464,7 @@ export class SummarizedView {
this._collapsed.style.width = "40px";
this._collapsed.style.height = "20px";
let self = this;
+ this._view = view;
this._collapsed.onpointerdown = function (e: any) {
console.log("star pressed!");
if (node.attrs.visibility) {
@@ -471,17 +474,19 @@ export class SummarizedView {
view.dispatch(view.state.tr.setSelection(TextSelection.create(view.state.doc, y + 1, y + 1 + node.attrs.oldtextlen)));
view.dispatch(view.state.tr.deleteSelection(view.state, () => { }));
self._collapsed.textContent = "㊉";
+ self.updateSummarizedText();
} else {
node.attrs.visibility = !node.attrs.visibility;
console.log("content is invisible");
let y = getPos();
console.log(y);
- let mark = view.state.schema.mark(view.state.schema.marks.underline);
+ let mark = view.state.schema.mark(view.state.schema.marks.highlight);
console.log("PASTING " + node.attrs.oldtext.toString());
view.dispatch(view.state.tr.setSelection(TextSelection.create(view.state.doc, y + 1, y + 1)));
const from = view.state.selection.from;
view.dispatch(view.state.tr.replaceSelection(node.attrs.oldtext).addMark(from, from + node.attrs.oldtextlen, mark));
//view.dispatch(view.state.tr.setSelection(view.state.doc, from + node.attrs.oldtextlen + 1, from + node.attrs.oldtextlen + 1));
+ view.dispatch(view.state.tr.removeStoredMark(mark));
self._collapsed.textContent = "㊀";
}
e.preventDefault();
@@ -493,6 +498,11 @@ export class SummarizedView {
selectNode() {
}
+ updateSummarizedText(mark?: any) {
+ console.log(this._view.state.doc.marks);
+ console.log(this._view.state.doc.childCount);
+ }
+
deselectNode() {
}
}
diff --git a/src/client/util/TooltipTextMenu.scss b/src/client/util/TooltipTextMenu.scss
index af449071e..676411535 100644
--- a/src/client/util/TooltipTextMenu.scss
+++ b/src/client/util/TooltipTextMenu.scss
@@ -235,7 +235,7 @@
.tooltipMenu {
position: absolute;
z-index: 50;
- background: whitesmoke;
+ background: black;
border: 1px solid silver;
border-radius: 15px;
padding: 2px 10px;
@@ -308,8 +308,8 @@
}
.summarize{
margin-left: 15px;
- color: black;
+ color: white;
height: 20px;
- background-color: white;
+ // background-color: white;
text-align: center;
- }
+ } \ No newline at end of file
diff --git a/src/client/util/TooltipTextMenu.tsx b/src/client/util/TooltipTextMenu.tsx
index 7d4d5566c..f3f27335f 100644
--- a/src/client/util/TooltipTextMenu.tsx
+++ b/src/client/util/TooltipTextMenu.tsx
@@ -179,13 +179,13 @@ export class TooltipTextMenu {
this.linkText.style.whiteSpace = "nowrap";
this.linkText.style.width = "150px";
this.linkText.style.overflow = "hidden";
- this.linkText.style.color = "black";
+ this.linkText.style.color = "white";
this.linkText.onpointerdown = (e: PointerEvent) => { e.stopPropagation(); };
let linkBtn = document.createElement("div");
linkBtn.textContent = ">>";
linkBtn.style.width = "10px";
linkBtn.style.height = "10px";
- linkBtn.style.color = "black";
+ linkBtn.style.color = "white";
linkBtn.style.cssFloat = "left";
linkBtn.onpointerdown = (e: PointerEvent) => {
let node = this.view.state.selection.$from.nodeAfter;
@@ -382,7 +382,7 @@ export class TooltipTextMenu {
span.className = name + " menuicon";
span.title = title;
span.textContent = text;
- span.style.color = "black";
+ span.style.color = "white";
return span;
}