kiteditor 1.0.12 → 1.0.13
Sign up to get free protection for your applications and to get access to all the features.
- data/{lib/generators/mercury/install/images/templates → app/controllers/mercury}/images_controller.rb +0 -0
- data/{lib/generators/mercury/install/images/templates/ar_paperclip_image.rb → app/models/mercury/image.rb} +0 -7
- data/app/views/layouts/mercury.html.erb +20 -10
- data/app/views/mercury/modals/character.html +1 -1
- data/app/views/mercury/modals/htmleditor.html +7 -3
- data/app/views/mercury/modals/link.html +51 -37
- data/app/views/mercury/modals/media.html +0 -102
- data/app/views/mercury/modals/table.html +73 -79
- data/app/views/mercury/panels/snippets.html +1 -6
- data/app/views/mercury/snippets/example/options.html.erb +27 -23
- data/{lib/generators/mercury/install/images/templates/ar_paperclip_image_migration.rb → db/migrate/20110526035601_create_mercury_images.rb} +0 -0
- data/features/loading/loading.feature +2 -5
- data/features/loading/user_interface.feature +7 -9
- data/features/regions/{full → editable}/advanced_editing.feature +0 -0
- data/features/regions/editable/basic_editing.feature +195 -0
- data/features/regions/{full → editable}/inserting_links.feature +19 -20
- data/features/regions/{full → editable}/inserting_media.feature +18 -36
- data/features/regions/{full → editable}/inserting_snippets.feature +18 -28
- data/features/regions/{full → editable}/inserting_special_characters.feature +2 -2
- data/features/regions/editable/inserting_tables.feature +109 -0
- data/features/regions/{full → editable}/pasting.feature +0 -0
- data/features/regions/{full → editable}/uploading_images.feature +0 -0
- data/features/regions/{markdown → markupable}/advanced_editing.feature +0 -0
- data/features/regions/{markdown → markupable}/basic_editing.feature +0 -0
- data/features/regions/{markdown → markupable}/inserting_links.feature +0 -0
- data/features/regions/{markdown → markupable}/inserting_media.feature +0 -0
- data/features/regions/{markdown → markupable}/inserting_snippets.feature +0 -0
- data/features/regions/{markdown → markupable}/inserting_special_characters.feature +0 -0
- data/features/regions/{markdown → markupable}/inserting_tables.feature +0 -0
- data/features/regions/{image → markupable}/uploading_images.feature +0 -0
- data/features/regions/{snippets → snippetable}/advanced_editing.feature +0 -0
- data/features/regions/{snippets → snippetable}/basic_editing.feature +0 -0
- data/features/regions/{snippets → snippetable}/inserting_snippets.feature +0 -0
- data/features/saving/saving.feature +8 -8
- data/features/step_definitions/mercury_steps.rb +438 -1
- data/features/support/env.rb +1 -11
- data/{lib/mercury/cucumber → features}/support/mercury_contents.rb +3 -3
- data/{lib/mercury/cucumber → features}/support/mercury_selectors.rb +20 -0
- data/features/support/selectors.rb +0 -23
- data/lib/generators/mercury/install/install_generator.rb +23 -12
- data/lib/generators/mercury/install/{images/templates → templates}/mongoid_paperclip_image.rb +0 -0
- data/lib/mercury/authentication.rb +0 -1
- data/lib/mercury-rails.rb +2 -1
- data/spec/javascripts/mercury/{dialog_spec.coffee → dialog_spec.js.coffee} +12 -11
- data/spec/javascripts/mercury/dialogs/backcolor_spec.js.coffee +3 -2
- data/spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee +4 -3
- data/spec/javascripts/mercury/dialogs/formatblock_spec.js.coffee +3 -2
- data/spec/javascripts/mercury/dialogs/snippetpanel_spec.js.coffee +3 -2
- data/spec/javascripts/mercury/dialogs/style_spec.js.coffee +3 -2
- data/spec/javascripts/mercury/lightview_spec.js.coffee +142 -180
- data/spec/javascripts/mercury/mercury_spec.js.coffee +13 -19
- data/spec/javascripts/mercury/modal_spec.js.coffee +148 -192
- data/spec/javascripts/mercury/modals/htmleditor_spec.js.coffee +5 -4
- data/spec/javascripts/mercury/modals/insertcharacter_spec.js.coffee +3 -2
- data/spec/javascripts/mercury/modals/insertlink_spec.js.coffee +34 -107
- data/spec/javascripts/mercury/modals/insertmedia_spec.js.coffee +26 -106
- data/spec/javascripts/mercury/modals/insertsnippet_spec.js.coffee +3 -2
- data/spec/javascripts/mercury/modals/inserttable_spec.js.coffee +40 -50
- data/spec/javascripts/mercury/page_editor_spec.js.coffee +80 -124
- data/spec/javascripts/mercury/palette_spec.js.coffee +5 -4
- data/spec/javascripts/mercury/panel_spec.js.coffee +12 -9
- data/spec/javascripts/mercury/region_spec.js.coffee +17 -22
- data/spec/javascripts/mercury/regions/{full_spec.js.coffee → editable_spec.js.coffee} +28 -26
- data/spec/javascripts/mercury/regions/{markdown_spec.js.coffee → markupable_spec.js.coffee} +34 -32
- data/spec/javascripts/mercury/regions/{snippets_spec.js.coffee → snippetable_spec.js.coffee} +55 -54
- data/spec/javascripts/mercury/select_spec.js.coffee +5 -4
- data/spec/javascripts/mercury/snippet_spec.js.coffee +16 -92
- data/spec/javascripts/mercury/snippet_toolbar_spec.js.coffee +16 -31
- data/spec/javascripts/mercury/statusbar_spec.js.coffee +10 -9
- data/spec/javascripts/mercury/table_editor_spec.js.coffee +2 -1
- data/spec/javascripts/mercury/toolbar.button_group_spec.js.coffee +9 -7
- data/spec/javascripts/mercury/toolbar.button_spec.js.coffee +26 -55
- data/spec/javascripts/mercury/toolbar.expander_spec.js.coffee +13 -13
- data/spec/javascripts/mercury/toolbar_spec.js.coffee +14 -43
- data/spec/javascripts/mercury/tooltip_spec.js.coffee +2 -1
- data/spec/javascripts/mercury/uploader_spec.js.coffee +33 -47
- data/spec/javascripts/{support/event_simulation.js → spec_helper.js} +2 -0
- data/spec/javascripts/{fixtures → templates}/mercury/dialog.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/dialogs/backcolor.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/dialogs/forecolor.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/dialogs/formatblock.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/dialogs/snippetpanel.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/dialogs/style.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/lightview.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/modal.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/modals/htmleditor.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/modals/insertcharacter.html +0 -0
- data/spec/javascripts/templates/mercury/modals/insertlink.html +30 -0
- data/spec/javascripts/templates/mercury/modals/insertmedia.html +35 -0
- data/spec/javascripts/{fixtures → templates}/mercury/modals/insertsnippet.html +0 -0
- data/spec/javascripts/templates/mercury/modals/inserttable.html +27 -0
- data/spec/javascripts/{fixtures → templates}/mercury/page_editor.html +4 -4
- data/spec/javascripts/{fixtures → templates}/mercury/palette.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/panel.html +0 -0
- data/spec/javascripts/templates/mercury/region.html +2 -0
- data/spec/javascripts/templates/mercury/regions/editable.html +3 -0
- data/spec/javascripts/templates/mercury/regions/snippetable.html +4 -0
- data/spec/javascripts/{fixtures → templates}/mercury/select.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/snippet.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/snippet_toolbar.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/statusbar.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/table_editor.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/toolbar.button.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/toolbar.button_group.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/toolbar.expander.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/toolbar.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/tooltip.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/uploader.html +0 -0
- data/{app → vendor}/assets/images/mercury/button.png +0 -0
- data/{app → vendor}/assets/images/mercury/close.png +0 -0
- data/{app → vendor}/assets/images/mercury/loading-dark.gif +0 -0
- data/{app → vendor}/assets/images/mercury/loading-light.gif +0 -0
- data/{app → vendor}/assets/images/mercury/missing-image.png +0 -0
- data/{app → vendor}/assets/images/mercury/search-icon.png +0 -0
- data/{app → vendor}/assets/images/mercury/temp-logo.png +0 -0
- data/{app/assets/javascripts → vendor/assets/javascripts/mercury/dependencies}/jquery-1.7.js +0 -0
- data/{app → vendor}/assets/javascripts/mercury/dependencies/jquery-ui-1.8.13.custom.js +0 -0
- data/{app → vendor}/assets/javascripts/mercury/dependencies/jquery.additions.js +13 -103
- data/{app → vendor}/assets/javascripts/mercury/dependencies/jquery.htmlClean.js +0 -0
- data/{app → vendor}/assets/javascripts/mercury/dependencies/liquidmetal.js +0 -0
- data/{app → vendor}/assets/javascripts/mercury/dependencies/showdown.js +0 -0
- data/{app → vendor}/assets/javascripts/mercury/dialog.js.coffee +0 -0
- data/{app → vendor}/assets/javascripts/mercury/dialogs/backcolor.js.coffee +0 -0
- data/{app → vendor}/assets/javascripts/mercury/dialogs/forecolor.js.coffee +1 -1
- data/{app → vendor}/assets/javascripts/mercury/dialogs/formatblock.js.coffee +0 -0
- data/{app → vendor}/assets/javascripts/mercury/dialogs/snippetpanel.js.coffee +1 -1
- data/{app → vendor}/assets/javascripts/mercury/dialogs/style.js.coffee +0 -0
- data/{app → vendor}/assets/javascripts/mercury/finalize.js.coffee +0 -0
- data/{app → vendor}/assets/javascripts/mercury/history_buffer.js.coffee +0 -0
- data/{app → vendor}/assets/javascripts/mercury/lightview.js.coffee +17 -38
- data/{features/regions/markdown/uploading_images.feature → vendor/assets/javascripts/mercury/locales/da.locale.js.coffee} +0 -0
- data/{app → vendor}/assets/javascripts/mercury/locales/de.locale.js.coffee +10 -4
- data/{app → vendor}/assets/javascripts/mercury/locales/es.locale.js.coffee +9 -3
- data/{app → vendor}/assets/javascripts/mercury/locales/example.local.js.coffee +5 -3
- data/{app → vendor}/assets/javascripts/mercury/locales/fr.locale.js.coffee +9 -3
- data/{app → vendor}/assets/javascripts/mercury/locales/it.locale.js.coffee +9 -3
- data/{app → vendor}/assets/javascripts/mercury/locales/ko.local.js.coffee +10 -4
- data/{app → vendor}/assets/javascripts/mercury/locales/nl.locale.js.coffee +9 -3
- data/{app → vendor}/assets/javascripts/mercury/locales/pt.locale.js.coffee +9 -3
- data/{app → vendor}/assets/javascripts/mercury/locales/sv.local.js.coffee +9 -3
- data/{app → vendor}/assets/javascripts/mercury/locales/swedish_chef.locale.js.coffee +9 -3
- data/{app → vendor}/assets/javascripts/mercury/mercury.js.coffee +1 -10
- data/{app → vendor}/assets/javascripts/mercury/modal.js.coffee +40 -62
- data/{app → vendor}/assets/javascripts/mercury/modals/htmleditor.js.coffee +2 -3
- data/{app → vendor}/assets/javascripts/mercury/modals/insertcharacter.js.coffee +0 -1
- data/{app → vendor}/assets/javascripts/mercury/modals/insertsnippet.js.coffee +0 -2
- data/vendor/assets/javascripts/mercury/modals/inserttable.js.coffee +54 -0
- data/{app → vendor}/assets/javascripts/mercury/native_extensions.js.coffee +6 -0
- data/{app → vendor}/assets/javascripts/mercury/page_editor.js.coffee +50 -84
- data/{app → vendor}/assets/javascripts/mercury/palette.js.coffee +1 -1
- data/{app → vendor}/assets/javascripts/mercury/panel.js.coffee +2 -3
- data/{app → vendor}/assets/javascripts/mercury/plugins/save_as_xml/mercury/page_editor.js.coffee +2 -2
- data/{app → vendor}/assets/javascripts/mercury/plugins/save_as_xml/plugin.js +0 -0
- data/{app → vendor}/assets/javascripts/mercury/region.js.coffee +17 -18
- data/{app/assets/javascripts/mercury/regions/full.js.coffee → vendor/assets/javascripts/mercury/regions/editable.js.coffee} +31 -41
- data/{app/assets/javascripts/mercury/regions/markdown.js.coffee → vendor/assets/javascripts/mercury/regions/markupable.js.coffee} +24 -29
- data/{app → vendor}/assets/javascripts/mercury/regions/simple.js.coffee +54 -11
- data/{app/assets/javascripts/mercury/regions/snippets.js.coffee → vendor/assets/javascripts/mercury/regions/snippetable.js.coffee} +9 -10
- data/{app → vendor}/assets/javascripts/mercury/select.js.coffee +1 -1
- data/{app → vendor}/assets/javascripts/mercury/snippet_toolbar.js.coffee +6 -19
- data/{app → vendor}/assets/javascripts/mercury/statusbar.js.coffee +0 -0
- data/{app → vendor}/assets/javascripts/mercury/support/history.js +0 -0
- data/{app → vendor}/assets/javascripts/mercury/table_editor.js.coffee +0 -16
- data/{app → vendor}/assets/javascripts/mercury/toolbar.button.js.coffee +30 -45
- data/{app → vendor}/assets/javascripts/mercury/toolbar.button_group.js.coffee +2 -2
- data/{app → vendor}/assets/javascripts/mercury/toolbar.expander.js.coffee +4 -4
- data/{app → vendor}/assets/javascripts/mercury/toolbar.js.coffee +6 -10
- data/{app → vendor}/assets/javascripts/mercury/tooltip.js.coffee +0 -0
- data/{app → vendor}/assets/javascripts/mercury/uploader.js.coffee +19 -37
- data/{app → vendor}/assets/javascripts/mercury.js +87 -60
- data/vendor/assets/javascripts/mercury_loader.js +193 -0
- data/vendor/assets/javascripts/mercury_overrides.js +6 -0
- data/{app → vendor}/assets/stylesheets/mercury/all_images.css.erb +2 -6
- data/{app → vendor}/assets/stylesheets/mercury/dialog.css +8 -21
- data/{app → vendor}/assets/stylesheets/mercury/lightview.css +56 -6
- data/vendor/assets/stylesheets/mercury/mercury.css +151 -0
- data/{app → vendor}/assets/stylesheets/mercury/modal.css +32 -15
- data/{app → vendor}/assets/stylesheets/mercury/statusbar.css +0 -0
- data/{app → vendor}/assets/stylesheets/mercury/toolbar.css +1 -4
- data/{app → vendor}/assets/stylesheets/mercury/tooltip.css +0 -0
- data/{app → vendor}/assets/stylesheets/mercury/uploader.css +4 -4
- data/{app → vendor}/assets/stylesheets/mercury.css +5 -1
- data/vendor/assets/stylesheets/mercury_overrides.css +17 -0
- metadata +197 -367
- data/POST_INSTALL +0 -21
- data/app/assets/images/mercury/default-snippet.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/app/assets/javascripts/mercury/locales/ar.locale.js.coffee +0 -201
- data/app/assets/javascripts/mercury/locales/da.locale.js.coffee +0 -208
- data/app/assets/javascripts/mercury/locales/hu.locale.js.coffee +0 -209
- data/app/assets/javascripts/mercury/locales/pl.locale.js.coffee +0 -213
- data/app/assets/javascripts/mercury/locales/ru.locale.js.coffee +0 -200
- data/app/assets/javascripts/mercury/locales/uk.locale.js.coffee +0 -200
- data/app/assets/javascripts/mercury/locales/zh.local.js.coffee +0 -203
- data/app/assets/javascripts/mercury/mercury-compiled.js +0 -10720
- data/app/assets/javascripts/mercury/modals/insertlink.js.coffee +0 -152
- data/app/assets/javascripts/mercury/modals/insertmedia.js.coffee +0 -132
- data/app/assets/javascripts/mercury/modals/inserttable.js.coffee +0 -68
- data/app/assets/javascripts/mercury/regions/image.js.coffee +0 -93
- data/app/assets/javascripts/mercury/snippet.js.coffee +0 -136
- data/app/assets/stylesheets/_mercury-bootstrap-overrides.scss +0 -61
- data/app/assets/stylesheets/_mercury-sass.scss +0 -33
- data/app/assets/stylesheets/mercury/bootstrap-ish.css +0 -1367
- data/app/assets/stylesheets/mercury/bootstrap-overrides.css +0 -61
- data/app/assets/stylesheets/mercury/mercury.css +0 -43
- data/app/helpers/mercury_helper.rb +0 -7
- data/app/views/layouts/mercury.html.haml +0 -19
- data/app/views/layouts/mercury.html.slim +0 -19
- data/app/views/mercury/snippets/no_options/preview.html.erb +0 -1
- data/config/routes.rb +0 -9
- data/features/generators/authentication.feature +0 -10
- data/features/generators/images.feature +0 -41
- data/features/generators/install.feature +0 -21
- data/features/regions/full/basic_editing.feature +0 -198
- data/features/regions/full/inserting_tables.feature +0 -109
- data/features/regions/simple/basic_editing.feature +0 -5
- data/features/step_definitions/custom_web_steps.rb +0 -22
- data/features/step_definitions/generator_steps.rb +0 -23
- data/features/support/aruba.rb +0 -28
- data/lib/generators/mercury/install/authentication/authentication_generator.rb +0 -17
- data/lib/generators/mercury/install/images/images_generator.rb +0 -47
- data/lib/mercury/cucumber/step_definitions/mercury_steps.rb +0 -408
- data/lib/mercury/cucumber/step_definitions.rb +0 -13
- data/lib/mercury/engine.rb +0 -19
- data/lib/mercury/rails.rb +0 -5
- data/lib/mercury/version.rb +0 -3
- data/spec/dummy/Rakefile +0 -7
- data/spec/dummy/app/assets/javascripts/application.js +0 -0
- data/spec/dummy/app/assets/javascripts/prototype.js +0 -6082
- data/spec/dummy/app/assets/stylesheets/application.css.scss +0 -110
- data/spec/dummy/app/controllers/application_controller.rb +0 -3
- data/spec/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/dummy/app/views/layouts/mercury.html.erb +0 -28
- data/spec/dummy/config/application.rb +0 -58
- data/spec/dummy/config/boot.rb +0 -10
- data/spec/dummy/config/database.yml +0 -10
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -37
- data/spec/dummy/config/environments/production.rb +0 -67
- data/spec/dummy/config/environments/test.rb +0 -37
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/inflections.rb +0 -15
- data/spec/dummy/config/initializers/mime_types.rb +0 -5
- data/spec/dummy/config/initializers/secret_token.rb +0 -7
- data/spec/dummy/config/initializers/session_store.rb +0 -8
- data/spec/dummy/config/initializers/teabag.rb +0 -9
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/locales/en.yml +0 -5
- data/spec/dummy/config/routes.rb +0 -5
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/db/.gitkeep +0 -0
- data/spec/dummy/public/500.html +0 -25
- data/spec/dummy/public/blank.html +0 -1
- 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 +0 -279
- data/spec/dummy/script/rails +0 -6
- data/spec/javascripts/fixtures/mercury/modals/insertlink.html +0 -67
- data/spec/javascripts/fixtures/mercury/modals/insertmedia.html +0 -87
- data/spec/javascripts/fixtures/mercury/modals/inserttable.html +0 -73
- data/spec/javascripts/fixtures/mercury/region.html +0 -6
- data/spec/javascripts/fixtures/mercury/regions/full.html +0 -1
- data/spec/javascripts/fixtures/mercury/regions/image.html +0 -1
- data/spec/javascripts/fixtures/mercury/regions/markdown.html +0 -1
- data/spec/javascripts/fixtures/mercury/regions/simple.html +0 -1
- data/spec/javascripts/fixtures/mercury/regions/snippets.html +0 -4
- data/spec/javascripts/mercury/regions/image_spec.js.coffee +0 -33
- data/spec/javascripts/mercury/regions/simple_spec.js.coffee +0 -32
- data/spec/javascripts/spec_helper.coffee +0 -4
- data/spec/teabag_env.rb +0 -32
@@ -1,152 +0,0 @@
|
|
1
|
-
@Mercury.modalHandlers.insertLink = {
|
2
|
-
|
3
|
-
initialize: ->
|
4
|
-
@editing = false
|
5
|
-
@content = null
|
6
|
-
|
7
|
-
# make the inputs work with the radio buttons
|
8
|
-
@element.find('.control-label input').on('click', @onLabelChecked)
|
9
|
-
@element.find('.controls .optional, .controls .required').on('focus', @onInputFocused)
|
10
|
-
|
11
|
-
# show/hide the link target options on target change
|
12
|
-
@element.find('#link_target').on('change', => @onChangeTarget())
|
13
|
-
|
14
|
-
@initializeForm()
|
15
|
-
|
16
|
-
# build the link on form submission
|
17
|
-
@element.find('form').on 'submit', (event) =>
|
18
|
-
event.preventDefault()
|
19
|
-
@validateForm()
|
20
|
-
unless @valid
|
21
|
-
@resize()
|
22
|
-
return
|
23
|
-
@submitForm()
|
24
|
-
@hide()
|
25
|
-
|
26
|
-
|
27
|
-
initializeForm: ->
|
28
|
-
@fillExistingBookmarks()
|
29
|
-
|
30
|
-
# get the selection and initialize its information into the form
|
31
|
-
return unless Mercury.region && Mercury.region.selection
|
32
|
-
selection = Mercury.region.selection()
|
33
|
-
|
34
|
-
# set the text content
|
35
|
-
@element.find('#link_text').val(selection.textContent()) if selection.textContent
|
36
|
-
|
37
|
-
# if we're editing a link prefill the information
|
38
|
-
|
39
|
-
a = selection.commonAncestor(true).closest('a') if selection && selection.commonAncestor
|
40
|
-
img = /<img/.test(selection.htmlContent()) if selection.htmlContent
|
41
|
-
return false unless img || a && a.length
|
42
|
-
|
43
|
-
# don't allow changing the content on edit
|
44
|
-
@element.find('#link_text_container').hide()
|
45
|
-
|
46
|
-
@content = selection.htmlContent() if img
|
47
|
-
|
48
|
-
return false unless a && a.length
|
49
|
-
@editing = a
|
50
|
-
|
51
|
-
# fill in the external url or bookmark select based on what it looks like
|
52
|
-
if a.attr('href') && a.attr('href').indexOf('#') == 0
|
53
|
-
bookmarkSelect = @element.find('#link_existing_bookmark')
|
54
|
-
bookmarkSelect.val(a.attr('href').replace(/[^#]*#/, ''))
|
55
|
-
bookmarkSelect.closest('.control-group').find('input[type=radio]').prop('checked', true)
|
56
|
-
else
|
57
|
-
@element.find('#link_external_url').val(a.attr('href'))
|
58
|
-
|
59
|
-
# if it has a name, assume it's a bookmark target
|
60
|
-
if a.attr('name')
|
61
|
-
newBookmarkInput = @element.find('#link_new_bookmark')
|
62
|
-
newBookmarkInput.val(a.attr('name'))
|
63
|
-
newBookmarkInput.closest('.control-group').find('input[type=radio]').prop('checked', true)
|
64
|
-
|
65
|
-
# if it has a target, select it, and try to pull options out
|
66
|
-
if a.attr('target')
|
67
|
-
@element.find('#link_target').val(a.attr('target'))
|
68
|
-
|
69
|
-
# if it's a popup window
|
70
|
-
if a.attr('href') && a.attr('href').indexOf('javascript:void') == 0
|
71
|
-
href = a.attr('href')
|
72
|
-
@element.find('#link_external_url').val(href.match(/window.open\('([^']+)',/)[1])
|
73
|
-
@element.find('#link_target').val('popup')
|
74
|
-
@element.find('#link_popup_width').val(href.match(/width=(\d+),/)[1])
|
75
|
-
@element.find('#link_popup_height').val(href.match(/height=(\d+),/)[1])
|
76
|
-
@element.find('#popup_options').show()
|
77
|
-
|
78
|
-
|
79
|
-
fillExistingBookmarks: ->
|
80
|
-
bookmarkSelect = @element.find('#link_existing_bookmark')
|
81
|
-
for tag in jQuery('a[name]', window.mercuryInstance.document)
|
82
|
-
bookmarkSelect.append(jQuery('<option>', {value: jQuery(tag).attr('name')}).text(jQuery(tag).text()))
|
83
|
-
|
84
|
-
|
85
|
-
onLabelChecked: ->
|
86
|
-
forInput = jQuery(@).closest('.control-label').attr('for')
|
87
|
-
jQuery(@).closest('.control-group').find("##{forInput}").focus()
|
88
|
-
|
89
|
-
|
90
|
-
onInputFocused: ->
|
91
|
-
jQuery(@).closest('.control-group').find('input[type=radio]').prop('checked', true)
|
92
|
-
|
93
|
-
|
94
|
-
onChangeTarget: ->
|
95
|
-
@element.find(".link-target-options").hide()
|
96
|
-
@element.find("##{@element.find('#link_target').val()}_options").show()
|
97
|
-
@resize(true)
|
98
|
-
|
99
|
-
|
100
|
-
addInputError: (input, message) ->
|
101
|
-
input.after('<span class="help-inline error-message">' + Mercury.I18n(message) + '</span>').closest('.control-group').addClass('error')
|
102
|
-
@valid = false
|
103
|
-
|
104
|
-
|
105
|
-
clearInputErrors: ->
|
106
|
-
@element.find('.control-group.error').removeClass('error').find('.error-message').remove()
|
107
|
-
@valid = true
|
108
|
-
|
109
|
-
|
110
|
-
validateForm: ->
|
111
|
-
@clearInputErrors()
|
112
|
-
|
113
|
-
type = @element.find('input[name=link_type]:checked').val()
|
114
|
-
|
115
|
-
el = @element.find("#link_#{type}")
|
116
|
-
@addInputError(el, "can't be blank") unless el.val()
|
117
|
-
|
118
|
-
if !@editing && !@content
|
119
|
-
el = @element.find('#link_text')
|
120
|
-
@addInputError(el, "can't be blank") unless el.val()
|
121
|
-
|
122
|
-
|
123
|
-
submitForm: ->
|
124
|
-
content = @element.find('#link_text').val()
|
125
|
-
target = @element.find('#link_target').val()
|
126
|
-
type = @element.find('input[name=link_type]:checked').val()
|
127
|
-
|
128
|
-
switch type
|
129
|
-
when 'existing_bookmark' then attrs = {href: "##{@element.find('#link_existing_bookmark').val()}"}
|
130
|
-
when 'new_bookmark' then attrs = {name: "#{@element.find('#link_new_bookmark').val()}"}
|
131
|
-
else attrs = {href: @element.find("#link_#{type}").val()}
|
132
|
-
|
133
|
-
switch target
|
134
|
-
when 'popup'
|
135
|
-
args = {
|
136
|
-
width: parseInt(@element.find('#link_popup_width').val()) || 500,
|
137
|
-
height: parseInt(@element.find('#link_popup_height').val()) || 500,
|
138
|
-
menubar: 'no',
|
139
|
-
toolbar: 'no'
|
140
|
-
}
|
141
|
-
attrs['href'] = "javascript:void(window.open('#{attrs['href']}', 'popup_window', '#{jQuery.param(args).replace(/&/g, ',')}'))"
|
142
|
-
else
|
143
|
-
attrs['target'] = target if target
|
144
|
-
|
145
|
-
value = {tagName: 'a', attrs: attrs, content: @content || content}
|
146
|
-
|
147
|
-
if @editing
|
148
|
-
Mercury.trigger('action', {action: 'replaceLink', value: value, node: @editing.get(0)})
|
149
|
-
else
|
150
|
-
Mercury.trigger('action', {action: 'insertLink', value: value})
|
151
|
-
|
152
|
-
}
|
@@ -1,132 +0,0 @@
|
|
1
|
-
@Mercury.modalHandlers.insertMedia = {
|
2
|
-
|
3
|
-
initialize: ->
|
4
|
-
@element.find('.control-label input').on('click', @onLabelChecked)
|
5
|
-
@element.find('.controls .optional, .controls .required').on('focus', (event) => @onInputFocused($(event.target)))
|
6
|
-
|
7
|
-
@focus('#media_image_url')
|
8
|
-
@initializeForm()
|
9
|
-
|
10
|
-
# build the image or embed/iframe on form submission
|
11
|
-
@element.find('form').on 'submit', (event) =>
|
12
|
-
event.preventDefault()
|
13
|
-
@validateForm()
|
14
|
-
unless @valid
|
15
|
-
@resize()
|
16
|
-
return
|
17
|
-
@submitForm()
|
18
|
-
@hide()
|
19
|
-
|
20
|
-
|
21
|
-
initializeForm: ->
|
22
|
-
# get the selection and initialize its information into the form
|
23
|
-
return unless Mercury.region && Mercury.region.selection
|
24
|
-
selection = Mercury.region.selection()
|
25
|
-
|
26
|
-
# if we're editing an image prefill the information
|
27
|
-
if image = selection.is?('img')
|
28
|
-
@element.find('#media_image_url').val(image.attr('src'))
|
29
|
-
@element.find('#media_image_alignment').val(image.attr('align'))
|
30
|
-
@element.find('#media_image_float').val(if image.attr('style')? then image.css('float') else '')
|
31
|
-
@focus('#media_image_url')
|
32
|
-
|
33
|
-
# if we're editing an iframe (assume it's a video for now)
|
34
|
-
if iframe = selection.is?('iframe')
|
35
|
-
src = iframe.attr('src')
|
36
|
-
if /^https?:\/\/www.youtube.com\//i.test(src)
|
37
|
-
# it's a youtube video
|
38
|
-
@element.find('#media_youtube_url').val("#{src.match(/^https?/)[0]}://youtu.be/#{src.match(/\/embed\/(\w+)/)[1]}")
|
39
|
-
@element.find('#media_youtube_width').val(iframe.width())
|
40
|
-
@element.find('#media_youtube_height').val(iframe.height())
|
41
|
-
@focus('#media_youtube_url')
|
42
|
-
else if /^https?:\/\/player.vimeo.com\//i.test(src)
|
43
|
-
# it's a vimeo video
|
44
|
-
@element.find('#media_vimeo_url').val("#{src.match(/^https?/)[0]}://vimeo.com/#{src.match(/\/video\/(\w+)/)[1]}")
|
45
|
-
@element.find('#media_vimeo_width').val(iframe.width())
|
46
|
-
@element.find('#media_vimeo_height').val(iframe.height())
|
47
|
-
@focus('#media_vimeo_url')
|
48
|
-
|
49
|
-
|
50
|
-
focus: (selector) ->
|
51
|
-
setTimeout((=> @element.find(selector).focus()), 300)
|
52
|
-
|
53
|
-
|
54
|
-
onLabelChecked: ->
|
55
|
-
forInput = jQuery(@).closest('.control-label').attr('for')
|
56
|
-
jQuery(@).closest('.control-group').find("##{forInput}").focus()
|
57
|
-
|
58
|
-
|
59
|
-
onInputFocused: (input) ->
|
60
|
-
input.closest('.control-group').find('input[type=radio]').prop('checked', true)
|
61
|
-
|
62
|
-
return if input.closest('.media-options').length
|
63
|
-
@element.find(".media-options").hide()
|
64
|
-
@element.find("##{input.attr('id').replace('media_', '')}_options").show()
|
65
|
-
@resize(true)
|
66
|
-
|
67
|
-
|
68
|
-
addInputError: (input, message) ->
|
69
|
-
input.after('<span class="help-inline error-message">' + Mercury.I18n(message) + '</span>').closest('.control-group').addClass('error')
|
70
|
-
@valid = false
|
71
|
-
|
72
|
-
|
73
|
-
clearInputErrors: ->
|
74
|
-
@element.find('.control-group.error').removeClass('error').find('.error-message').remove()
|
75
|
-
@valid = true
|
76
|
-
|
77
|
-
|
78
|
-
validateForm: ->
|
79
|
-
@clearInputErrors()
|
80
|
-
|
81
|
-
type = @element.find('input[name=media_type]:checked').val()
|
82
|
-
el = @element.find("#media_#{type}")
|
83
|
-
|
84
|
-
switch type
|
85
|
-
when 'youtube_url'
|
86
|
-
url = @element.find('#media_youtube_url').val()
|
87
|
-
@addInputError(el, "is invalid") unless /^https?:\/\/youtu.be\//.test(url)
|
88
|
-
when 'vimeo_url'
|
89
|
-
url = @element.find('#media_vimeo_url').val()
|
90
|
-
@addInputError(el, "is invalid") unless /^https?:\/\/vimeo.com\//.test(url)
|
91
|
-
else
|
92
|
-
@addInputError(el, "can't be blank") unless el.val()
|
93
|
-
|
94
|
-
|
95
|
-
submitForm: ->
|
96
|
-
type = @element.find('input[name=media_type]:checked').val()
|
97
|
-
|
98
|
-
switch type
|
99
|
-
when 'image_url'
|
100
|
-
attrs = {src: @element.find('#media_image_url').val()}
|
101
|
-
attrs['align'] = alignment if alignment = @element.find('#media_image_alignment').val()
|
102
|
-
attrs['style'] = 'float: ' + float + ';' if float = @element.find('#media_image_float').val()
|
103
|
-
Mercury.trigger('action', {action: 'insertImage', value: attrs})
|
104
|
-
|
105
|
-
when 'youtube_url'
|
106
|
-
url = @element.find('#media_youtube_url').val()
|
107
|
-
code = url.replace(/https?:\/\/youtu.be\//, '')
|
108
|
-
protocol = 'http'
|
109
|
-
protocol = 'https' if /^https:/.test(url)
|
110
|
-
value = jQuery('<iframe>', {
|
111
|
-
width: parseInt(@element.find('#media_youtube_width').val(), 10) || 560,
|
112
|
-
height: parseInt(@element.find('#media_youtube_height').val(), 10) || 349,
|
113
|
-
src: "#{protocol}://www.youtube.com/embed/#{code}?wmode=transparent",
|
114
|
-
frameborder: 0,
|
115
|
-
allowfullscreen: 'true'
|
116
|
-
})
|
117
|
-
Mercury.trigger('action', {action: 'insertHTML', value: value})
|
118
|
-
|
119
|
-
when 'vimeo_url'
|
120
|
-
url = @element.find('#media_vimeo_url').val()
|
121
|
-
code = url.replace(/^https?:\/\/vimeo.com\//, '')
|
122
|
-
protocol = 'http'
|
123
|
-
protocol = 'https' if /^https:/.test(url)
|
124
|
-
value = jQuery('<iframe>', {
|
125
|
-
width: parseInt(@element.find('#media_vimeo_width').val(), 10) || 400,
|
126
|
-
height: parseInt(@element.find('#media_vimeo_height').val(), 10) || 225,
|
127
|
-
src: "#{protocol}://player.vimeo.com/video/#{code}?title=1&byline=1&portrait=0&color=ffffff",
|
128
|
-
frameborder: 0
|
129
|
-
})
|
130
|
-
Mercury.trigger('action', {action: 'insertHTML', value: value})
|
131
|
-
|
132
|
-
}
|
@@ -1,68 +0,0 @@
|
|
1
|
-
@Mercury.modalHandlers.insertTable = {
|
2
|
-
|
3
|
-
initialize: ->
|
4
|
-
@table = @element.find('#table_display table')
|
5
|
-
|
6
|
-
@table.on 'click', (event) => @onCellClick($(event.target))
|
7
|
-
|
8
|
-
@element.find('#table_alignment').on 'change', => @setTableAlignment()
|
9
|
-
@element.find('#table_border').on 'keyup', => @setTableBorder()
|
10
|
-
@element.find('#table_spacing').on 'keyup', => @setTableCellSpacing()
|
11
|
-
@element.find('[data-action]').on 'click', (event) =>
|
12
|
-
event.preventDefault()
|
13
|
-
@onActionClick(jQuery(event.target).data('action'))
|
14
|
-
|
15
|
-
@selectFirstCell()
|
16
|
-
|
17
|
-
@element.find('form').on 'submit', (event) =>
|
18
|
-
event.preventDefault()
|
19
|
-
@submitForm()
|
20
|
-
@hide()
|
21
|
-
|
22
|
-
|
23
|
-
selectFirstCell: ->
|
24
|
-
firstCell = @table.find('td, th').first()
|
25
|
-
firstCell.addClass('selected')
|
26
|
-
Mercury.tableEditor(@table, firstCell, ' ')
|
27
|
-
|
28
|
-
|
29
|
-
onCellClick: (@cell) ->
|
30
|
-
@table = @cell.closest('table')
|
31
|
-
@table.find('.selected').removeAttr('class')
|
32
|
-
@cell.addClass('selected')
|
33
|
-
Mercury.tableEditor(@table, @cell, ' ')
|
34
|
-
|
35
|
-
|
36
|
-
onActionClick: (action) ->
|
37
|
-
return unless action
|
38
|
-
Mercury.tableEditor[action]()
|
39
|
-
|
40
|
-
|
41
|
-
setTableAlignment: ->
|
42
|
-
@table.attr({align: @element.find('#table_alignment').val()})
|
43
|
-
|
44
|
-
setTableBorder: ->
|
45
|
-
border = parseInt(@element.find('#table_border').val(), 10)
|
46
|
-
if isNaN(border)
|
47
|
-
@table.removeAttr('border')
|
48
|
-
else
|
49
|
-
@table.attr({border: border})
|
50
|
-
|
51
|
-
setTableCellSpacing: ->
|
52
|
-
cellspacing = parseInt(@element.find('#table_spacing').val(), 10)
|
53
|
-
if isNaN(cellspacing)
|
54
|
-
@table.removeAttr('cellspacing')
|
55
|
-
else
|
56
|
-
@table.attr({cellspacing: cellspacing})
|
57
|
-
|
58
|
-
|
59
|
-
submitForm: ->
|
60
|
-
@table.find('.selected').removeAttr('class')
|
61
|
-
@table.find('td, th').html('<br/>')
|
62
|
-
|
63
|
-
html = jQuery('<div>').html(@table).html()
|
64
|
-
value = html.replace(/^\s+|\n/gm, '').replace(/(<\/.*?>|<table.*?>|<tbody>|<tr>)/g, '$1\n')
|
65
|
-
|
66
|
-
Mercury.trigger('action', {action: 'insertTable', value: value})
|
67
|
-
|
68
|
-
}
|
@@ -1,93 +0,0 @@
|
|
1
|
-
# The image region is designed for a single, stand-along image and allows drag & drop uploading of a replacement right
|
2
|
-
# into the page, but provides no editing of other DOM attributes at this time.
|
3
|
-
class @Mercury.Regions.Image extends Mercury.Region
|
4
|
-
@supported: document.getElementById
|
5
|
-
@supportedText: "Chrome 10+, Firefox 4+, IE 7+, Safari 5+, Opera 8+"
|
6
|
-
type = 'image'
|
7
|
-
type: -> type
|
8
|
-
|
9
|
-
constructor: (@element, @window, @options = {}) ->
|
10
|
-
super
|
11
|
-
|
12
|
-
|
13
|
-
bindEvents: ->
|
14
|
-
Mercury.on 'mode', (event, options) => @togglePreview() if options.mode == 'preview'
|
15
|
-
|
16
|
-
Mercury.on 'focus:frame', =>
|
17
|
-
return if @previewing || Mercury.region != @
|
18
|
-
@focus()
|
19
|
-
|
20
|
-
Mercury.on 'action', (event, options) =>
|
21
|
-
return if @previewing || Mercury.region != @
|
22
|
-
@execCommand(options.action, options) if options.action
|
23
|
-
|
24
|
-
@element.on 'dragenter', (event) =>
|
25
|
-
return if @previewing
|
26
|
-
event.preventDefault()
|
27
|
-
event.originalEvent.dataTransfer.dropEffect = 'copy'
|
28
|
-
|
29
|
-
@element.on 'dragover', (event) =>
|
30
|
-
return if @previewing
|
31
|
-
event.preventDefault()
|
32
|
-
event.originalEvent.dataTransfer.dropEffect = 'copy'
|
33
|
-
|
34
|
-
@element.on 'drop', (event) =>
|
35
|
-
return if @previewing
|
36
|
-
if event.originalEvent.dataTransfer.files.length
|
37
|
-
event.preventDefault()
|
38
|
-
@focus()
|
39
|
-
Mercury.uploader(event.originalEvent.dataTransfer.files[0])
|
40
|
-
|
41
|
-
@element.on 'focus', =>
|
42
|
-
@focus()
|
43
|
-
|
44
|
-
|
45
|
-
togglePreview: ->
|
46
|
-
if @previewing
|
47
|
-
@previewing = false
|
48
|
-
@element.attr(Mercury.config.regions.attribute, type)
|
49
|
-
@build()
|
50
|
-
else
|
51
|
-
@previewing = true
|
52
|
-
@element.removeAttr(Mercury.config.regions.attribute)
|
53
|
-
Mercury.trigger('region:blurred', {region: @})
|
54
|
-
|
55
|
-
|
56
|
-
focus: ->
|
57
|
-
return if @previewing
|
58
|
-
Mercury.region = @
|
59
|
-
Mercury.trigger('region:focused', {region: @})
|
60
|
-
Mercury.trigger('region:update', {region: @})
|
61
|
-
|
62
|
-
|
63
|
-
execCommand: (action, options = {}) ->
|
64
|
-
super
|
65
|
-
handler.call(@, options) if handler = Mercury.Regions.Image.actions[action]
|
66
|
-
|
67
|
-
|
68
|
-
pushHistory: () ->
|
69
|
-
@history.push(src: @element.attr('src'))
|
70
|
-
|
71
|
-
|
72
|
-
updateSrc: (src) ->
|
73
|
-
@element.attr('src', src)
|
74
|
-
|
75
|
-
|
76
|
-
serialize: ->
|
77
|
-
return {
|
78
|
-
type: type
|
79
|
-
data: @dataAttributes()
|
80
|
-
attributes:
|
81
|
-
src: @element.attr('src')
|
82
|
-
}
|
83
|
-
|
84
|
-
|
85
|
-
@actions: {
|
86
|
-
|
87
|
-
undo: -> if prev = @history.undo() then @updateSrc(prev.src)
|
88
|
-
|
89
|
-
redo: -> if next = @history.redo() then @updateSrc(next.src)
|
90
|
-
|
91
|
-
insertImage: (options) -> @updateSrc(options.value.src)
|
92
|
-
|
93
|
-
}
|
@@ -1,136 +0,0 @@
|
|
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,61 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Bootsrap Overrides (overrides what's in bootstrap-ish)
|
3
|
-
*---------------------------------------------------------------------------*/
|
4
|
-
.btn-group > .btn {
|
5
|
-
margin-right: 0;
|
6
|
-
}
|
7
|
-
form {
|
8
|
-
margin-bottom: 0;
|
9
|
-
}
|
10
|
-
fieldset {
|
11
|
-
margin-bottom: 15px;
|
12
|
-
background: #F6F6F6;
|
13
|
-
border: 1px solid #CCC;
|
14
|
-
border-radius: 7px;
|
15
|
-
padding: 10px;
|
16
|
-
}
|
17
|
-
legend {
|
18
|
-
display: block;
|
19
|
-
position: relative;
|
20
|
-
margin-left: 10px;
|
21
|
-
margin-bottom: 0;
|
22
|
-
font-weight: bold;
|
23
|
-
width: auto;
|
24
|
-
padding: 0;
|
25
|
-
font-size: 12px;
|
26
|
-
color: #333333;
|
27
|
-
border: 0;
|
28
|
-
line-height: 1px;
|
29
|
-
}
|
30
|
-
select {
|
31
|
-
width: auto;
|
32
|
-
}
|
33
|
-
.form-actions {
|
34
|
-
margin-top: 0;
|
35
|
-
margin-bottom: 0;
|
36
|
-
background-color: transparent;
|
37
|
-
}
|
38
|
-
.control-group {
|
39
|
-
margin-bottom: 0;
|
40
|
-
}
|
41
|
-
legend + .control-group {
|
42
|
-
margin-top: 0;
|
43
|
-
-webkit-margin-top-collapse: separate;
|
44
|
-
}
|
45
|
-
.form-horizontal .control-group {
|
46
|
-
margin-bottom: 0;
|
47
|
-
}
|
48
|
-
.form-horizontal .controls {
|
49
|
-
margin-left: 150px;
|
50
|
-
}
|
51
|
-
.form-horizontal hr {
|
52
|
-
margin-left: 150px;
|
53
|
-
border: 0;
|
54
|
-
border-top: 1px solid #ccc;
|
55
|
-
}
|
56
|
-
label input[type=radio] {
|
57
|
-
margin-right: 5px;
|
58
|
-
}
|
59
|
-
.form-actions {
|
60
|
-
padding-bottom: 0;
|
61
|
-
}
|
@@ -1,33 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Mercury Editor is a Coffeescript and jQuery based WYSIWYG editor. Documentation and other useful information can be
|
3
|
-
* found at https://github.com/jejacks0n/mercury
|
4
|
-
*
|
5
|
-
* Copyright (c) 2011 Jeremy Jackson
|
6
|
-
*
|
7
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
8
|
-
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
9
|
-
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
10
|
-
* persons to whom the Software is furnished to do so, subject to the following conditions:
|
11
|
-
*
|
12
|
-
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
13
|
-
* Software.
|
14
|
-
*
|
15
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
16
|
-
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
17
|
-
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
18
|
-
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
19
|
-
*
|
20
|
-
*/
|
21
|
-
|
22
|
-
$linkColor: #09F !default;
|
23
|
-
$linkColorHover: darken($linkColor, 15%) !default;
|
24
|
-
|
25
|
-
@import '/assets/mercury/mercury.css';
|
26
|
-
@import 'mercury-bootstrap-overrides';
|
27
|
-
|
28
|
-
#mercury_about a { color: $linkColor; }
|
29
|
-
#mercury_table #table_display .selected { background: $linkColor; }
|
30
|
-
.mercury-uploader .mercury-uploader-progress div.mercury-uploader-indicator div {
|
31
|
-
background-color: $linkColor;
|
32
|
-
border: 1px solid $linkColorHover;
|
33
|
-
}
|