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,12 +1,11 @@
|
|
1
|
-
class @Mercury.Regions.
|
2
|
-
# No IE support
|
3
|
-
@supported: document.designMode && !jQuery.browser.konqueror && !jQuery.browser.msie
|
4
|
-
@supportedText: "Chrome 10+, Firefox 4+, Safari 5+"
|
5
|
-
|
6
|
-
type
|
1
|
+
class @Mercury.Regions.Full extends Mercury.Region
|
2
|
+
# No IE < 10 support because those versions don't follow the W3C standards for HTML5 contentEditable (aka designMode).
|
3
|
+
@supported: document.designMode && !jQuery.browser.konqueror && (!jQuery.browser.msie || (jQuery.browser.msie && parseFloat(jQuery.browser.version, 10) >= 10))
|
4
|
+
@supportedText: "Chrome 10+, Firefox 4+, Safari 5+, Opera 11.64+"
|
5
|
+
type = 'full'
|
6
|
+
type: -> type
|
7
7
|
|
8
8
|
constructor: (@element, @window, @options = {}) ->
|
9
|
-
@type = 'editable'
|
10
9
|
super
|
11
10
|
|
12
11
|
|
@@ -26,7 +25,7 @@ class @Mercury.Regions.Editable extends Mercury.Region
|
|
26
25
|
@element.get(0).contentEditable = true
|
27
26
|
|
28
27
|
# make all snippets not editable, and set their versions to 1
|
29
|
-
for element in @element.find('
|
28
|
+
for element in @element.find('[data-snippet]')
|
30
29
|
element.contentEditable = false
|
31
30
|
jQuery(element).attr('data-version', '1')
|
32
31
|
|
@@ -47,7 +46,7 @@ class @Mercury.Regions.Editable extends Mercury.Region
|
|
47
46
|
|
48
47
|
Mercury.on 'region:update', =>
|
49
48
|
return if @previewing || Mercury.region != @
|
50
|
-
setTimeout(
|
49
|
+
setTimeout((=> @selection().forceSelection(@element.get(0))), 1)
|
51
50
|
currentElement = @currentElement()
|
52
51
|
if currentElement.length
|
53
52
|
# setup the table editor if we're inside a table
|
@@ -69,16 +68,17 @@ class @Mercury.Regions.Editable extends Mercury.Region
|
|
69
68
|
return if @previewing
|
70
69
|
event.preventDefault() unless Mercury.snippet
|
71
70
|
event.originalEvent.dataTransfer.dropEffect = 'copy'
|
72
|
-
|
73
|
-
|
74
|
-
|
71
|
+
# removed to fix chrome update issue #362 https://github.com/jejacks0n/mercury/issues/362
|
72
|
+
# if jQuery.browser.webkit
|
73
|
+
# clearTimeout(@dropTimeout)
|
74
|
+
# @dropTimeout = setTimeout((=> @element.trigger('possible:drop')), 10)
|
75
75
|
|
76
76
|
@element.on 'drop', (event) =>
|
77
77
|
return if @previewing
|
78
78
|
|
79
79
|
# handle dropping snippets
|
80
80
|
clearTimeout(@dropTimeout)
|
81
|
-
@dropTimeout = setTimeout(
|
81
|
+
@dropTimeout = setTimeout((=> @element.trigger('possible:drop')), 1)
|
82
82
|
|
83
83
|
# handle any files that were dropped
|
84
84
|
return unless event.originalEvent.dataTransfer.files.length
|
@@ -93,9 +93,9 @@ class @Mercury.Regions.Editable extends Mercury.Region
|
|
93
93
|
# read: http://www.quirksmode.org/blog/archives/2009/09/the_html5_drag.html
|
94
94
|
@element.on 'possible:drop', =>
|
95
95
|
return if @previewing
|
96
|
-
if
|
96
|
+
if Mercury.snippet
|
97
97
|
@focus()
|
98
|
-
Mercury.Snippet.displayOptionsFor(
|
98
|
+
Mercury.Snippet.displayOptionsFor(Mercury.snippet.name, {}, Mercury.snippet.hasOptions)
|
99
99
|
@document.execCommand('undo', false, null)
|
100
100
|
|
101
101
|
# custom paste handling: we have to do some hackery to get the pasted content since it's not exposed normally
|
@@ -115,7 +115,7 @@ class @Mercury.Regions.Editable extends Mercury.Region
|
|
115
115
|
@element.on 'focus', =>
|
116
116
|
return if @previewing
|
117
117
|
Mercury.region = @
|
118
|
-
setTimeout(
|
118
|
+
setTimeout((=> @selection().forceSelection(@element.get(0))), 1)
|
119
119
|
Mercury.trigger('region:focused', {region: @})
|
120
120
|
|
121
121
|
@element.on 'blur', =>
|
@@ -194,13 +194,13 @@ class @Mercury.Regions.Editable extends Mercury.Region
|
|
194
194
|
|
195
195
|
focus: ->
|
196
196
|
if Mercury.region != @
|
197
|
-
setTimeout(
|
197
|
+
setTimeout((=> @element.focus()), 10)
|
198
198
|
try
|
199
199
|
@selection().selection.collapseToStart()
|
200
200
|
catch e
|
201
201
|
# intentially do nothing
|
202
202
|
else
|
203
|
-
setTimeout(
|
203
|
+
setTimeout((=> @element.focus()), 10)
|
204
204
|
|
205
205
|
Mercury.trigger('region:focused', {region: @})
|
206
206
|
Mercury.trigger('region:update', {region: @})
|
@@ -217,7 +217,9 @@ class @Mercury.Regions.Editable extends Mercury.Region
|
|
217
217
|
element.contentEditable = false
|
218
218
|
element = jQuery(element)
|
219
219
|
if snippet = Mercury.Snippet.find(element.data('snippet'))
|
220
|
-
|
220
|
+
if element.data('version')
|
221
|
+
snippet.setVersion(element.data('version'))
|
222
|
+
else
|
221
223
|
try
|
222
224
|
version = parseInt(element.html().match(/\/(\d+)\]/)[1])
|
223
225
|
if version
|
@@ -277,7 +279,7 @@ class @Mercury.Regions.Editable extends Mercury.Region
|
|
277
279
|
super
|
278
280
|
|
279
281
|
# use a custom handler if there's one, otherwise use execCommand
|
280
|
-
if handler = Mercury.config.behaviors[action] || Mercury.Regions.
|
282
|
+
if handler = Mercury.config.behaviors[action] || Mercury.Regions.Full.actions[action]
|
281
283
|
handler.call(@, @selection(), options)
|
282
284
|
else
|
283
285
|
sibling = @element.get(0).previousSibling if action == 'indent'
|
@@ -308,7 +310,7 @@ class @Mercury.Regions.Editable extends Mercury.Region
|
|
308
310
|
@history.push(@content(null, false, true))
|
309
311
|
else if keyCode
|
310
312
|
# set a timeout for pushing to the history
|
311
|
-
@historyTimeout = setTimeout(
|
313
|
+
@historyTimeout = setTimeout((=> @history.push(@content(null, false, true))), waitTime * 1000)
|
312
314
|
else
|
313
315
|
# push to the history immediately
|
314
316
|
@history.push(@content(null, false, true))
|
@@ -317,7 +319,7 @@ class @Mercury.Regions.Editable extends Mercury.Region
|
|
317
319
|
|
318
320
|
|
319
321
|
selection: ->
|
320
|
-
return new Mercury.Regions.
|
322
|
+
return new Mercury.Regions.Full.Selection(@window.getSelection(), @document)
|
321
323
|
|
322
324
|
|
323
325
|
path: ->
|
@@ -349,7 +351,7 @@ class @Mercury.Regions.Editable extends Mercury.Region
|
|
349
351
|
sanitizer = jQuery('#mercury_sanitizer', @document).focus()
|
350
352
|
|
351
353
|
# set 1ms timeout to allow paste event to complete
|
352
|
-
setTimeout
|
354
|
+
setTimeout =>
|
353
355
|
# sanitize the content
|
354
356
|
content = @sanitize(sanitizer)
|
355
357
|
|
@@ -360,11 +362,13 @@ class @Mercury.Regions.Editable extends Mercury.Region
|
|
360
362
|
# paste sanitized content
|
361
363
|
@element.focus()
|
362
364
|
@execCommand('insertHTML', {value: content})
|
365
|
+
, 1
|
363
366
|
|
364
367
|
|
365
368
|
sanitize: (sanitizer) ->
|
366
369
|
# always remove nested regions
|
367
|
-
sanitizer.find("
|
370
|
+
sanitizer.find("[#{Mercury.config.regions.attribute}]").remove()
|
371
|
+
sanitizer.find('[src*="webkit-fake-url://"]').remove()
|
368
372
|
|
369
373
|
if Mercury.config.pasting.sanitize
|
370
374
|
switch Mercury.config.pasting.sanitize
|
@@ -422,7 +426,7 @@ class @Mercury.Regions.Editable extends Mercury.Region
|
|
422
426
|
|
423
427
|
redo: -> @content(@history.redo())
|
424
428
|
|
425
|
-
horizontalRule: ->
|
429
|
+
horizontalRule: -> @execCommand('insertHTML', {value: '<hr/>'})
|
426
430
|
|
427
431
|
removeFormatting: (selection) -> selection.insertTextNode(selection.textContent())
|
428
432
|
|
@@ -466,7 +470,7 @@ class @Mercury.Regions.Editable extends Mercury.Region
|
|
466
470
|
|
467
471
|
|
468
472
|
# Helper class for managing selection and getting information from it
|
469
|
-
class Mercury.Regions.
|
473
|
+
class Mercury.Regions.Full.Selection
|
470
474
|
|
471
475
|
constructor: (@selection, @context) ->
|
472
476
|
return unless @selection.rangeCount >= 1
|
@@ -490,7 +494,13 @@ class Mercury.Regions.Editable.Selection
|
|
490
494
|
|
491
495
|
|
492
496
|
textContent: ->
|
493
|
-
return @
|
497
|
+
return @content().textContent
|
498
|
+
|
499
|
+
|
500
|
+
htmlContent: ->
|
501
|
+
content = @content()
|
502
|
+
return jQuery('<div>').html(content).html()
|
503
|
+
return null
|
494
504
|
|
495
505
|
|
496
506
|
content: ->
|
@@ -508,15 +518,15 @@ class Mercury.Regions.Editable.Selection
|
|
508
518
|
range = @context.createRange()
|
509
519
|
|
510
520
|
if @range
|
511
|
-
if @commonAncestor(true).closest('
|
512
|
-
lastChild = @context.createTextNode(
|
521
|
+
if @commonAncestor(true).closest('[data-snippet]').length
|
522
|
+
lastChild = @context.createTextNode("\x00")
|
513
523
|
element.appendChild(lastChild)
|
514
524
|
else
|
515
525
|
if element.lastChild && element.lastChild.nodeType == 3 && element.lastChild.textContent.replace(/^[\s+|\n+]|[\s+|\n+]$/, '') == ''
|
516
526
|
lastChild = element.lastChild
|
517
|
-
element.lastChild.textContent =
|
527
|
+
element.lastChild.textContent = "\x00"
|
518
528
|
else
|
519
|
-
lastChild = @context.createTextNode(
|
529
|
+
lastChild = @context.createTextNode("\x00")
|
520
530
|
element.appendChild(lastChild)
|
521
531
|
|
522
532
|
if lastChild
|
@@ -0,0 +1,93 @@
|
|
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,16 +1,10 @@
|
|
1
|
-
|
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
|
1
|
+
class @Mercury.Regions.Markdown extends Mercury.Region
|
7
2
|
@supported: document.getElementById
|
8
|
-
@supportedText: "
|
9
|
-
|
10
|
-
type
|
3
|
+
@supportedText: "Chrome 10+, Firefox 4+, IE 7+, Safari 5+, Opera 8+"
|
4
|
+
type = 'markdown'
|
5
|
+
type: -> type
|
11
6
|
|
12
7
|
constructor: (@element, @window, @options = {}) ->
|
13
|
-
@type = 'markupable'
|
14
8
|
super
|
15
9
|
@converter = new Showdown.converter()
|
16
10
|
|
@@ -18,13 +12,18 @@ class @Mercury.Regions.Markupable extends Mercury.Region
|
|
18
12
|
build: ->
|
19
13
|
width = '100%'
|
20
14
|
height = @element.height()
|
21
|
-
|
22
15
|
value = @element.html().replace(/^\s+|\s+$/g, '').replace('>', '>')
|
23
|
-
|
24
|
-
@textarea = jQuery('<textarea>', @document).val(value)
|
25
|
-
@textarea.
|
26
|
-
|
27
|
-
|
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
|
+
|
28
27
|
@element.empty().append(@textarea)
|
29
28
|
|
30
29
|
@previewElement = jQuery('<div>', @document)
|
@@ -35,6 +34,12 @@ class @Mercury.Regions.Markupable extends Mercury.Region
|
|
35
34
|
@resize()
|
36
35
|
|
37
36
|
|
37
|
+
dataAttributes: ->
|
38
|
+
data = {}
|
39
|
+
data[attr] = @container.attr('data-' + attr) for attr in Mercury.config.regions.dataAttributes
|
40
|
+
return data
|
41
|
+
|
42
|
+
|
38
43
|
bindEvents: ->
|
39
44
|
Mercury.on 'mode', (event, options) => @togglePreview() if options.mode == 'preview'
|
40
45
|
Mercury.on 'focus:frame', => @focus() if !@previewing && Mercury.region == @
|
@@ -66,7 +71,7 @@ class @Mercury.Regions.Markupable extends Mercury.Region
|
|
66
71
|
if Mercury.snippet
|
67
72
|
event.preventDefault()
|
68
73
|
@focus()
|
69
|
-
Mercury.Snippet.displayOptionsFor(Mercury.snippet)
|
74
|
+
Mercury.Snippet.displayOptionsFor(Mercury.snippet.name, {}, Mercury.snippet.hasOptions)
|
70
75
|
|
71
76
|
# handle any files that were dropped
|
72
77
|
if event.originalEvent.dataTransfer.files.length
|
@@ -164,13 +169,13 @@ class @Mercury.Regions.Markupable extends Mercury.Region
|
|
164
169
|
togglePreview: ->
|
165
170
|
if @previewing
|
166
171
|
@previewing = false
|
167
|
-
@container.
|
172
|
+
@container.attr(Mercury.config.regions.attribute, type)
|
168
173
|
@previewElement.hide()
|
169
174
|
@element.show()
|
170
175
|
@focus() if Mercury.region == @
|
171
176
|
else
|
172
177
|
@previewing = true
|
173
|
-
@container.
|
178
|
+
@container.removeAttr(Mercury.config.regions.attribute)
|
174
179
|
value = @converter.makeHtml(@element.val())
|
175
180
|
@previewElement.html(value)
|
176
181
|
@previewElement.show()
|
@@ -181,7 +186,7 @@ class @Mercury.Regions.Markupable extends Mercury.Region
|
|
181
186
|
execCommand: (action, options = {}) ->
|
182
187
|
super
|
183
188
|
|
184
|
-
handler.call(@, @selection(), options) if handler = Mercury.Regions.
|
189
|
+
handler.call(@, @selection(), options) if handler = Mercury.Regions.Markdown.actions[action]
|
185
190
|
@resize()
|
186
191
|
|
187
192
|
|
@@ -200,7 +205,7 @@ class @Mercury.Regions.Markupable extends Mercury.Region
|
|
200
205
|
@history.push(@contentAndSelection())
|
201
206
|
else if keyCode
|
202
207
|
# set a timeout for pushing to the history
|
203
|
-
@historyTimeout = setTimeout(
|
208
|
+
@historyTimeout = setTimeout((=> @history.push(@contentAndSelection())), waitTime * 1000)
|
204
209
|
else
|
205
210
|
# push to the history immediately
|
206
211
|
@history.push(@contentAndSelection())
|
@@ -209,7 +214,7 @@ class @Mercury.Regions.Markupable extends Mercury.Region
|
|
209
214
|
|
210
215
|
|
211
216
|
selection: ->
|
212
|
-
return new Mercury.Regions.
|
217
|
+
return new Mercury.Regions.Markdown.Selection(@element)
|
213
218
|
|
214
219
|
|
215
220
|
resize: ->
|
@@ -261,7 +266,7 @@ class @Mercury.Regions.Markupable extends Mercury.Region
|
|
261
266
|
}
|
262
267
|
selection.unWrapLine("#{wrapper[0]}", "#{wrapper[1]}") for wrapperName, wrapper of wrappers
|
263
268
|
if options.value == 'blockquote'
|
264
|
-
Mercury.Regions.
|
269
|
+
Mercury.Regions.Markdown.actions.indent.call(@, selection, options)
|
265
270
|
return
|
266
271
|
selection.wrapLine("#{wrappers[options.value][0]}", "#{wrappers[options.value][1]}")
|
267
272
|
|
@@ -289,7 +294,7 @@ class @Mercury.Regions.Markupable extends Mercury.Region
|
|
289
294
|
|
290
295
|
|
291
296
|
# Helper class for managing selection and getting information from it
|
292
|
-
class Mercury.Regions.
|
297
|
+
class Mercury.Regions.Markdown.Selection
|
293
298
|
|
294
299
|
constructor: (@element) ->
|
295
300
|
@el = @element.get(0)
|
@@ -1,16 +1,11 @@
|
|
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
|
-
|
6
1
|
class @Mercury.Regions.Simple extends Mercury.Region
|
7
2
|
@supported: document.getElementById
|
8
|
-
@supportedText: "
|
9
|
-
|
3
|
+
@supportedText: "Chrome 10+, Firefox 4+, IE 7+, Safari 5+, Opera 8+"
|
10
4
|
type = 'simple'
|
5
|
+
type: -> type
|
11
6
|
|
12
7
|
constructor: (@element, @window, @options = {}) ->
|
13
|
-
|
8
|
+
Mercury.log("building #{type}", @element, @options)
|
14
9
|
super
|
15
10
|
|
16
11
|
|
@@ -23,9 +18,7 @@ class @Mercury.Regions.Simple extends Mercury.Region
|
|
23
18
|
height = @element.height() # 'auto'
|
24
19
|
|
25
20
|
value = @element.text()
|
26
|
-
@
|
27
|
-
@textarea = jQuery('<textarea>', @document).val(value)
|
28
|
-
@textarea.attr('class', @element.attr('class')).addClass('mercury-textarea')
|
21
|
+
@textarea = jQuery('<textarea>', @document).val(value).addClass('mercury-textarea')
|
29
22
|
@textarea.css
|
30
23
|
border: 0
|
31
24
|
background: 'transparent'
|
@@ -44,7 +37,7 @@ class @Mercury.Regions.Simple extends Mercury.Region
|
|
44
37
|
display: 'inherit'
|
45
38
|
lineHeight: 'inherit'
|
46
39
|
textAlign: 'inherit'
|
47
|
-
|
40
|
+
|
48
41
|
@element.empty().append(@textarea)
|
49
42
|
|
50
43
|
@container = @element
|
@@ -67,31 +60,10 @@ class @Mercury.Regions.Simple extends Mercury.Region
|
|
67
60
|
@container.removeClass('focus')
|
68
61
|
Mercury.trigger('region:blurred', {region: @})
|
69
62
|
|
70
|
-
@
|
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'
|
63
|
+
@bindElementEvents()
|
79
64
|
|
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])
|
94
65
|
|
66
|
+
bindElementEvents: ->
|
95
67
|
@element.on 'focus', =>
|
96
68
|
return if @previewing
|
97
69
|
Mercury.region = @
|
@@ -131,20 +103,6 @@ class @Mercury.Regions.Simple extends Mercury.Region
|
|
131
103
|
event.preventDefault()
|
132
104
|
@execCommand('insertHTML', {value: ' '})
|
133
105
|
|
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
|
-
|
148
106
|
@pushHistory(event.keyCode)
|
149
107
|
|
150
108
|
@element.on 'keyup', =>
|
@@ -202,15 +160,14 @@ class @Mercury.Regions.Simple extends Mercury.Region
|
|
202
160
|
if @previewing
|
203
161
|
@previewing = false
|
204
162
|
@element = @container
|
163
|
+
@container.attr(Mercury.config.regions.attribute, type)
|
205
164
|
@build()
|
165
|
+
@bindElementEvents()
|
206
166
|
@focus() if Mercury.region == @
|
207
|
-
# @container.addClass(Mercury.config.regions.className).removeClass("#{Mercury.config.regions.className}-preview")
|
208
|
-
# @previewElement.hide()
|
209
|
-
# @element.show()
|
210
167
|
else
|
211
168
|
@previewing = true
|
212
|
-
@container.addClass("#{Mercury.config.regions.className}-preview").removeClass(Mercury.config.regions.className)
|
213
169
|
value = jQuery('<div></div>').text(@element.val()).html()
|
170
|
+
@container.removeAttr(Mercury.config.regions.attribute)
|
214
171
|
@container.html(value)
|
215
172
|
Mercury.trigger('region:blurred', {region: @})
|
216
173
|
|
@@ -237,7 +194,7 @@ class @Mercury.Regions.Simple extends Mercury.Region
|
|
237
194
|
@history.push(@contentAndSelection())
|
238
195
|
else if keyCode
|
239
196
|
# set a timeout for pushing to the history
|
240
|
-
@historyTimeout = setTimeout(
|
197
|
+
@historyTimeout = setTimeout((=> @history.push(@contentAndSelection())), waitTime * 1000)
|
241
198
|
else
|
242
199
|
# push to the history immediately
|
243
200
|
@history.push(@contentAndSelection())
|