aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvellichora <fangrui_tong@brown.edu>2020-01-07 10:51:40 -0500
committervellichora <fangrui_tong@brown.edu>2020-01-07 10:51:40 -0500
commit80c417f24bcc1109e12645cfc522a820cf22e099 (patch)
tree86dec5cdb2ad1a1e0cd5eb676062fdb67b19ff8a /src
parent3633971bd9c1f739c0d6facd74754b99a7f26db6 (diff)
pull from master
Diffstat (limited to 'src')
-rw-r--r--src/client/util/RichTextMenu.tsx20
-rw-r--r--src/client/util/SelectionManager.ts1
-rw-r--r--src/client/views/DocumentDecorations.tsx10
3 files changed, 11 insertions, 20 deletions
diff --git a/src/client/util/RichTextMenu.tsx b/src/client/util/RichTextMenu.tsx
index 371ba97a9..111822307 100644
--- a/src/client/util/RichTextMenu.tsx
+++ b/src/client/util/RichTextMenu.tsx
@@ -53,6 +53,7 @@ export default class RichTextMenu extends AntimodeMenu {
constructor(props: Readonly<{}>) {
super(props);
RichTextMenu.Instance = this;
+ this.Pinned = true;
}
@action
@@ -79,16 +80,6 @@ export default class RichTextMenu extends AntimodeMenu {
// this.reset_mark_doms();
- // // update link dropdown
- // const linkDropdown = await this.createLinkDropdown();
- // const newLinkDropdowndom = linkDropdown.render(this.view).dom;
- // this._linkDropdownDom && this.tooltip.replaceChild(newLinkDropdowndom, this._linkDropdownDom);
- // this._linkDropdownDom = newLinkDropdowndom;
-
- // const targetTitle = await this.getTextLinkTargetTitle();
- // // console.log(targetTitle);
- // this.setCurrentLink(targetTitle);
-
// update active font family and size
const active = this.getActiveFontStylesOnSelection();
const activeFamilies = active && active.get("families");
@@ -97,6 +88,7 @@ export default class RichTextMenu extends AntimodeMenu {
this.activeFontFamily = !activeFamilies || activeFamilies.length === 0 ? "default" : activeFamilies.length === 1 ? String(activeFamilies[0]) : "various";
this.activeFontSize = !activeSizes || activeSizes.length === 0 ? "default" : activeSizes.length === 1 ? String(activeSizes[0]) + "pt" : "various";
+ // update link in current selection
const targetTitle = await this.getTextLinkTargetTitle();
this.setCurrentLink(targetTitle);
@@ -574,29 +566,21 @@ export default class RichTextMenu extends AntimodeMenu {
const node = this.view.state.selection.$from.nodeAfter;
const link = node && node.marks.find(m => m.type === this.view!.state.schema.marks.link);
const href = link!.attrs.href;
- console.log("delete link", node, link, href);
if (href) {
- console.log("has href");
if (href.indexOf(Utils.prepend("/doc/")) === 0) {
const linkclicked = href.replace(Utils.prepend("/doc/"), "").split("?")[0];
if (linkclicked) {
- console.log("linkclicked");
DocServer.GetRefField(linkclicked).then(async linkDoc => {
if (linkDoc instanceof Doc) {
- console.log("is doc");
LinkManager.Instance.deleteLink(linkDoc);
- console.log("remove the link! ", this.view!.state.selection.from, this.view!.state.selection.to, this.view!.state.schema.marks.link);
this.view!.dispatch(this.view!.state.tr.removeMark(this.view!.state.selection.from, this.view!.state.selection.to, this.view!.state.schema.marks.link));
}
});
}
} else {
- console.log("remove the link! ", this.view!.state.selection.from, this.view!.state.selection.to, this.view!.state.schema.marks.link);
if (node) {
let extension = this.linkExtend(this.view!.state.selection.$anchor, href);
- console.log("remove the link", extension.from, extension.to);
this.view!.dispatch(this.view!.state.tr.removeMark(extension.from, extension.to, this.view!.state.schema.marks.link));
-
}
}
}
diff --git a/src/client/util/SelectionManager.ts b/src/client/util/SelectionManager.ts
index 4612f10f4..0c733ac47 100644
--- a/src/client/util/SelectionManager.ts
+++ b/src/client/util/SelectionManager.ts
@@ -14,6 +14,7 @@ export namespace SelectionManager {
@action
SelectDoc(docView: DocumentView, ctrlPressed: boolean): void {
+ console.log("select doc!!!");
// if doc is not in SelectedDocuments, add it
if (!manager.SelectedDocuments.get(docView)) {
if (!ctrlPressed) {
diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx
index 76b6a8834..093761f1f 100644
--- a/src/client/views/DocumentDecorations.tsx
+++ b/src/client/views/DocumentDecorations.tsx
@@ -77,6 +77,11 @@ export class DocumentDecorations extends React.Component<{}, { value: string }>
DocumentDecorations.Instance = this;
this._keyinput = React.createRef();
reaction(() => SelectionManager.SelectedDocuments().slice(), docs => this.titleBlur(false));
+ console.log("constructing document decorations!!!");
+ }
+
+ componentDidMount() {
+ console.log("mounting deocument deoctirioeon!!!!");
}
@action titleChanged = (event: any) => this._accumulatedTitle = event.target.value;
@@ -574,8 +579,9 @@ export class DocumentDecorations extends React.Component<{}, { value: string }>
if (bounds.y > bounds.b) {
bounds.y = bounds.b - (this._resizeBorderWidth + this._linkBoxHeight + this._titleHeight);
}
- // RichTextMenu.Instance.jumpTo(this._lastX, this._lastY - 50);
- RichTextMenu.Instance.jumpTo(500, 300);
+ // // RichTextMenu.Instance.jumpTo(this._lastX, this._lastY - 50);
+ // console.log("jump to ");
+ // RichTextMenu.Instance.jumpTo(500, 300);
return (<div className="documentDecorations">
<div className="documentDecorations-background" style={{
width: (bounds.r - bounds.x + this._resizeBorderWidth) + "px",