Skip to content

Commit ff627be

Browse files
committed
Init basic TextEditor app
0 parents  commit ff627be

6 files changed

Lines changed: 111 additions & 0 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.meteor
2+
.sandstorm
3+
Vagrantfile
4+
build

LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
MIT

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# TextEditor
2+
3+
TextEditor is an extremely basic plain text editing application for SandstormIO built with MeteorJS. However, since it's using MeteorJS, it *is* reactive, and data is live updated across clients.
4+
5+
## Usage
6+
7+
```
8+
meteor serve
9+
```
10+
11+
## Building for SandstormIO
12+
13+
Follow the vagrant spk steps found here https://docs.sandstorm.io/en/latest/vagrant-spk/platform-stacks/#meteor-platform-stack
14+
15+
Copied for posterity:
16+
17+
---
18+
19+
## Meteor platform stack
20+
21+
For a Meteor app, keep the following in mind:
22+
23+
* Run `vagrant-spk setupvm meteor`
24+
* Run `vagrant-spk up`. Note this will print _lots_ of red text; sorry about that, then abruptly end.
25+
* Run `vagrant-spk init` and edit `.sandstorm/sandstorm-pkgdef.capnp`
26+
* Run `vagrant-spk dev` and make sure the app works OK at http://local.sandstorm.io:6080/
27+
* Run `vagrant-spk pack ~/projects/meteor-package.spk` and you have a package file!
28+
29+
---
30+
31+
32+
## Credits
33+
34+
Richard Caceres (@rchrd2)
35+
36+
## License
37+
38+
MIT

texteditor.css

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/* CSS declarations go here */
2+
body, html {
3+
overflow: hidden;
4+
}
5+
textarea, body, html {
6+
height: 100%;
7+
width: 100%;
8+
padding: 0;
9+
margin: 0;
10+
box-sizing: border-box;
11+
border: none;
12+
font-size: 16px;
13+
}
14+
15+
textarea {
16+
padding: 1rem .5rem .25rem .75rem;
17+
font-family: Menlo,Monaco,consolas,monospace;
18+
font-weight: 400;
19+
line-height: 1.45rem;
20+
background-color: #fff;
21+
color: #000;
22+
outline: medium none;
23+
height: 100%;
24+
resize: none;
25+
-webkit-overflow-scrolling: touch
26+
}

texteditor.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<head>
2+
<title>TextEditor</title>
3+
<meta name="viewport" content="user-scalable=no, width=device-width, maximum-scale=1, initial-scale=1, minimum-scale=1">
4+
</head>
5+
6+
<body>
7+
{{> texteditor}}
8+
</body>
9+
10+
<template name="texteditor">
11+
<textarea>{{value}}</textarea>
12+
</template>

texteditor.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Data = new Mongo.Collection("Data");
2+
3+
DATA_ID = 'default_id'
4+
5+
if (Meteor.isClient) {
6+
7+
Template.texteditor.helpers({
8+
value: function () {
9+
// Read value from the collection.
10+
var doc = Data.findOne(DATA_ID);
11+
if (doc) {
12+
return doc.value;
13+
}
14+
}
15+
});
16+
17+
Template.texteditor.events({
18+
"input textarea": function(event, template) {
19+
Data.upsert(DATA_ID, {$set: {
20+
value: event.target.value
21+
}});
22+
},
23+
});
24+
}
25+
26+
if (Meteor.isServer) {
27+
Meteor.startup(function () {
28+
// code to run on server at startup
29+
});
30+
}

0 commit comments

Comments
 (0)