markuapad 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/assets/javascripts/markuapad.js +54 -68872
- data/app/assets/stylesheets/markuapad.css +1 -800
- data/build/app.css +1 -800
- data/build/app.js +54 -68857
- data/build/dist.css +1 -800
- data/build/dist.js +54 -68872
- data/build/index.css +1 -34
- data/build/index.js +1 -2214
- data/build/web.css +1 -800
- data/build/web.js +54 -68865
- data/lib/markuapad/version.rb +1 -1
- data/src/jsx/editor.jsx +17 -1
- data/src/jsx/file_browser.jsx +1 -1
- metadata +1 -1
data/lib/markuapad/version.rb
CHANGED
data/src/jsx/editor.jsx
CHANGED
|
@@ -6,6 +6,8 @@ import emacsKeys from "brace/keybinding/emacs"
|
|
|
6
6
|
import FileAccessor from "../file_accessor";
|
|
7
7
|
import _ from "underscore";
|
|
8
8
|
|
|
9
|
+
let EDITOR_KEY = 1;
|
|
10
|
+
|
|
9
11
|
class Editor extends React.Component {
|
|
10
12
|
constructor(props) {
|
|
11
13
|
super(props);
|
|
@@ -21,10 +23,20 @@ class Editor extends React.Component {
|
|
|
21
23
|
this.setupEditor();
|
|
22
24
|
}
|
|
23
25
|
|
|
26
|
+
componentWillUpdate(nextProps, nextState) {
|
|
27
|
+
if (nextProps.currentFile !== this.props.currentFile) {
|
|
28
|
+
if (this.editor) {
|
|
29
|
+
this.editor.destroy();
|
|
30
|
+
EDITOR_KEY = EDITOR_KEY + 1;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
24
35
|
// If we get a file change from outside our domain, switch to it.
|
|
25
36
|
// TODO: maybe show a merge warning or something?
|
|
26
37
|
componentDidUpdate(lastProps, lastState) {
|
|
27
38
|
if (lastProps.currentFile !== this.props.currentFile) {
|
|
39
|
+
this.setState({ currentFileValue: null })
|
|
28
40
|
this.setupEditor();
|
|
29
41
|
}
|
|
30
42
|
}
|
|
@@ -56,6 +68,8 @@ class Editor extends React.Component {
|
|
|
56
68
|
|
|
57
69
|
// When someone changes the cursor, we need to tell the file that we have a changed cursor
|
|
58
70
|
onCursorChanged() {
|
|
71
|
+
if (!this.props.currentFile) return;
|
|
72
|
+
|
|
59
73
|
let count = 0,
|
|
60
74
|
position = this.editor.getCursorPosition(),
|
|
61
75
|
i = 0,
|
|
@@ -68,6 +82,8 @@ class Editor extends React.Component {
|
|
|
68
82
|
// When the editor value changes, then we have to set our current state,
|
|
69
83
|
// then update the file through the data store.
|
|
70
84
|
onEditorChanged() {
|
|
85
|
+
if (!this.props.currentFile) return;
|
|
86
|
+
|
|
71
87
|
let value = this.editor.getValue();
|
|
72
88
|
|
|
73
89
|
if (value === this.state.currentFileValue)
|
|
@@ -93,7 +109,7 @@ class Editor extends React.Component {
|
|
|
93
109
|
|
|
94
110
|
renderEditor() {
|
|
95
111
|
return (
|
|
96
|
-
<section ref="editor" className="editor"></section>
|
|
112
|
+
<section key={EDITOR_KEY} ref="editor" className="editor"></section>
|
|
97
113
|
);
|
|
98
114
|
}
|
|
99
115
|
|
data/src/jsx/file_browser.jsx
CHANGED