markuapad 0.2.6 → 0.2.7
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/.gitignore +1 -0
- data/app/assets/javascripts/markuapad.js +28 -28
- data/app/assets/stylesheets/markuapad.css +1 -1
- data/build/app.css +1 -1
- data/build/app.js +28 -28
- data/build/dist.css +1 -1
- data/build/dist.js +28 -28
- data/build/images/markua-icon.png +0 -0
- data/build/images/markua-logo.png +0 -0
- data/build/index.css +1 -1
- data/build/index.html +10 -16
- data/build/index.js +1 -1
- data/build/web.css +1 -1
- data/build/web.js +28 -28
- data/lib/markuapad/version.rb +1 -1
- data/markuapad-0.2.6.gem +0 -0
- data/src/jsx/editor.jsx +29 -17
- data/src/jsx/toolbar.jsx +2 -2
- data/src/markuapad.js +3 -3
- data/src/styles/index.scss +17 -23
- data/src/web.js +1 -1
- metadata +5 -2
data/markuapad-0.2.6.gem
ADDED
|
Binary file
|
data/src/jsx/editor.jsx
CHANGED
|
@@ -20,7 +20,7 @@ class Editor extends React.Component {
|
|
|
20
20
|
|
|
21
21
|
// Setup all the editor options when we mount.
|
|
22
22
|
componentDidMount() {
|
|
23
|
-
this.
|
|
23
|
+
this.loadFile();
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
componentWillUpdate(nextProps, nextState) {
|
|
@@ -37,16 +37,20 @@ class Editor extends React.Component {
|
|
|
37
37
|
componentDidUpdate(lastProps, lastState) {
|
|
38
38
|
if (lastProps.currentFile !== this.props.currentFile) {
|
|
39
39
|
this.setState({ currentFileValue: null })
|
|
40
|
-
this.
|
|
40
|
+
this.loadFile();
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
loadFile() {
|
|
45
45
|
if (!this.props.currentFile) return;
|
|
46
46
|
|
|
47
|
-
//
|
|
47
|
+
// Get the current file to put in the ace editor
|
|
48
|
+
FileAccessor.get(this.props.currentFile.filename, this.onCurrentFileLoaded, this.props.currentFile.type);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
setupEditor() {
|
|
52
|
+
// Set all editor related properties here.
|
|
48
53
|
this.editor = ace.edit(this.refs.editor.getDOMNode());
|
|
49
|
-
this.editor.getSession().setMode('ace/mode/markdown');
|
|
50
54
|
this.editor.setTheme('ace/theme/xcode');
|
|
51
55
|
this.editor.setKeyboardHandler('ace/keyboard/emacs');
|
|
52
56
|
this.editor.renderer.setShowGutter(false);
|
|
@@ -55,15 +59,8 @@ class Editor extends React.Component {
|
|
|
55
59
|
this.editor.setShowPrintMargin(false);
|
|
56
60
|
this.editor.setFontSize(14);
|
|
57
61
|
this.editor.$blockScrolling = Infinity;
|
|
58
|
-
this.editor.session.setUseWrapMode(true);
|
|
59
62
|
this.editor.setHighlightActiveLine(false);
|
|
60
|
-
|
|
61
|
-
// When the editor changes, alert us
|
|
62
63
|
this.editor.on("change", this.onEditorChanged)
|
|
63
|
-
this.editor.getSession().selection.on("changeCursor", this.onCursorChanged)
|
|
64
|
-
|
|
65
|
-
// Get the current file to put in the ace editor
|
|
66
|
-
FileAccessor.get(this.props.currentFile.filename, this.onCurrentFileLoaded, this.props.currentFile.type);
|
|
67
64
|
}
|
|
68
65
|
|
|
69
66
|
// When someone changes the cursor, we need to tell the file that we have a changed cursor
|
|
@@ -99,14 +96,29 @@ class Editor extends React.Component {
|
|
|
99
96
|
if (error)
|
|
100
97
|
return console.error(error)
|
|
101
98
|
else {
|
|
102
|
-
// Focus the editor
|
|
103
|
-
this.editor.focus;
|
|
104
|
-
|
|
105
99
|
// Set the value of it
|
|
106
|
-
this.setState({ currentFileValue: contents },
|
|
100
|
+
this.setState({ currentFileValue: contents }, this.setupCurrentFile);
|
|
107
101
|
}
|
|
108
102
|
}
|
|
109
103
|
|
|
104
|
+
// Called when we load a new file. Sets up the files editor session, and initial values.
|
|
105
|
+
// TODO we should actually probably keep a set of edit sessions in our state, and then switch between them to keep the
|
|
106
|
+
setupCurrentFile = () => {
|
|
107
|
+
this.setupEditor();
|
|
108
|
+
|
|
109
|
+
let newSession = new ace.EditSession(this.state.currentFileValue);
|
|
110
|
+
// Add some session modes
|
|
111
|
+
// TODO parse file type here and change mode and store session info
|
|
112
|
+
newSession.setMode('ace/mode/markdown');
|
|
113
|
+
newSession.setUseWrapMode(true);
|
|
114
|
+
newSession.selection.on("changeCursor", this.onCursorChanged)
|
|
115
|
+
newSession.setUndoManager(new ace.UndoManager());
|
|
116
|
+
|
|
117
|
+
// Make the editor load this session
|
|
118
|
+
this.editor.setSession(newSession)
|
|
119
|
+
this.editor.focus()
|
|
120
|
+
}
|
|
121
|
+
|
|
110
122
|
renderEditor() {
|
|
111
123
|
return (
|
|
112
124
|
<section key={EDITOR_KEY} ref="editor" className="editor"></section>
|
|
@@ -135,4 +147,4 @@ Editor.propTypes = {
|
|
|
135
147
|
onBookContentChanged: React.PropTypes.func.isRequired
|
|
136
148
|
}
|
|
137
149
|
|
|
138
|
-
export default Editor;
|
|
150
|
+
export default Editor;
|
data/src/jsx/toolbar.jsx
CHANGED
|
@@ -34,7 +34,7 @@ class Toolbar extends React.Component {
|
|
|
34
34
|
render() {
|
|
35
35
|
return (
|
|
36
36
|
<nav className="toolbar">
|
|
37
|
-
<h3 className="book-title">{ this.props.bookTitle}</h3>
|
|
37
|
+
<h3 className="book-title">{ this.props.bookTitle }</h3>
|
|
38
38
|
<ul className="actions">
|
|
39
39
|
<li>
|
|
40
40
|
<a className={`progressMessage ${this.props.inProgress ? 'active' : ''}`}>
|
|
@@ -72,4 +72,4 @@ Toolbar.propTypes = {
|
|
|
72
72
|
bookTitle: React.PropTypes.string.isRequired
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
export default Toolbar;
|
|
75
|
+
export default Toolbar;
|
data/src/markuapad.js
CHANGED
|
@@ -26,11 +26,11 @@ class Markuapad {
|
|
|
26
26
|
this.options = _.extend({}, this.options, options);
|
|
27
27
|
|
|
28
28
|
// Project Root
|
|
29
|
-
let projectTitle = options.title || "
|
|
29
|
+
let projectTitle = options.title || "";
|
|
30
30
|
let projectRoot = options.slug || _.string.slugify(projectTitle);
|
|
31
31
|
|
|
32
32
|
// Instantiate a new markua processor instance
|
|
33
|
-
this.markua = new Markua(projectRoot, { fileAccessor: this.options.fileAccessor })
|
|
33
|
+
this.markua = new Markua(projectRoot, { fileAccessor: this.options.fileAccessor });
|
|
34
34
|
|
|
35
35
|
// Setup the markuapad file accessor
|
|
36
36
|
FileAccessor.setup(this.options.fileAccessor, projectRoot);
|
|
@@ -40,4 +40,4 @@ class Markuapad {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
export default new Markuapad();
|
|
43
|
+
export default new Markuapad();
|
data/src/styles/index.scss
CHANGED
|
@@ -2,29 +2,23 @@
|
|
|
2
2
|
@import "./variables";
|
|
3
3
|
@import "../../bower_components/bourbon/app/assets/stylesheets/bourbon";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
top: 10px;
|
|
23
|
-
|
|
24
|
-
padding: 5px;
|
|
25
|
-
|
|
26
|
-
&:focus {
|
|
27
|
-
outline: none;
|
|
5
|
+
#markuapad-about {
|
|
6
|
+
padding: 20 10 0 10;
|
|
7
|
+
.nav-links {
|
|
8
|
+
float: right;
|
|
9
|
+
list-style-type: none;
|
|
10
|
+
height: 50px;
|
|
11
|
+
line-height: 50px;
|
|
12
|
+
li {
|
|
13
|
+
vertical-align: middle;
|
|
14
|
+
display: inline-block;
|
|
15
|
+
margin: 0 5px;
|
|
16
|
+
a {
|
|
17
|
+
color: #777;
|
|
18
|
+
&:hover {
|
|
19
|
+
color: #222;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
28
22
|
}
|
|
29
23
|
}
|
|
30
24
|
}
|
data/src/web.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import Markuapad from "./markuapad"
|
|
2
2
|
|
|
3
3
|
// Call the api to create a new markuapad instance on the #main element
|
|
4
|
-
Markuapad.create("main", { fileAccessor: ExampleFileAccessor, CHANGED_INTERVAL: 100, enablePreview: true });
|
|
4
|
+
Markuapad.create("main", { fileAccessor: ExampleFileAccessor, CHANGED_INTERVAL: 100, enablePreview: true, slug: 'my-first-markuapad-book' });
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: markuapad
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Braden Simpson
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-09-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -64,6 +64,8 @@ files:
|
|
|
64
64
|
- build/browser-polyfill.min.js
|
|
65
65
|
- build/dist.css
|
|
66
66
|
- build/dist.js
|
|
67
|
+
- build/images/markua-icon.png
|
|
68
|
+
- build/images/markua-logo.png
|
|
67
69
|
- build/index.css
|
|
68
70
|
- build/index.html
|
|
69
71
|
- build/index.js
|
|
@@ -72,6 +74,7 @@ files:
|
|
|
72
74
|
- lib/markuapad.rb
|
|
73
75
|
- lib/markuapad/engine.rb
|
|
74
76
|
- lib/markuapad/version.rb
|
|
77
|
+
- markuapad-0.2.6.gem
|
|
75
78
|
- markuapad.gemspec
|
|
76
79
|
- package.json
|
|
77
80
|
- prepare_gem.sh
|