Skip to content

Commit

Permalink
Merge pull request #5 from neocotic/wip-1.0.4
Browse files Browse the repository at this point in the history
WIP 1.0.4
  • Loading branch information
neocotic committed Jun 19, 2014
2 parents 396bcb0 + 67e71c4 commit 5907ad0
Show file tree
Hide file tree
Showing 294 changed files with 369 additions and 190 deletions.
15 changes: 15 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## Version 1.0.4, 2014.06.19

* [#3](https://github.com/neocotic/injector-chrome/issues/3): Fix editor clipping bug with long snippets
* [#4](https://github.com/neocotic/injector-chrome/issues/4): Add keyboard shortcuts (Win32+Linux: `Ctrl+S`, Mac: `⌘+S`) to the editor for quickly saving snippets
* Update development dependencies
* Update [ace][] to v1.1.3
* Update [async][] to v0.9.0
* Update [jQuery][] to v2.1.1
* Update [less][] to v1.7.1

## Version 1.0.3, 2014.03.12

* Fix alignment bug with Analytics label
Expand All @@ -10,3 +20,8 @@
## Version 1.0.1, 2014.03.09

* Fix donation link

[ace]: http://ace.c9.io
[async]: https://github.com/caolan/async
[jquery]: http://jquery.com
[less]: http://lesscss.org
Binary file modified dist/Injector.zip
Binary file not shown.
19 changes: 15 additions & 4 deletions docs/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ <h2 id="editor">Editor</h2>

<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">events</span>:
<span class="hljs-string">'click #reset_button:not(:disabled)'</span>: <span class="hljs-string">'reset'</span>
<span class="hljs-string">'click #update_button:not(:disabled)'</span>: <span class="hljs-string">'save'</span></pre></div></div>
<span class="hljs-string">'click #save_button:not(:disabled)'</span>: <span class="hljs-string">'save'</span></pre></div></div>

</li>

Expand Down Expand Up @@ -378,10 +378,10 @@ <h2 id="editor">Editor</h2>

</div>

<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">save</span>: <span class="hljs-function"><span class="hljs-params">(event)</span> -&gt;</span>
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">save</span>:<span class="hljs-function"> -&gt;</span>
<span class="hljs-keyword">return</span> <span class="hljs-keyword">unless</span> <span class="hljs-property">@hasModel</span>()

$button = $(event.currentTarget)
$button = $(<span class="hljs-string">'#save_button'</span>)
code = <span class="hljs-property">@options</span>.ace.getValue()

$button.button(<span class="hljs-string">'loading'</span>).delay(<span class="hljs-number">500</span>)
Expand Down Expand Up @@ -409,7 +409,7 @@ <h2 id="editor">Editor</h2>
</div>

<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">update</span>: <span class="hljs-function"><span class="hljs-params">(<span class="hljs-property">@model</span>)</span> -&gt;</span>
$buttons = <span class="hljs-property">@$</span>(<span class="hljs-string">'#reset_button, #update_button'</span>)</pre></div></div>
$buttons = <span class="hljs-property">@$</span>(<span class="hljs-string">'#reset_button, #save_button'</span>)</pre></div></div>

</li>

Expand Down Expand Up @@ -826,6 +826,17 @@ <h2 id="editor">Editor</h2>
<span class="hljs-property">@ace</span>.getSession().<span class="hljs-literal">on</span> <span class="hljs-string">'change'</span>,<span class="hljs-function"> =&gt;</span>
<span class="hljs-property">@model</span>.trigger(<span class="hljs-string">'modified'</span>, <span class="hljs-property">@hasUnsavedChanges</span>(), <span class="hljs-property">@ace</span>.getValue()) <span class="hljs-keyword">if</span> <span class="hljs-property">@hasModel</span>()

<span class="hljs-property">@ace</span>.commands.addCommand({
<span class="hljs-attribute">name</span>: <span class="hljs-string">'save'</span>
<span class="hljs-attribute">bindKey</span>: {
<span class="hljs-attribute">mac</span>: <span class="hljs-string">'Command-S'</span>
<span class="hljs-attribute">win</span>: <span class="hljs-string">'Ctrl-S'</span>
}
<span class="hljs-attribute">readOnly</span>: <span class="hljs-literal">no</span>
<span class="hljs-attribute">exec</span>:<span class="hljs-function"> =&gt;</span>
<span class="hljs-property">@controls</span>.save()
})

<span class="hljs-property">@settings</span> = <span class="hljs-keyword">new</span> EditorSettingsView({ <span class="hljs-attribute">model</span>: <span class="hljs-property">@options</span>.settings })
<span class="hljs-property">@controls</span> = <span class="hljs-keyword">new</span> EditorControls({ <span class="hljs-property">@ace</span> })
<span class="hljs-property">@modes</span> = <span class="hljs-keyword">new</span> EditorModes({ <span class="hljs-property">@ace</span> })
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "injector-chrome",
"description": "Chrome extension that allows you to create custom code snippets to be injected into any website",
"version": "1.0.3",
"version": "1.0.4",
"homepage": "http://neocotic.com/injector",
"bugs": {
"url": "https://github.com/neocotic/injector-chrome/issues"
Expand Down Expand Up @@ -35,15 +35,15 @@
"type": "git"
},
"devDependencies": {
"grunt": "~0.4.2",
"grunt": "~0.4.5",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-compress": "~0.7.0",
"grunt-contrib-compress": "~0.9.1",
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-coffee": "~0.10.1",
"grunt-contrib-less": "~0.10.0",
"grunt-contrib-uglify": "~0.4.0",
"grunt-contrib-watch": "~0.5.3",
"grunt-cson": "~0.7.0",
"grunt-contrib-less": "~0.11.2",
"grunt-contrib-uglify": "~0.5.0",
"grunt-contrib-watch": "~0.6.1",
"grunt-cson": "~0.8.0",
"grunt-json-minify": "~0.4.0",
"grunt-docco": "~0.3.3",
"int17": "~0.3.0"
Expand Down
20 changes: 14 additions & 6 deletions src/_locales/en/messages.cson
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,18 @@ editor_theme_idle_fingers:
message: 'Idle Fingers'
description: 'Text for the Idle Fingers editor theme.'

editor_theme_katzenmilch:
message: 'Katzenmilch'
description: 'Text for the Katzenmilch editor theme.'

editor_theme_kr:
message: 'KR'
description: 'Text for the KR editor theme.'

editor_theme_kuroir:
message: 'Kuroir'
description: 'Text for the Kuroir editor theme.'

editor_theme_label:
message: 'Theme'
description: 'Label for the editor Theme field.'
Expand Down Expand Up @@ -259,7 +267,7 @@ snippet_clone_header:
description: 'Header for the clone snippet form modal dialog.'

snippet_edit_button:
message: 'Update'
message: 'Save'
description: 'Text for the submit button in the edit snippet modal dialog form.'

snippet_edit_header:
Expand Down Expand Up @@ -290,10 +298,10 @@ top_button:
message: 'Back to top'
description: 'Text for the link in the footer that takes the user to the top of the page.'

update_button:
message: 'Update'
description: 'Text for the Update button.'
save_button:
message: 'Save'
description: 'Text for the Save button.'

update_button_alt:
save_button_alt:
message: 'Saving...'
description: 'Alternative text for the Update button which is displayed after being clicked.'
description: 'Alternative text for the Save button which is displayed after being clicked.'
19 changes: 15 additions & 4 deletions src/coffee/options.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ EditorControls = Injector.View.extend {
# Register DOM events for the editor controls
events:
'click #reset_button:not(:disabled)': 'reset'
'click #update_button:not(:disabled)': 'save'
'click #save_button:not(:disabled)': 'save'

# Render the editor controls.
render: ->
Expand All @@ -81,10 +81,10 @@ EditorControls = Injector.View.extend {
ace.gotoLine(0)

# Save the contents of the Ace editor as the snippet code.
save: (event) ->
save: ->
return unless @hasModel()

$button = $(event.currentTarget)
$button = $('#save_button')
code = @options.ace.getValue()

$button.button('loading').delay(500)
Expand All @@ -100,7 +100,7 @@ EditorControls = Injector.View.extend {

# Update the state of the editor controls.
update: (@model) ->
$buttons = @$('#reset_button, #update_button')
$buttons = @$('#reset_button, #save_button')

# Ensure that specific buttons are only enabled when a snippet is selected.
$buttons.prop('disabled', not @hasModel())
Expand Down Expand Up @@ -265,6 +265,17 @@ EditorView = Injector.View.extend {
@ace.getSession().on 'change', =>
@model.trigger('modified', @hasUnsavedChanges(), @ace.getValue()) if @hasModel()

@ace.commands.addCommand({
name: 'save'
bindKey: {
mac: 'Command-S'
win: 'Ctrl-S'
}
readOnly: no
exec: =>
@controls.save()
})

@settings = new EditorSettingsView({ model: @options.settings })
@controls = new EditorControls({ @ace })
@modes = new EditorModes({ @ace })
Expand Down
2 changes: 2 additions & 0 deletions src/configuration.cson
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ editor:
'eclipse'
'github'
'idle_fingers'
'katzenmilch'
'kr'
'kuroir'
'merbivore'
'merbivore_soft'
'mono_industrial'
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.cson
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ background:
]
persistent: no

version: '1.0.3'
version: '1.0.4'

icons:
16: 'img/icon-128.png'
Expand Down
4 changes: 2 additions & 2 deletions src/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ <h4 id="snippet_clone_header" class="modal-title" data-i18n-content="snippet_clo

<div id="editor_controls" class="pull-right">
<button id="reset_button" type="button" class="btn btn-warning" data-i18n-content="reset_button" disabled></button>
<button id="update_button" type="button" class="btn btn-success" data-i18n-values=".innerHTML:update_button;data-loading-text:update_button_alt" disabled></button>
<button id="save_button" type="button" class="btn btn-success" data-i18n-values=".innerHTML:save_button;data-loading-text:save_button_alt" disabled></button>
</div>
</div>
</div>
Expand Down Expand Up @@ -300,4 +300,4 @@ <h4 id="editor_settings_header" class="modal-title" data-i18n-content="editor_se
</div>
</div>
</body>
</html>
</html>
12 changes: 1 addition & 11 deletions src/vendor/js/ace/ace.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/vendor/js/ace/ext-chromevox.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5907ad0

Please sign in to comment.