kiteditor 1.0.11 → 1.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/POST_INSTALL +21 -0
- data/{vendor → app}/assets/images/mercury/button.png +0 -0
- data/{vendor → app}/assets/images/mercury/close.png +0 -0
- data/app/assets/images/mercury/default-snippet.png +0 -0
- data/{vendor → app}/assets/images/mercury/loading-dark.gif +0 -0
- data/{vendor → app}/assets/images/mercury/loading-light.gif +0 -0
- data/{vendor → app}/assets/images/mercury/missing-image.png +0 -0
- data/{vendor → app}/assets/images/mercury/search-icon.png +0 -0
- data/{vendor → app}/assets/images/mercury/temp-logo.png +0 -0
- data/app/assets/images/mercury/toolbar/editable/buttons.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/_expander.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/_pressed.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/action.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/historypanel.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/insertcharacter.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/insertlink.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/insertmedia.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/inserttable.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/inspectorpanel.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/notespanel.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/preview.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/redo.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/save.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/snippetpanel.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/tools.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/undo.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/user.png +0 -0
- data/app/assets/images/mercury/toolbar/snippets/buttons.png +0 -0
- data/{vendor/assets/javascripts/mercury/dependencies → app/assets/javascripts}/jquery-1.7.js +0 -0
- data/{vendor → app}/assets/javascripts/mercury.js +60 -87
- data/{vendor → app}/assets/javascripts/mercury/dependencies/jquery-ui-1.8.13.custom.js +0 -0
- data/{vendor → app}/assets/javascripts/mercury/dependencies/jquery.additions.js +103 -13
- data/{vendor → app}/assets/javascripts/mercury/dependencies/jquery.htmlClean.js +0 -0
- data/{vendor → app}/assets/javascripts/mercury/dependencies/liquidmetal.js +0 -0
- data/{vendor → app}/assets/javascripts/mercury/dependencies/showdown.js +0 -0
- data/{vendor → app}/assets/javascripts/mercury/dialog.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/dialogs/backcolor.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/dialogs/forecolor.js.coffee +1 -1
- data/{vendor → app}/assets/javascripts/mercury/dialogs/formatblock.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/dialogs/snippetpanel.js.coffee +1 -1
- data/{vendor → app}/assets/javascripts/mercury/dialogs/style.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/finalize.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/history_buffer.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/lightview.js.coffee +38 -17
- data/app/assets/javascripts/mercury/locales/ar.locale.js.coffee +201 -0
- data/app/assets/javascripts/mercury/locales/da.locale.js.coffee +208 -0
- data/{vendor → app}/assets/javascripts/mercury/locales/de.locale.js.coffee +4 -10
- data/{vendor → app}/assets/javascripts/mercury/locales/es.locale.js.coffee +3 -9
- data/{vendor → app}/assets/javascripts/mercury/locales/example.local.js.coffee +3 -5
- data/{vendor → app}/assets/javascripts/mercury/locales/fr.locale.js.coffee +3 -9
- data/app/assets/javascripts/mercury/locales/hu.locale.js.coffee +209 -0
- data/{vendor → app}/assets/javascripts/mercury/locales/it.locale.js.coffee +3 -9
- data/{vendor → app}/assets/javascripts/mercury/locales/ko.local.js.coffee +4 -10
- data/{vendor → app}/assets/javascripts/mercury/locales/nl.locale.js.coffee +3 -9
- data/app/assets/javascripts/mercury/locales/pl.locale.js.coffee +213 -0
- data/{vendor → app}/assets/javascripts/mercury/locales/pt.locale.js.coffee +3 -9
- data/app/assets/javascripts/mercury/locales/ru.locale.js.coffee +200 -0
- data/{vendor → app}/assets/javascripts/mercury/locales/sv.local.js.coffee +3 -9
- data/{vendor → app}/assets/javascripts/mercury/locales/swedish_chef.locale.js.coffee +3 -9
- data/app/assets/javascripts/mercury/locales/uk.locale.js.coffee +200 -0
- data/app/assets/javascripts/mercury/locales/zh.local.js.coffee +203 -0
- data/app/assets/javascripts/mercury/mercury-compiled.js +10720 -0
- data/{vendor → app}/assets/javascripts/mercury/mercury.js.coffee +10 -1
- data/{vendor → app}/assets/javascripts/mercury/modal.js.coffee +62 -40
- data/{vendor → app}/assets/javascripts/mercury/modals/htmleditor.js.coffee +1 -0
- data/{vendor → app}/assets/javascripts/mercury/modals/insertcharacter.js.coffee +1 -0
- data/app/assets/javascripts/mercury/modals/insertlink.js.coffee +152 -0
- data/app/assets/javascripts/mercury/modals/insertmedia.js.coffee +132 -0
- data/{vendor → app}/assets/javascripts/mercury/modals/insertsnippet.js.coffee +2 -0
- data/app/assets/javascripts/mercury/modals/inserttable.js.coffee +68 -0
- data/{vendor → app}/assets/javascripts/mercury/native_extensions.js.coffee +0 -6
- data/{vendor → app}/assets/javascripts/mercury/page_editor.js.coffee +84 -50
- data/{vendor → app}/assets/javascripts/mercury/palette.js.coffee +1 -1
- data/{vendor → app}/assets/javascripts/mercury/panel.js.coffee +3 -2
- data/{vendor → app}/assets/javascripts/mercury/plugins/save_as_xml/mercury/page_editor.js.coffee +2 -2
- data/{vendor → app}/assets/javascripts/mercury/plugins/save_as_xml/plugin.js +0 -0
- data/{vendor → app}/assets/javascripts/mercury/region.js.coffee +18 -17
- data/{vendor/assets/javascripts/mercury/regions/editable.js.coffee → app/assets/javascripts/mercury/regions/full.js.coffee} +41 -31
- data/app/assets/javascripts/mercury/regions/image.js.coffee +93 -0
- data/{vendor/assets/javascripts/mercury/regions/markupable.js.coffee → app/assets/javascripts/mercury/regions/markdown.js.coffee} +29 -24
- data/{vendor → app}/assets/javascripts/mercury/regions/simple.js.coffee +11 -54
- data/{vendor/assets/javascripts/mercury/regions/snippetable.js.coffee → app/assets/javascripts/mercury/regions/snippets.js.coffee} +10 -9
- data/{vendor → app}/assets/javascripts/mercury/select.js.coffee +1 -1
- data/app/assets/javascripts/mercury/snippet.js.coffee +136 -0
- data/{vendor → app}/assets/javascripts/mercury/snippet_toolbar.js.coffee +19 -6
- data/{vendor → app}/assets/javascripts/mercury/statusbar.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/support/history.js +0 -0
- data/{vendor → app}/assets/javascripts/mercury/table_editor.js.coffee +16 -0
- data/{vendor → app}/assets/javascripts/mercury/toolbar.button.js.coffee +45 -30
- data/{vendor → app}/assets/javascripts/mercury/toolbar.button_group.js.coffee +2 -2
- data/{vendor → app}/assets/javascripts/mercury/toolbar.expander.js.coffee +4 -4
- data/{vendor → app}/assets/javascripts/mercury/toolbar.js.coffee +10 -6
- data/{vendor → app}/assets/javascripts/mercury/tooltip.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/uploader.js.coffee +37 -19
- data/app/assets/stylesheets/_mercury-bootstrap-overrides.scss +61 -0
- data/app/assets/stylesheets/_mercury-sass.scss +33 -0
- data/{vendor → app}/assets/stylesheets/mercury.css +1 -5
- data/{vendor → app}/assets/stylesheets/mercury/all_images.css.erb +6 -2
- data/app/assets/stylesheets/mercury/bootstrap-ish.css +1367 -0
- data/app/assets/stylesheets/mercury/bootstrap-overrides.css +61 -0
- data/{vendor → app}/assets/stylesheets/mercury/dialog.css +21 -8
- data/{vendor → app}/assets/stylesheets/mercury/lightview.css +6 -56
- data/app/assets/stylesheets/mercury/mercury.css +43 -0
- data/{vendor → app}/assets/stylesheets/mercury/modal.css +15 -32
- data/{vendor → app}/assets/stylesheets/mercury/statusbar.css +0 -0
- data/{vendor → app}/assets/stylesheets/mercury/toolbar.css +4 -1
- data/{vendor → app}/assets/stylesheets/mercury/tooltip.css +0 -0
- data/{vendor → app}/assets/stylesheets/mercury/uploader.css +4 -4
- data/app/helpers/mercury_helper.rb +7 -0
- data/app/views/layouts/mercury.html.erb +10 -20
- data/app/views/layouts/mercury.html.haml +19 -0
- data/app/views/layouts/mercury.html.slim +19 -0
- data/app/views/mercury/modals/character.html +1 -1
- data/app/views/mercury/modals/htmleditor.html +3 -7
- data/app/views/mercury/modals/link.html +37 -51
- data/app/views/mercury/modals/media.html +102 -0
- data/app/views/mercury/modals/table.html +79 -73
- data/app/views/mercury/panels/snippets.html +6 -1
- data/app/views/mercury/snippets/example/options.html.erb +23 -27
- data/app/views/mercury/snippets/no_options/preview.html.erb +1 -0
- data/config/routes.rb +9 -0
- data/features/generators/authentication.feature +10 -0
- data/features/generators/images.feature +41 -0
- data/features/generators/install.feature +21 -0
- data/features/loading/loading.feature +5 -2
- data/features/loading/user_interface.feature +9 -7
- data/features/regions/{editable → full}/advanced_editing.feature +0 -0
- data/features/regions/full/basic_editing.feature +198 -0
- data/features/regions/{editable → full}/inserting_links.feature +20 -19
- data/features/regions/{editable → full}/inserting_media.feature +36 -18
- data/features/regions/{editable → full}/inserting_snippets.feature +28 -18
- data/features/regions/{editable → full}/inserting_special_characters.feature +2 -2
- data/features/regions/full/inserting_tables.feature +109 -0
- data/features/regions/{editable → full}/pasting.feature +0 -0
- data/features/regions/{editable → full}/uploading_images.feature +0 -0
- data/features/regions/{markupable → image}/uploading_images.feature +0 -0
- data/features/regions/{markupable → markdown}/advanced_editing.feature +0 -0
- data/features/regions/{markupable → markdown}/basic_editing.feature +0 -0
- data/features/regions/{markupable → markdown}/inserting_links.feature +0 -0
- data/features/regions/{markupable → markdown}/inserting_media.feature +0 -0
- data/features/regions/{markupable → markdown}/inserting_snippets.feature +0 -0
- data/features/regions/{markupable → markdown}/inserting_special_characters.feature +0 -0
- data/features/regions/{markupable → markdown}/inserting_tables.feature +0 -0
- data/features/regions/{snippetable/advanced_editing.feature → markdown/uploading_images.feature} +0 -0
- data/features/regions/simple/basic_editing.feature +5 -0
- data/features/regions/{snippetable/basic_editing.feature → snippets/advanced_editing.feature} +0 -0
- data/features/regions/{snippetable/inserting_snippets.feature → snippets/basic_editing.feature} +0 -0
- data/{vendor/assets/javascripts/mercury/locales/da.locale.js.coffee → features/regions/snippets/inserting_snippets.feature} +0 -0
- data/features/saving/saving.feature +8 -8
- data/features/step_definitions/custom_web_steps.rb +22 -0
- data/features/step_definitions/generator_steps.rb +23 -0
- data/features/step_definitions/mercury_steps.rb +1 -438
- data/features/support/aruba.rb +28 -0
- data/features/support/env.rb +11 -1
- data/features/support/selectors.rb +23 -0
- data/lib/generators/mercury/install/authentication/authentication_generator.rb +17 -0
- data/lib/generators/mercury/install/images/images_generator.rb +47 -0
- data/{app/models/mercury/image.rb → lib/generators/mercury/install/images/templates/ar_paperclip_image.rb} +7 -0
- data/{db/migrate/20110526035601_create_mercury_images.rb → lib/generators/mercury/install/images/templates/ar_paperclip_image_migration.rb} +0 -0
- data/{app/controllers/mercury → lib/generators/mercury/install/images/templates}/images_controller.rb +0 -0
- data/lib/generators/mercury/install/{templates → images/templates}/mongoid_paperclip_image.rb +0 -0
- data/lib/generators/mercury/install/install_generator.rb +12 -23
- data/lib/mercury-rails.rb +1 -2
- data/lib/mercury/authentication.rb +1 -0
- data/lib/mercury/cucumber/step_definitions.rb +13 -0
- data/lib/mercury/cucumber/step_definitions/mercury_steps.rb +408 -0
- data/{features → lib/mercury/cucumber}/support/mercury_contents.rb +3 -3
- data/{features → lib/mercury/cucumber}/support/mercury_selectors.rb +0 -20
- data/lib/mercury/engine.rb +19 -0
- data/lib/mercury/rails.rb +5 -0
- data/lib/mercury/version.rb +3 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +0 -0
- data/spec/dummy/app/assets/javascripts/prototype.js +6082 -0
- data/spec/dummy/app/assets/stylesheets/application.css.scss +110 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/layouts/mercury.html.erb +28 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +58 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +10 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/teabag.rb +9 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +5 -0
- data/spec/dummy/db/.gitkeep +0 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/blank.html +1 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/images/bunny.gif +0 -0
- data/spec/dummy/public/images/bunny2.jpg +0 -0
- data/spec/dummy/public/index.html +279 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/javascripts/{templates → fixtures}/mercury/dialog.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/dialogs/backcolor.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/dialogs/forecolor.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/dialogs/formatblock.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/dialogs/snippetpanel.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/dialogs/style.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/lightview.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/modal.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/modals/htmleditor.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/modals/insertcharacter.html +0 -0
- data/spec/javascripts/fixtures/mercury/modals/insertlink.html +67 -0
- data/spec/javascripts/fixtures/mercury/modals/insertmedia.html +87 -0
- data/spec/javascripts/{templates → fixtures}/mercury/modals/insertsnippet.html +0 -0
- data/spec/javascripts/fixtures/mercury/modals/inserttable.html +73 -0
- data/spec/javascripts/{templates → fixtures}/mercury/page_editor.html +4 -4
- data/spec/javascripts/{templates → fixtures}/mercury/palette.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/panel.html +0 -0
- data/spec/javascripts/fixtures/mercury/region.html +6 -0
- data/spec/javascripts/fixtures/mercury/regions/full.html +1 -0
- data/spec/javascripts/fixtures/mercury/regions/image.html +1 -0
- data/spec/javascripts/fixtures/mercury/regions/markdown.html +1 -0
- data/spec/javascripts/fixtures/mercury/regions/simple.html +1 -0
- data/spec/javascripts/fixtures/mercury/regions/snippets.html +4 -0
- data/spec/javascripts/{templates → fixtures}/mercury/select.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/snippet.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/snippet_toolbar.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/statusbar.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/table_editor.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/toolbar.button.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/toolbar.button_group.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/toolbar.expander.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/toolbar.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/tooltip.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/uploader.html +0 -0
- data/spec/javascripts/mercury/{dialog_spec.js.coffee → dialog_spec.coffee} +11 -12
- data/spec/javascripts/mercury/dialogs/backcolor_spec.js.coffee +2 -3
- data/spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee +3 -4
- data/spec/javascripts/mercury/dialogs/formatblock_spec.js.coffee +2 -3
- data/spec/javascripts/mercury/dialogs/snippetpanel_spec.js.coffee +2 -3
- data/spec/javascripts/mercury/dialogs/style_spec.js.coffee +2 -3
- data/spec/javascripts/mercury/lightview_spec.js.coffee +180 -142
- data/spec/javascripts/mercury/mercury_spec.js.coffee +19 -13
- data/spec/javascripts/mercury/modal_spec.js.coffee +192 -148
- data/spec/javascripts/mercury/modals/htmleditor_spec.js.coffee +4 -5
- data/spec/javascripts/mercury/modals/insertcharacter_spec.js.coffee +2 -3
- data/spec/javascripts/mercury/modals/insertlink_spec.js.coffee +107 -34
- data/spec/javascripts/mercury/modals/insertmedia_spec.js.coffee +106 -26
- data/spec/javascripts/mercury/modals/insertsnippet_spec.js.coffee +2 -3
- data/spec/javascripts/mercury/modals/inserttable_spec.js.coffee +50 -40
- data/spec/javascripts/mercury/page_editor_spec.js.coffee +124 -80
- data/spec/javascripts/mercury/palette_spec.js.coffee +4 -5
- data/spec/javascripts/mercury/panel_spec.js.coffee +9 -12
- data/spec/javascripts/mercury/region_spec.js.coffee +22 -17
- data/spec/javascripts/mercury/regions/{editable_spec.js.coffee → full_spec.js.coffee} +26 -28
- data/spec/javascripts/mercury/regions/image_spec.js.coffee +33 -0
- data/spec/javascripts/mercury/regions/{markupable_spec.js.coffee → markdown_spec.js.coffee} +32 -34
- data/spec/javascripts/mercury/regions/simple_spec.js.coffee +32 -0
- data/spec/javascripts/mercury/regions/{snippetable_spec.js.coffee → snippets_spec.js.coffee} +54 -55
- data/spec/javascripts/mercury/select_spec.js.coffee +4 -5
- data/spec/javascripts/mercury/snippet_spec.js.coffee +92 -16
- data/spec/javascripts/mercury/snippet_toolbar_spec.js.coffee +31 -16
- data/spec/javascripts/mercury/statusbar_spec.js.coffee +9 -10
- data/spec/javascripts/mercury/table_editor_spec.js.coffee +1 -2
- data/spec/javascripts/mercury/toolbar.button_group_spec.js.coffee +7 -9
- data/spec/javascripts/mercury/toolbar.button_spec.js.coffee +55 -26
- data/spec/javascripts/mercury/toolbar.expander_spec.js.coffee +13 -13
- data/spec/javascripts/mercury/toolbar_spec.js.coffee +43 -14
- data/spec/javascripts/mercury/tooltip_spec.js.coffee +1 -2
- data/spec/javascripts/mercury/uploader_spec.js.coffee +47 -33
- data/spec/javascripts/spec_helper.coffee +4 -0
- data/spec/javascripts/{spec_helper.js → support/event_simulation.js} +0 -2
- data/spec/teabag_env.rb +32 -0
- metadata +366 -196
- data/features/regions/editable/basic_editing.feature +0 -195
- data/features/regions/editable/inserting_tables.feature +0 -109
- data/spec/javascripts/templates/mercury/modals/insertlink.html +0 -30
- data/spec/javascripts/templates/mercury/modals/insertmedia.html +0 -35
- data/spec/javascripts/templates/mercury/modals/inserttable.html +0 -27
- data/spec/javascripts/templates/mercury/region.html +0 -2
- data/spec/javascripts/templates/mercury/regions/editable.html +0 -3
- data/spec/javascripts/templates/mercury/regions/snippetable.html +0 -4
- data/vendor/assets/javascripts/mercury/modals/inserttable.js.coffee +0 -54
- data/vendor/assets/javascripts/mercury_loader.js +0 -193
- data/vendor/assets/javascripts/mercury_overrides.js +0 -6
- data/vendor/assets/stylesheets/mercury/mercury.css +0 -151
- data/vendor/assets/stylesheets/mercury_overrides.css +0 -17
@@ -1,16 +1,17 @@
|
|
1
|
-
class @Mercury.Regions.
|
1
|
+
class @Mercury.Regions.Snippets extends Mercury.Region
|
2
2
|
@supported: document.getElementById
|
3
|
-
@supportedText: "
|
4
|
-
|
5
|
-
type
|
3
|
+
@supportedText: "Chrome 10+, Firefox 4+, IE 7+, Safari 5+, Opera 8+"
|
4
|
+
type = 'snippets'
|
5
|
+
type: -> type
|
6
6
|
|
7
7
|
constructor: (@element, @window, @options = {}) ->
|
8
|
-
|
8
|
+
Mercury.log("building #{type}", @element, @options)
|
9
9
|
super
|
10
10
|
@makeSortable()
|
11
11
|
|
12
12
|
|
13
13
|
build: ->
|
14
|
+
jQuery(snippet).attr('data-version', 0) for snippet in @element.find('[data-snippet]')
|
14
15
|
@element.css({minHeight: 20}) if @element.css('minHeight') == '0px'
|
15
16
|
|
16
17
|
|
@@ -45,7 +46,7 @@ class @Mercury.Regions.Snippetable extends Mercury.Region
|
|
45
46
|
return if @previewing || ! Mercury.snippet
|
46
47
|
@focus()
|
47
48
|
event.preventDefault()
|
48
|
-
Mercury.Snippet.displayOptionsFor(Mercury.snippet)
|
49
|
+
Mercury.Snippet.displayOptionsFor(Mercury.snippet.name, {}, Mercury.snippet.hasOptions)
|
49
50
|
|
50
51
|
jQuery(@document).on 'keydown', (event) =>
|
51
52
|
return if @previewing || Mercury.region != @
|
@@ -77,7 +78,7 @@ class @Mercury.Regions.Snippetable extends Mercury.Region
|
|
77
78
|
|
78
79
|
execCommand: (action, options = {}) ->
|
79
80
|
super
|
80
|
-
handler.call(@, options) if handler = Mercury.Regions.
|
81
|
+
handler.call(@, options) if handler = Mercury.Regions.Snippets.actions[action]
|
81
82
|
|
82
83
|
|
83
84
|
makeSortable: ->
|
@@ -85,7 +86,7 @@ class @Mercury.Regions.Snippetable extends Mercury.Region
|
|
85
86
|
document: @document,
|
86
87
|
scroll: false, #scrolling is buggy
|
87
88
|
containment: 'parent',
|
88
|
-
items: '
|
89
|
+
items: '[data-snippet]',
|
89
90
|
opacity: 0.4,
|
90
91
|
revert: 100,
|
91
92
|
tolerance: 'pointer',
|
@@ -93,7 +94,7 @@ class @Mercury.Regions.Snippetable extends Mercury.Region
|
|
93
94
|
Mercury.trigger('hide:toolbar', {type: 'snippet', immediately: true})
|
94
95
|
return true
|
95
96
|
stop: =>
|
96
|
-
setTimeout(
|
97
|
+
setTimeout((=> @pushHistory()), 100)
|
97
98
|
return true
|
98
99
|
}
|
99
100
|
|
@@ -20,7 +20,7 @@ class @Mercury.Select extends Mercury.Dialog
|
|
20
20
|
|
21
21
|
position: (keepVisible) ->
|
22
22
|
@element.css({top: 0, left: 0, display: 'block', visibility: 'hidden'})
|
23
|
-
position = @button.
|
23
|
+
position = @button.position()
|
24
24
|
elementWidth = @element.width()
|
25
25
|
elementHeight = @element.height()
|
26
26
|
documentHeight = jQuery(document).height()
|
@@ -0,0 +1,136 @@
|
|
1
|
+
class @Mercury.Snippet
|
2
|
+
|
3
|
+
@all: []
|
4
|
+
|
5
|
+
@displayOptionsFor: (name, options = {}, displayOptions = true) ->
|
6
|
+
if displayOptions
|
7
|
+
Mercury.modal @optionsUrl(name), jQuery.extend({
|
8
|
+
title: 'Snippet Options'
|
9
|
+
handler: 'insertSnippet'
|
10
|
+
snippetName: name
|
11
|
+
loadType: Mercury.config.snippets.method
|
12
|
+
}, options)
|
13
|
+
else
|
14
|
+
snippet = Mercury.Snippet.create(name)
|
15
|
+
Mercury.trigger('action', {action: 'insertSnippet', value: snippet})
|
16
|
+
Mercury.snippet = null
|
17
|
+
|
18
|
+
|
19
|
+
@optionsUrl: (name) ->
|
20
|
+
url = Mercury.config.snippets.optionsUrl
|
21
|
+
url = url() if typeof(url) == 'function'
|
22
|
+
return url.replace(':name', name)
|
23
|
+
|
24
|
+
|
25
|
+
@previewUrl: (name) ->
|
26
|
+
url = Mercury.config.snippets.previewUrl
|
27
|
+
url = url() if typeof(url) == 'function'
|
28
|
+
return url.replace(':name', name)
|
29
|
+
|
30
|
+
|
31
|
+
@create: (name, options) ->
|
32
|
+
instance = new Mercury.Snippet(name, @uniqueId(), options)
|
33
|
+
@all.push(instance)
|
34
|
+
return instance
|
35
|
+
|
36
|
+
@uniqueId: ->
|
37
|
+
[i, identity] = [0, "snippet_0"]
|
38
|
+
identities = (snippet.identity for snippet in @all)
|
39
|
+
|
40
|
+
while identities.indexOf(identity) isnt -1
|
41
|
+
i += 1
|
42
|
+
identity = "snippet_#{i}"
|
43
|
+
|
44
|
+
return identity
|
45
|
+
|
46
|
+
|
47
|
+
@find: (identity) ->
|
48
|
+
for snippet in @all
|
49
|
+
return snippet if snippet.identity == identity
|
50
|
+
return null
|
51
|
+
|
52
|
+
|
53
|
+
@load: (snippets) ->
|
54
|
+
for own identity, details of snippets
|
55
|
+
instance = new Mercury.Snippet(details.name, identity, details)
|
56
|
+
@all.push(instance)
|
57
|
+
|
58
|
+
|
59
|
+
@clearAll = ->
|
60
|
+
delete @all
|
61
|
+
@all = []
|
62
|
+
|
63
|
+
|
64
|
+
constructor: (@name, @identity, options = {}) ->
|
65
|
+
@version = 0
|
66
|
+
@data = ''
|
67
|
+
@wrapperTag = 'div'
|
68
|
+
@wrapperClass = ''
|
69
|
+
@history = new Mercury.HistoryBuffer()
|
70
|
+
@setOptions(options)
|
71
|
+
|
72
|
+
|
73
|
+
getHTML: (context, callback = null) ->
|
74
|
+
elementClass = "#{@name}-snippet"
|
75
|
+
elementClass += " #{@wrapperClass}" if @wrapperClass
|
76
|
+
element = jQuery("<#{@wrapperTag}>", {
|
77
|
+
class: elementClass
|
78
|
+
contenteditable: "false"
|
79
|
+
'data-snippet': @identity
|
80
|
+
'data-version': @version
|
81
|
+
}, context)
|
82
|
+
element.html("[#{@identity}]")
|
83
|
+
@loadPreview(element, callback)
|
84
|
+
return element
|
85
|
+
|
86
|
+
|
87
|
+
getText: (callback) ->
|
88
|
+
return "[--#{@identity}--]"
|
89
|
+
|
90
|
+
|
91
|
+
loadPreview: (element, callback = null) ->
|
92
|
+
jQuery.ajax Snippet.previewUrl(@name), {
|
93
|
+
headers: Mercury.ajaxHeaders()
|
94
|
+
type: Mercury.config.snippets.method
|
95
|
+
data: @options
|
96
|
+
success: (data) =>
|
97
|
+
@data = data
|
98
|
+
element.html(data)
|
99
|
+
callback() if callback
|
100
|
+
error: =>
|
101
|
+
Mercury.notify('Error loading the preview for the \"%s\" snippet.', @name)
|
102
|
+
}
|
103
|
+
|
104
|
+
|
105
|
+
displayOptions: ->
|
106
|
+
Mercury.snippet = @
|
107
|
+
Mercury.modal Snippet.optionsUrl(@name), {
|
108
|
+
title: 'Snippet Options',
|
109
|
+
handler: 'insertSnippet',
|
110
|
+
loadType: Mercury.config.snippets.method,
|
111
|
+
loadData: @options
|
112
|
+
}
|
113
|
+
|
114
|
+
|
115
|
+
setOptions: (@options) ->
|
116
|
+
delete(@options['authenticity_token'])
|
117
|
+
delete(@options['utf8'])
|
118
|
+
@wrapperTag = @options.wrapperTag if @options.wrapperTag
|
119
|
+
@wrapperClass = @options.wrapperClass if @options.wrapperClass
|
120
|
+
@version += 1
|
121
|
+
@history.push(@options)
|
122
|
+
|
123
|
+
|
124
|
+
setVersion: (version = null) ->
|
125
|
+
version = parseInt(version)
|
126
|
+
if version && @history.stack[version - 1]
|
127
|
+
@version = version
|
128
|
+
@options = @history.stack[version - 1]
|
129
|
+
return true
|
130
|
+
return false
|
131
|
+
|
132
|
+
|
133
|
+
serialize: ->
|
134
|
+
return $.extend({name: @name}, @options )
|
135
|
+
|
136
|
+
|
@@ -1,6 +1,7 @@
|
|
1
1
|
class @Mercury.SnippetToolbar extends Mercury.Toolbar
|
2
2
|
|
3
3
|
constructor: (@document, @options = {}) ->
|
4
|
+
@_boundEvents = []
|
4
5
|
super(@options)
|
5
6
|
|
6
7
|
|
@@ -8,29 +9,34 @@ class @Mercury.SnippetToolbar extends Mercury.Toolbar
|
|
8
9
|
@element = jQuery('<div>', {class: 'mercury-toolbar mercury-snippet-toolbar', style: 'display:none'})
|
9
10
|
@element.appendTo(jQuery(@options.appendTo).get(0) ? 'body')
|
10
11
|
|
11
|
-
for own buttonName, options of Mercury.config.toolbars.
|
12
|
+
for own buttonName, options of Mercury.config.toolbars.snippets
|
12
13
|
button = @buildButton(buttonName, options)
|
13
14
|
button.appendTo(@element) if button
|
14
15
|
|
15
16
|
|
16
17
|
bindEvents: ->
|
17
|
-
Mercury
|
18
|
+
@bindReleasableEvent Mercury, 'show:toolbar', (event, options) =>
|
18
19
|
return unless options.snippet
|
19
20
|
options.snippet.mouseout => @hide()
|
20
21
|
@show(options.snippet)
|
21
22
|
|
22
|
-
Mercury
|
23
|
+
@bindReleasableEvent Mercury, 'hide:toolbar', (event, options) =>
|
23
24
|
return unless options.type && options.type == 'snippet'
|
24
25
|
@hide(options.immediately)
|
25
26
|
|
27
|
+
@bindReleasableEvent jQuery(@document), 'scroll', =>
|
28
|
+
@position() if @visible
|
29
|
+
|
26
30
|
@element.mousemove =>
|
27
31
|
clearTimeout(@hideTimeout)
|
28
32
|
|
29
33
|
@element.mouseout =>
|
30
34
|
@hide()
|
31
35
|
|
32
|
-
|
33
|
-
|
36
|
+
|
37
|
+
bindReleasableEvent: (target, eventName, handler)->
|
38
|
+
target.on eventName, handler
|
39
|
+
@_boundEvents.push [target, eventName, handler]
|
34
40
|
|
35
41
|
|
36
42
|
show: (@snippet) ->
|
@@ -65,8 +71,15 @@ class @Mercury.SnippetToolbar extends Mercury.Toolbar
|
|
65
71
|
@element.hide()
|
66
72
|
@visible = false
|
67
73
|
else
|
68
|
-
@hideTimeout = setTimeout
|
74
|
+
@hideTimeout = setTimeout =>
|
69
75
|
@element.stop().animate {opacity: 0}, 300, 'easeInOutSine', =>
|
70
76
|
@element.hide()
|
71
77
|
@visible = false
|
78
|
+
, 500
|
79
|
+
|
80
|
+
release: ->
|
81
|
+
@element.off()
|
82
|
+
@element.remove()
|
83
|
+
target.off(eventName, handler) for [target, eventName, handler] in @_boundEvents
|
84
|
+
@_boundEvents = []
|
72
85
|
|
File without changes
|
File without changes
|
@@ -10,6 +10,14 @@ jQuery.extend Mercury.tableEditor,
|
|
10
10
|
@rowCount = @getRowCount()
|
11
11
|
|
12
12
|
|
13
|
+
addColumnBefore: ->
|
14
|
+
@addColumn('before')
|
15
|
+
|
16
|
+
|
17
|
+
addColumnAfter: ->
|
18
|
+
@addColumn('after')
|
19
|
+
|
20
|
+
|
13
21
|
addColumn: (position = 'after') ->
|
14
22
|
sig = @cellSignatureFor(@cell)
|
15
23
|
|
@@ -42,6 +50,14 @@ jQuery.extend Mercury.tableEditor,
|
|
42
50
|
@setColspanFor(cell, @colspanFor(cell) - 1) for cell in adjusting
|
43
51
|
|
44
52
|
|
53
|
+
addRowBefore: ->
|
54
|
+
@addRow('before')
|
55
|
+
|
56
|
+
|
57
|
+
addRowAfter: ->
|
58
|
+
@addRow('after')
|
59
|
+
|
60
|
+
|
45
61
|
addRow: (position = 'after') ->
|
46
62
|
newRow = jQuery('<tr>')
|
47
63
|
|
@@ -34,25 +34,25 @@ class @Mercury.Toolbar.Button
|
|
34
34
|
|
35
35
|
when 'palette'
|
36
36
|
@element.addClass("mercury-button-palette")
|
37
|
-
|
38
|
-
@handled[type] = new Mercury.Palette(
|
37
|
+
result = if jQuery.isFunction(mixed) then mixed.call(@, @name) else mixed
|
38
|
+
@handled[type] = if typeof result is 'string' then new Mercury.Palette(result, @name, @defaultDialogOptions()) else result
|
39
39
|
|
40
40
|
when 'select'
|
41
41
|
@element.addClass("mercury-button-select").find('em').html(@title)
|
42
|
-
|
43
|
-
@handled[type] = new Mercury.Select(
|
42
|
+
result = if jQuery.isFunction(mixed) then mixed.call(@, @name) else mixed
|
43
|
+
@handled[type] = if typeof result is 'string' then new Mercury.Select(result, @name, @defaultDialogOptions()) else result
|
44
44
|
|
45
45
|
when 'panel'
|
46
46
|
@element.addClass('mercury-button-panel')
|
47
|
-
url = if jQuery.isFunction(mixed) then mixed.call(@, @name) else mixed
|
48
47
|
@handled['toggle'] = true
|
49
|
-
|
48
|
+
result = if jQuery.isFunction(mixed) then mixed.call(@, @name) else mixed
|
49
|
+
@handled[type] = if typeof result is 'string' then new Mercury.Panel(result, @name, @defaultDialogOptions()) else result
|
50
50
|
|
51
51
|
when 'modal'
|
52
|
-
@handled[type] = if jQuery.isFunction(mixed) then mixed.
|
52
|
+
@handled[type] = if jQuery.isFunction(mixed) then mixed.call(@, @name) else mixed
|
53
53
|
|
54
54
|
when 'lightview'
|
55
|
-
@handled[type] = if jQuery.isFunction(mixed) then mixed.
|
55
|
+
@handled[type] = if jQuery.isFunction(mixed) then mixed.call(@, @name) else mixed
|
56
56
|
|
57
57
|
else throw Mercury.I18n('Unknown button type \"%s\" used for the \"%s\" button.', type, @name)
|
58
58
|
|
@@ -72,8 +72,8 @@ class @Mercury.Toolbar.Button
|
|
72
72
|
@element.removeClass('active')
|
73
73
|
|
74
74
|
Mercury.on 'region:focused', (event, options) =>
|
75
|
-
if @handled.regions && options.region && options.region.type
|
76
|
-
if @handled.regions.indexOf(options.region.type) > -1
|
75
|
+
if @handled.regions && options.region && options.region.type()
|
76
|
+
if @handled.regions.indexOf(options.region.type()) > -1
|
77
77
|
@element.removeClass('disabled')
|
78
78
|
else
|
79
79
|
@element.addClass('disabled')
|
@@ -89,32 +89,47 @@ class @Mercury.Toolbar.Button
|
|
89
89
|
|
90
90
|
@element.on 'click', (event) =>
|
91
91
|
if @element.closest('.disabled').length then return
|
92
|
+
@handleClick(event)
|
93
|
+
|
94
|
+
|
95
|
+
handleClick: (event) ->
|
96
|
+
handled = false
|
97
|
+
for own type, mixed of @handled
|
98
|
+
switch type
|
99
|
+
when 'toggle'
|
100
|
+
@togglePressed() unless @handled.mode
|
101
|
+
|
102
|
+
when 'mode'
|
103
|
+
handled = true
|
104
|
+
Mercury.trigger('mode', {mode: mixed})
|
105
|
+
|
106
|
+
when 'modal'
|
107
|
+
handled = @handleModal(event)
|
108
|
+
|
109
|
+
when 'lightview'
|
110
|
+
handled = @handleLightview(event)
|
111
|
+
|
112
|
+
when 'palette', 'select', 'panel'
|
113
|
+
handled = @handleDialog(event, type)
|
114
|
+
|
115
|
+
Mercury.trigger('action', {action: @name}) unless handled
|
116
|
+
Mercury.trigger('focus:frame') if @options['regions'] && @options['regions'].length
|
92
117
|
|
93
|
-
handled = false
|
94
|
-
for own type, mixed of @handled
|
95
|
-
switch type
|
96
|
-
when 'toggle'
|
97
|
-
@togglePressed() unless @handled.mode
|
98
118
|
|
99
|
-
|
100
|
-
|
101
|
-
|
119
|
+
handleModal: (event) ->
|
120
|
+
Mercury.modal(@handled.modal, {title: @summary || @title, handler: @name})
|
121
|
+
return true
|
102
122
|
|
103
|
-
when 'modal'
|
104
|
-
handled = true
|
105
|
-
Mercury.modal(@handled.modal, {title: @summary || @title, handler: @name})
|
106
123
|
|
107
|
-
|
108
|
-
|
109
|
-
|
124
|
+
handleLightview: (event) ->
|
125
|
+
Mercury.lightview(@handled.lightview, {title: @summary || @title, handler: @name, closeButton: true})
|
126
|
+
return true
|
110
127
|
|
111
|
-
when 'palette', 'select', 'panel'
|
112
|
-
event.stopPropagation()
|
113
|
-
handled = true
|
114
|
-
@handled[type].toggle()
|
115
128
|
|
116
|
-
|
117
|
-
|
129
|
+
handleDialog: (event, type) ->
|
130
|
+
event.stopPropagation()
|
131
|
+
@handled[type].toggle()
|
132
|
+
return true
|
118
133
|
|
119
134
|
|
120
135
|
defaultDialogOptions: ->
|
@@ -25,8 +25,8 @@ class @Mercury.Toolbar.ButtonGroup
|
|
25
25
|
@element.addClass('disabled')
|
26
26
|
|
27
27
|
Mercury.on 'region:focused', (event, options) =>
|
28
|
-
if @regions && options.region && options.region.type
|
29
|
-
if @regions.indexOf(options.region.type) > -1
|
28
|
+
if @regions && options.region && options.region.type()
|
29
|
+
if @regions.indexOf(options.region.type()) > -1
|
30
30
|
@element.removeClass('disabled') unless @options._context
|
31
31
|
else
|
32
32
|
@element.addClass('disabled')
|
@@ -2,13 +2,13 @@ class @Mercury.Toolbar.Expander extends Mercury.Palette
|
|
2
2
|
|
3
3
|
constructor: (@name, @options) ->
|
4
4
|
@container = @options.for
|
5
|
-
@containerWidth = @container.outerWidth()
|
6
5
|
super(null, @name, @options)
|
7
6
|
return @element
|
8
7
|
|
9
8
|
|
10
9
|
build: ->
|
11
|
-
@container.css({whiteSpace: 'normal'})
|
10
|
+
@container.css({whiteSpace: 'normal', visibility: 'hidden', display: 'block'})
|
11
|
+
@container.css({visibility: 'visible'})
|
12
12
|
@trigger = jQuery('<div>', {class: 'mercury-toolbar-expander'}).appendTo(jQuery(@options.appendTo).get(0) ? 'body')
|
13
13
|
@element = jQuery('<div>', {class: "mercury-palette mercury-expander mercury-#{@name}-expander", style: 'display:none'})
|
14
14
|
@windowResize()
|
@@ -37,13 +37,13 @@ class @Mercury.Toolbar.Expander extends Mercury.Palette
|
|
37
37
|
|
38
38
|
|
39
39
|
windowResize: ->
|
40
|
-
if
|
40
|
+
if jQuery(window).width() == @container.outerWidth() then @trigger.show() else @trigger.hide()
|
41
41
|
@hide()
|
42
42
|
|
43
43
|
|
44
44
|
position: (keepVisible) ->
|
45
45
|
@element.css({top: 0, left: 0, display: 'block', visibility: 'hidden'})
|
46
|
-
position = @trigger.
|
46
|
+
position = @trigger.position()
|
47
47
|
width = @element.width()
|
48
48
|
|
49
49
|
position.left = position.left - width + @trigger.width() if position.left + width > jQuery(window).width()
|