ace_vimtura-rails 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/README.md +54 -0
- data/Rakefile +1 -0
- data/ace_vimtura-rails.gemspec +25 -0
- data/app/assets/javascripts/ace_vimtura/ace_vimtura.js +198 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/ace.js +11 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/mode-haml.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/mode-html.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/mode-jade.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/mode-markdown.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/ambiance.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/chaos.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/chrome.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/clouds.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/clouds_midnight.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/cobalt.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/crimson_editor.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/dawn.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/dreamweaver.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/eclipse.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/github.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/idle_fingers.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/iplastic.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/katzenmilch.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/kr_theme.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/kuroir.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/merbivore.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/merbivore_soft.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/mono_industrial.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/monokai.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/pastel_on_dark.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/solarized_dark.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/solarized_light.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/sqlserver.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/terminal.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/textmate.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/tomorrow.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/tomorrow_night.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/tomorrow_night_blue.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/tomorrow_night_bright.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/tomorrow_night_eighties.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/twilight.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/vibrant_ink.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/theme/xcode.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/ace/vim.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/renderers/haml.js +1 -0
- data/app/assets/javascripts/ace_vimtura/lib/renderers/markdown.js +6 -0
- data/app/assets/javascripts/ace_vimtura/lib/require.js +2087 -0
- data/app/assets/javascripts/ace_vimtura/main.js +23 -0
- data/app/assets/javascripts/ace_vimtura/preview.js +90 -0
- data/app/assets/javascripts/ace_vimtura/renderers/haml.js +13 -0
- data/app/assets/javascripts/ace_vimtura/renderers/html.js +16 -0
- data/app/assets/javascripts/ace_vimtura/renderers/jade.js +1 -0
- data/app/assets/javascripts/ace_vimtura/renderers/markdown.js +28 -0
- data/app/assets/javascripts/ace_vimtura/style.js +10 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/ace_vimtura/rails.rb +8 -0
- data/lib/ace_vimtura/rails/engine.rb +6 -0
- data/lib/ace_vimtura/rails/version.rb +5 -0
- metadata +133 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
requirejs.config({
|
2
|
+
baseUrl: 'assets/ace_vimtura',
|
3
|
+
paths: {
|
4
|
+
ace_vimtura: 'ace_vimtura'
|
5
|
+
},
|
6
|
+
packages: [
|
7
|
+
{
|
8
|
+
name: 'ace',
|
9
|
+
main: 'ace',
|
10
|
+
location: "lib/ace"
|
11
|
+
}, {
|
12
|
+
name: 'ace/keyboard/vim',
|
13
|
+
main: 'vim',
|
14
|
+
location: 'lib/ace'
|
15
|
+
}
|
16
|
+
]
|
17
|
+
});
|
18
|
+
|
19
|
+
require(['./ace_vimtura'], function(av) {
|
20
|
+
if (window) {
|
21
|
+
return window.AceVimtura = av;
|
22
|
+
}
|
23
|
+
});
|
@@ -0,0 +1,90 @@
|
|
1
|
+
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
2
|
+
|
3
|
+
define(function() {
|
4
|
+
AceVimtura.Preview = (function() {
|
5
|
+
function Preview() {
|
6
|
+
this.toggle = bind(this.toggle, this);
|
7
|
+
this.disable = bind(this.disable, this);
|
8
|
+
this.enable = bind(this.enable, this);
|
9
|
+
this.html = bind(this.html, this);
|
10
|
+
this.instantUpdate = bind(this.instantUpdate, this);
|
11
|
+
this.update = bind(this.update, this);
|
12
|
+
this.dom = document.createElement('div');
|
13
|
+
this.dom.classList.add('av_preview');
|
14
|
+
this.timeout = null;
|
15
|
+
this.isEnabled = false;
|
16
|
+
AceVimtura.dom.appendChild(this.dom);
|
17
|
+
this.enable();
|
18
|
+
}
|
19
|
+
|
20
|
+
Preview.prototype.update = function() {
|
21
|
+
if (this.timeout) {
|
22
|
+
window.clearTimeout(this.timeout);
|
23
|
+
}
|
24
|
+
return this.timeout = window.setTimeout((function(_this) {
|
25
|
+
return function() {
|
26
|
+
_this.instantUpdate();
|
27
|
+
return _this.timeout = null;
|
28
|
+
};
|
29
|
+
})(this), AceVimtura.options.refreshTimeout);
|
30
|
+
};
|
31
|
+
|
32
|
+
Preview.prototype.instantUpdate = function() {
|
33
|
+
var rend;
|
34
|
+
if (!(rend = AceVimtura.renderer)) {
|
35
|
+
return;
|
36
|
+
}
|
37
|
+
return this.html(rend.render(AceVimtura.ace.getValue()));
|
38
|
+
};
|
39
|
+
|
40
|
+
Preview.prototype.html = function(text) {
|
41
|
+
if (text) {
|
42
|
+
return this.dom.innerHTML = text;
|
43
|
+
} else {
|
44
|
+
return this.dom.innerHTML;
|
45
|
+
}
|
46
|
+
};
|
47
|
+
|
48
|
+
Preview.prototype.enable = function() {
|
49
|
+
var reg;
|
50
|
+
this.isEnabled = true;
|
51
|
+
reg = AceVimtura.ace._eventRegistry;
|
52
|
+
if (!reg['change']) {
|
53
|
+
return;
|
54
|
+
}
|
55
|
+
if (reg['change'].indexOf(this.update) > -1) {
|
56
|
+
return;
|
57
|
+
}
|
58
|
+
this.instantUpdate();
|
59
|
+
AceVimtura.ace.on('change', this.update);
|
60
|
+
return this.dom.classList.remove('collapsed');
|
61
|
+
};
|
62
|
+
|
63
|
+
Preview.prototype.disable = function() {
|
64
|
+
var i, reg;
|
65
|
+
this.isEnabled = false;
|
66
|
+
reg = AceVimtura.ace._eventRegistry;
|
67
|
+
if (!reg['change']) {
|
68
|
+
return;
|
69
|
+
}
|
70
|
+
i = reg['change'].indexOf(this.update);
|
71
|
+
if (i < 0) {
|
72
|
+
return;
|
73
|
+
}
|
74
|
+
reg['change'].splice(i, 1);
|
75
|
+
return this.dom.classList.add('collapsed');
|
76
|
+
};
|
77
|
+
|
78
|
+
Preview.prototype.toggle = function() {
|
79
|
+
if (this.isEnabled) {
|
80
|
+
return this.disable();
|
81
|
+
} else {
|
82
|
+
return this.enable();
|
83
|
+
}
|
84
|
+
};
|
85
|
+
|
86
|
+
return Preview;
|
87
|
+
|
88
|
+
})();
|
89
|
+
return AceVimtura.Preview;
|
90
|
+
});
|
@@ -0,0 +1,16 @@
|
|
1
|
+
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
2
|
+
|
3
|
+
define(function() {
|
4
|
+
return AceVimtura.Renderers.Html = (function() {
|
5
|
+
function Html(options) {
|
6
|
+
this.render = bind(this.render, this);
|
7
|
+
}
|
8
|
+
|
9
|
+
Html.prototype.render = function(text) {
|
10
|
+
return text;
|
11
|
+
};
|
12
|
+
|
13
|
+
return Html;
|
14
|
+
|
15
|
+
})();
|
16
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
2
|
+
|
3
|
+
define(['lib/renderers/markdown'], function(marked) {
|
4
|
+
return AceVimtura.Renderers.Markdown = (function() {
|
5
|
+
function Markdown(options) {
|
6
|
+
if (options == null) {
|
7
|
+
options = {};
|
8
|
+
}
|
9
|
+
this.render = bind(this.render, this);
|
10
|
+
this.marked = marked;
|
11
|
+
options.gfm || (options.gfm = true);
|
12
|
+
options.tables || (options.tables = true);
|
13
|
+
options.breaks || (options.breaks = false);
|
14
|
+
options.pedantic || (options.pedantic = true);
|
15
|
+
options.sanitize || (options.sanitize = true);
|
16
|
+
options.smartLists || (options.smartLists = true);
|
17
|
+
options.smartypants || (options.smartypants = true);
|
18
|
+
this.marked.setOptions(options);
|
19
|
+
}
|
20
|
+
|
21
|
+
Markdown.prototype.render = function(text) {
|
22
|
+
return this.marked(text);
|
23
|
+
};
|
24
|
+
|
25
|
+
return Markdown;
|
26
|
+
|
27
|
+
})();
|
28
|
+
});
|
@@ -0,0 +1,10 @@
|
|
1
|
+
(function() {
|
2
|
+
define(function() {
|
3
|
+
var st, string;
|
4
|
+
string = '.av_editor { display: inline-block; width: 48%; min-height: 500px; height: 100%; transition: width 1s; -webkit-transition: width 1s; } .av_editor.fullscreen { width: 100%; } .av_preview { display: inline-block; width: 48%; min-height: 500px; height: 100%; background: #eee; overflow-x: hidden; overflow-y: scroll; transition: width 1s; -webkit-transition: width 1s; } .av_preview.collapsed { width: 0; }';
|
5
|
+
st = document.createElement('style');
|
6
|
+
st.innerHTML = string;
|
7
|
+
return document.head.appendChild(st);
|
8
|
+
});
|
9
|
+
|
10
|
+
}).call(this);
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "ace_vimtura/rails"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
metadata
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ace_vimtura-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- d-theus
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-06-14 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: Gem version == node package version
|
42
|
+
email:
|
43
|
+
- slma0x02@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- ".travis.yml"
|
50
|
+
- Gemfile
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- ace_vimtura-rails.gemspec
|
54
|
+
- app/assets/javascripts/ace_vimtura/ace_vimtura.js
|
55
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/ace.js
|
56
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/mode-haml.js
|
57
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/mode-html.js
|
58
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/mode-jade.js
|
59
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/mode-markdown.js
|
60
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/ambiance.js
|
61
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/chaos.js
|
62
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/chrome.js
|
63
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/clouds.js
|
64
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/clouds_midnight.js
|
65
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/cobalt.js
|
66
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/crimson_editor.js
|
67
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/dawn.js
|
68
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/dreamweaver.js
|
69
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/eclipse.js
|
70
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/github.js
|
71
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/idle_fingers.js
|
72
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/iplastic.js
|
73
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/katzenmilch.js
|
74
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/kr_theme.js
|
75
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/kuroir.js
|
76
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/merbivore.js
|
77
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/merbivore_soft.js
|
78
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/mono_industrial.js
|
79
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/monokai.js
|
80
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/pastel_on_dark.js
|
81
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/solarized_dark.js
|
82
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/solarized_light.js
|
83
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/sqlserver.js
|
84
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/terminal.js
|
85
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/textmate.js
|
86
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/tomorrow.js
|
87
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/tomorrow_night.js
|
88
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/tomorrow_night_blue.js
|
89
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/tomorrow_night_bright.js
|
90
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/tomorrow_night_eighties.js
|
91
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/twilight.js
|
92
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/vibrant_ink.js
|
93
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/theme/xcode.js
|
94
|
+
- app/assets/javascripts/ace_vimtura/lib/ace/vim.js
|
95
|
+
- app/assets/javascripts/ace_vimtura/lib/renderers/haml.js
|
96
|
+
- app/assets/javascripts/ace_vimtura/lib/renderers/markdown.js
|
97
|
+
- app/assets/javascripts/ace_vimtura/lib/require.js
|
98
|
+
- app/assets/javascripts/ace_vimtura/main.js
|
99
|
+
- app/assets/javascripts/ace_vimtura/preview.js
|
100
|
+
- app/assets/javascripts/ace_vimtura/renderers/haml.js
|
101
|
+
- app/assets/javascripts/ace_vimtura/renderers/html.js
|
102
|
+
- app/assets/javascripts/ace_vimtura/renderers/jade.js
|
103
|
+
- app/assets/javascripts/ace_vimtura/renderers/markdown.js
|
104
|
+
- app/assets/javascripts/ace_vimtura/style.js
|
105
|
+
- bin/console
|
106
|
+
- bin/setup
|
107
|
+
- lib/ace_vimtura/rails.rb
|
108
|
+
- lib/ace_vimtura/rails/engine.rb
|
109
|
+
- lib/ace_vimtura/rails/version.rb
|
110
|
+
homepage: http://github.com/d-theus/ace_vimtura-rails
|
111
|
+
licenses: []
|
112
|
+
metadata: {}
|
113
|
+
post_install_message:
|
114
|
+
rdoc_options: []
|
115
|
+
require_paths:
|
116
|
+
- lib
|
117
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
requirements: []
|
128
|
+
rubyforge_project:
|
129
|
+
rubygems_version: 2.4.5
|
130
|
+
signing_key:
|
131
|
+
specification_version: 4
|
132
|
+
summary: Rails wrapper for http://github.com/d-theus/ace_vimtura
|
133
|
+
test_files: []
|