blob: bde50fed80e190a80ba3257df4e6029648b95303 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
import { observable, computed, action } from "mobx";
import React = require("react");
import { SelectionManager } from "../../util/SelectionManager";
import { observer } from "mobx-react";
import './LinkEditor.scss';
import { KeyStore } from '../../../fields/KeyStore';
import { props } from "bluebird";
import { DocumentView } from "./DocumentView";
import { Document } from "../../../fields/Document";
import { TextField } from "../../../fields/TextField";
import { link } from "fs";
interface Props {
linkDoc: Document;
showLinks: () => void;
}
@observer
export class LinkEditor extends React.Component<Props> {
@observable private _nameInput: string = this.props.linkDoc.GetText(KeyStore.Title, "");
@observable private _descriptionInput: string = this.props.linkDoc.GetText(KeyStore.LinkDescription, "");
onSaveButtonPressed = (e: React.PointerEvent): void => {
console.log("view down");
e.stopPropagation();
this.props.linkDoc.SetData(KeyStore.Title, this._nameInput, TextField);
this.props.linkDoc.SetData(KeyStore.LinkDescription, this._descriptionInput, TextField);
this.props.showLinks();
}
render() {
return (
<div className="edit-container">
<input onChange={this.onNameChanged} className="name-input" type="text" value={this._nameInput} placeholder="Name . . ."></input>
<textarea onChange={this.onDescriptionChanged} className="description-input" value={this._descriptionInput} placeholder="Description . . ."></textarea>
<div className="save-button" onPointerDown={this.onSaveButtonPressed}>SAVE</div>
</div>
);
}
@action
onNameChanged = (e: React.ChangeEvent<HTMLInputElement>) => {
this._nameInput = e.target.value;
}
@action
onDescriptionChanged = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
this._descriptionInput = e.target.value;
}
}
|