aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorab <abdullah_ahmed@brown.edu>2019-06-13 12:03:39 -0400
committerab <abdullah_ahmed@brown.edu>2019-06-13 12:03:39 -0400
commit0a6c03f109254e36556482e75fa5fb14491d1626 (patch)
tree61c5cc4e3f62b054c39e36672d50852822b1f94f /src
parent37335c64be97502895d6fd80282daa8ef42a81a5 (diff)
demo
Diffstat (limited to 'src')
-rw-r--r--src/client/util/RichTextSchema.tsx12
-rw-r--r--src/client/util/TooltipTextMenu.scss11
-rw-r--r--src/client/util/TooltipTextMenu.tsx15
-rw-r--r--src/client/views/nodes/FormattedTextBox.scss2
4 files changed, 24 insertions, 16 deletions
diff --git a/src/client/util/RichTextSchema.tsx b/src/client/util/RichTextSchema.tsx
index 61ca4af5e..c0225f1f9 100644
--- a/src/client/util/RichTextSchema.tsx
+++ b/src/client/util/RichTextSchema.tsx
@@ -259,7 +259,7 @@ export const marks: { [index: string]: MarkSpec } = {
toDOM() {
return ['span', {
style: 'color: blue'
- }]
+ }];
}
},
@@ -461,6 +461,7 @@ export class SummarizedView {
this._collapsed.style.position = "relative";
this._collapsed.style.width = "40px";
this._collapsed.style.height = "20px";
+ let self = this;
this._collapsed.onpointerdown = function (e: any) {
console.log("star pressed!");
if (node.attrs.visibility) {
@@ -469,16 +470,19 @@ export class SummarizedView {
let y = getPos();
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, () => { }));
- //this._collapsed.textContent = "㊀";
+ self._collapsed.textContent = "㊉";
} 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);
console.log("PASTING " + node.attrs.oldtext.toString());
view.dispatch(view.state.tr.setSelection(TextSelection.create(view.state.doc, y + 1, y + 1)));
- view.dispatch(view.state.tr.replaceSelection(node.attrs.oldtext).addMark(view.state.selection.from, view.state.selection.from + node.attrs.oldtextlen, mark));
- //this._collapsed.textContent = "㊉";
+ 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));
+ self._collapsed.textContent = "㊀";
}
e.preventDefault();
e.stopPropagation();
diff --git a/src/client/util/TooltipTextMenu.scss b/src/client/util/TooltipTextMenu.scss
index 4d4eb386d..af449071e 100644
--- a/src/client/util/TooltipTextMenu.scss
+++ b/src/client/util/TooltipTextMenu.scss
@@ -244,8 +244,8 @@
//transform: translateX(-50%);
transform: translateY(-50%);
pointer-events: all;
- height: auto;
- width:inherit;
+ height: 100;
+ width:250;
.ProseMirror-example-setup-style hr {
padding: 2px 10px;
border: none;
@@ -306,3 +306,10 @@
font-size: 12px;
padding-right: 0px;
}
+ .summarize{
+ margin-left: 15px;
+ color: black;
+ height: 20px;
+ background-color: white;
+ text-align: center;
+ }
diff --git a/src/client/util/TooltipTextMenu.tsx b/src/client/util/TooltipTextMenu.tsx
index e12d4ed3c..7d4d5566c 100644
--- a/src/client/util/TooltipTextMenu.tsx
+++ b/src/client/util/TooltipTextMenu.tsx
@@ -234,19 +234,16 @@ export class TooltipTextMenu {
this.linkEditor.appendChild(linkBtn);
this.tooltip.appendChild(this.linkEditor);
+ // SUMMARIZE BUTTON
+
let starButton = document.createElement("span");
- // starButton.style.width = '10px';
- // starButton.style.height = '10px';
- starButton.style.marginLeft = '10px';
- starButton.textContent = "Summarize";
- starButton.style.color = 'black';
- starButton.style.height = '20px';
- starButton.style.backgroundColor = 'white';
- starButton.style.textAlign = 'center';
+ starButton.className = "summarize";
+ starButton.textContent = "★";
+ starButton.title = 'Summarize';
starButton.onclick = () => {
let state = this.view.state;
this.insertStar(state, this.view.dispatch);
- }
+ };
this.tooltip.appendChild(starButton);
}
diff --git a/src/client/views/nodes/FormattedTextBox.scss b/src/client/views/nodes/FormattedTextBox.scss
index 4a29c1949..e3e40860c 100644
--- a/src/client/views/nodes/FormattedTextBox.scss
+++ b/src/client/views/nodes/FormattedTextBox.scss
@@ -1,7 +1,7 @@
@import "../globalCssVariables";
.ProseMirror {
width: 100%;
- height: auto;
+ height: 100;
min-height: 100%;
font-family: $serif;
}