markuapad 0.1.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.
Files changed (59) hide show
  1. checksums.yaml +7 -0
  2. data/.babelrc +3 -0
  3. data/.gitignore +30 -0
  4. data/.jshintrc +4 -0
  5. data/CODE_OF_CONDUCT.md +13 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE +21 -0
  8. data/README.md +30 -0
  9. data/Rakefile +1 -0
  10. data/app/assets/javascripts/markuapad.js +72 -0
  11. data/app/assets/stylesheets/markuapad.css +1 -0
  12. data/bin/console +14 -0
  13. data/bin/setup +7 -0
  14. data/bower.json +30 -0
  15. data/build/app.css +1 -0
  16. data/build/app.js +72 -0
  17. data/build/browser-polyfill.min.js +3 -0
  18. data/build/dist.css +1 -0
  19. data/build/dist.js +72 -0
  20. data/build/index.css +1 -0
  21. data/build/index.html +30 -0
  22. data/build/index.js +1 -0
  23. data/build/web.css +1 -0
  24. data/build/web.js +72 -0
  25. data/lib/markuapad.rb +5 -0
  26. data/lib/markuapad/engine.rb +4 -0
  27. data/lib/markuapad/version.rb +3 -0
  28. data/markuapad.gemspec +32 -0
  29. data/package.json +55 -0
  30. data/prepare_gem.sh +3 -0
  31. data/src/dist.js +7 -0
  32. data/src/file_accessor.js +77 -0
  33. data/src/index.js +180 -0
  34. data/src/jsx/editor.jsx +122 -0
  35. data/src/jsx/file_browser.jsx +252 -0
  36. data/src/jsx/file_browser_list_item.jsx +86 -0
  37. data/src/jsx/image_modal.jsx +49 -0
  38. data/src/jsx/live_preview.jsx +36 -0
  39. data/src/jsx/main.jsx +145 -0
  40. data/src/jsx/preview.jsx +32 -0
  41. data/src/jsx/toolbar.jsx +24 -0
  42. data/src/markuapad.js +39 -0
  43. data/src/styles/_editor.scss +27 -0
  44. data/src/styles/_extendables.scss +115 -0
  45. data/src/styles/_file_browser.scss +160 -0
  46. data/src/styles/_grid-settings.scss +13 -0
  47. data/src/styles/_layout.scss +18 -0
  48. data/src/styles/_modal.scss +145 -0
  49. data/src/styles/_preview.scss +65 -0
  50. data/src/styles/_toolbar.scss +99 -0
  51. data/src/styles/_variables.scss +25 -0
  52. data/src/styles/_workspace.scss +31 -0
  53. data/src/styles/app.scss +52 -0
  54. data/src/styles/index.scss +41 -0
  55. data/src/util.js +43 -0
  56. data/src/web.js +4 -0
  57. data/test/editor.es6 +6 -0
  58. data/webpack.config.js +48 -0
  59. metadata +129 -0
@@ -0,0 +1,25 @@
1
+ // Colors
2
+ $white: #fff;
3
+ $editor-background: #fff;
4
+ $files-background: #fff;
5
+ $background: #f5f5f5;
6
+ $blue: #477dca;
7
+ $light-blue: lighten($blue, 10%);
8
+
9
+ // Transitions
10
+ $base-transition-duration: .250s;
11
+
12
+ // Layout
13
+ $editor-min-height: 90%;
14
+ $files-min-height: 90%;
15
+ $editor-padding: 2em;
16
+ $file-browser-padding: 1em;
17
+
18
+ // Typography
19
+ $base-font-size: 1em; // Default 16px
20
+ $h1-font-size: $base-font-size * 2.25;
21
+ $h2-font-size: $base-font-size * 2;
22
+ $h3-font-size: $base-font-size * 1.75;
23
+ $h4-font-size: $base-font-size * 1.5;
24
+ $h5-font-size: $base-font-size * 1.25;
25
+ $h6-font-size: $base-font-size;
@@ -0,0 +1,31 @@
1
+ .workspace {
2
+ @include display(flex);
3
+ @include flex(1 1 100%);
4
+ @include flex-flow(row nowrap);
5
+
6
+ &.live {
7
+ bottom: 0;
8
+ left: 10px;
9
+ position: absolute;
10
+ right: 10px;
11
+ top: 0;
12
+
13
+ .editor {
14
+ max-width: 64em;
15
+ }
16
+
17
+ .live-preview {
18
+ @extend %box-shadow;
19
+ @include flex(1);
20
+ background: $editor-background;
21
+ max-height: 100%;
22
+ overflow: auto;
23
+ padding: 2em 1em;
24
+
25
+ // Make the preview contents not center, looks dumb at large resolutions
26
+ .content {
27
+ margin-left: initial;
28
+ }
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,52 @@
1
+ @import "variables";
2
+
3
+ // Bourbon
4
+ @import "../../bower_components/bourbon/app/assets/stylesheets/bourbon";
5
+
6
+ // Bitters
7
+ @import "../../bower_components/bitters/app/assets/stylesheets/base";
8
+
9
+ // Neat
10
+ @import "grid-settings";
11
+ @import "../../bower_components/neat/app/assets/stylesheets/neat";
12
+
13
+ // Fonts
14
+ @import url(http://fonts.googleapis.com/css?family=Roboto+Slab:400,700|Open+Sans);
15
+
16
+ // Font awesome
17
+ @import url(https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.css);
18
+
19
+ // Our extends
20
+ @import "extendables";
21
+
22
+ // Our layout library
23
+ @import "layout";
24
+
25
+ @import "toolbar";
26
+ @import "editor";
27
+ @import "file_browser";
28
+ @import "preview";
29
+ @import "workspace";
30
+ @import "modal";
31
+
32
+ .markuapad {
33
+ @include display(flex);
34
+ @include flex-flow(column nowrap);
35
+ height: 100%;
36
+
37
+ a:hover { text-decoration: none; }
38
+
39
+ h1 { font-size: $h1-font-size; }
40
+ h2 { font-size: $h2-font-size; }
41
+ h3 { font-size: $h3-font-size; }
42
+ h4 { font-size: $h4-font-size; }
43
+ h5 { font-size: $h5-font-size; }
44
+ h6 { font-size: $h6-font-size; }
45
+ }
46
+
47
+ .markuapad .main-view {
48
+ @include display(flex);
49
+ @include flex(1);
50
+ @include flex-flow(row nowrap);
51
+ position: relative;
52
+ }
@@ -0,0 +1,41 @@
1
+ // Bourbon
2
+ @import "./variables";
3
+ @import "../../bower_components/bourbon/app/assets/stylesheets/bourbon";
4
+
5
+ // Move this to an example-only css
6
+ #markuapad-hero {
7
+ padding: 20px;
8
+ border: thin solid #bce8f1;
9
+ margin: 10px;
10
+ background-color: #d9edf7;
11
+ border-radius: 3px;
12
+ h2 { font-family: 'Roboto Slab', serif; font-size: 2em; }
13
+ position: relative;
14
+ #markuapad-hero-close {
15
+ @include appearance(none);
16
+ background: initial;
17
+ border-radius: initial;
18
+ color: initial;
19
+
20
+ position: absolute;
21
+ right: 10px;
22
+ top: 10px;
23
+
24
+ padding: 5px;
25
+
26
+ &:focus {
27
+ outline: none;
28
+ }
29
+ }
30
+ }
31
+
32
+ html,
33
+ body {
34
+ height: 100%;
35
+ }
36
+
37
+ body {
38
+ background: $background;
39
+ font-family: 'Open Sans', sans-serif;
40
+ margin: 0 8px;
41
+ }
data/src/util.js ADDED
@@ -0,0 +1,43 @@
1
+ let imageTagFixRegex = /src="images\/([\w,\s-]+\.(?:(?:png)|(?:jpg)|(?:jpeg)|(?:gif)|(?:bmp)))/;
2
+ let allImageTagFixRegex = new RegExp(imageTagFixRegex.source, "g");
3
+
4
+ import FileAccessor from "./file_accessor"
5
+
6
+ export let fixImagePaths = (htmlString, rerun) => {
7
+ let matches = htmlString.match(allImageTagFixRegex);
8
+
9
+ for (let match of matches || []) {
10
+ // Get the base64 url for the image
11
+ let key = match.substr(match.lastIndexOf("/") + 1)
12
+ let file = FileAccessor.getSync(key, "image", rerun);
13
+
14
+ if (!file || !file.data) {
15
+ FileAccessor.get(key, rerun, "image");
16
+ continue;
17
+ }
18
+
19
+ let uri = `data:${file.mimetype.string};base64,${file.data}`
20
+ htmlString = htmlString.replace(imageTagFixRegex, `src="${uri}`)
21
+ }
22
+ return htmlString;
23
+ }
24
+
25
+ // Helpers for the localstorage manipulation
26
+ export let getCached = (key, defaultValue) => {
27
+ let value;
28
+ if (value = localStorage.getItem(key))
29
+ try {
30
+ value = JSON.parse(value);
31
+ return value
32
+ }
33
+ catch(error) {
34
+ return value;
35
+ }
36
+ else
37
+ return defaultValue;
38
+ }
39
+
40
+ export let setCached = (key, value) => {
41
+ localStorage.setItem(key, (typeof value === "string" ? value : JSON.stringify(value)));
42
+ return value;
43
+ }
data/src/web.js ADDED
@@ -0,0 +1,4 @@
1
+ import Markuapad from "./markuapad"
2
+
3
+ // Call the api to create a new markuapad instance on the #main element
4
+ Markuapad.create("main", { fileAccessor: ExampleFileAccessor });
data/test/editor.es6 ADDED
@@ -0,0 +1,6 @@
1
+ var should = require("should")
2
+ var markuapad = require("../build/markuapad")
3
+
4
+ describe("Editor", () => {
5
+ it("Should have an editor", () => { markuapad.should.have.function('create'); })
6
+ });
data/webpack.config.js ADDED
@@ -0,0 +1,48 @@
1
+ 'use strict';
2
+ var fs = require('fs');
3
+ var path = require('path');
4
+
5
+ var webpack = require('webpack');
6
+ var ExtractTextPlugin = require('extract-text-webpack-plugin');
7
+
8
+ var commonLoaders = [
9
+ { test: /\.jsx?$/, loaders: ['babel-loader'], exclude: /node_modules/ },
10
+ { test: /\.scss?$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader!sass') }
11
+ ];
12
+
13
+ var plugins = [
14
+ new ExtractTextPlugin('[name].css', {
15
+ allChunks: true
16
+ })
17
+ ];
18
+
19
+ if (process.env.PROD) {
20
+ plugins.push(
21
+ new webpack.optimize.UglifyJsPlugin({minimize: true})
22
+ )
23
+ }
24
+
25
+ module.exports = {
26
+ name: 'browser',
27
+ entry: {
28
+ app: ['./src/markuapad.js'],
29
+ web: './src/web.js',
30
+ index: './src/index.js',
31
+ dist: './src/dist.js'
32
+ },
33
+ output: {
34
+ path: "./build",
35
+ filename: '[name].js'
36
+ },
37
+ resolve: {
38
+ extensions: ['', '.js', '.jsx', '.scss']
39
+ },
40
+ module: {
41
+ loaders: commonLoaders
42
+ },
43
+ plugins: plugins,
44
+ devServer: {
45
+ contentBase: "./build",
46
+ inline: true
47
+ }
48
+ }
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: markuapad
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.7
5
+ platform: ruby
6
+ authors:
7
+ - Braden Simpson
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-07-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.9'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description:
42
+ email:
43
+ - braden@ruboss.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".babelrc"
49
+ - ".gitignore"
50
+ - ".jshintrc"
51
+ - CODE_OF_CONDUCT.md
52
+ - Gemfile
53
+ - LICENSE
54
+ - README.md
55
+ - Rakefile
56
+ - app/assets/javascripts/markuapad.js
57
+ - app/assets/stylesheets/markuapad.css
58
+ - bin/console
59
+ - bin/setup
60
+ - bower.json
61
+ - build/app.css
62
+ - build/app.js
63
+ - build/browser-polyfill.min.js
64
+ - build/dist.css
65
+ - build/dist.js
66
+ - build/index.css
67
+ - build/index.html
68
+ - build/index.js
69
+ - build/web.css
70
+ - build/web.js
71
+ - lib/markuapad.rb
72
+ - lib/markuapad/engine.rb
73
+ - lib/markuapad/version.rb
74
+ - markuapad.gemspec
75
+ - package.json
76
+ - prepare_gem.sh
77
+ - src/dist.js
78
+ - src/file_accessor.js
79
+ - src/index.js
80
+ - src/jsx/editor.jsx
81
+ - src/jsx/file_browser.jsx
82
+ - src/jsx/file_browser_list_item.jsx
83
+ - src/jsx/image_modal.jsx
84
+ - src/jsx/live_preview.jsx
85
+ - src/jsx/main.jsx
86
+ - src/jsx/preview.jsx
87
+ - src/jsx/toolbar.jsx
88
+ - src/markuapad.js
89
+ - src/styles/_editor.scss
90
+ - src/styles/_extendables.scss
91
+ - src/styles/_file_browser.scss
92
+ - src/styles/_grid-settings.scss
93
+ - src/styles/_layout.scss
94
+ - src/styles/_modal.scss
95
+ - src/styles/_preview.scss
96
+ - src/styles/_toolbar.scss
97
+ - src/styles/_variables.scss
98
+ - src/styles/_workspace.scss
99
+ - src/styles/app.scss
100
+ - src/styles/index.scss
101
+ - src/util.js
102
+ - src/web.js
103
+ - test/editor.es6
104
+ - webpack.config.js
105
+ homepage: http://github.com/bradens/markuapad
106
+ licenses:
107
+ - MIT
108
+ metadata: {}
109
+ post_install_message:
110
+ rdoc_options: []
111
+ require_paths:
112
+ - lib
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ requirements: []
124
+ rubyforge_project:
125
+ rubygems_version: 2.4.5
126
+ signing_key:
127
+ specification_version: 4
128
+ summary: An app for writing markua based documents.
129
+ test_files: []