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,10 +1,16 @@
|
|
1
|
-
|
1
|
+
# todo:
|
2
|
+
# context for the toolbar buttons and groups needs to change so we can do the following:
|
3
|
+
# how to handle context for buttons? if the cursor is within a bold area (**bo|ld**), or selecting it -- it would be
|
4
|
+
# nice if we could activate the bold button for instance.
|
5
|
+
|
6
|
+
class @Mercury.Regions.Markupable extends Mercury.Region
|
2
7
|
@supported: document.getElementById
|
3
|
-
@supportedText: "Chrome 10+, Firefox 4+,
|
4
|
-
|
5
|
-
type
|
8
|
+
@supportedText: "IE 7+, Chrome 10+, Firefox 4+, Safari 5+, Opera 8+"
|
9
|
+
|
10
|
+
type = 'markupable'
|
6
11
|
|
7
12
|
constructor: (@element, @window, @options = {}) ->
|
13
|
+
@type = 'markupable'
|
8
14
|
super
|
9
15
|
@converter = new Showdown.converter()
|
10
16
|
|
@@ -12,18 +18,13 @@ class @Mercury.Regions.Markdown extends Mercury.Region
|
|
12
18
|
build: ->
|
13
19
|
width = '100%'
|
14
20
|
height = @element.height()
|
15
|
-
value = @element.html().replace(/^\s+|\s+$/g, '').replace('>', '>')
|
16
|
-
|
17
|
-
@textarea = jQuery('<textarea>', @document).val(value).addClass('mercury-textarea')
|
18
|
-
@textarea.css
|
19
|
-
border: 0
|
20
|
-
background: 'transparent'
|
21
|
-
display: 'block'
|
22
|
-
'overflow-y': 'hidden'
|
23
|
-
width: width
|
24
|
-
height: height
|
25
|
-
fontFamily: '"Courier New", Courier, monospace'
|
26
21
|
|
22
|
+
value = @element.html().replace(/^\s+|\s+$/g, '').replace('>', '>')
|
23
|
+
@element.removeClass(Mercury.config.regions.className)
|
24
|
+
@textarea = jQuery('<textarea>', @document).val(value)
|
25
|
+
@textarea.attr('class', @element.attr('class')).addClass('mercury-textarea')
|
26
|
+
@textarea.css({border: 0, background: 'transparent', display: 'block', 'overflow-y': 'hidden', width: width, height: height, fontFamily: '"Courier New", Courier, monospace'})
|
27
|
+
@element.addClass(Mercury.config.regions.className)
|
27
28
|
@element.empty().append(@textarea)
|
28
29
|
|
29
30
|
@previewElement = jQuery('<div>', @document)
|
@@ -34,12 +35,6 @@ class @Mercury.Regions.Markdown extends Mercury.Region
|
|
34
35
|
@resize()
|
35
36
|
|
36
37
|
|
37
|
-
dataAttributes: ->
|
38
|
-
data = {}
|
39
|
-
data[attr] = @container.attr('data-' + attr) for attr in Mercury.config.regions.dataAttributes
|
40
|
-
return data
|
41
|
-
|
42
|
-
|
43
38
|
bindEvents: ->
|
44
39
|
Mercury.on 'mode', (event, options) => @togglePreview() if options.mode == 'preview'
|
45
40
|
Mercury.on 'focus:frame', => @focus() if !@previewing && Mercury.region == @
|
@@ -71,7 +66,7 @@ class @Mercury.Regions.Markdown extends Mercury.Region
|
|
71
66
|
if Mercury.snippet
|
72
67
|
event.preventDefault()
|
73
68
|
@focus()
|
74
|
-
Mercury.Snippet.displayOptionsFor(Mercury.snippet
|
69
|
+
Mercury.Snippet.displayOptionsFor(Mercury.snippet)
|
75
70
|
|
76
71
|
# handle any files that were dropped
|
77
72
|
if event.originalEvent.dataTransfer.files.length
|
@@ -169,13 +164,13 @@ class @Mercury.Regions.Markdown extends Mercury.Region
|
|
169
164
|
togglePreview: ->
|
170
165
|
if @previewing
|
171
166
|
@previewing = false
|
172
|
-
@container.
|
167
|
+
@container.addClass(Mercury.config.regions.className).removeClass("#{Mercury.config.regions.className}-preview")
|
173
168
|
@previewElement.hide()
|
174
169
|
@element.show()
|
175
170
|
@focus() if Mercury.region == @
|
176
171
|
else
|
177
172
|
@previewing = true
|
178
|
-
@container.
|
173
|
+
@container.addClass("#{Mercury.config.regions.className}-preview").removeClass(Mercury.config.regions.className)
|
179
174
|
value = @converter.makeHtml(@element.val())
|
180
175
|
@previewElement.html(value)
|
181
176
|
@previewElement.show()
|
@@ -186,7 +181,7 @@ class @Mercury.Regions.Markdown extends Mercury.Region
|
|
186
181
|
execCommand: (action, options = {}) ->
|
187
182
|
super
|
188
183
|
|
189
|
-
handler.call(@, @selection(), options) if handler = Mercury.Regions.
|
184
|
+
handler.call(@, @selection(), options) if handler = Mercury.Regions.Markupable.actions[action]
|
190
185
|
@resize()
|
191
186
|
|
192
187
|
|
@@ -205,7 +200,7 @@ class @Mercury.Regions.Markdown extends Mercury.Region
|
|
205
200
|
@history.push(@contentAndSelection())
|
206
201
|
else if keyCode
|
207
202
|
# set a timeout for pushing to the history
|
208
|
-
@historyTimeout = setTimeout(
|
203
|
+
@historyTimeout = setTimeout(waitTime * 1000, => @history.push(@contentAndSelection()))
|
209
204
|
else
|
210
205
|
# push to the history immediately
|
211
206
|
@history.push(@contentAndSelection())
|
@@ -214,7 +209,7 @@ class @Mercury.Regions.Markdown extends Mercury.Region
|
|
214
209
|
|
215
210
|
|
216
211
|
selection: ->
|
217
|
-
return new Mercury.Regions.
|
212
|
+
return new Mercury.Regions.Markupable.Selection(@element)
|
218
213
|
|
219
214
|
|
220
215
|
resize: ->
|
@@ -266,7 +261,7 @@ class @Mercury.Regions.Markdown extends Mercury.Region
|
|
266
261
|
}
|
267
262
|
selection.unWrapLine("#{wrapper[0]}", "#{wrapper[1]}") for wrapperName, wrapper of wrappers
|
268
263
|
if options.value == 'blockquote'
|
269
|
-
Mercury.Regions.
|
264
|
+
Mercury.Regions.Markupable.actions.indent.call(@, selection, options)
|
270
265
|
return
|
271
266
|
selection.wrapLine("#{wrappers[options.value][0]}", "#{wrappers[options.value][1]}")
|
272
267
|
|
@@ -294,7 +289,7 @@ class @Mercury.Regions.Markdown extends Mercury.Region
|
|
294
289
|
|
295
290
|
|
296
291
|
# Helper class for managing selection and getting information from it
|
297
|
-
class Mercury.Regions.
|
292
|
+
class Mercury.Regions.Markupable.Selection
|
298
293
|
|
299
294
|
constructor: (@element) ->
|
300
295
|
@el = @element.get(0)
|
@@ -1,11 +1,16 @@
|
|
1
|
+
# todo:
|
2
|
+
|
3
|
+
# how to handle context for buttons? if the cursor is within a bold area (**bo|ld**), or selecting it -- it would be
|
4
|
+
# nice if we could activate the bold button for instance.
|
5
|
+
|
1
6
|
class @Mercury.Regions.Simple extends Mercury.Region
|
2
7
|
@supported: document.getElementById
|
3
|
-
@supportedText: "Chrome 10+, Firefox 4+,
|
8
|
+
@supportedText: "IE 7+, Chrome 10+, Firefox 4+, Safari 5+, Opera 8+"
|
9
|
+
|
4
10
|
type = 'simple'
|
5
|
-
type: -> type
|
6
11
|
|
7
12
|
constructor: (@element, @window, @options = {}) ->
|
8
|
-
|
13
|
+
@type = 'simple'
|
9
14
|
super
|
10
15
|
|
11
16
|
|
@@ -18,7 +23,9 @@ class @Mercury.Regions.Simple extends Mercury.Region
|
|
18
23
|
height = @element.height() # 'auto'
|
19
24
|
|
20
25
|
value = @element.text()
|
21
|
-
@
|
26
|
+
@element.removeClass(Mercury.config.regions.className)
|
27
|
+
@textarea = jQuery('<textarea>', @document).val(value)
|
28
|
+
@textarea.attr('class', @element.attr('class')).addClass('mercury-textarea')
|
22
29
|
@textarea.css
|
23
30
|
border: 0
|
24
31
|
background: 'transparent'
|
@@ -37,7 +44,7 @@ class @Mercury.Regions.Simple extends Mercury.Region
|
|
37
44
|
display: 'inherit'
|
38
45
|
lineHeight: 'inherit'
|
39
46
|
textAlign: 'inherit'
|
40
|
-
|
47
|
+
@element.addClass(Mercury.config.regions.className)
|
41
48
|
@element.empty().append(@textarea)
|
42
49
|
|
43
50
|
@container = @element
|
@@ -60,10 +67,31 @@ class @Mercury.Regions.Simple extends Mercury.Region
|
|
60
67
|
@container.removeClass('focus')
|
61
68
|
Mercury.trigger('region:blurred', {region: @})
|
62
69
|
|
63
|
-
@
|
70
|
+
@element.on 'dragenter', (event) =>
|
71
|
+
return if @previewing
|
72
|
+
event.preventDefault()
|
73
|
+
event.originalEvent.dataTransfer.dropEffect = 'copy'
|
74
|
+
|
75
|
+
@element.on 'dragover', (event) =>
|
76
|
+
return if @previewing
|
77
|
+
event.preventDefault()
|
78
|
+
event.originalEvent.dataTransfer.dropEffect = 'copy'
|
64
79
|
|
80
|
+
@element.on 'drop', (event) =>
|
81
|
+
return if @previewing
|
82
|
+
|
83
|
+
# handle dropping snippets
|
84
|
+
if Mercury.snippet
|
85
|
+
event.preventDefault()
|
86
|
+
@focus()
|
87
|
+
Mercury.Snippet.displayOptionsFor(Mercury.snippet)
|
88
|
+
|
89
|
+
# handle any files that were dropped
|
90
|
+
if event.originalEvent.dataTransfer.files.length
|
91
|
+
event.preventDefault()
|
92
|
+
@focus()
|
93
|
+
Mercury.uploader(event.originalEvent.dataTransfer.files[0])
|
65
94
|
|
66
|
-
bindElementEvents: ->
|
67
95
|
@element.on 'focus', =>
|
68
96
|
return if @previewing
|
69
97
|
Mercury.region = @
|
@@ -103,6 +131,20 @@ class @Mercury.Regions.Simple extends Mercury.Region
|
|
103
131
|
event.preventDefault()
|
104
132
|
@execCommand('insertHTML', {value: ' '})
|
105
133
|
|
134
|
+
if event.metaKey
|
135
|
+
switch event.keyCode
|
136
|
+
when 66 # b
|
137
|
+
@execCommand('bold')
|
138
|
+
event.preventDefault()
|
139
|
+
|
140
|
+
when 73 # i
|
141
|
+
@execCommand('italic')
|
142
|
+
event.preventDefault()
|
143
|
+
|
144
|
+
when 85 # u
|
145
|
+
@execCommand('underline')
|
146
|
+
event.preventDefault()
|
147
|
+
|
106
148
|
@pushHistory(event.keyCode)
|
107
149
|
|
108
150
|
@element.on 'keyup', =>
|
@@ -160,14 +202,15 @@ class @Mercury.Regions.Simple extends Mercury.Region
|
|
160
202
|
if @previewing
|
161
203
|
@previewing = false
|
162
204
|
@element = @container
|
163
|
-
@container.attr(Mercury.config.regions.attribute, type)
|
164
205
|
@build()
|
165
|
-
@bindElementEvents()
|
166
206
|
@focus() if Mercury.region == @
|
207
|
+
# @container.addClass(Mercury.config.regions.className).removeClass("#{Mercury.config.regions.className}-preview")
|
208
|
+
# @previewElement.hide()
|
209
|
+
# @element.show()
|
167
210
|
else
|
168
211
|
@previewing = true
|
212
|
+
@container.addClass("#{Mercury.config.regions.className}-preview").removeClass(Mercury.config.regions.className)
|
169
213
|
value = jQuery('<div></div>').text(@element.val()).html()
|
170
|
-
@container.removeAttr(Mercury.config.regions.attribute)
|
171
214
|
@container.html(value)
|
172
215
|
Mercury.trigger('region:blurred', {region: @})
|
173
216
|
|
@@ -194,7 +237,7 @@ class @Mercury.Regions.Simple extends Mercury.Region
|
|
194
237
|
@history.push(@contentAndSelection())
|
195
238
|
else if keyCode
|
196
239
|
# set a timeout for pushing to the history
|
197
|
-
@historyTimeout = setTimeout(
|
240
|
+
@historyTimeout = setTimeout(waitTime * 1000, => @history.push(@contentAndSelection()))
|
198
241
|
else
|
199
242
|
# push to the history immediately
|
200
243
|
@history.push(@contentAndSelection())
|
@@ -1,17 +1,16 @@
|
|
1
|
-
class @Mercury.Regions.
|
1
|
+
class @Mercury.Regions.Snippetable extends Mercury.Region
|
2
2
|
@supported: document.getElementById
|
3
|
-
@supportedText: "Chrome 10+, Firefox 4+,
|
4
|
-
|
5
|
-
type
|
3
|
+
@supportedText: "IE 7+, Chrome 10+, Firefox 4+, Safari 5+, Opera 8+"
|
4
|
+
|
5
|
+
type = 'snippetable'
|
6
6
|
|
7
7
|
constructor: (@element, @window, @options = {}) ->
|
8
|
-
|
8
|
+
@type = 'snippetable'
|
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]')
|
15
14
|
@element.css({minHeight: 20}) if @element.css('minHeight') == '0px'
|
16
15
|
|
17
16
|
|
@@ -46,7 +45,7 @@ class @Mercury.Regions.Snippets extends Mercury.Region
|
|
46
45
|
return if @previewing || ! Mercury.snippet
|
47
46
|
@focus()
|
48
47
|
event.preventDefault()
|
49
|
-
Mercury.Snippet.displayOptionsFor(Mercury.snippet
|
48
|
+
Mercury.Snippet.displayOptionsFor(Mercury.snippet)
|
50
49
|
|
51
50
|
jQuery(@document).on 'keydown', (event) =>
|
52
51
|
return if @previewing || Mercury.region != @
|
@@ -78,7 +77,7 @@ class @Mercury.Regions.Snippets extends Mercury.Region
|
|
78
77
|
|
79
78
|
execCommand: (action, options = {}) ->
|
80
79
|
super
|
81
|
-
handler.call(@, options) if handler = Mercury.Regions.
|
80
|
+
handler.call(@, options) if handler = Mercury.Regions.Snippetable.actions[action]
|
82
81
|
|
83
82
|
|
84
83
|
makeSortable: ->
|
@@ -86,7 +85,7 @@ class @Mercury.Regions.Snippets extends Mercury.Region
|
|
86
85
|
document: @document,
|
87
86
|
scroll: false, #scrolling is buggy
|
88
87
|
containment: 'parent',
|
89
|
-
items: '
|
88
|
+
items: '.mercury-snippet',
|
90
89
|
opacity: 0.4,
|
91
90
|
revert: 100,
|
92
91
|
tolerance: 'pointer',
|
@@ -94,7 +93,7 @@ class @Mercury.Regions.Snippets extends Mercury.Region
|
|
94
93
|
Mercury.trigger('hide:toolbar', {type: 'snippet', immediately: true})
|
95
94
|
return true
|
96
95
|
stop: =>
|
97
|
-
setTimeout(
|
96
|
+
setTimeout(100, => @pushHistory())
|
98
97
|
return true
|
99
98
|
}
|
100
99
|
|
@@ -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.offset()
|
24
24
|
elementWidth = @element.width()
|
25
25
|
elementHeight = @element.height()
|
26
26
|
documentHeight = jQuery(document).height()
|
@@ -1,7 +1,6 @@
|
|
1
1
|
class @Mercury.SnippetToolbar extends Mercury.Toolbar
|
2
2
|
|
3
3
|
constructor: (@document, @options = {}) ->
|
4
|
-
@_boundEvents = []
|
5
4
|
super(@options)
|
6
5
|
|
7
6
|
|
@@ -9,34 +8,29 @@ class @Mercury.SnippetToolbar extends Mercury.Toolbar
|
|
9
8
|
@element = jQuery('<div>', {class: 'mercury-toolbar mercury-snippet-toolbar', style: 'display:none'})
|
10
9
|
@element.appendTo(jQuery(@options.appendTo).get(0) ? 'body')
|
11
10
|
|
12
|
-
for own buttonName, options of Mercury.config.toolbars.
|
11
|
+
for own buttonName, options of Mercury.config.toolbars.snippetable
|
13
12
|
button = @buildButton(buttonName, options)
|
14
13
|
button.appendTo(@element) if button
|
15
14
|
|
16
15
|
|
17
16
|
bindEvents: ->
|
18
|
-
|
17
|
+
Mercury.on 'show:toolbar', (event, options) =>
|
19
18
|
return unless options.snippet
|
20
19
|
options.snippet.mouseout => @hide()
|
21
20
|
@show(options.snippet)
|
22
21
|
|
23
|
-
|
22
|
+
Mercury.on 'hide:toolbar', (event, options) =>
|
24
23
|
return unless options.type && options.type == 'snippet'
|
25
24
|
@hide(options.immediately)
|
26
25
|
|
27
|
-
@bindReleasableEvent jQuery(@document), 'scroll', =>
|
28
|
-
@position() if @visible
|
29
|
-
|
30
26
|
@element.mousemove =>
|
31
27
|
clearTimeout(@hideTimeout)
|
32
28
|
|
33
29
|
@element.mouseout =>
|
34
30
|
@hide()
|
35
31
|
|
36
|
-
|
37
|
-
|
38
|
-
target.on eventName, handler
|
39
|
-
@_boundEvents.push [target, eventName, handler]
|
32
|
+
jQuery(@document).on 'scroll', =>
|
33
|
+
@position() if @visible
|
40
34
|
|
41
35
|
|
42
36
|
show: (@snippet) ->
|
@@ -71,15 +65,8 @@ class @Mercury.SnippetToolbar extends Mercury.Toolbar
|
|
71
65
|
@element.hide()
|
72
66
|
@visible = false
|
73
67
|
else
|
74
|
-
@hideTimeout = setTimeout =>
|
68
|
+
@hideTimeout = setTimeout 500, =>
|
75
69
|
@element.stop().animate {opacity: 0}, 300, 'easeInOutSine', =>
|
76
70
|
@element.hide()
|
77
71
|
@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 = []
|
85
72
|
|
File without changes
|
File without changes
|
@@ -10,14 +10,6 @@ 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
|
-
|
21
13
|
addColumn: (position = 'after') ->
|
22
14
|
sig = @cellSignatureFor(@cell)
|
23
15
|
|
@@ -50,14 +42,6 @@ jQuery.extend Mercury.tableEditor,
|
|
50
42
|
@setColspanFor(cell, @colspanFor(cell) - 1) for cell in adjusting
|
51
43
|
|
52
44
|
|
53
|
-
addRowBefore: ->
|
54
|
-
@addRow('before')
|
55
|
-
|
56
|
-
|
57
|
-
addRowAfter: ->
|
58
|
-
@addRow('after')
|
59
|
-
|
60
|
-
|
61
45
|
addRow: (position = 'after') ->
|
62
46
|
newRow = jQuery('<tr>')
|
63
47
|
|
@@ -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] =
|
37
|
+
url = if jQuery.isFunction(mixed) then mixed.call(@, @name) else mixed
|
38
|
+
@handled[type] = new Mercury.Palette(url, @name, @defaultDialogOptions())
|
39
39
|
|
40
40
|
when 'select'
|
41
41
|
@element.addClass("mercury-button-select").find('em').html(@title)
|
42
|
-
|
43
|
-
@handled[type] =
|
42
|
+
url = if jQuery.isFunction(mixed) then mixed.call(@, @name) else mixed
|
43
|
+
@handled[type] = new Mercury.Select(url, @name, @defaultDialogOptions())
|
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
|
47
48
|
@handled['toggle'] = true
|
48
|
-
|
49
|
-
@handled[type] = if typeof result is 'string' then new Mercury.Panel(result, @name, @defaultDialogOptions()) else result
|
49
|
+
@handled[type] = new Mercury.Panel(url, @name, @defaultDialogOptions())
|
50
50
|
|
51
51
|
when 'modal'
|
52
|
-
@handled[type] = if jQuery.isFunction(mixed) then mixed.
|
52
|
+
@handled[type] = if jQuery.isFunction(mixed) then mixed.apply(@, @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.apply(@, @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
|
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,47 +89,32 @@ 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
|
117
92
|
|
93
|
+
handled = false
|
94
|
+
for own type, mixed of @handled
|
95
|
+
switch type
|
96
|
+
when 'toggle'
|
97
|
+
@togglePressed() unless @handled.mode
|
118
98
|
|
119
|
-
|
120
|
-
|
121
|
-
|
99
|
+
when 'mode'
|
100
|
+
handled = true
|
101
|
+
Mercury.trigger('mode', {mode: mixed})
|
122
102
|
|
103
|
+
when 'modal'
|
104
|
+
handled = true
|
105
|
+
Mercury.modal(@handled.modal, {title: @summary || @title, handler: @name})
|
123
106
|
|
124
|
-
|
125
|
-
|
126
|
-
|
107
|
+
when 'lightview'
|
108
|
+
handled = true
|
109
|
+
Mercury.lightview(@handled.lightview, {title: @summary || @title, handler: @name, closeButton: true})
|
127
110
|
|
111
|
+
when 'palette', 'select', 'panel'
|
112
|
+
event.stopPropagation()
|
113
|
+
handled = true
|
114
|
+
@handled[type].toggle()
|
128
115
|
|
129
|
-
|
130
|
-
|
131
|
-
@handled[type].toggle()
|
132
|
-
return true
|
116
|
+
Mercury.trigger('action', {action: @name}) unless handled
|
117
|
+
Mercury.trigger('focus:frame') if @options['regions'] && @options['regions'].length
|
133
118
|
|
134
119
|
|
135
120
|
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
|
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()
|
5
6
|
super(null, @name, @options)
|
6
7
|
return @element
|
7
8
|
|
8
9
|
|
9
10
|
build: ->
|
10
|
-
@container.css({whiteSpace: 'normal'
|
11
|
-
@container.css({visibility: 'visible'})
|
11
|
+
@container.css({whiteSpace: 'normal'})
|
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 jQuery(window).width()
|
40
|
+
if @containerWidth > jQuery(window).width() 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.offset()
|
47
47
|
width = @element.width()
|
48
48
|
|
49
49
|
position.left = position.left - width + @trigger.width() if position.left + width > jQuery(window).width()
|
@@ -8,7 +8,7 @@ class @Mercury.Toolbar
|
|
8
8
|
|
9
9
|
build: ->
|
10
10
|
@element = jQuery('<div>', {class: 'mercury-toolbar-container', style: 'width:10000px'})
|
11
|
-
@element.css({
|
11
|
+
@element.css({display: 'none'}) unless @visible
|
12
12
|
@element.appendTo(jQuery(@options.appendTo).get(0) ? 'body')
|
13
13
|
|
14
14
|
for own toolbarName, buttons of Mercury.config.toolbars
|
@@ -28,7 +28,7 @@ class @Mercury.Toolbar
|
|
28
28
|
|
29
29
|
toolbar.addClass('disabled') if Mercury.config.toolbars['primary'] && toolbarName != 'primary'
|
30
30
|
|
31
|
-
@element.css({
|
31
|
+
@element.css({width: '100%'})
|
32
32
|
|
33
33
|
|
34
34
|
buildButton: (name, options) ->
|
@@ -56,13 +56,13 @@ class @Mercury.Toolbar
|
|
56
56
|
for toolbar in @element.find(".mercury-toolbar")
|
57
57
|
toolbar = jQuery(toolbar)
|
58
58
|
if regions = toolbar.data('regions')
|
59
|
-
toolbar.removeClass('disabled') if regions.split(',').indexOf(options.region.type
|
59
|
+
toolbar.removeClass('disabled') if regions.split(',').indexOf(options.region.type) > -1
|
60
60
|
|
61
61
|
Mercury.on 'region:blurred', (event, options) =>
|
62
62
|
for toolbar in @element.find(".mercury-toolbar")
|
63
63
|
toolbar = jQuery(toolbar)
|
64
64
|
if regions = toolbar.data('regions')
|
65
|
-
toolbar.addClass('disabled') if regions.split(',').indexOf(options.region.type
|
65
|
+
toolbar.addClass('disabled') if regions.split(',').indexOf(options.region.type) > -1
|
66
66
|
|
67
67
|
@element.on 'click', ->
|
68
68
|
Mercury.trigger('hide:dialogs')
|
@@ -71,12 +71,8 @@ class @Mercury.Toolbar
|
|
71
71
|
event.preventDefault()
|
72
72
|
|
73
73
|
|
74
|
-
height:
|
75
|
-
if @visible
|
76
|
-
|
77
|
-
|
78
|
-
top: ->
|
79
|
-
if @visible then @element.offset().top else 0
|
74
|
+
height: ->
|
75
|
+
if @visible then @element.outerHeight() else 0
|
80
76
|
|
81
77
|
|
82
78
|
show: ->
|
File without changes
|